1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <svx/svxids.hrc>
23 #include <svx/tabline.hxx>
24 #include <svx/xenum.hxx>
25 #include <svl/intitem.hxx>
26 #include <svl/stritem.hxx>
27 #include <sfx2/request.hxx>
28 #include <svx/xdef.hxx>
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <ViewShell.hxx>
34 #include <drawdoc.hxx>
36 #include <svx/svxdlg.hxx>
37 #include <svx/dialogs.hrc>
49 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
53 rtl::Reference
<FuPoor
> FuLine::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
55 rtl::Reference
<FuPoor
> xFunc( new FuLine( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
56 xFunc
->DoExecute(rReq
);
60 void FuLine::DoExecute( SfxRequest
& rReq
)
64 const SfxItemSet
* pArgs
= rReq
.GetArgs();
68 const SdrObject
* pObj
= nullptr;
69 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
70 if( rMarkList
.GetMarkCount() == 1 )
71 pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
73 std::unique_ptr
<SfxItemSet
> pNewAttr(new SfxItemSet( mpDoc
->GetPool() ));
74 mpView
->GetAttributes( *pNewAttr
);
76 bool bHasMarked
= mpView
->AreObjectsMarked();
77 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
78 VclPtr
<SfxAbstractTabDialog
> pDlg(pFact
? pFact
->CreateSvxLineTabDialog(mpViewShell
->GetActiveWindow(), pNewAttr
.get(), mpDoc
, pObj
, bHasMarked
) : nullptr);
82 pDlg
->StartExecuteAsync([=](sal_Int32 nResult
){
83 if (nResult
== RET_OK
)
85 mpView
->SetAttributes (*(pDlg
->GetOutputItemSet ()));
87 // some attributes are changed, we have to update the listboxes in the objectbars
88 static const sal_uInt16 SidArray
[] = {
89 SID_ATTR_LINE_STYLE
, // ( SID_SVX_START + 169 )
90 SID_ATTR_LINE_DASH
, // ( SID_SVX_START + 170 )
91 SID_ATTR_LINE_WIDTH
, // ( SID_SVX_START + 171 )
92 SID_ATTR_LINE_COLOR
, // ( SID_SVX_START + 172 )
93 SID_ATTR_LINE_START
, // ( SID_SVX_START + 173 )
94 SID_ATTR_LINE_END
, // ( SID_SVX_START + 174 )
95 SID_ATTR_LINE_TRANSPARENCE
, // (SID_SVX_START+1107)
96 SID_ATTR_LINE_JOINT
, // (SID_SVX_START+1110)
97 SID_ATTR_LINE_CAP
, // (SID_SVX_START+1111)
100 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
103 // deferred until the dialog ends
104 mpViewShell
->Cancel();
108 void FuLine::Activate()
112 void FuLine::Deactivate()
116 } // end of namespace sd
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */