xref: /trunk/main/sd/source/ui/func/fuline.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 
32 #include "fuline.hxx"
33 
34 #include <svx/svxids.hrc>
35 #include <svx/tabline.hxx>
36 #include <svx/xenum.hxx>
37 #include <vcl/msgbox.hxx>
38 #include <svl/intitem.hxx>
39 #include <svl/stritem.hxx>
40 #include <sfx2/request.hxx>
41 #include <svx/xdef.hxx>
42 #include <sfx2/bindings.hxx>
43 #include <sfx2/viewfrm.hxx>
44 #include "ViewShell.hxx"
45 #include "View.hxx"
46 #ifndef SD_WINDOW_SHELL_HXX
47 #include "Window.hxx"
48 #endif
49 #include "drawdoc.hxx"
50 #include "app.hrc"
51 #include <svx/svxdlg.hxx>
52 #include <svx/dialogs.hrc>
53 
54 namespace sd {
55 
56 TYPEINIT1( FuLine, FuPoor );
57 
58 /*************************************************************************
59 |*
60 |* Konstruktor
61 |*
62 \************************************************************************/
63 
64 FuLine::FuLine (
65     ViewShell* pViewSh,
66     ::sd::Window* pWin,
67     ::sd::View* pView,
68     SdDrawDocument* pDoc,
69     SfxRequest& rReq)
70     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
71 {
72 }
73 
74 FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
75 {
76     FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
77     xFunc->DoExecute(rReq);
78     return xFunc;
79 }
80 
81 void FuLine::DoExecute( SfxRequest& rReq )
82 {
83     sal_Bool        bHasMarked = mpView->AreObjectsMarked();
84 
85     const SfxItemSet* pArgs = rReq.GetArgs();
86 
87     if( !pArgs )
88     {
89         const SdrObject* pObj = NULL;
90         const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
91         if( rMarkList.GetMarkCount() == 1 )
92             pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
93 
94         SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
95         mpView->GetAttributes( *pNewAttr );
96 
97         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
98         SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
99         if( pDlg && (pDlg->Execute() == RET_OK) )
100         {
101             mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
102         }
103 
104         // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
105         static sal_uInt16 SidArray[] = {
106                         SID_ATTR_LINE_STYLE,
107                         SID_ATTR_LINE_DASH,
108                         SID_ATTR_LINE_WIDTH,
109                         SID_ATTR_LINE_COLOR,
110                         0 };
111 
112         mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
113 
114         delete pDlg;
115         delete pNewAttr;
116     }
117 
118     rReq.Ignore ();
119 }
120 
121 void FuLine::Activate()
122 {
123 }
124 
125 void FuLine::Deactivate()
126 {
127 }
128 
129 
130 } // end of namespace sd
131