xref: /AOO41X/main/sd/source/ui/func/fuconstr.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "fuconstr.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <svx/svxids.hrc>
34*cdf0e10cSrcweir #include <svl/aeitem.hxx>
35*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
36*cdf0e10cSrcweir #include <svx/xdef.hxx>
37*cdf0e10cSrcweir #include <svx/xfillit0.hxx>
38*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
39*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include "app.hrc"
42*cdf0e10cSrcweir #include "glob.hrc"
43*cdf0e10cSrcweir #include "fudraw.hxx"
44*cdf0e10cSrcweir #include "View.hxx"
45*cdf0e10cSrcweir #include "Window.hxx"
46*cdf0e10cSrcweir #include "ViewShell.hxx"
47*cdf0e10cSrcweir #include "drawdoc.hxx"
48*cdf0e10cSrcweir #include "FrameView.hxx"
49*cdf0e10cSrcweir #include "sdpage.hxx"
50*cdf0e10cSrcweir #include "sdresid.hxx"
51*cdf0e10cSrcweir #include "stlpool.hxx"
52*cdf0e10cSrcweir #include <svx/globl3d.hxx>
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace sd {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir TYPEINIT1( FuConstruct, FuDraw );
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir /*************************************************************************
59*cdf0e10cSrcweir |*
60*cdf0e10cSrcweir |* Konstruktor
61*cdf0e10cSrcweir |*
62*cdf0e10cSrcweir \************************************************************************/
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir FuConstruct::FuConstruct (
65*cdf0e10cSrcweir     ViewShell*		pViewSh,
66*cdf0e10cSrcweir     ::sd::Window*			pWin,
67*cdf0e10cSrcweir     ::sd::View*			pView,
68*cdf0e10cSrcweir     SdDrawDocument*	pDoc,
69*cdf0e10cSrcweir     SfxRequest&		rReq)
70*cdf0e10cSrcweir     : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
71*cdf0e10cSrcweir       bSelectionChanged(sal_False)
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir void FuConstruct::DoExecute( SfxRequest& rReq )
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 	FuDraw::DoExecute( rReq );
78*cdf0e10cSrcweir }
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir /*************************************************************************
81*cdf0e10cSrcweir |*
82*cdf0e10cSrcweir |* MouseButtonDown-event
83*cdf0e10cSrcweir |*
84*cdf0e10cSrcweir \************************************************************************/
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir sal_Bool FuConstruct::MouseButtonDown(const MouseEvent& rMEvt)
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir 	sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	bMBDown = sal_True;
91*cdf0e10cSrcweir 	bSelectionChanged = sal_False;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	if ( mpView->IsAction() )
94*cdf0e10cSrcweir 	{
95*cdf0e10cSrcweir 		// #90235# this extra triggering is an error and leads to
96*cdf0e10cSrcweir 		// erasing the last two points when creating a polygon.
97*cdf0e10cSrcweir 		// if ( rMEvt.IsRight() )
98*cdf0e10cSrcweir 		//	mpView->BckAction();
99*cdf0e10cSrcweir 		return sal_True;
100*cdf0e10cSrcweir 	}
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	bFirstMouseMove = sal_True;
103*cdf0e10cSrcweir 	aDragTimer.Start();
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
106*cdf0e10cSrcweir 	sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	if (rMEvt.IsLeft() && mpView->IsExtendedMouseEventDispatcherEnabled())
109*cdf0e10cSrcweir 	{
110*cdf0e10cSrcweir 		mpWindow->CaptureMouse();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 		SdrHdl* pHdl = mpView->PickHandle(aMDPos);
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 		if ( pHdl != NULL || mpView->IsMarkedHit(aMDPos, nHitLog) )
115*cdf0e10cSrcweir 		{
116*cdf0e10cSrcweir 			sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
117*cdf0e10cSrcweir 			mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
118*cdf0e10cSrcweir 			bReturn = sal_True;
119*cdf0e10cSrcweir 		}
120*cdf0e10cSrcweir 		else if ( mpView->AreObjectsMarked() )
121*cdf0e10cSrcweir 		{
122*cdf0e10cSrcweir 			mpView->UnmarkAll();
123*cdf0e10cSrcweir 			bReturn = sal_True;
124*cdf0e10cSrcweir 		}
125*cdf0e10cSrcweir 	}
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	return bReturn;
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir /*************************************************************************
131*cdf0e10cSrcweir |*
132*cdf0e10cSrcweir |* MouseMove-event
133*cdf0e10cSrcweir |*
134*cdf0e10cSrcweir \************************************************************************/
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir sal_Bool FuConstruct::MouseMove(const MouseEvent& rMEvt)
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir 	FuDraw::MouseMove(rMEvt);
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 	if (aDragTimer.IsActive() )
141*cdf0e10cSrcweir 	{
142*cdf0e10cSrcweir 		if( bFirstMouseMove )
143*cdf0e10cSrcweir 			bFirstMouseMove = sal_False;
144*cdf0e10cSrcweir 		else
145*cdf0e10cSrcweir 			aDragTimer.Stop();
146*cdf0e10cSrcweir 	}
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	Point aPix(rMEvt.GetPosPixel());
149*cdf0e10cSrcweir 	Point aPnt( mpWindow->PixelToLogic(aPix) );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	if ( mpView->IsAction() )
152*cdf0e10cSrcweir 	{
153*cdf0e10cSrcweir 		ForceScroll(aPix);
154*cdf0e10cSrcweir 		mpView->MovAction(aPnt);
155*cdf0e10cSrcweir 	}
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	return sal_True;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir /*************************************************************************
161*cdf0e10cSrcweir |*
162*cdf0e10cSrcweir |* MouseButtonUp-event
163*cdf0e10cSrcweir |*
164*cdf0e10cSrcweir \************************************************************************/
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir sal_Bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir 	sal_Bool bReturn = sal_True;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	if (aDragTimer.IsActive() )
171*cdf0e10cSrcweir 	{
172*cdf0e10cSrcweir 		aDragTimer.Stop();
173*cdf0e10cSrcweir 		bIsInDragMode = sal_False;
174*cdf0e10cSrcweir 	}
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	FuDraw::MouseButtonUp(rMEvt);
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	if ( mpView && mpView->IsDragObj() )
181*cdf0e10cSrcweir 	{
182*cdf0e10cSrcweir 		FrameView* pFrameView = mpViewShell->GetFrameView();
183*cdf0e10cSrcweir 		sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 		if (bDragWithCopy)
186*cdf0e10cSrcweir 		{
187*cdf0e10cSrcweir 			bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
188*cdf0e10cSrcweir 		}
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 		mpView->SetDragWithCopy(bDragWithCopy);
191*cdf0e10cSrcweir 		mpView->EndDragObj( mpView->IsDragWithCopy() );
192*cdf0e10cSrcweir 	}
193*cdf0e10cSrcweir 	else if ( mpView && mpView->IsMarkObj() )
194*cdf0e10cSrcweir 	{
195*cdf0e10cSrcweir 		mpView->EndMarkObj();
196*cdf0e10cSrcweir 	}
197*cdf0e10cSrcweir 	else
198*cdf0e10cSrcweir 	{
199*cdf0e10cSrcweir 		bReturn = sal_False;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 	if ( mpView &&  !mpView->IsAction() )
203*cdf0e10cSrcweir 	{
204*cdf0e10cSrcweir 		mpWindow->ReleaseMouse();
205*cdf0e10cSrcweir 		sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 		if ( !mpView->AreObjectsMarked() )
208*cdf0e10cSrcweir 		{
209*cdf0e10cSrcweir 			SdrObject* pObj;
210*cdf0e10cSrcweir 			SdrPageView* pPV;
211*cdf0e10cSrcweir 			sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 			if (!mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV))
214*cdf0e10cSrcweir 			{
215*cdf0e10cSrcweir 				mpView->MarkObj(aPnt, nHitLog);
216*cdf0e10cSrcweir 			}
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 		else if (rMEvt.IsLeft() && !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
221*cdf0e10cSrcweir 				 !bSelectionChanged                   &&
222*cdf0e10cSrcweir 				 Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
223*cdf0e10cSrcweir 				 Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
224*cdf0e10cSrcweir 		{
225*cdf0e10cSrcweir 			/**************************************************************
226*cdf0e10cSrcweir 			* Toggle zw. Selektion und Rotation
227*cdf0e10cSrcweir 			**************************************************************/
228*cdf0e10cSrcweir 			SdrObject* pSingleObj = NULL;
229*cdf0e10cSrcweir 			sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 			if (nMarkCount==1)
232*cdf0e10cSrcweir 			{
233*cdf0e10cSrcweir 				pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
234*cdf0e10cSrcweir 			}
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 			if (mpView->GetDragMode() == SDRDRAG_MOVE && mpView->IsRotateAllowed() &&
237*cdf0e10cSrcweir 				(mpViewShell->GetFrameView()->IsClickChangeRotation() ||
238*cdf0e10cSrcweir 				 (pSingleObj && pSingleObj->GetObjInventor()==E3dInventor)))
239*cdf0e10cSrcweir 			{
240*cdf0e10cSrcweir 				mpView->SetDragMode(SDRDRAG_ROTATE);
241*cdf0e10cSrcweir 			}
242*cdf0e10cSrcweir 			else
243*cdf0e10cSrcweir 			{
244*cdf0e10cSrcweir 				mpView->SetDragMode(SDRDRAG_MOVE);
245*cdf0e10cSrcweir 			}
246*cdf0e10cSrcweir 		}
247*cdf0e10cSrcweir 	}
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 	sal_uInt16 nClicks = rMEvt.GetClicks();
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
252*cdf0e10cSrcweir 		!rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift() )
253*cdf0e10cSrcweir 	{
254*cdf0e10cSrcweir 		DoubleClick(rMEvt);
255*cdf0e10cSrcweir 	}
256*cdf0e10cSrcweir 	bMBDown = sal_False;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	return bReturn;
259*cdf0e10cSrcweir }
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir /*************************************************************************
262*cdf0e10cSrcweir |*
263*cdf0e10cSrcweir |* Tastaturereignisse bearbeiten
264*cdf0e10cSrcweir |*
265*cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
266*cdf0e10cSrcweir |* sal_False.
267*cdf0e10cSrcweir |*
268*cdf0e10cSrcweir \************************************************************************/
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir sal_Bool FuConstruct::KeyInput(const KeyEvent& rKEvt)
271*cdf0e10cSrcweir {
272*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 	if ( !bReturn )
275*cdf0e10cSrcweir 		bReturn = FuDraw::KeyInput(rKEvt);
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	return(bReturn);
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir /*************************************************************************
281*cdf0e10cSrcweir |*
282*cdf0e10cSrcweir |* Function aktivieren
283*cdf0e10cSrcweir |*
284*cdf0e10cSrcweir \************************************************************************/
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir void FuConstruct::Activate()
287*cdf0e10cSrcweir {
288*cdf0e10cSrcweir 	mpView->SetEditMode(SDREDITMODE_CREATE);
289*cdf0e10cSrcweir 	FuDraw::Activate();
290*cdf0e10cSrcweir }
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir /*************************************************************************
293*cdf0e10cSrcweir |*
294*cdf0e10cSrcweir |* Function deaktivieren
295*cdf0e10cSrcweir |*
296*cdf0e10cSrcweir \************************************************************************/
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir void FuConstruct::Deactivate()
299*cdf0e10cSrcweir {
300*cdf0e10cSrcweir 	FuDraw::Deactivate();
301*cdf0e10cSrcweir 	mpView->SetEditMode(SDREDITMODE_EDIT);
302*cdf0e10cSrcweir }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir /*************************************************************************
305*cdf0e10cSrcweir |*
306*cdf0e10cSrcweir |* StyleSheet fuer das zu erzeugende Objekt setzen
307*cdf0e10cSrcweir |*
308*cdf0e10cSrcweir \************************************************************************/
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir void FuConstruct::SetStyleSheet(SfxItemSet& rAttr, SdrObject* pObj)
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir 	sal_Bool bUseFillStyle, bUseNoFillStyle;
313*cdf0e10cSrcweir 	bUseFillStyle = bUseNoFillStyle = sal_False;
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 	switch( nSlotId )
316*cdf0e10cSrcweir 	{
317*cdf0e10cSrcweir 	case SID_DRAW_RECT:
318*cdf0e10cSrcweir 	case SID_DRAW_RECT_ROUND:
319*cdf0e10cSrcweir 	case SID_DRAW_SQUARE:
320*cdf0e10cSrcweir 	case SID_DRAW_SQUARE_ROUND:
321*cdf0e10cSrcweir 	case SID_DRAW_ELLIPSE:
322*cdf0e10cSrcweir 	case SID_DRAW_PIE:
323*cdf0e10cSrcweir 	case SID_DRAW_ELLIPSECUT:
324*cdf0e10cSrcweir 	case SID_DRAW_CIRCLE:
325*cdf0e10cSrcweir 	case SID_DRAW_CIRCLEPIE:
326*cdf0e10cSrcweir 	case SID_DRAW_CIRCLECUT:
327*cdf0e10cSrcweir 	case SID_DRAW_POLYGON:
328*cdf0e10cSrcweir 	case SID_DRAW_XPOLYGON:
329*cdf0e10cSrcweir 	case SID_DRAW_FREELINE:
330*cdf0e10cSrcweir 	case SID_DRAW_BEZIER_FILL:
331*cdf0e10cSrcweir 	{
332*cdf0e10cSrcweir 		bUseFillStyle = sal_True;
333*cdf0e10cSrcweir 		break;
334*cdf0e10cSrcweir 	}
335*cdf0e10cSrcweir 	case  SID_DRAW_RECT_NOFILL:
336*cdf0e10cSrcweir 	case SID_DRAW_RECT_ROUND_NOFILL:
337*cdf0e10cSrcweir 	case SID_DRAW_SQUARE_NOFILL:
338*cdf0e10cSrcweir 	case SID_DRAW_SQUARE_ROUND_NOFILL:
339*cdf0e10cSrcweir 	case SID_DRAW_ELLIPSE_NOFILL:
340*cdf0e10cSrcweir 	case SID_DRAW_PIE_NOFILL:
341*cdf0e10cSrcweir 	case SID_DRAW_ELLIPSECUT_NOFILL:
342*cdf0e10cSrcweir 	case SID_DRAW_CIRCLE_NOFILL:
343*cdf0e10cSrcweir 	case SID_DRAW_CIRCLEPIE_NOFILL:
344*cdf0e10cSrcweir 	case SID_DRAW_CIRCLECUT_NOFILL:
345*cdf0e10cSrcweir 	case SID_DRAW_POLYGON_NOFILL:
346*cdf0e10cSrcweir 	case SID_DRAW_XPOLYGON_NOFILL:
347*cdf0e10cSrcweir 	case SID_DRAW_FREELINE_NOFILL:
348*cdf0e10cSrcweir 	case SID_DRAW_LINE:
349*cdf0e10cSrcweir 	case SID_DRAW_XLINE:
350*cdf0e10cSrcweir 	case SID_CONNECTOR_ARROW_START:
351*cdf0e10cSrcweir 	case SID_CONNECTOR_ARROW_END:
352*cdf0e10cSrcweir 	case SID_CONNECTOR_ARROWS:
353*cdf0e10cSrcweir 	case SID_CONNECTOR_CIRCLE_START:
354*cdf0e10cSrcweir 	case SID_CONNECTOR_CIRCLE_END:
355*cdf0e10cSrcweir 	case SID_CONNECTOR_CIRCLES:
356*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE:
357*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_ARROW_START:
358*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_ARROW_END:
359*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_ARROWS:
360*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_CIRCLE_START:
361*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_CIRCLE_END:
362*cdf0e10cSrcweir 	case SID_CONNECTOR_LINE_CIRCLES:
363*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE:
364*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_ARROW_START:
365*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_ARROW_END:
366*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_ARROWS:
367*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_CIRCLE_START:
368*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_CIRCLE_END:
369*cdf0e10cSrcweir 	case SID_CONNECTOR_CURVE_CIRCLES:
370*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES:
371*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_ARROW_START:
372*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_ARROW_END:
373*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_ARROWS:
374*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_CIRCLE_START:
375*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_CIRCLE_END:
376*cdf0e10cSrcweir 	case SID_CONNECTOR_LINES_CIRCLES:
377*cdf0e10cSrcweir 	case SID_DRAW_BEZIER_NOFILL:
378*cdf0e10cSrcweir 	case SID_LINE_ARROW_END:
379*cdf0e10cSrcweir 	{
380*cdf0e10cSrcweir 		bUseNoFillStyle = sal_True;
381*cdf0e10cSrcweir 		break;
382*cdf0e10cSrcweir 	}
383*cdf0e10cSrcweir 	}
384*cdf0e10cSrcweir 	SetStyleSheet( rAttr, pObj, bUseFillStyle, bUseNoFillStyle );
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
388*cdf0e10cSrcweir 		const sal_Bool bForceFillStyle, const sal_Bool bForceNoFillStyle )
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir 	SdPage* pPage = (SdPage*)mpView->GetSdrPageView()->GetPage();
391*cdf0e10cSrcweir 	if ( pPage->IsMasterPage() && pPage->GetPageKind() == PK_STANDARD &&
392*cdf0e10cSrcweir 	     mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
393*cdf0e10cSrcweir 	{
394*cdf0e10cSrcweir 		/**********************************************
395*cdf0e10cSrcweir 		* Objects was created on the slide master page
396*cdf0e10cSrcweir 		***********************************************/
397*cdf0e10cSrcweir 		String aName( pPage->GetLayoutName() );
398*cdf0e10cSrcweir 		String aSep = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
399*cdf0e10cSrcweir 		sal_uInt16 n = aName.Search(aSep);
400*cdf0e10cSrcweir 		n = n + aSep.Len();
401*cdf0e10cSrcweir 		aName.Erase(n);
402*cdf0e10cSrcweir 		aName.Append( String ( SdResId( STR_LAYOUT_BACKGROUNDOBJECTS ) ) );
403*cdf0e10cSrcweir 		SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
404*cdf0e10cSrcweir 												GetStyleSheetPool()->
405*cdf0e10cSrcweir 												Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
406*cdf0e10cSrcweir 		DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
407*cdf0e10cSrcweir 		if (pSheet)
408*cdf0e10cSrcweir 		{
409*cdf0e10cSrcweir 			// applying style sheet for background objects
410*cdf0e10cSrcweir 			pObj->SetStyleSheet(pSheet, sal_False);
411*cdf0e10cSrcweir 			SfxItemSet& rSet = pSheet->GetItemSet();
412*cdf0e10cSrcweir 			const XFillStyleItem& rFillStyle = (const XFillStyleItem&)rSet.Get(XATTR_FILLSTYLE);
413*cdf0e10cSrcweir 			if ( bForceFillStyle )
414*cdf0e10cSrcweir 			{
415*cdf0e10cSrcweir 				if (rFillStyle.GetValue() == XFILL_NONE)
416*cdf0e10cSrcweir 					rAttr.Put(XFillStyleItem(XFILL_SOLID));
417*cdf0e10cSrcweir 			}
418*cdf0e10cSrcweir 			else if ( bForceNoFillStyle )
419*cdf0e10cSrcweir 			{
420*cdf0e10cSrcweir 				if (rFillStyle.GetValue() != XFILL_NONE)
421*cdf0e10cSrcweir 					rAttr.Put(XFillStyleItem(XFILL_NONE));
422*cdf0e10cSrcweir 			}
423*cdf0e10cSrcweir 		}
424*cdf0e10cSrcweir 	}
425*cdf0e10cSrcweir 	else
426*cdf0e10cSrcweir 	{
427*cdf0e10cSrcweir 		/***********************************
428*cdf0e10cSrcweir 		* object was created on normal page
429*cdf0e10cSrcweir 		************************************/
430*cdf0e10cSrcweir 		if ( bForceNoFillStyle )
431*cdf0e10cSrcweir 		{
432*cdf0e10cSrcweir 			String aName(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
433*cdf0e10cSrcweir 			SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
434*cdf0e10cSrcweir 										 GetStyleSheetPool()->
435*cdf0e10cSrcweir 										 Find(aName, SD_STYLE_FAMILY_GRAPHICS);
436*cdf0e10cSrcweir 			DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
437*cdf0e10cSrcweir 			if (pSheet)
438*cdf0e10cSrcweir 			{
439*cdf0e10cSrcweir 				pObj->SetStyleSheet(pSheet, sal_False);
440*cdf0e10cSrcweir 				SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
441*cdf0e10cSrcweir 				aAttr.Put(pSheet->GetItemSet().Get(XATTR_FILLSTYLE));
442*cdf0e10cSrcweir 				pObj->SetMergedItemSet(aAttr);
443*cdf0e10cSrcweir 			}
444*cdf0e10cSrcweir 			else
445*cdf0e10cSrcweir 			{
446*cdf0e10cSrcweir 				SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
447*cdf0e10cSrcweir 				rAttr.Put(XFillStyleItem(XFILL_NONE));
448*cdf0e10cSrcweir 				pObj->SetMergedItemSet(aAttr);
449*cdf0e10cSrcweir 			}
450*cdf0e10cSrcweir 		}
451*cdf0e10cSrcweir 	}
452*cdf0e10cSrcweir }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir } // end of namespace sd
455