xref: /aoo42x/main/sd/source/ui/view/drviews2.cxx (revision cdf0e10c)
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 "DrawViewShell.hxx"
32*cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
33*cdf0e10cSrcweir #include <vcl/waitobj.hxx>
34*cdf0e10cSrcweir #include <svx/svdograf.hxx>
35*cdf0e10cSrcweir #ifndef _SVXIDS_HRC
36*cdf0e10cSrcweir #include <svx/svxids.hrc>
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
39*cdf0e10cSrcweir #include <svx/svdundo.hxx>
40*cdf0e10cSrcweir #ifndef _ZOOMITEM_HXX
41*cdf0e10cSrcweir #include <svx/zoomitem.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _EDITDATA_HXX
44*cdf0e10cSrcweir #include <editeng/editdata.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #include <basic/sberrors.hxx>
47*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
48*cdf0e10cSrcweir #include <sfx2/request.hxx>
49*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
50*cdf0e10cSrcweir #include <svx/xfillit0.hxx>
51*cdf0e10cSrcweir #include <svx/xflclit.hxx>
52*cdf0e10cSrcweir #include <svl/aeitem.hxx>
53*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
54*cdf0e10cSrcweir #include <basic/sbstar.hxx>
55*cdf0e10cSrcweir #include <editeng/flditem.hxx>
56*cdf0e10cSrcweir #include <svx/xlineit0.hxx>
57*cdf0e10cSrcweir #include <svx/xfillit0.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #ifndef _SDOUTL_HXX //autogen
60*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
61*cdf0e10cSrcweir #endif
62*cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
63*cdf0e10cSrcweir #include <svx/svdoattr.hxx>
64*cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
65*cdf0e10cSrcweir #include <svx/sdtmfitm.hxx>
66*cdf0e10cSrcweir #include <svx/sdtagitm.hxx>
67*cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
68*cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
71*cdf0e10cSrcweir #include <svx/dialogs.hrc>
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
74*cdf0e10cSrcweir #include "sdgrffilter.hxx"
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir #include "app.hrc"
77*cdf0e10cSrcweir #include "glob.hrc"
78*cdf0e10cSrcweir #include "helpids.h"
79*cdf0e10cSrcweir #include "sdattr.hxx"
80*cdf0e10cSrcweir #include "drawview.hxx"
81*cdf0e10cSrcweir #include "Window.hxx"
82*cdf0e10cSrcweir #include "drawdoc.hxx"
83*cdf0e10cSrcweir #include "DrawDocShell.hxx"
84*cdf0e10cSrcweir #include "sdpage.hxx"
85*cdf0e10cSrcweir #include "fuscale.hxx"
86*cdf0e10cSrcweir #include "sdresid.hxx"
87*cdf0e10cSrcweir #include "GraphicViewShell.hxx"
88*cdf0e10cSrcweir #include "unmodpg.hxx"
89*cdf0e10cSrcweir #include "slideshow.hxx"
90*cdf0e10cSrcweir #include "fuvect.hxx"
91*cdf0e10cSrcweir #include "stlpool.hxx"
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir // #90356#
94*cdf0e10cSrcweir #include "optsitem.hxx"
95*cdf0e10cSrcweir #include "sdabstdlg.hxx"
96*cdf0e10cSrcweir #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
97*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPages.hpp>
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir #include <strings.hrc>
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir using namespace ::com::sun::star;
102*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir namespace sd {
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir /*************************************************************************
107*cdf0e10cSrcweir |*
108*cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen
109*cdf0e10cSrcweir |*
110*cdf0e10cSrcweir \************************************************************************/
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir void DrawViewShell::FuTemporary(SfxRequest& rReq)
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir 	// Waehrend einer Native-Diashow wird nichts ausgefuehrt!
115*cdf0e10cSrcweir 	if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
116*cdf0e10cSrcweir 		return;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
119*cdf0e10cSrcweir 	if( !mpDrawView )
120*cdf0e10cSrcweir 		return;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	CheckLineTo (rReq);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	DeactivateCurrentFunction();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	sal_uInt16 nSId = rReq.GetSlot();
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	// Slot wird gemapped (ToolboxImages/-Slots)
129*cdf0e10cSrcweir 	MapSlot( nSId );
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	switch ( nSId )
132*cdf0e10cSrcweir 	{
133*cdf0e10cSrcweir 		// Flaechen und Linien-Attribute:
134*cdf0e10cSrcweir 		// Sollten (wie StateMethode) eine eigene
135*cdf0e10cSrcweir 		// Execute-Methode besitzen
136*cdf0e10cSrcweir 		case SID_ATTR_FILL_STYLE:
137*cdf0e10cSrcweir 		case SID_ATTR_FILL_COLOR:
138*cdf0e10cSrcweir 		case SID_ATTR_FILL_GRADIENT:
139*cdf0e10cSrcweir 		case SID_ATTR_FILL_HATCH:
140*cdf0e10cSrcweir 		case SID_ATTR_FILL_BITMAP:
141*cdf0e10cSrcweir 		case SID_ATTR_FILL_SHADOW:
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 		case SID_ATTR_LINE_STYLE:
144*cdf0e10cSrcweir 		case SID_ATTR_LINE_DASH:
145*cdf0e10cSrcweir 		case SID_ATTR_LINE_WIDTH:
146*cdf0e10cSrcweir 		case SID_ATTR_LINE_COLOR:
147*cdf0e10cSrcweir 		case SID_ATTR_LINEEND_STYLE:
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 		case SID_ATTR_TEXT_FITTOSIZE:
150*cdf0e10cSrcweir 		{
151*cdf0e10cSrcweir 			if( rReq.GetArgs() )
152*cdf0e10cSrcweir 			{
153*cdf0e10cSrcweir 				sal_Bool bMergeUndo = sal_False;
154*cdf0e10cSrcweir 				::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 				// Anpassungen Start/EndWidth #63083#
157*cdf0e10cSrcweir 				if(nSId == SID_ATTR_LINE_WIDTH)
158*cdf0e10cSrcweir 				{
159*cdf0e10cSrcweir 					SdrObject* pObj = NULL;
160*cdf0e10cSrcweir 					const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
161*cdf0e10cSrcweir 					sal_uLong nCount = rMarkList.GetMarkCount();
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 					sal_Int32 nNewLineWidth = ((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue();
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 					for (sal_uLong i=0; i<nCount; i++)
166*cdf0e10cSrcweir 					{
167*cdf0e10cSrcweir 						SfxItemSet aAttr(GetDoc()->GetPool());
168*cdf0e10cSrcweir 						pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
169*cdf0e10cSrcweir 						aAttr.Put(pObj->GetMergedItemSet());
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 						sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 						if(nActLineWidth != nNewLineWidth)
174*cdf0e10cSrcweir 						{
175*cdf0e10cSrcweir 							sal_Bool bSetItemSet(sal_False);
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 							// #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
178*cdf0e10cSrcweir 							if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
179*cdf0e10cSrcweir 							{
180*cdf0e10cSrcweir 								sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
181*cdf0e10cSrcweir 								sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
182*cdf0e10cSrcweir 								if(nValNew < 0)
183*cdf0e10cSrcweir 									nValNew = 0;
184*cdf0e10cSrcweir 								bSetItemSet = sal_True;
185*cdf0e10cSrcweir 								aAttr.Put(XLineStartWidthItem(nValNew));
186*cdf0e10cSrcweir 							}
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 							// #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
189*cdf0e10cSrcweir 							if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
190*cdf0e10cSrcweir 							{
191*cdf0e10cSrcweir 								sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
192*cdf0e10cSrcweir 								sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
193*cdf0e10cSrcweir 								if(nValNew < 0)
194*cdf0e10cSrcweir 									nValNew = 0;
195*cdf0e10cSrcweir 								bSetItemSet = sal_True;
196*cdf0e10cSrcweir 								aAttr.Put(XLineEndWidthItem(nValNew));
197*cdf0e10cSrcweir 							}
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 							if(bSetItemSet)
200*cdf0e10cSrcweir 								pObj->SetMergedItemSet(aAttr);
201*cdf0e10cSrcweir 						}
202*cdf0e10cSrcweir 					}
203*cdf0e10cSrcweir 				}
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 				if (nSId == SID_ATTR_FILL_SHADOW)
206*cdf0e10cSrcweir 				{
207*cdf0e10cSrcweir 					// Ggf. werden transparente Objekte wei?gefuellt
208*cdf0e10cSrcweir 					SdrObject* pObj = NULL;
209*cdf0e10cSrcweir 					const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
210*cdf0e10cSrcweir 					sal_uLong nCount = rMarkList.GetMarkCount();
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 					const bool bUndo = mpDrawView->IsUndoEnabled();
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 					for (sal_uLong i=0; i<nCount; i++)
215*cdf0e10cSrcweir 					{
216*cdf0e10cSrcweir 						SfxItemSet aAttr(GetDoc()->GetPool());
217*cdf0e10cSrcweir 						pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 						// #i25616#
220*cdf0e10cSrcweir 						if(!pObj->ISA(SdrGrafObj))
221*cdf0e10cSrcweir 						{
222*cdf0e10cSrcweir 							aAttr.Put(pObj->GetMergedItemSet());
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 							const XFillStyleItem& rFillStyle =
225*cdf0e10cSrcweir 							(const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 							if (rFillStyle.GetValue() == XFILL_NONE)
228*cdf0e10cSrcweir 							{
229*cdf0e10cSrcweir 								if( bUndo )
230*cdf0e10cSrcweir 								{
231*cdf0e10cSrcweir 									// Vorlage hat keine Fuellung,
232*cdf0e10cSrcweir 									// daher hart attributieren: Fuellung setzen
233*cdf0e10cSrcweir 									if (!bMergeUndo)
234*cdf0e10cSrcweir 									{
235*cdf0e10cSrcweir 										bMergeUndo = sal_True;
236*cdf0e10cSrcweir 										pUndoManager->EnterListAction( String(), String() );
237*cdf0e10cSrcweir 										mpDrawView->BegUndo();
238*cdf0e10cSrcweir 									}
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 									mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
241*cdf0e10cSrcweir 								}
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 								aAttr.Put(XFillStyleItem(XFILL_SOLID));
244*cdf0e10cSrcweir 								aAttr.Put(XFillColorItem(String(), COL_WHITE));
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 								pObj->SetMergedItemSet(aAttr);
247*cdf0e10cSrcweir 							}
248*cdf0e10cSrcweir 						}
249*cdf0e10cSrcweir 					}
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 					if (bMergeUndo)
252*cdf0e10cSrcweir 					{
253*cdf0e10cSrcweir 						mpDrawView->EndUndo();
254*cdf0e10cSrcweir 					}
255*cdf0e10cSrcweir 				}
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 				mpDrawView->SetAttributes(*rReq.GetArgs());
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 				if (bMergeUndo)
260*cdf0e10cSrcweir 				{
261*cdf0e10cSrcweir 					pUndoManager->LeaveListAction();
262*cdf0e10cSrcweir 				}
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 				rReq.Done();
265*cdf0e10cSrcweir 			}
266*cdf0e10cSrcweir 			else
267*cdf0e10cSrcweir 			{
268*cdf0e10cSrcweir 				switch( rReq.GetSlot() )
269*cdf0e10cSrcweir 				{
270*cdf0e10cSrcweir 					case SID_ATTR_FILL_SHADOW:
271*cdf0e10cSrcweir 					case SID_ATTR_FILL_STYLE:
272*cdf0e10cSrcweir 					case SID_ATTR_FILL_COLOR:
273*cdf0e10cSrcweir 					case SID_ATTR_FILL_GRADIENT:
274*cdf0e10cSrcweir 					case SID_ATTR_FILL_HATCH:
275*cdf0e10cSrcweir 					case SID_ATTR_FILL_BITMAP:
276*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
277*cdf0e10cSrcweir 						break;
278*cdf0e10cSrcweir 					case SID_ATTR_LINE_STYLE:
279*cdf0e10cSrcweir 					case SID_ATTR_LINE_DASH:
280*cdf0e10cSrcweir 					case SID_ATTR_LINE_WIDTH:
281*cdf0e10cSrcweir 					case SID_ATTR_LINE_COLOR:
282*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
283*cdf0e10cSrcweir 						break;
284*cdf0e10cSrcweir 					case SID_ATTR_TEXT_FITTOSIZE:
285*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON );
286*cdf0e10cSrcweir 						break;
287*cdf0e10cSrcweir 				}
288*cdf0e10cSrcweir 			}
289*cdf0e10cSrcweir 			Cancel();
290*cdf0e10cSrcweir 		}
291*cdf0e10cSrcweir 		break;
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 		case SID_HYPHENATION:
294*cdf0e10cSrcweir 		{
295*cdf0e10cSrcweir 			// const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
296*cdf0e10cSrcweir 			//  ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
297*cdf0e10cSrcweir 			SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False);
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 			if( pItem )
300*cdf0e10cSrcweir 			{
301*cdf0e10cSrcweir 				SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
302*cdf0e10cSrcweir 				sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
303*cdf0e10cSrcweir 				aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
304*cdf0e10cSrcweir 				mpDrawView->SetAttributes( aSet );
305*cdf0e10cSrcweir 			}
306*cdf0e10cSrcweir 			else // nur zum Test
307*cdf0e10cSrcweir 			{
308*cdf0e10cSrcweir 				DBG_ERROR(" Kein Wert fuer Silbentrennung!");
309*cdf0e10cSrcweir 				SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
310*cdf0e10cSrcweir 				sal_Bool bValue = sal_True;
311*cdf0e10cSrcweir 				aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
312*cdf0e10cSrcweir 				mpDrawView->SetAttributes( aSet );
313*cdf0e10cSrcweir 			}
314*cdf0e10cSrcweir 			rReq.Done();
315*cdf0e10cSrcweir 			Cancel();
316*cdf0e10cSrcweir 		}
317*cdf0e10cSrcweir 		break;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 		case SID_INSERTPAGE:
320*cdf0e10cSrcweir 		case SID_INSERTPAGE_QUICK:
321*cdf0e10cSrcweir 		case SID_DUPLICATE_PAGE:
322*cdf0e10cSrcweir         {
323*cdf0e10cSrcweir             SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
324*cdf0e10cSrcweir             Cancel();
325*cdf0e10cSrcweir             if(HasCurrentFunction(SID_BEZIER_EDIT) )
326*cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
327*cdf0e10cSrcweir             if (pNewPage != NULL)
328*cdf0e10cSrcweir                 SwitchPage((pNewPage->GetPageNum()-1)/2);
329*cdf0e10cSrcweir             rReq.Done ();
330*cdf0e10cSrcweir         }
331*cdf0e10cSrcweir 		break;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		case SID_INSERT_MASTER_PAGE:
334*cdf0e10cSrcweir         {
335*cdf0e10cSrcweir             // Use the API to create a new page.
336*cdf0e10cSrcweir             Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
337*cdf0e10cSrcweir                 GetDoc()->getUnoModel(), UNO_QUERY);
338*cdf0e10cSrcweir             if (xMasterPagesSupplier.is())
339*cdf0e10cSrcweir             {
340*cdf0e10cSrcweir                 Reference<drawing::XDrawPages> xMasterPages (
341*cdf0e10cSrcweir                     xMasterPagesSupplier->getMasterPages());
342*cdf0e10cSrcweir                 if (xMasterPages.is())
343*cdf0e10cSrcweir                 {
344*cdf0e10cSrcweir                     sal_uInt16 nIndex = GetCurPageId();
345*cdf0e10cSrcweir                     xMasterPages->insertNewByIndex (nIndex);
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir                     // Create shapes for the default layout.
348*cdf0e10cSrcweir                     SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
349*cdf0e10cSrcweir                         nIndex, PK_STANDARD);
350*cdf0e10cSrcweir                     pMasterPage->CreateTitleAndLayout (sal_True,sal_True);
351*cdf0e10cSrcweir                 }
352*cdf0e10cSrcweir             }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir             Cancel();
355*cdf0e10cSrcweir             if(HasCurrentFunction(SID_BEZIER_EDIT))
356*cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(
357*cdf0e10cSrcweir                     SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
358*cdf0e10cSrcweir             rReq.Done ();
359*cdf0e10cSrcweir         }
360*cdf0e10cSrcweir         break;
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 		case SID_MODIFYPAGE:
363*cdf0e10cSrcweir 		{
364*cdf0e10cSrcweir 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
365*cdf0e10cSrcweir 				(mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
366*cdf0e10cSrcweir 			{
367*cdf0e10cSrcweir 				if ( mpDrawView->IsTextEdit() )
368*cdf0e10cSrcweir 				{
369*cdf0e10cSrcweir 					mpDrawView->SdrEndTextEdit();
370*cdf0e10cSrcweir 				}
371*cdf0e10cSrcweir 				sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
372*cdf0e10cSrcweir 				mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
373*cdf0e10cSrcweir                 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
374*cdf0e10cSrcweir                     rReq,
375*cdf0e10cSrcweir                     mpActualPage,
376*cdf0e10cSrcweir                     mePageKind);
377*cdf0e10cSrcweir 			}
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 			Cancel();
380*cdf0e10cSrcweir 			rReq.Done ();
381*cdf0e10cSrcweir 		}
382*cdf0e10cSrcweir 		break;
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir         case SID_ASSIGN_LAYOUT:
385*cdf0e10cSrcweir 		{
386*cdf0e10cSrcweir 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
387*cdf0e10cSrcweir 			{
388*cdf0e10cSrcweir 			    if ( mpDrawView->IsTextEdit() )
389*cdf0e10cSrcweir 				    mpDrawView->SdrEndTextEdit();
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 				::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
392*cdf0e10cSrcweir             }
393*cdf0e10cSrcweir             Cancel();
394*cdf0e10cSrcweir 			rReq.Done ();
395*cdf0e10cSrcweir 		}
396*cdf0e10cSrcweir         break;
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 		case SID_RENAMEPAGE:
399*cdf0e10cSrcweir 		case SID_RENAME_MASTER_PAGE:
400*cdf0e10cSrcweir         {
401*cdf0e10cSrcweir 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
402*cdf0e10cSrcweir 			{
403*cdf0e10cSrcweir 				if ( mpDrawView->IsTextEdit() )
404*cdf0e10cSrcweir 				{
405*cdf0e10cSrcweir 					mpDrawView->SdrEndTextEdit();
406*cdf0e10cSrcweir 				}
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir                 sal_uInt16 nPageId = maTabControl.GetCurPageId();
409*cdf0e10cSrcweir                 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
410*cdf0e10cSrcweir                     ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
411*cdf0e10cSrcweir                     : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir                 String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
414*cdf0e10cSrcweir                 String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
415*cdf0e10cSrcweir                 String aPageName = pCurrentPage->GetName();
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
418*cdf0e10cSrcweir 				DBG_ASSERT(pFact, "Dialogdiet fail!");
419*cdf0e10cSrcweir 				AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr );
420*cdf0e10cSrcweir 				DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
421*cdf0e10cSrcweir 				aNameDlg->SetText( aTitle );
422*cdf0e10cSrcweir                 aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
423*cdf0e10cSrcweir                 aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir                 if( aNameDlg->Execute() == RET_OK )
426*cdf0e10cSrcweir                 {
427*cdf0e10cSrcweir                     String aNewName;
428*cdf0e10cSrcweir                     aNameDlg->GetName( aNewName );
429*cdf0e10cSrcweir                     if( ! aNewName.Equals( aPageName ) )
430*cdf0e10cSrcweir                     {
431*cdf0e10cSrcweir #ifdef DBG_UTIL
432*cdf0e10cSrcweir                         bool bResult =
433*cdf0e10cSrcweir #endif
434*cdf0e10cSrcweir 							RenameSlide( nPageId, aNewName );
435*cdf0e10cSrcweir                         DBG_ASSERT( bResult, "Couldn't rename slide" );
436*cdf0e10cSrcweir                     }
437*cdf0e10cSrcweir                 }
438*cdf0e10cSrcweir 				delete aNameDlg;
439*cdf0e10cSrcweir             }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 			Cancel();
442*cdf0e10cSrcweir 			rReq.Ignore ();
443*cdf0e10cSrcweir         }
444*cdf0e10cSrcweir         break;
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir         case SID_RENAMEPAGE_QUICK:
447*cdf0e10cSrcweir 		{
448*cdf0e10cSrcweir 			if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
449*cdf0e10cSrcweir 			{
450*cdf0e10cSrcweir 				if ( mpDrawView->IsTextEdit() )
451*cdf0e10cSrcweir 				{
452*cdf0e10cSrcweir 					mpDrawView->SdrEndTextEdit();
453*cdf0e10cSrcweir 				}
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 				maTabControl.StartEditMode( maTabControl.GetCurPageId() );
456*cdf0e10cSrcweir 			}
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir 			Cancel();
459*cdf0e10cSrcweir 			rReq.Ignore ();
460*cdf0e10cSrcweir 		}
461*cdf0e10cSrcweir 		break;
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 		case SID_PAGESIZE :  // entweder dieses (kein menueeintrag o. ae. !!)
464*cdf0e10cSrcweir 		{
465*cdf0e10cSrcweir 			const SfxItemSet *pArgs = rReq.GetArgs ();
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 			if (pArgs)
468*cdf0e10cSrcweir 				if (pArgs->Count () == 3)
469*cdf0e10cSrcweir 				{
470*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False);
471*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False);
472*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir 					Size aSize (pWidth->GetValue (), pHeight->GetValue ());
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 					SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ());
477*cdf0e10cSrcweir 					rReq.Ignore ();
478*cdf0e10cSrcweir 					break;
479*cdf0e10cSrcweir 				}
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
482*cdf0e10cSrcweir 			rReq.Ignore ();
483*cdf0e10cSrcweir 			break;
484*cdf0e10cSrcweir 		}
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir 		case SID_PAGEMARGIN :  // oder dieses (kein menueeintrag o. ae. !!)
487*cdf0e10cSrcweir 		{
488*cdf0e10cSrcweir 			const SfxItemSet *pArgs = rReq.GetArgs ();
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 			if (pArgs)
491*cdf0e10cSrcweir 				if (pArgs->Count () == 5)
492*cdf0e10cSrcweir 				{
493*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False);
494*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False);
495*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False);
496*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False);
497*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 					Size aEmptySize (0, 0);
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 					SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
502*cdf0e10cSrcweir 							   pUpper->GetValue (), pLower->GetValue (),
503*cdf0e10cSrcweir 							   sal_False, sal_True, pScaleAll->GetValue ());
504*cdf0e10cSrcweir 					rReq.Ignore ();
505*cdf0e10cSrcweir 					break;
506*cdf0e10cSrcweir 				}
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
509*cdf0e10cSrcweir 			rReq.Ignore ();
510*cdf0e10cSrcweir 			break;
511*cdf0e10cSrcweir 		}
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 		case SID_ATTR_ZOOMSLIDER:
514*cdf0e10cSrcweir 		{
515*cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir 			if (pArgs && pArgs->Count () == 1 )
518*cdf0e10cSrcweir 			{
519*cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
520*cdf0e10cSrcweir 				if (CHECK_RANGE (5, pScale->GetValue (), 3000))
521*cdf0e10cSrcweir 				{
522*cdf0e10cSrcweir 					SetZoom (pScale->GetValue ());
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 					SfxBindings& rBindings = GetViewFrame()->GetBindings();
525*cdf0e10cSrcweir 					rBindings.Invalidate( SID_ATTR_ZOOM );
526*cdf0e10cSrcweir 					rBindings.Invalidate( SID_ZOOM_IN );
527*cdf0e10cSrcweir 					rBindings.Invalidate( SID_ZOOM_OUT );
528*cdf0e10cSrcweir 					rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir 				}
531*cdf0e10cSrcweir 			}
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir 			Cancel();
534*cdf0e10cSrcweir 			rReq.Done ();
535*cdf0e10cSrcweir 			break;
536*cdf0e10cSrcweir 		}
537*cdf0e10cSrcweir 		case SID_ZOOMING :	// kein Menueintrag, sondern aus dem Zoomdialog generiert
538*cdf0e10cSrcweir 		{
539*cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 			if (pArgs)
542*cdf0e10cSrcweir 				if (pArgs->Count () == 1)
543*cdf0e10cSrcweir 				{
544*cdf0e10cSrcweir 					SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
545*cdf0e10cSrcweir 					if (CHECK_RANGE (10, pScale->GetValue (), 1000))
546*cdf0e10cSrcweir 					{
547*cdf0e10cSrcweir 						SetZoom (pScale->GetValue ());
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 						SfxBindings& rBindings = GetViewFrame()->GetBindings();
550*cdf0e10cSrcweir 						rBindings.Invalidate( SID_ATTR_ZOOM );
551*cdf0e10cSrcweir 						rBindings.Invalidate( SID_ZOOM_IN );
552*cdf0e10cSrcweir 						rBindings.Invalidate( SID_ZOOM_OUT );
553*cdf0e10cSrcweir 						rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
554*cdf0e10cSrcweir 					}
555*cdf0e10cSrcweir 					else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir 					rReq.Ignore ();
558*cdf0e10cSrcweir 					break;
559*cdf0e10cSrcweir 				}
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir 			StarBASIC::FatalError (SbERR_WRONG_ARGS);
562*cdf0e10cSrcweir 			rReq.Ignore ();
563*cdf0e10cSrcweir 			break;
564*cdf0e10cSrcweir 		}
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 		case SID_ATTR_ZOOM:
567*cdf0e10cSrcweir 		{
568*cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
569*cdf0e10cSrcweir 			mbZoomOnPage = sal_False;
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir 			if ( pArgs )
572*cdf0e10cSrcweir 			{
573*cdf0e10cSrcweir 				SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
574*cdf0e10cSrcweir 											Get( SID_ATTR_ZOOM ) ).GetType();
575*cdf0e10cSrcweir 				switch( eZT )
576*cdf0e10cSrcweir 				{
577*cdf0e10cSrcweir 					case SVX_ZOOM_PERCENT:
578*cdf0e10cSrcweir 						SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
579*cdf0e10cSrcweir 											Get( SID_ATTR_ZOOM ) ).GetValue() );
580*cdf0e10cSrcweir 						break;
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 					case SVX_ZOOM_OPTIMAL:
583*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
584*cdf0e10cSrcweir 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
585*cdf0e10cSrcweir 						break;
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 					case SVX_ZOOM_PAGEWIDTH:
588*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
589*cdf0e10cSrcweir 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
590*cdf0e10cSrcweir 						break;
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 					case SVX_ZOOM_WHOLEPAGE:
593*cdf0e10cSrcweir 						GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
594*cdf0e10cSrcweir 									SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
595*cdf0e10cSrcweir 						break;
596*cdf0e10cSrcweir 					case SVX_ZOOM_PAGEWIDTH_NOBORDER:
597*cdf0e10cSrcweir 						DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
598*cdf0e10cSrcweir 						break;
599*cdf0e10cSrcweir 				}
600*cdf0e10cSrcweir 				rReq.Ignore ();
601*cdf0e10cSrcweir 			}
602*cdf0e10cSrcweir 			else
603*cdf0e10cSrcweir 			{
604*cdf0e10cSrcweir 				// hier den Zoom-Dialog oeffnen
605*cdf0e10cSrcweir 				SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
606*cdf0e10cSrcweir 			}
607*cdf0e10cSrcweir 			Cancel();
608*cdf0e10cSrcweir 		}
609*cdf0e10cSrcweir 		break;
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 		case SID_CHANGEBEZIER:
612*cdf0e10cSrcweir 		case SID_CHANGEPOLYGON:
613*cdf0e10cSrcweir 			if ( mpDrawView->IsTextEdit() )
614*cdf0e10cSrcweir 			{
615*cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
616*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
617*cdf0e10cSrcweir 			}
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
620*cdf0e10cSrcweir 			{
621*cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
622*cdf0e10cSrcweir 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
623*cdf0e10cSrcweir 			}
624*cdf0e10cSrcweir 			else
625*cdf0e10cSrcweir 			{
626*cdf0e10cSrcweir 				if( rReq.GetSlot() == SID_CHANGEBEZIER )
627*cdf0e10cSrcweir 				{
628*cdf0e10cSrcweir 					WaitObject aWait( (Window*)GetActiveWindow() );
629*cdf0e10cSrcweir 					mpDrawView->ConvertMarkedToPathObj(sal_False);
630*cdf0e10cSrcweir 				}
631*cdf0e10cSrcweir 				else
632*cdf0e10cSrcweir 				{
633*cdf0e10cSrcweir 					if( mpDrawView->IsVectorizeAllowed() )
634*cdf0e10cSrcweir 						SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
635*cdf0e10cSrcweir 					else
636*cdf0e10cSrcweir 					{
637*cdf0e10cSrcweir 						WaitObject aWait( (Window*)GetActiveWindow() );
638*cdf0e10cSrcweir 						mpDrawView->ConvertMarkedToPolyObj(sal_False);
639*cdf0e10cSrcweir 					}
640*cdf0e10cSrcweir 				}
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir 				Invalidate(SID_CHANGEBEZIER);
643*cdf0e10cSrcweir 				Invalidate(SID_CHANGEPOLYGON);
644*cdf0e10cSrcweir 			}
645*cdf0e10cSrcweir 			Cancel();
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir 			if( HasCurrentFunction(SID_BEZIER_EDIT) )
648*cdf0e10cSrcweir 			{	// ggf. die richtige Editfunktion aktivieren
649*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
650*cdf0e10cSrcweir 										SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
651*cdf0e10cSrcweir 			}
652*cdf0e10cSrcweir 			rReq.Ignore ();
653*cdf0e10cSrcweir 			break;
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 		case SID_CONVERT_TO_CONTOUR:
656*cdf0e10cSrcweir 			if ( mpDrawView->IsTextEdit() )
657*cdf0e10cSrcweir 			{
658*cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
659*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
660*cdf0e10cSrcweir 			}
661*cdf0e10cSrcweir 
662*cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected() )
663*cdf0e10cSrcweir 			{
664*cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
665*cdf0e10cSrcweir 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
666*cdf0e10cSrcweir 			}
667*cdf0e10cSrcweir 			else
668*cdf0e10cSrcweir 			{
669*cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
670*cdf0e10cSrcweir 				mpDrawView->ConvertMarkedToPathObj(sal_True);
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 				Invalidate(SID_CONVERT_TO_CONTOUR);
673*cdf0e10cSrcweir 			}
674*cdf0e10cSrcweir 			Cancel();
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 			rReq.Ignore ();
677*cdf0e10cSrcweir 			break;
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir 		case SID_CONVERT_TO_METAFILE:
680*cdf0e10cSrcweir 		case SID_CONVERT_TO_BITMAP:
681*cdf0e10cSrcweir 		{
682*cdf0e10cSrcweir             // End text edit mode when it is active because the metafile or
683*cdf0e10cSrcweir             // bitmap that will be created does not support it.
684*cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
685*cdf0e10cSrcweir 			{
686*cdf0e10cSrcweir 				mpDrawView->SdrEndTextEdit();
687*cdf0e10cSrcweir 				GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
688*cdf0e10cSrcweir             }
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected(true,true,true) )
691*cdf0e10cSrcweir 			{
692*cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
693*cdf0e10cSrcweir 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
694*cdf0e10cSrcweir 			}
695*cdf0e10cSrcweir 			else
696*cdf0e10cSrcweir 			{
697*cdf0e10cSrcweir 				WaitObject aWait( (Window*)GetActiveWindow() );
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir 				// switch on undo for the next operations
700*cdf0e10cSrcweir 				mpDrawView->BegUndo(
701*cdf0e10cSrcweir 					String(
702*cdf0e10cSrcweir 					SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP)));
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 				// create SdrGrafObj from metafile/bitmap
705*cdf0e10cSrcweir 				Graphic aGraphic;
706*cdf0e10cSrcweir 				switch (nSId)
707*cdf0e10cSrcweir 				{
708*cdf0e10cSrcweir 					case SID_CONVERT_TO_METAFILE:
709*cdf0e10cSrcweir 					{
710*cdf0e10cSrcweir 						GDIMetaFile aMetaFile(mpDrawView->GetAllMarkedMetaFile ());
711*cdf0e10cSrcweir 						aGraphic = Graphic(aMetaFile);
712*cdf0e10cSrcweir 					}
713*cdf0e10cSrcweir 					break;
714*cdf0e10cSrcweir 					case SID_CONVERT_TO_BITMAP:
715*cdf0e10cSrcweir 					{
716*cdf0e10cSrcweir 						Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
717*cdf0e10cSrcweir 						aGraphic = Graphic(aBitmap);
718*cdf0e10cSrcweir 					}
719*cdf0e10cSrcweir 					break;
720*cdf0e10cSrcweir 				}
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir 				// create new object
723*cdf0e10cSrcweir 				SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir 				// get some necessary info and ensure it
726*cdf0e10cSrcweir 				const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
727*cdf0e10cSrcweir 				const sal_uInt32 nMarkCount(rMarkList.GetMarkCount());
728*cdf0e10cSrcweir 				SdrPageView* pPageView = mpDrawView->GetSdrPageView();
729*cdf0e10cSrcweir 				OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
730*cdf0e10cSrcweir 				OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir 				// fit rectangle of new graphic object to selection's mark rect
733*cdf0e10cSrcweir 				Rectangle aAllMarkedRect;
734*cdf0e10cSrcweir 				rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
735*cdf0e10cSrcweir 				pGraphicObj->SetLogicRect(aAllMarkedRect);
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 				// #i71540# to keep the order, it is necessary to replace the lowest object
738*cdf0e10cSrcweir 				// of the selection with the new object. This also means that with multi
739*cdf0e10cSrcweir 				// selection, all other objects need to be deleted first
740*cdf0e10cSrcweir 				SdrMark* pFirstMark = rMarkList.GetMark(0L);
741*cdf0e10cSrcweir 				SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir 				if(nMarkCount > 1L)
744*cdf0e10cSrcweir 				{
745*cdf0e10cSrcweir 					// take first object out of selection
746*cdf0e10cSrcweir 					mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 					// clear remaining selection
749*cdf0e10cSrcweir 					mpDrawView->DeleteMarkedObj();
750*cdf0e10cSrcweir 				}
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir 				// now replace lowest object with new one
753*cdf0e10cSrcweir 				mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir 				// switch off undo
756*cdf0e10cSrcweir 				mpDrawView->EndUndo();
757*cdf0e10cSrcweir 			}
758*cdf0e10cSrcweir 		}
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 		Cancel();
761*cdf0e10cSrcweir 
762*cdf0e10cSrcweir 		rReq.Done ();
763*cdf0e10cSrcweir 		break;
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir 		case SID_SET_DEFAULT:
766*cdf0e10cSrcweir 		{
767*cdf0e10cSrcweir 			SfxItemSet* pSet = NULL;
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir 			if (mpDrawView->IsTextEdit())
770*cdf0e10cSrcweir 			{
771*cdf0e10cSrcweir 				::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
772*cdf0e10cSrcweir 				if (pOutl)
773*cdf0e10cSrcweir 				{
774*cdf0e10cSrcweir 					pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType());
775*cdf0e10cSrcweir 				}
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir 				pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
778*cdf0e10cSrcweir 				mpDrawView->SetAttributes( *pSet, sal_True );
779*cdf0e10cSrcweir 			}
780*cdf0e10cSrcweir 			else
781*cdf0e10cSrcweir 			{
782*cdf0e10cSrcweir 				const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
783*cdf0e10cSrcweir 				sal_uLong nCount = rMarkList.GetMarkCount();
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir 				// In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
786*cdf0e10cSrcweir 				// der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
787*cdf0e10cSrcweir 				// mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert
788*cdf0e10cSrcweir 				// werden muessen
789*cdf0e10cSrcweir 				List* pAttrList = new List();
790*cdf0e10cSrcweir 				SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
791*cdf0e10cSrcweir 				sal_uLong i;
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir 				for ( i = 0; i < nCount; i++ )
794*cdf0e10cSrcweir 				{
795*cdf0e10cSrcweir 					SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir 					if( pPresPage->IsPresObj( pObj ) )
798*cdf0e10cSrcweir 					{
799*cdf0e10cSrcweir 						SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
800*cdf0e10cSrcweir 						pNewSet->Put(pObj->GetMergedItemSet());
801*cdf0e10cSrcweir 						pAttrList->Insert( pNewSet, LIST_APPEND );
802*cdf0e10cSrcweir 						pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND );
803*cdf0e10cSrcweir 					}
804*cdf0e10cSrcweir 				}
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 				pSet = new SfxItemSet( GetPool() );
807*cdf0e10cSrcweir 				mpDrawView->SetAttributes( *pSet, sal_True );
808*cdf0e10cSrcweir 
809*cdf0e10cSrcweir 				sal_uLong j = 0;
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir 				for ( i = 0; i < nCount; i++ )
812*cdf0e10cSrcweir 				{
813*cdf0e10cSrcweir 					SfxStyleSheet* pSheet = NULL;
814*cdf0e10cSrcweir 					SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 					if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
817*cdf0e10cSrcweir 					{
818*cdf0e10cSrcweir 						pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
819*cdf0e10cSrcweir 						if (pSheet)
820*cdf0e10cSrcweir 							pObj->SetStyleSheet(pSheet, sal_False);
821*cdf0e10cSrcweir 					}
822*cdf0e10cSrcweir 					else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
823*cdf0e10cSrcweir 					{
824*cdf0e10cSrcweir 						for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
825*cdf0e10cSrcweir 						{
826*cdf0e10cSrcweir 							pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
827*cdf0e10cSrcweir 							DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
828*cdf0e10cSrcweir 							if (pSheet)
829*cdf0e10cSrcweir 							{
830*cdf0e10cSrcweir 								pObj->StartListening(*pSheet);
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir 								if( nLevel == 1 )
833*cdf0e10cSrcweir 									// Textrahmen hoert auf StyleSheet der Ebene1
834*cdf0e10cSrcweir 									pObj->NbcSetStyleSheet(pSheet, sal_False);
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir 							}
837*cdf0e10cSrcweir 						}
838*cdf0e10cSrcweir 					}
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir 					if( pPresPage->IsPresObj( pObj ) )
841*cdf0e10cSrcweir 					{
842*cdf0e10cSrcweir 						SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++);
843*cdf0e10cSrcweir 						SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++);
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir 						if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON )
846*cdf0e10cSrcweir 						{
847*cdf0e10cSrcweir 							pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
848*cdf0e10cSrcweir 						}
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir 						if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON )
851*cdf0e10cSrcweir 						{
852*cdf0e10cSrcweir 							pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
853*cdf0e10cSrcweir 						}
854*cdf0e10cSrcweir 
855*cdf0e10cSrcweir 						if( pUserCall )
856*cdf0e10cSrcweir 							pObj->SetUserCall( pUserCall );
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir 						delete pNewSet;
859*cdf0e10cSrcweir 					}
860*cdf0e10cSrcweir 				}
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir 				delete pAttrList;
863*cdf0e10cSrcweir 			}
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir 			delete pSet;
866*cdf0e10cSrcweir 			Cancel();
867*cdf0e10cSrcweir 		}
868*cdf0e10cSrcweir 		break;
869*cdf0e10cSrcweir 
870*cdf0e10cSrcweir 		case SID_DELETE_SNAPITEM:
871*cdf0e10cSrcweir 		{
872*cdf0e10cSrcweir 			SdrPageView* pPV;
873*cdf0e10cSrcweir 			Point	aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
874*cdf0e10cSrcweir 			sal_uInt16	nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
875*cdf0e10cSrcweir                 FuPoor::HITPIX, 0 ) ).Width();
876*cdf0e10cSrcweir 			sal_uInt16	nHelpLine;
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir 			mbMousePosFreezed = sal_False;
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 			if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
881*cdf0e10cSrcweir 			{
882*cdf0e10cSrcweir 				pPV->DeleteHelpLine( nHelpLine );
883*cdf0e10cSrcweir 			}
884*cdf0e10cSrcweir 			Cancel();
885*cdf0e10cSrcweir 			rReq.Ignore ();
886*cdf0e10cSrcweir 		}
887*cdf0e10cSrcweir 		break;
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir 		case SID_DELETE_PAGE:
890*cdf0e10cSrcweir 		case SID_DELETE_MASTER_PAGE:
891*cdf0e10cSrcweir 			DeleteActualPage();
892*cdf0e10cSrcweir 			Cancel();
893*cdf0e10cSrcweir 			rReq.Ignore ();
894*cdf0e10cSrcweir 		break;
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir 		case SID_DELETE_LAYER:
897*cdf0e10cSrcweir 			DeleteActualLayer();
898*cdf0e10cSrcweir 			Cancel();
899*cdf0e10cSrcweir 			rReq.Ignore ();
900*cdf0e10cSrcweir 		break;
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 		case SID_ORIGINAL_SIZE:
903*cdf0e10cSrcweir 			mpDrawView->SetMarkedOriginalSize();
904*cdf0e10cSrcweir 			Cancel();
905*cdf0e10cSrcweir 			rReq.Done();
906*cdf0e10cSrcweir 		break;
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir 		case SID_DRAW_FONTWORK:
909*cdf0e10cSrcweir 		case SID_DRAW_FONTWORK_VERTICAL:
910*cdf0e10cSrcweir 		{
911*cdf0e10cSrcweir 			svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() );		// SJ: can be removed  (I think)
912*cdf0e10cSrcweir 			Cancel();
913*cdf0e10cSrcweir 			rReq.Done();
914*cdf0e10cSrcweir 		}
915*cdf0e10cSrcweir 		break;
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 		case SID_SAVEGRAPHIC:
918*cdf0e10cSrcweir 		{
919*cdf0e10cSrcweir 			const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
920*cdf0e10cSrcweir 			if( rMarkList.GetMarkCount() == 1 )
921*cdf0e10cSrcweir 			{
922*cdf0e10cSrcweir 				SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
923*cdf0e10cSrcweir 				if(pGrafObj )
924*cdf0e10cSrcweir 				{
925*cdf0e10cSrcweir 					::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY );
926*cdf0e10cSrcweir 					SdGRFFilter::SaveGraphic( xShape );
927*cdf0e10cSrcweir 				}
928*cdf0e10cSrcweir 			}
929*cdf0e10cSrcweir 			Cancel();
930*cdf0e10cSrcweir 			rReq.Ignore();
931*cdf0e10cSrcweir 		}
932*cdf0e10cSrcweir 		break;
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir 		default:
935*cdf0e10cSrcweir 		{
936*cdf0e10cSrcweir 			// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
937*cdf0e10cSrcweir 			// eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
938*cdf0e10cSrcweir 			// gewandert.
939*cdf0e10cSrcweir 			FuTemp01(rReq);
940*cdf0e10cSrcweir 		}
941*cdf0e10cSrcweir 		break;
942*cdf0e10cSrcweir 	}
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir 	if(HasCurrentFunction())
945*cdf0e10cSrcweir 	{
946*cdf0e10cSrcweir 		GetCurrentFunction()->Activate();
947*cdf0e10cSrcweir 	}
948*cdf0e10cSrcweir }
949*cdf0e10cSrcweir 
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir /** This method consists basically of three parts:
954*cdf0e10cSrcweir     1. Process the arguments of the SFX request.
955*cdf0e10cSrcweir     2. Use the model to create a new page or duplicate an existing one.
956*cdf0e10cSrcweir     3. Update the tab control and switch to the new page.
957*cdf0e10cSrcweir */
958*cdf0e10cSrcweir SdPage* DrawViewShell::CreateOrDuplicatePage (
959*cdf0e10cSrcweir     SfxRequest& rRequest,
960*cdf0e10cSrcweir     PageKind ePageKind,
961*cdf0e10cSrcweir     SdPage* pPage,
962*cdf0e10cSrcweir     const sal_Int32 nInsertPosition)
963*cdf0e10cSrcweir {
964*cdf0e10cSrcweir     SdPage* pNewPage = NULL;
965*cdf0e10cSrcweir     if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
966*cdf0e10cSrcweir     {
967*cdf0e10cSrcweir         if ( mpDrawView->IsTextEdit() )
968*cdf0e10cSrcweir         {
969*cdf0e10cSrcweir             mpDrawView->SdrEndTextEdit();
970*cdf0e10cSrcweir         }
971*cdf0e10cSrcweir         pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
972*cdf0e10cSrcweir     }
973*cdf0e10cSrcweir     return pNewPage;
974*cdf0e10cSrcweir }
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir } // end of namespace sd
977