1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <fuarea.hxx>
21 
22 #include <svx/svxids.hrc>
23 #include <sfx2/request.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <sfx2/bindings.hxx>
26 #include <ViewShell.hxx>
27 
28 #include <drawdoc.hxx>
29 #include <View.hxx>
30 #include <svx/svxdlg.hxx>
31 
32 namespace sd {
33 
FuArea(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * _pView,SdDrawDocument * pDoc,SfxRequest & rReq)34 FuArea::FuArea( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq)
35 : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
36 {
37 }
38 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * _pView,SdDrawDocument * pDoc,SfxRequest & rReq)39 rtl::Reference<FuPoor> FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq )
40 {
41     rtl::Reference<FuPoor> xFunc( new FuArea( pViewSh, pWin, _pView, pDoc, rReq ) );
42     xFunc->DoExecute(rReq);
43     return xFunc;
44 }
45 
DoExecute(SfxRequest & rReq)46 void FuArea::DoExecute( SfxRequest& rReq )
47 {
48     rReq.Ignore ();
49 
50     const SfxItemSet* pArgs = rReq.GetArgs();
51     if (pArgs)
52         return;
53 
54     SfxItemSet aNewAttr( mpDoc->GetPool() );
55     mpView->GetAttributes( aNewAttr );
56 
57     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
58     VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(mpViewShell->GetFrameWeld(), &aNewAttr, mpDoc, true));
59 
60     pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){
61         if (nResult == RET_OK)
62         {
63             mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
64 
65             // attributes changed, update Listboxes in Objectbars
66             static const sal_uInt16 SidArray[] = {
67                 SID_ATTR_FILL_STYLE,
68                 SID_ATTR_FILL_COLOR,
69                 SID_ATTR_FILL_GRADIENT,
70                 SID_ATTR_FILL_HATCH,
71                 SID_ATTR_FILL_BITMAP,
72                 SID_ATTR_FILL_TRANSPARENCE,
73                 SID_ATTR_FILL_FLOATTRANSPARENCE,
74                 0 };
75 
76             mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
77         }
78 
79         // deferred until the dialog ends
80         mpViewShell->Cancel();
81 
82         pDlg->disposeOnce();
83     });
84 }
85 
Activate()86 void FuArea::Activate()
87 {
88 }
89 
Deactivate()90 void FuArea::Deactivate()
91 {
92 }
93 
94 } // end of namespace sd
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
97