Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sfx2/dispatch.hxx>
21 : #include <vcl/msgbox.hxx>
22 : #include <svx/svdpagv.hxx>
23 : #include <sfx2/request.hxx>
24 : #include <svl/style.hxx>
25 : #include <editeng/outliner.hxx>
26 : #include <svx/view3d.hxx>
27 : #include <svx/svxids.hrc>
28 : #include <svx/svdotext.hxx>
29 : #include <svx/svdograf.hxx>
30 : #include <svx/svdogrp.hxx>
31 : #include <svx/svdorect.hxx>
32 : #include <svl/poolitem.hxx>
33 : #include <editeng/eeitem.hxx>
34 : #include <editeng/bulletitem.hxx>
35 : #include <svl/itempool.hxx>
36 : #include <editeng/numitem.hxx>
37 : #include <svl/whiter.hxx>
38 :
39 : #include <sfx2/viewfrm.hxx>
40 : #include <sfx2/objface.hxx>
41 : #include "stlsheet.hxx"
42 :
43 : #include <svx/svdoutl.hxx>
44 : #include <svx/svdstr.hrc>
45 : #include <svx/dialmgr.hxx>
46 :
47 : #include "glob.hrc"
48 : #include "strings.hrc"
49 : #include "View.hxx"
50 : #include "sdattr.hxx"
51 : #include "drawview.hxx"
52 : #include "drawdoc.hxx"
53 : #include "DrawDocShell.hxx"
54 : #include "sdpage.hxx"
55 : #include "DrawViewShell.hxx"
56 : #include "pres.hxx"
57 : #include "sdresid.hxx"
58 : #include "Window.hxx"
59 : #include "unchss.hxx"
60 : #include "FrameView.hxx"
61 : #include "anminfo.hxx"
62 : #include "slideshow.hxx"
63 : #include <vcl/virdev.hxx>
64 : #include <svx/sdrpaintwindow.hxx>
65 : #include <svx/sdr/contact/viewobjectcontact.hxx>
66 : #include <svx/sdr/contact/viewcontact.hxx>
67 : #include <svx/sdr/contact/displayinfo.hxx>
68 :
69 : #include "undo/undomanager.hxx"
70 :
71 : using namespace ::com::sun::star;
72 :
73 : namespace sd {
74 :
75 1776 : TYPEINIT1(DrawView, View);
76 :
77 : /**
78 : * Shows the first page of document at position 0,0. In the case
79 : * that there is no page a page is created.
80 : */
81 :
82 442 : DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
83 442 : : ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
84 : , mpDocShell(pDocSh)
85 : , mpDrawViewShell(pShell)
86 : , mpVDev(NULL)
87 442 : , mnPOCHSmph(0)
88 : {
89 442 : SetCurrentObj(OBJ_RECT, SdrInventor);
90 442 : }
91 :
92 1204 : DrawView::~DrawView()
93 : {
94 442 : delete mpVDev;
95 762 : }
96 :
97 : /**
98 : * Virtual method from SdrView, called at selection change.
99 : */
100 :
101 214 : void DrawView::MarkListHasChanged()
102 : {
103 214 : ::sd::View::MarkListHasChanged();
104 :
105 214 : if (mpDrawViewShell)
106 214 : mpDrawViewShell->SelectionHasChanged();
107 214 : }
108 :
109 : /**
110 : * Virtual method from SdrView, called at model change.
111 : */
112 :
113 558 : void DrawView::ModelHasChanged()
114 : {
115 558 : ::sd::View::ModelHasChanged();
116 :
117 : // force framer to rerender
118 558 : SfxStyleSheetBasePool* pSSPool = mrDoc.GetStyleSheetPool();
119 558 : pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
120 :
121 558 : if( mpDrawViewShell )
122 405 : mpDrawViewShell->ModelHasChanged();
123 :
124 558 : }
125 :
126 : /**
127 : * Redirect attributes onto title and outline text and background
128 : * rectangle of a masterpage into templates, otherwise pass on baseclass.
129 : */
130 :
131 0 : bool DrawView::SetAttributes(const SfxItemSet& rSet,
132 : bool bReplaceAll)
133 : {
134 0 : bool bOk = false;
135 :
136 : // is there a masterpage edit?
137 0 : if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
138 : {
139 0 : SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
140 0 : SdPage& rPage = *mpDrawViewShell->getCurrentPage();
141 0 : SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
142 :
143 0 : if (pEditObject)
144 : {
145 : // Textedit
146 :
147 0 : sal_uInt32 nInv = pEditObject->GetObjInventor();
148 :
149 0 : if (nInv == SdrInventor)
150 : {
151 0 : sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
152 0 : PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
153 :
154 0 : if ( ePresObjKind == PRESOBJ_TITLE ||
155 : ePresObjKind == PRESOBJ_NOTES )
156 : {
157 : // Presentation object (except outline)
158 0 : SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
159 : DBG_ASSERT(pSheet, "StyleSheet not found");
160 :
161 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
162 0 : aTempSet.Put( rSet );
163 0 : aTempSet.ClearInvalidItems();
164 :
165 : // Undo-Action
166 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
167 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
168 :
169 0 : pSheet->GetItemSet().Put(aTempSet);
170 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
171 0 : bOk = true;
172 : }
173 0 : else if (eObjKind == OBJ_OUTLINETEXT)
174 : {
175 : // Presentation object outline
176 0 : OutlinerView* pOV = GetTextEditOutlinerView();
177 0 : ::Outliner* pOutliner = pOV->GetOutliner();
178 :
179 0 : pOutliner->SetUpdateMode(false);
180 0 : mpDocSh->SetWaitCursor( true );
181 :
182 : // replace placeholder by template name
183 0 : OUString aComment(SD_RESSTR(STR_UNDO_CHANGE_PRES_OBJECT));
184 0 : aComment = aComment.replaceFirst("$", SD_RESSTR(STR_PSEUDOSHEET_OUTLINE));
185 0 : mpDocSh->GetUndoManager()->EnterListAction( aComment, OUString() );
186 :
187 0 : std::vector<Paragraph*> aSelList;
188 0 : pOV->CreateSelectionList(aSelList);
189 :
190 0 : std::vector<Paragraph*>::reverse_iterator iter = aSelList.rbegin();
191 0 : Paragraph* pPara = iter != aSelList.rend() ? *iter : NULL;
192 :
193 0 : while (pPara)
194 : {
195 0 : sal_Int32 nParaPos = pOutliner->GetAbsPos( pPara );
196 0 : sal_Int16 nDepth = pOutliner->GetDepth( nParaPos );
197 0 : OUString aName = rPage.GetLayoutName() + " " +
198 0 : OUString::number((nDepth <= 0) ? 1 : nDepth + 1);
199 0 : SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
200 : //We have no stylesheet if we access outline level 10
201 : //in the master preview, there is no true style backing
202 : //that entry
203 : SAL_WARN_IF(!pSheet, "sd", "StyleSheet " << aName << " not found");
204 0 : if (pSheet)
205 : {
206 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
207 0 : aTempSet.Put( rSet );
208 0 : aTempSet.ClearInvalidItems();
209 :
210 0 : if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET )
211 : {
212 : // no SvxNumBulletItem in outline level 1 to 8!
213 0 : aTempSet.ClearItem( EE_PARA_NUMBULLET );
214 : }
215 :
216 : // Undo-Action
217 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
218 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
219 :
220 0 : pSheet->GetItemSet().Put(aTempSet);
221 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
222 :
223 : // now also broadcast any child sheets
224 : sal_Int16 nChild;
225 0 : for( nChild = nDepth + 1; nChild < 9; nChild++ )
226 : {
227 0 : OUString aSheetName = rPage.GetLayoutName() + " " +
228 0 : OUString::number((nChild <= 0) ? 1 : nChild + 1);
229 0 : SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
230 :
231 0 : if( pOutlSheet )
232 0 : pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
233 0 : }
234 : }
235 :
236 0 : ++iter;
237 0 : pPara = iter != aSelList.rend() ? *iter : NULL;
238 :
239 0 : bool bJumpToLevel1 = false;
240 0 : if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET )
241 0 : bJumpToLevel1 = true;
242 :
243 0 : if (bJumpToLevel1)
244 : {
245 0 : iter = aSelList.rend();
246 0 : --iter;
247 :
248 0 : if (pOutliner->GetDepth(pOutliner->GetAbsPos(*iter)) > 0)
249 0 : pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1
250 : }
251 0 : }
252 :
253 0 : mpDocSh->SetWaitCursor( false );
254 0 : pOV->GetOutliner()->SetUpdateMode(true);
255 :
256 0 : mpDocSh->GetUndoManager()->LeaveListAction();
257 :
258 0 : bOk = true;
259 : }
260 : else
261 : {
262 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
263 : }
264 : }
265 : }
266 : else
267 : {
268 : // Selection
269 0 : const SdrMarkList& rList = GetMarkedObjectList();
270 0 : const size_t nMarkCount = rList.GetMarkCount();
271 0 : for (size_t nMark = 0; nMark < nMarkCount; ++nMark)
272 : {
273 0 : SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
274 0 : sal_uInt32 nInv = pObject->GetObjInventor();
275 :
276 0 : if (nInv == SdrInventor)
277 : {
278 0 : sal_uInt16 eObjKind = pObject->GetObjIdentifier();
279 0 : PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
280 :
281 0 : if (ePresObjKind == PRESOBJ_TITLE ||
282 : ePresObjKind == PRESOBJ_NOTES)
283 : {
284 : // Presentation object (except outline)
285 0 : SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
286 : DBG_ASSERT(pSheet, "StyleSheet not found");
287 :
288 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
289 0 : aTempSet.Put( rSet );
290 0 : aTempSet.ClearInvalidItems();
291 :
292 : // Undo-Action
293 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
294 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
295 :
296 0 : pSheet->GetItemSet().Put(aTempSet,false);
297 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
298 0 : bOk = true;
299 : }
300 0 : else if (eObjKind == OBJ_OUTLINETEXT)
301 : {
302 : // Presentation object outline
303 0 : for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
304 : {
305 0 : OUString aName = rPage.GetLayoutName() + " " +
306 0 : OUString::number(nLevel);
307 : SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
308 0 : Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
309 : DBG_ASSERT(pSheet, "StyleSheet not found");
310 :
311 0 : SfxItemSet aTempSet( pSheet->GetItemSet() );
312 :
313 0 : if( nLevel > 1 )
314 : {
315 : // for all levels over 1, clear all items that will be
316 : // hard set to level 1
317 0 : SfxWhichIter aWhichIter(rSet);
318 0 : sal_uInt16 nWhich(aWhichIter.FirstWhich());
319 0 : while( nWhich )
320 : {
321 0 : if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
322 0 : aTempSet.ClearItem( nWhich );
323 0 : nWhich = aWhichIter.NextWhich();
324 0 : }
325 :
326 : }
327 : else
328 : {
329 : // put the items hard into level one
330 0 : aTempSet.Put( rSet );
331 : }
332 :
333 0 : aTempSet.ClearInvalidItems();
334 :
335 : // Undo-Action
336 0 : StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
337 0 : mpDocSh->GetUndoManager()->AddUndoAction(pAction);
338 :
339 0 : pSheet->GetItemSet().Set(aTempSet,false);
340 0 : pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
341 0 : }
342 :
343 : // remove all hard set items from shape that are now set in style
344 0 : SfxWhichIter aWhichIter(rSet);
345 0 : sal_uInt16 nWhich(aWhichIter.FirstWhich());
346 0 : while( nWhich )
347 : {
348 0 : if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
349 0 : pObject->ClearMergedItem( nWhich );
350 0 : nWhich = aWhichIter.NextWhich();
351 : }
352 :
353 0 : bOk = true;
354 : }
355 : }
356 : }
357 :
358 0 : if(!bOk)
359 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
360 : }
361 : }
362 : else // not at masterpage
363 : {
364 0 : bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
365 : }
366 :
367 0 : return (bOk);
368 : }
369 :
370 : /**
371 : * Notify for change of site arragement
372 : */
373 :
374 8621 : void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
375 : {
376 8621 : if ( mpDrawViewShell && dynamic_cast<const SdrHint*>(&rHint) )
377 : {
378 7836 : SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
379 :
380 7836 : if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
381 : {
382 740 : mpDrawViewShell->ResetActualPage();
383 : }
384 7096 : else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
385 : {
386 4 : mpDrawViewShell->ResetActualLayer();
387 : }
388 :
389 : // switch to that page when it's not a master page
390 7836 : if(HINT_SWITCHTOPAGE == eHintKind)
391 : {
392 0 : const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
393 :
394 0 : if(pPage && !pPage->IsMasterPage())
395 : {
396 0 : if(mpDrawViewShell->GetActualPage() != pPage)
397 : {
398 0 : sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
399 0 : mpDrawViewShell->SwitchPage(nPageNum);
400 : }
401 : }
402 : }
403 : }
404 :
405 8621 : ::sd::View::Notify(rBC, rHint);
406 8621 : }
407 :
408 : /**
409 : * Lock/Unlock PageOrderChangedHint
410 : */
411 :
412 0 : void DrawView::BlockPageOrderChangedHint(bool bBlock)
413 : {
414 0 : if (bBlock)
415 0 : mnPOCHSmph++;
416 : else
417 : {
418 : DBG_ASSERT(mnPOCHSmph, "counter overflow");
419 0 : mnPOCHSmph--;
420 : }
421 0 : }
422 :
423 : /**
424 : * If presentation objects are selected, intercept stylesheet-positing at
425 : * masterpage.
426 : */
427 :
428 0 : bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
429 : {
430 0 : bool bResult = true;
431 :
432 : // is there a masterpage edit?
433 0 : if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
434 : {
435 0 : if (IsPresObjSelected(false, true))
436 : {
437 :
438 0 : InfoBox(mpDrawViewShell->GetActiveWindow(),
439 0 : SD_RESSTR(STR_ACTION_NOTPOSSIBLE)).Execute();
440 0 : bResult = false;
441 : }
442 : else
443 : {
444 0 : bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
445 : }
446 : }
447 : else
448 : {
449 0 : bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
450 : }
451 0 : return bResult;
452 : }
453 :
454 : /**
455 : * Paint-method: Redirect event to the view
456 : */
457 :
458 780 : void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
459 : {
460 780 : if( mpVDev )
461 : {
462 0 : delete mpVDev;
463 0 : mpVDev = NULL;
464 : }
465 :
466 780 : bool bStandardPaint = true;
467 :
468 780 : SdDrawDocument* pDoc = mpDocShell->GetDoc();
469 780 : if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
470 : {
471 74 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
472 74 : if(xSlideshow.is() && xSlideshow->isRunning())
473 : {
474 0 : OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
475 0 : if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
476 : {
477 0 : if( pShowWindow == pOutDev )
478 0 : PresPaint(rReg);
479 0 : bStandardPaint = false;
480 : }
481 74 : }
482 : }
483 :
484 780 : if(bStandardPaint)
485 : {
486 780 : ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
487 : }
488 780 : }
489 :
490 : /**
491 : * Paint-Event during running slide show
492 : */
493 :
494 0 : void DrawView::PresPaint(const vcl::Region& rRegion)
495 : {
496 0 : if(mpViewSh)
497 : {
498 0 : rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
499 0 : if( xSlideshow.is() && xSlideshow->isRunning() )
500 0 : xSlideshow->paint( rRegion.GetBoundRect() );
501 : }
502 0 : }
503 :
504 : /**
505 : * Decides if an object could get marked (eg. unreleased animation objects
506 : * in slide show).
507 : */
508 :
509 2 : bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
510 : {
511 2 : return FmFormView::IsObjMarkable(pObj, pPV);
512 : }
513 :
514 : /**
515 : * Make passed region visible (scrolling if necessary)
516 : */
517 :
518 0 : void DrawView::MakeVisible(const Rectangle& rRect, vcl::Window& rWin)
519 : {
520 0 : if (!rRect.IsEmpty() && mpDrawViewShell)
521 : {
522 0 : mpDrawViewShell->MakeVisible(rRect, rWin);
523 : }
524 0 : }
525 :
526 : /**
527 : * Hide page.
528 : */
529 :
530 401 : void DrawView::HideSdrPage()
531 : {
532 401 : if (mpDrawViewShell)
533 : {
534 220 : mpDrawViewShell->HidePage();
535 : }
536 :
537 401 : ::sd::View::HideSdrPage();
538 401 : }
539 :
540 0 : void DrawView::DeleteMarked()
541 : {
542 : OSL_TRACE( "DrawView::DeleteMarked() - enter" );
543 :
544 0 : sd::UndoManager* pUndoManager = mrDoc.GetUndoManager();
545 : DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
546 :
547 0 : if( pUndoManager )
548 : {
549 0 : OUString aUndo(SVX_RESSTR(STR_EditDelete));
550 0 : aUndo = aUndo.replaceFirst("%1", GetDescriptionOfMarkedObjects());
551 0 : pUndoManager->EnterListAction(aUndo, aUndo);
552 : }
553 :
554 0 : SdPage* pPage = 0;
555 0 : bool bResetLayout = false;
556 :
557 0 : const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
558 0 : if( nMarkCount )
559 : {
560 0 : SdrMarkList aList( GetMarkedObjectList() );
561 0 : for (size_t nMark = 0; nMark < nMarkCount; ++nMark)
562 : {
563 0 : SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
564 0 : if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
565 : {
566 0 : pPage = static_cast< SdPage* >( pObj->GetPage() );
567 : PresObjKind ePresObjKind;
568 0 : if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
569 : {
570 0 : switch( ePresObjKind )
571 : {
572 : case PRESOBJ_GRAPHIC:
573 : case PRESOBJ_OBJECT:
574 : case PRESOBJ_CHART:
575 : case PRESOBJ_ORGCHART:
576 : case PRESOBJ_TABLE:
577 : case PRESOBJ_CALC:
578 : case PRESOBJ_IMAGE:
579 : case PRESOBJ_MEDIA:
580 0 : ePresObjKind = PRESOBJ_OUTLINE;
581 0 : break;
582 : default:
583 0 : break;
584 : }
585 0 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
586 0 : bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
587 0 : Rectangle aRect( pObj->GetLogicRect() );
588 0 : SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
589 :
590 : // pUndoManager should not be NULL (see assert above)
591 : // but since we have defensive code
592 : // for it earlier and later in the function
593 : // we might as well be consistant
594 0 : if(pUndoManager)
595 : {
596 : // Move the new PresObj to the position before the
597 : // object it will replace.
598 : pUndoManager->AddUndoAction(
599 0 : mrDoc.GetSdrUndoFactory().CreateUndoObjectOrdNum(
600 : *pNewObj,
601 : pNewObj->GetOrdNum(),
602 0 : pObj->GetOrdNum()));
603 : }
604 0 : pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
605 :
606 0 : bResetLayout = true;
607 :
608 : OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
609 : }
610 : }
611 0 : }
612 : }
613 :
614 0 : ::sd::View::DeleteMarked();
615 :
616 0 : if( pPage && bResetLayout )
617 0 : pPage->SetAutoLayout( pPage->GetAutoLayout() );
618 :
619 0 : if( pUndoManager )
620 0 : pUndoManager->LeaveListAction();
621 :
622 : OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
623 0 : }
624 :
625 114 : } // end of namespace sd
626 :
627 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|