xref: /trunk/main/sd/source/ui/view/drawview.cxx (revision cba0c2bc)
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 #include <sfx2/dispatch.hxx>
27 #ifndef _MSGBOX_HXX //autogen
28 #include <vcl/msgbox.hxx>
29 #endif
30 #include <svx/svdpagv.hxx>
31 #include <sfx2/request.hxx>
32 #include <svl/style.hxx>
33 #include <editeng/outliner.hxx>
34 #ifndef _VIEW3D_HXX //autogen
35 #include <svx/view3d.hxx>
36 #endif
37 #ifndef _SVXIDS_HRC //autogen
38 #include <svx/svxids.hrc>
39 #endif
40 #include <svx/svdotext.hxx>
41 #include <svx/svdograf.hxx>
42 #include <svx/svdogrp.hxx>
43 #include <svx/svdorect.hxx>
44 #include <svl/poolitem.hxx>
45 #include <editeng/eeitem.hxx>
46 #include <editeng/bulitem.hxx>
47 #include <svl/itempool.hxx>
48 #include <editeng/numitem.hxx>
49 #include <svl/whiter.hxx>
50 
51 #include <sfx2/viewfrm.hxx>
52 #include <sfx2/objface.hxx>
53 #include "stlsheet.hxx"
54 
55 #include <svx/svdoutl.hxx>
56 #undef BMP_OLEOBJ
57 #include <svx/svdstr.hrc>
58 #include <svx/dialmgr.hxx>
59 
60 #include "glob.hrc"
61 #include "strings.hrc"
62 #include "View.hxx"
63 #include "sdattr.hxx"
64 #include "drawview.hxx"
65 #include "drawdoc.hxx"
66 #include "DrawDocShell.hxx"
67 #include "sdpage.hxx"
68 #include "DrawViewShell.hxx"
69 #include "pres.hxx"
70 #include "sdresid.hxx"
71 #include "Window.hxx"
72 #include "unchss.hxx"
73 #ifndef SD_FRAME_VIEW
74 #include "FrameView.hxx"
75 #endif
76 #include "anminfo.hxx"
77 #include "slideshow.hxx"
78 #include <vcl/virdev.hxx>
79 #include <svx/sdrpaintwindow.hxx>
80 #include <svx/sdr/contact/viewobjectcontact.hxx>
81 #include <svx/sdr/contact/viewcontact.hxx>
82 #include <svx/sdr/contact/displayinfo.hxx>
83 
84 #include "undo/undomanager.hxx"
85 
86 using namespace ::com::sun::star;
87 
88 namespace sd {
89 
90 TYPEINIT1(DrawView, View);
91 
92 /*************************************************************************
93 |*
94 |* Konstruktor
95 |* zeigt die erste Seite des Dokuments auf Position 0,0 an;
96 |* falls noch keine Seite vorhanden ist, wird eine erzeugt
97 |*
98 \************************************************************************/
99 
100 DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
101 : ::sd::View(pDocSh->GetDoc(), pOutDev, pShell)
102 , mpDocShell(pDocSh)
103 , mpDrawViewShell(pShell)
104 , mpVDev(NULL)
105 , mnPOCHSmph(0)
106 {
107 	SetCurrentObj(OBJ_RECT, SdrInventor);
108 }
109 
110 /*************************************************************************
111 |*
112 |* Destruktor
113 |*
114 \************************************************************************/
115 
116 DrawView::~DrawView()
117 {
118 	delete mpVDev;
119 }
120 
121 /*************************************************************************
122 |*
123 |* virtuelle Methode von SdrView, wird bei Selektionsaenderung gerufen
124 |*
125 \************************************************************************/
126 
127 void DrawView::MarkListHasChanged()
128 {
129 	::sd::View::MarkListHasChanged();
130 
131 	if (mpDrawViewShell)
132 		mpDrawViewShell->SelectionHasChanged();
133 }
134 
135 /*************************************************************************
136 |*
137 |* virtuelle Methode von SdrView, wird bei Modelaenderung gerufen
138 |*
139 \************************************************************************/
140 
141 void DrawView::ModelHasChanged()
142 {
143 	::sd::View::ModelHasChanged();
144 
145 	// den Gestalter zur Neudarstellung zwingen
146 	SfxStyleSheetBasePool* pSSPool = mpDoc->GetStyleSheetPool();
147 	pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
148 
149 	if( mpDrawViewShell )
150 		mpDrawViewShell->ModelHasChanged();
151 
152 }
153 
154 /*************************************************************************
155 |*
156 |* Attribute auf Titel- und Gliederungtext und Hintergrundrechteck einer
157 |* Masterpage in Vorlagen umlenken, sonst an Basisklasse weitergeben
158 |*
159 \************************************************************************/
160 
161 sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
162 											sal_Bool bReplaceAll)
163 {
164 	sal_Bool bOk = sal_False;
165 
166 	// wird eine Masterpage bearbeitet?
167 	if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
168 	{
169 		SfxStyleSheetBasePool* pStShPool = mpDoc->GetStyleSheetPool();
170 		SdPage& rPage = *mpDrawViewShell->getCurrentPage();
171 		String aLayoutName = rPage.GetName();
172 		SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
173 
174 		if (pEditObject)
175 		{
176 			// Textedit
177 			String aTemplateName(aLayoutName);
178 
179 			sal_uInt32 nInv = pEditObject->GetObjInventor();
180 
181 			if (nInv == SdrInventor)
182 			{
183 				sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
184 				PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
185 
186 				if ( ePresObjKind == PRESOBJ_TITLE ||
187 				     ePresObjKind == PRESOBJ_NOTES )
188 				{
189 					// Presentation object (except outline)
190 					SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
191 					DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
192 
193 					SfxItemSet aTempSet( pSheet->GetItemSet() );
194 					aTempSet.Put( rSet );
195 					aTempSet.ClearInvalidItems();
196 
197 					// Undo-Action
198 					StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
199 					mpDocSh->GetUndoManager()->AddUndoAction(pAction);
200 
201 					pSheet->GetItemSet().Put(aTempSet);
202 					pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
203 					bOk = sal_True;
204 				}
205 				else if (eObjKind == OBJ_OUTLINETEXT)
206 				{
207 					// Presentation object outline
208 					OutlinerView* pOV	= GetTextEditOutlinerView();
209 					::Outliner* pOutliner = pOV->GetOutliner();
210 					List*		  pList = (List*)pOV->CreateSelectionList();
211 					aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
212 
213 					pOutliner->SetUpdateMode(sal_False);
214 					mpDocSh->SetWaitCursor( sal_True );
215 
216 					// Platzhalter durch Vorlagennamen ersetzen
217 					String aComment(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
218 					xub_StrLen nPos = aComment.Search( (sal_Unicode)'$' );
219 					aComment.Erase(nPos, 1);
220 					aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
221 					mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
222 
223 					Paragraph* pPara = (Paragraph*)pList->Last();
224 					while (pPara)
225 					{
226 						sal_uLong nParaPos = pOutliner->GetAbsPos( pPara );
227 						sal_Int16 nDepth = pOutliner->GetDepth( (sal_uInt16) nParaPos );
228 						String aName(rPage.GetLayoutName());
229 						aName += (sal_Unicode)(' ');
230 						aName += String::CreateFromInt32( (nDepth <= 0) ? 1 : nDepth + 1 );
231 						SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
232 						DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
233 
234 						SfxItemSet aTempSet( pSheet->GetItemSet() );
235 						aTempSet.Put( rSet );
236 						aTempSet.ClearInvalidItems();
237 
238 						if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
239 						{
240 							// no SvxNumBulletItem in outline level 1 to 8!
241 							aTempSet.ClearItem( EE_PARA_NUMBULLET );
242 						}
243 
244 						// Undo-Action
245 						StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
246 						mpDocSh->GetUndoManager()->AddUndoAction(pAction);
247 
248 						pSheet->GetItemSet().Put(aTempSet);
249 						pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
250 
251 						// now also broadcast any child sheets
252 						sal_Int16 nChild;
253 						for( nChild = nDepth + 1; nChild < 9; nChild++ )
254 						{
255 							String aSheetName(rPage.GetLayoutName());
256 							aSheetName += (sal_Unicode)(' ');
257 							aSheetName += String::CreateFromInt32( nChild <= 0 ? 1 : nChild + 1 );
258 							SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
259 
260 							if( pOutlSheet )
261 								pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
262 						}
263 
264 						pPara = (Paragraph*)pList->Prev();
265 
266 						if( !pPara && nDepth > 0 &&  rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
267 						    pOutliner->GetDepth( (sal_uInt16) pOutliner->GetAbsPos( (Paragraph*) pList->First() ) ) > 0 )
268 							pPara = pOutliner->GetParagraph( 0 );  // Put NumBulletItem in outline level 1
269 					}
270 
271 					mpDocSh->SetWaitCursor( sal_False );
272 					pOV->GetOutliner()->SetUpdateMode(sal_True);
273 
274 					mpDocSh->GetUndoManager()->LeaveListAction();
275 
276 					delete pList;
277 					bOk = sal_True;
278 				}
279 				else
280 				{
281 					bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
282 				}
283 			}
284 		}
285 		else
286 		{
287 			// Selection
288 			const SdrMarkList& rList = GetMarkedObjectList();
289 			sal_uLong nMarkCount		 = rList.GetMarkCount();
290 			for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
291 			{
292 				SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
293 				sal_uInt32 nInv = pObject->GetObjInventor();
294 
295 				if (nInv == SdrInventor)
296 				{
297 					sal_uInt16 eObjKind = pObject->GetObjIdentifier();
298 					PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
299 					String aTemplateName(aLayoutName);
300 
301 					if (ePresObjKind == PRESOBJ_TITLE ||
302 						ePresObjKind == PRESOBJ_NOTES)
303 					{
304 						// Presentation object (except outline)
305 						SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
306 						DBG_ASSERT(pSheet, "StyleSheet not found");
307 
308 						SfxItemSet aTempSet( pSheet->GetItemSet() );
309 						aTempSet.Put( rSet );
310 						aTempSet.ClearInvalidItems();
311 
312 						// Undo-Action
313 						StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
314 						mpDocSh->GetUndoManager()->AddUndoAction(pAction);
315 
316 						pSheet->GetItemSet().Put(aTempSet,false);
317 						pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
318 						bOk = sal_True;
319 					}
320 					else if (eObjKind == OBJ_OUTLINETEXT)
321 					{
322 						// Presentation object outline
323 						aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
324 						for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
325 						{
326 							String aName(rPage.GetLayoutName());
327 							aName += (sal_Unicode)(' ');
328 							aName += String::CreateFromInt32( (sal_Int32)nLevel );
329 							SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
330 												Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
331 							DBG_ASSERT(pSheet, "StyleSheet nicht gefunden");
332 
333 							SfxItemSet aTempSet( pSheet->GetItemSet() );
334 
335 							if( nLevel > 1 )
336 							{
337 								// for all levels over 1, clear all items that will be
338 								// hard set to level 1
339 								SfxWhichIter aWhichIter(rSet);
340 								sal_uInt16 nWhich(aWhichIter.FirstWhich());
341 								while( nWhich )
342 								{
343 									if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
344 										aTempSet.ClearItem( nWhich );
345 									nWhich = aWhichIter.NextWhich();
346 								}
347 
348 							}
349 							else
350 							{
351 								// put the items hard into level one
352 								aTempSet.Put( rSet );
353 							}
354 
355 							aTempSet.ClearInvalidItems();
356 
357 							// Undo-Action
358 							StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, pSheet, &aTempSet);
359 							mpDocSh->GetUndoManager()->AddUndoAction(pAction);
360 
361 							pSheet->GetItemSet().Set(aTempSet,false);
362 							pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
363 						}
364 
365 						// remove all hard set items from shape that are now set in style
366 						SfxWhichIter aWhichIter(rSet);
367 						sal_uInt16 nWhich(aWhichIter.FirstWhich());
368 						while( nWhich )
369 						{
370 							if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
371 								pObject->ClearMergedItem( nWhich );
372 							nWhich = aWhichIter.NextWhich();
373 						}
374 
375 						bOk = sal_True;
376 					}
377 				}
378 			}
379 
380 			if(!bOk)
381 				bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
382 		}
383 	}
384 	else	// nicht auf der Masterpage
385 	{
386 		bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
387 	}
388 
389 	return (bOk);
390 }
391 
392 /*************************************************************************
393 |*
394 |* Notify fuer Aenderung der Seitenanordnung
395 |*
396 \************************************************************************/
397 
398 void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
399 {
400 	if ( mpDrawViewShell && rHint.ISA(SdrHint) )
401 	{
402 		SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
403 
404 		if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
405 		{
406 			mpDrawViewShell->ResetActualPage();
407 		}
408 		else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
409 		{
410 			mpDrawViewShell->ResetActualLayer();
411 		}
412 
413 		// #94278# switch to that page when it's not a master page
414 		if(HINT_SWITCHTOPAGE == eHintKind)
415 		{
416 			const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
417 
418 			if(pPage && !pPage->IsMasterPage())
419 			{
420 				if(mpDrawViewShell->GetActualPage() != pPage)
421 				{
422 					sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
423 					mpDrawViewShell->SwitchPage(nPageNum);
424 				}
425 			}
426 		}
427 	}
428 
429 	::sd::View::Notify(rBC, rHint);
430 }
431 
432 /*************************************************************************
433 |*
434 |* PageOrderChangedHint blockieren/freigeben
435 |*
436 \************************************************************************/
437 
438 void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
439 {
440 	if (bBlock)
441 		mnPOCHSmph++;
442 	else
443 	{
444 		DBG_ASSERT(mnPOCHSmph, "Zaehlerunterlauf");
445 		mnPOCHSmph--;
446 	}
447 }
448 
449 /*************************************************************************
450 |*
451 |* StyleSheet-Setzen auf der Masterpage abfangen, wenn Praesentationsobjekte
452 |* selektiert sind
453 |*
454 \************************************************************************/
455 
456 sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
457 {
458 	sal_Bool bResult = sal_True;
459 
460 	// wird eine Masterpage bearbeitet?
461 	if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
462 	{
463 		if (IsPresObjSelected(sal_False, sal_True))
464 		{
465 
466 			InfoBox(mpDrawViewShell->GetActiveWindow(),
467 					String(SdResId(STR_ACTION_NOTPOSSIBLE))).Execute();
468 			bResult = sal_False;
469 		}
470 		else
471 		{
472 			bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
473 		}
474 	}
475 	else
476 	{
477 		bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
478 	}
479 	return bResult;
480 }
481 
482 /*************************************************************************
483 |*
484 |* Paint-Methode: das Ereignis wird an die View weitergeleitet
485 |*
486 \************************************************************************/
487 
488 void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
489 {
490 	if( mpVDev )
491 	{
492 		delete mpVDev;
493 		mpVDev = NULL;
494 	}
495 
496 	sal_Bool bStandardPaint = sal_True;
497 
498 	SdDrawDocument* pDoc = mpDocShell->GetDoc();
499 	if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
500 	{
501 		rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
502 		if(xSlideshow.is() && xSlideshow->isRunning())
503 		{
504 			OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
505 			if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
506 			{
507 				if( pShowWindow == pOutDev )
508 					PresPaint(rReg);
509 				bStandardPaint = sal_False;
510 			}
511 		}
512 	}
513 
514 	if(bStandardPaint)
515 	{
516 		::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
517 	}
518 }
519 
520 /*************************************************************************
521 |*
522 |* Paint-Event during running slide show
523 |*
524 \************************************************************************/
525 
526 void DrawView::PresPaint(const Region& rRegion)
527 {
528 	if(mpViewSh)
529 	{
530 		rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
531 		if( xSlideshow.is() && xSlideshow->isRunning() )
532 			xSlideshow->paint( rRegion.GetBoundRect() );
533 	}
534 }
535 
536 /*************************************************************************
537 |* entscheidet, ob ein Objekt markiert werden kann (z. B. noch nicht
538 |* erschienene Animationsobjekte in der Diashow)
539 \************************************************************************/
540 
541 sal_Bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
542 {
543 	return FmFormView::IsObjMarkable(pObj, pPV);;
544 }
545 
546 /*************************************************************************
547 |*
548 |* Uebergebenen Bereich sichtbar machen (es wird ggf. gescrollt)
549 |*
550 \************************************************************************/
551 
552 void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
553 {
554 	if (!rRect.IsEmpty())
555 	{
556 		mpDrawViewShell->MakeVisible(rRect, rWin);
557 	}
558 }
559 /*************************************************************************
560 |*
561 |* Seite wird gehided
562 |*
563 \************************************************************************/
564 
565 void DrawView::HideSdrPage()
566 {
567 	if (mpDrawViewShell)
568 	{
569 		mpDrawViewShell->HidePage();
570 	}
571 
572 	::sd::View::HideSdrPage();
573 }
574 
575 void DrawView::DeleteMarked()
576 {
577 	OSL_TRACE( "DrawView::DeleteMarked() - enter" );
578 
579 	sd::UndoManager* pUndoManager = mpDoc->GetUndoManager();
580 	DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
581 
582 	if( pUndoManager )
583 	{
584 		String aUndo( SVX_RES(STR_EditDelete) );
585 		String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
586 		aUndo.SearchAndReplace(aSearchString, GetDescriptionOfMarkedObjects());
587 		pUndoManager->EnterListAction(aUndo, aUndo);
588 	}
589 
590 	SdPage* pPage = 0;
591 	bool bResetLayout = false;
592 
593 	const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
594 	if( nMarkCount )
595 	{
596 		SdrMarkList aList( GetMarkedObjectList() );
597 		for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
598 		{
599 			SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
600 			if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
601 			{
602 				pPage = static_cast< SdPage* >( pObj->GetPage() );
603 				PresObjKind ePresObjKind;
604 				if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
605 				{
606 					switch( ePresObjKind )
607 					{
608 					case PRESOBJ_GRAPHIC:
609 					case PRESOBJ_OBJECT:
610 					case PRESOBJ_CHART:
611 					case PRESOBJ_ORGCHART:
612 					case PRESOBJ_TABLE:
613 					case PRESOBJ_CALC:
614 					case PRESOBJ_IMAGE:
615 					case PRESOBJ_MEDIA:
616 						ePresObjKind = PRESOBJ_OUTLINE;
617 						break;
618 					default:
619 						break;
620 					}
621 					SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
622 					bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
623 					Rectangle aRect( pObj->GetLogicRect() );
624 					SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
625 
626                     // Move the new PresObj to the position before the
627                     // object it will replace.
628                     pUndoManager->AddUndoAction(
629                         mpDoc->GetSdrUndoFactory().CreateUndoObjectOrdNum(
630                             *pNewObj,
631                             pNewObj->GetOrdNum(),
632                             pObj->GetOrdNum()));
633                     pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
634 
635 					bResetLayout = true;
636 
637 					OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
638 				}
639 			}
640 		}
641 	}
642 
643 	::sd::View::DeleteMarked();
644 
645 	if( pPage && bResetLayout )
646 		pPage->SetAutoLayout( pPage->GetAutoLayout() );
647 
648 	if( pUndoManager )
649 		pUndoManager->LeaveListAction();
650 
651 	OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
652 }
653 
654 } // end of namespace sd
655