xref: /aoo4110/main/sd/source/ui/func/fuline.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 
28 #include "fuline.hxx"
29 
30 #include <svx/svxids.hrc>
31 #include <svx/tabline.hxx>
32 #include <svx/xenum.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <svl/intitem.hxx>
35 #include <svl/stritem.hxx>
36 #include <sfx2/request.hxx>
37 #include <svx/xdef.hxx>
38 #include <sfx2/bindings.hxx>
39 #include <sfx2/viewfrm.hxx>
40 #include "ViewShell.hxx"
41 #include "View.hxx"
42 #ifndef SD_WINDOW_SHELL_HXX
43 #include "Window.hxx"
44 #endif
45 #include "drawdoc.hxx"
46 #include "app.hrc"
47 #include <svx/svxdlg.hxx>
48 #include <svx/dialogs.hrc>
49 
50 namespace sd {
51 
52 TYPEINIT1( FuLine, FuPoor );
53 
54 /*************************************************************************
55 |*
56 |* Konstruktor
57 |*
58 \************************************************************************/
59 
FuLine(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)60 FuLine::FuLine (
61     ViewShell* pViewSh,
62     ::sd::Window* pWin,
63     ::sd::View* pView,
64     SdDrawDocument* pDoc,
65     SfxRequest& rReq)
66 	: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
67 {
68 }
69 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)70 FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
71 {
72 	FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
73 	xFunc->DoExecute(rReq);
74 	return xFunc;
75 }
76 
DoExecute(SfxRequest & rReq)77 void FuLine::DoExecute( SfxRequest& rReq )
78 {
79 	sal_Bool		bHasMarked = mpView->AreObjectsMarked();
80 
81 	const SfxItemSet* pArgs = rReq.GetArgs();
82 
83 	if( !pArgs )
84 	{
85 		const SdrObject* pObj = NULL;
86 		const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
87 		if( rMarkList.GetMarkCount() == 1 )
88 			pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
89 
90 		SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
91 		mpView->GetAttributes( *pNewAttr );
92 
93 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
94 		SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
95 		if( pDlg && (pDlg->Execute() == RET_OK) )
96 		{
97 			mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
98 		}
99 
100 		// Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
101 		static sal_uInt16 SidArray[] = {
102             SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
103             SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
104             SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
105             SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
106             SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
107             SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
108             SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
109             SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
110             SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
111             0 };
112 
113 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
114 
115 		delete pDlg;
116 		delete pNewAttr;
117 	}
118 
119 	rReq.Ignore ();
120 }
121 
Activate()122 void FuLine::Activate()
123 {
124 }
125 
Deactivate()126 void FuLine::Deactivate()
127 {
128 }
129 
130 
131 } // end of namespace sd
132