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