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