/src/libreoffice/sd/source/ui/func/fuline.cxx
Line | Count | Source |
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 <fuline.hxx> |
21 | | |
22 | | #include <svx/svxids.hrc> |
23 | | #include <sfx2/request.hxx> |
24 | | #include <sfx2/bindings.hxx> |
25 | | #include <sfx2/viewfrm.hxx> |
26 | | #include <ViewShell.hxx> |
27 | | #include <View.hxx> |
28 | | #include <drawdoc.hxx> |
29 | | #include <svx/svxdlg.hxx> |
30 | | |
31 | | namespace sd { |
32 | | |
33 | | |
34 | | FuLine::FuLine ( |
35 | | ViewShell& rViewSh, |
36 | | ::sd::Window* pWin, |
37 | | ::sd::View* pView, |
38 | | SdDrawDocument& rDoc, |
39 | | SfxRequest& rReq) |
40 | 0 | : FuPoor(rViewSh, pWin, pView, rDoc, rReq) |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | rtl::Reference<FuPoor> FuLine::Create( ViewShell& rViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument& rDoc, SfxRequest& rReq ) |
45 | 0 | { |
46 | 0 | rtl::Reference<FuPoor> xFunc( new FuLine( rViewSh, pWin, pView, rDoc, rReq ) ); |
47 | 0 | xFunc->DoExecute(rReq); |
48 | 0 | return xFunc; |
49 | 0 | } |
50 | | |
51 | | void FuLine::DoExecute( SfxRequest& rReq ) |
52 | 0 | { |
53 | 0 | rReq.Ignore(); |
54 | |
|
55 | 0 | const SfxItemSet* pArgs = rReq.GetArgs(); |
56 | 0 | if (pArgs) |
57 | 0 | return; |
58 | | |
59 | 0 | const SdrObject* pObj = nullptr; |
60 | 0 | const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); |
61 | 0 | if( rMarkList.GetMarkCount() == 1 ) |
62 | 0 | pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); |
63 | |
|
64 | 0 | SfxItemSet aNewAttr( mrDoc.GetPool() ); |
65 | 0 | mpView->GetAttributes( aNewAttr ); |
66 | |
|
67 | 0 | bool bHasMarked = rMarkList.GetMarkCount() != 0; |
68 | 0 | SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); |
69 | 0 | VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSvxLineTabDialog(mrViewShell.GetFrameWeld(), &aNewAttr, &mrDoc, pObj, bHasMarked) ); |
70 | |
|
71 | 0 | pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){ |
72 | 0 | if (nResult == RET_OK) |
73 | 0 | { |
74 | 0 | mpView->SetAttributes (*(pDlg->GetOutputItemSet ())); |
75 | | |
76 | | // some attributes are changed, we have to update the listboxes in the objectbars |
77 | 0 | static const sal_uInt16 SidArray[] = { |
78 | 0 | SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 ) |
79 | 0 | SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 ) |
80 | 0 | SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 ) |
81 | 0 | SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 ) |
82 | 0 | SID_ATTR_LINE_START, // ( SID_SVX_START + 173 ) |
83 | 0 | SID_ATTR_LINE_END, // ( SID_SVX_START + 174 ) |
84 | 0 | SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107) |
85 | 0 | SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110) |
86 | 0 | SID_ATTR_LINE_CAP, // (SID_SVX_START+1111) |
87 | 0 | 0 }; |
88 | |
|
89 | 0 | mrViewShell.GetViewFrame()->GetBindings().Invalidate( SidArray ); |
90 | 0 | } |
91 | | |
92 | | // deferred until the dialog ends |
93 | 0 | mrViewShell.Cancel(); |
94 | |
|
95 | 0 | pDlg->disposeOnce(); |
96 | 0 | }); |
97 | 0 | } |
98 | | |
99 | | void FuLine::Activate() |
100 | 0 | { |
101 | 0 | } |
102 | | |
103 | | void FuLine::Deactivate() |
104 | 0 | { |
105 | 0 | } |
106 | | |
107 | | } // end of namespace sd |
108 | | |
109 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |