xref: /aoo42x/main/sd/source/ui/func/fuline.cxx (revision 79aad27f)
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 
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 
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 
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,
103 						SID_ATTR_LINE_DASH,
104 						SID_ATTR_LINE_WIDTH,
105 						SID_ATTR_LINE_COLOR,
106 						0 };
107 
108 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
109 
110 		delete pDlg;
111 		delete pNewAttr;
112 	}
113 
114 	rReq.Ignore ();
115 }
116 
117 void FuLine::Activate()
118 {
119 }
120 
121 void FuLine::Deactivate()
122 {
123 }
124 
125 
126 } // end of namespace sd
127