bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / func / fuline.cxx
blobcd33f409ffa9ec60e457e14527a3ff1af2ec81ab
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 "fuline.hxx"
22 #include <svx/svxids.hrc>
23 #include <svx/tabline.hxx>
24 #include <svx/xenum.hxx>
25 #include <vcl/msgbox.hxx>
26 #include <svl/intitem.hxx>
27 #include <svl/stritem.hxx>
28 #include <sfx2/request.hxx>
29 #include <svx/xdef.hxx>
30 #include <sfx2/bindings.hxx>
31 #include <sfx2/viewfrm.hxx>
32 #include "ViewShell.hxx"
33 #include "View.hxx"
34 #include "Window.hxx"
35 #include "drawdoc.hxx"
36 #include "app.hrc"
37 #include <svx/svxdlg.hxx>
38 #include <svx/dialogs.hrc>
40 namespace sd {
42 TYPEINIT1( FuLine, FuPoor );
45 FuLine::FuLine (
46 ViewShell* pViewSh,
47 ::sd::Window* pWin,
48 ::sd::View* pView,
49 SdDrawDocument* pDoc,
50 SfxRequest& rReq)
51 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
55 FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
57 FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
58 xFunc->DoExecute(rReq);
59 return xFunc;
62 void FuLine::DoExecute( SfxRequest& rReq )
64 sal_Bool bHasMarked = mpView->AreObjectsMarked();
66 const SfxItemSet* pArgs = rReq.GetArgs();
68 if( !pArgs )
70 const SdrObject* pObj = NULL;
71 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
72 if( rMarkList.GetMarkCount() == 1 )
73 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
75 SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
76 mpView->GetAttributes( *pNewAttr );
78 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
79 SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
80 if( pDlg && (pDlg->Execute() == RET_OK) )
82 mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
85 // some attributes are changed, we have to update the listboxes in the objectbars
86 static sal_uInt16 SidArray[] = {
87 SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 )
88 SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 )
89 SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 )
90 SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 )
91 SID_ATTR_LINE_START, // ( SID_SVX_START + 173 )
92 SID_ATTR_LINE_END, // ( SID_SVX_START + 174 )
93 SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107)
94 SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110)
95 SID_ATTR_LINE_CAP, // (SID_SVX_START+1111)
96 0 };
98 mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
100 delete pDlg;
101 delete pNewAttr;
104 rReq.Ignore ();
107 void FuLine::Activate()
111 void FuLine::Deactivate()
116 } // end of namespace sd
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */