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