Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / func / fuarea.cxx
blob48ab232e591b144097f6185a22e4f46453b086b8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <fuarea.hxx>
22 #include <svx/svxids.hrc>
23 #include <svl/intitem.hxx>
24 #include <svl/stritem.hxx>
25 #include <sfx2/request.hxx>
26 #include <sfx2/viewfrm.hxx>
27 #include <sfx2/bindings.hxx>
28 #include <ViewShell.hxx>
30 #include <drawdoc.hxx>
31 #include <View.hxx>
32 #include <Window.hxx>
33 #include <app.hrc>
34 #include <svx/svxdlg.hxx>
35 #include <svx/dialogs.hrc>
36 #include <memory>
38 namespace sd {
40 FuArea::FuArea( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq)
41 : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
45 rtl::Reference<FuPoor> FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq )
47 rtl::Reference<FuPoor> xFunc( new FuArea( pViewSh, pWin, _pView, pDoc, rReq ) );
48 xFunc->DoExecute(rReq);
49 return xFunc;
52 void FuArea::DoExecute( SfxRequest& rReq )
54 rReq.Ignore ();
56 const SfxItemSet* pArgs = rReq.GetArgs();
57 if (pArgs)
58 return;
60 SfxItemSet aNewAttr( mpDoc->GetPool() );
61 mpView->GetAttributes( aNewAttr );
63 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
64 VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) : nullptr);
65 if (!pDlg)
66 return;
68 pDlg->StartExecuteAsync([=](sal_Int32 nResult){
69 if (nResult == RET_OK)
71 mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
73 // attributes changed, update Listboxes in Objectbars
74 static const sal_uInt16 SidArray[] = {
75 SID_ATTR_FILL_STYLE,
76 SID_ATTR_FILL_COLOR,
77 SID_ATTR_FILL_GRADIENT,
78 SID_ATTR_FILL_HATCH,
79 SID_ATTR_FILL_BITMAP,
80 SID_ATTR_FILL_TRANSPARENCE,
81 SID_ATTR_FILL_FLOATTRANSPARENCE,
82 0 };
84 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
87 // deferred until the dialog ends
88 mpViewShell->Cancel();
89 });
92 void FuArea::Activate()
96 void FuArea::Deactivate()
100 } // end of namespace sd
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */