LCOV - code coverage report
Current view: top level - sd/source/ui/view - drawview.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 238 0.0 %
Date: 2014-04-14 Functions: 0 20 0.0 %
Legend: Lines: hit not hit

          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           0 : 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           0 : DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
      83           0 : : ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
      84             : , mpDocShell(pDocSh)
      85             : , mpDrawViewShell(pShell)
      86             : , mpVDev(NULL)
      87           0 : , mnPOCHSmph(0)
      88             : {
      89           0 :     SetCurrentObj(OBJ_RECT, SdrInventor);
      90           0 : }
      91             : 
      92           0 : DrawView::~DrawView()
      93             : {
      94           0 :     delete mpVDev;
      95           0 : }
      96             : 
      97             : /**
      98             :  * Virtual method from SdrView, called at selection change.
      99             :  */
     100             : 
     101           0 : void DrawView::MarkListHasChanged()
     102             : {
     103           0 :     ::sd::View::MarkListHasChanged();
     104             : 
     105           0 :     if (mpDrawViewShell)
     106           0 :         mpDrawViewShell->SelectionHasChanged();
     107           0 : }
     108             : 
     109             : /**
     110             :  * Virtual method from SdrView, called at model change.
     111             :  */
     112             : 
     113           0 : void DrawView::ModelHasChanged()
     114             : {
     115           0 :     ::sd::View::ModelHasChanged();
     116             : 
     117             :     // force framer to rerender
     118           0 :     SfxStyleSheetBasePool* pSSPool = mrDoc.GetStyleSheetPool();
     119           0 :     pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
     120             : 
     121           0 :     if( mpDrawViewShell )
     122           0 :         mpDrawViewShell->ModelHasChanged();
     123             : 
     124           0 : }
     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 : sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
     132             :                                             sal_Bool bReplaceAll)
     133             : {
     134           0 :     sal_Bool bOk = sal_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 = sal_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             :                         DBG_ASSERT(pSheet, "StyleSheet not found");
     201             : 
     202           0 :                         SfxItemSet aTempSet( pSheet->GetItemSet() );
     203           0 :                         aTempSet.Put( rSet );
     204           0 :                         aTempSet.ClearInvalidItems();
     205             : 
     206           0 :                         if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
     207             :                         {
     208             :                             // no SvxNumBulletItem in outline level 1 to 8!
     209           0 :                             aTempSet.ClearItem( EE_PARA_NUMBULLET );
     210             :                         }
     211             : 
     212             :                         // Undo-Action
     213           0 :                         StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     214           0 :                         mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     215             : 
     216           0 :                         pSheet->GetItemSet().Put(aTempSet);
     217           0 :                         pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     218             : 
     219             :                         // now also broadcast any child sheets
     220             :                         sal_Int16 nChild;
     221           0 :                         for( nChild = nDepth + 1; nChild < 9; nChild++ )
     222             :                         {
     223           0 :                             OUString aSheetName = rPage.GetLayoutName() + " " +
     224           0 :                                 OUString::number((nChild <= 0) ? 1 : nChild + 1);
     225           0 :                             SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
     226             : 
     227           0 :                             if( pOutlSheet )
     228           0 :                                 pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     229           0 :                         }
     230             : 
     231           0 :                         ++iter;
     232           0 :                         pPara = iter != aSelList.rend() ? *iter : NULL;
     233             : 
     234           0 :                         if( !pPara && nDepth > 0 &&  rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
     235           0 :                             pOutliner->GetDepth( pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 )
     236           0 :                             pPara = pOutliner->GetParagraph( 0 );  // Put NumBulletItem in outline level 1
     237           0 :                     }
     238             : 
     239           0 :                     mpDocSh->SetWaitCursor( false );
     240           0 :                     pOV->GetOutliner()->SetUpdateMode(true);
     241             : 
     242           0 :                     mpDocSh->GetUndoManager()->LeaveListAction();
     243             : 
     244           0 :                     bOk = sal_True;
     245             :                 }
     246             :                 else
     247             :                 {
     248           0 :                     bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     249             :                 }
     250             :             }
     251             :         }
     252             :         else
     253             :         {
     254             :             // Selection
     255           0 :             const SdrMarkList& rList = GetMarkedObjectList();
     256           0 :             sal_uLong nMarkCount         = rList.GetMarkCount();
     257           0 :             for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
     258             :             {
     259           0 :                 SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
     260           0 :                 sal_uInt32 nInv = pObject->GetObjInventor();
     261             : 
     262           0 :                 if (nInv == SdrInventor)
     263             :                 {
     264           0 :                     sal_uInt16 eObjKind = pObject->GetObjIdentifier();
     265           0 :                     PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
     266             : 
     267           0 :                     if (ePresObjKind == PRESOBJ_TITLE ||
     268             :                         ePresObjKind == PRESOBJ_NOTES)
     269             :                     {
     270             :                         // Presentation object (except outline)
     271           0 :                         SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
     272             :                         DBG_ASSERT(pSheet, "StyleSheet not found");
     273             : 
     274           0 :                         SfxItemSet aTempSet( pSheet->GetItemSet() );
     275           0 :                         aTempSet.Put( rSet );
     276           0 :                         aTempSet.ClearInvalidItems();
     277             : 
     278             :                         // Undo-Action
     279           0 :                         StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     280           0 :                         mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     281             : 
     282           0 :                         pSheet->GetItemSet().Put(aTempSet,false);
     283           0 :                         pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     284           0 :                         bOk = sal_True;
     285             :                     }
     286           0 :                     else if (eObjKind == OBJ_OUTLINETEXT)
     287             :                     {
     288             :                         // Presentation object outline
     289           0 :                         for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
     290             :                         {
     291           0 :                             OUString aName = rPage.GetLayoutName() + " " +
     292           0 :                                 OUString::number(nLevel);
     293             :                             SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
     294           0 :                                                 Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     295             :                             DBG_ASSERT(pSheet, "StyleSheet not found");
     296             : 
     297           0 :                             SfxItemSet aTempSet( pSheet->GetItemSet() );
     298             : 
     299           0 :                             if( nLevel > 1 )
     300             :                             {
     301             :                                 // for all levels over 1, clear all items that will be
     302             :                                 // hard set to level 1
     303           0 :                                 SfxWhichIter aWhichIter(rSet);
     304           0 :                                 sal_uInt16 nWhich(aWhichIter.FirstWhich());
     305           0 :                                 while( nWhich )
     306             :                                 {
     307           0 :                                     if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
     308           0 :                                         aTempSet.ClearItem( nWhich );
     309           0 :                                     nWhich = aWhichIter.NextWhich();
     310           0 :                                 }
     311             : 
     312             :                             }
     313             :                             else
     314             :                             {
     315             :                                 // put the items hard into level one
     316           0 :                                 aTempSet.Put( rSet );
     317             :                             }
     318             : 
     319           0 :                             aTempSet.ClearInvalidItems();
     320             : 
     321             :                             // Undo-Action
     322           0 :                             StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     323           0 :                             mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     324             : 
     325           0 :                             pSheet->GetItemSet().Set(aTempSet,false);
     326           0 :                             pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     327           0 :                         }
     328             : 
     329             :                         // remove all hard set items from shape that are now set in style
     330           0 :                         SfxWhichIter aWhichIter(rSet);
     331           0 :                         sal_uInt16 nWhich(aWhichIter.FirstWhich());
     332           0 :                         while( nWhich )
     333             :                         {
     334           0 :                             if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
     335           0 :                                 pObject->ClearMergedItem( nWhich );
     336           0 :                             nWhich = aWhichIter.NextWhich();
     337             :                         }
     338             : 
     339           0 :                         bOk = sal_True;
     340             :                     }
     341             :                 }
     342             :             }
     343             : 
     344           0 :             if(!bOk)
     345           0 :                 bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     346             :         }
     347             :     }
     348             :     else    // not at masterpage
     349             :     {
     350           0 :         bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     351             :     }
     352             : 
     353           0 :     return (bOk);
     354             : }
     355             : 
     356             : /**
     357             :  * Notify for change of site arragement
     358             :  */
     359             : 
     360           0 : void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     361             : {
     362           0 :     if ( mpDrawViewShell && rHint.ISA(SdrHint) )
     363             :     {
     364           0 :         SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
     365             : 
     366           0 :         if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
     367             :         {
     368           0 :             mpDrawViewShell->ResetActualPage();
     369             :         }
     370           0 :         else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
     371             :         {
     372           0 :             mpDrawViewShell->ResetActualLayer();
     373             :         }
     374             : 
     375             :         // switch to that page when it's not a master page
     376           0 :         if(HINT_SWITCHTOPAGE == eHintKind)
     377             :         {
     378           0 :             const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
     379             : 
     380           0 :             if(pPage && !pPage->IsMasterPage())
     381             :             {
     382           0 :                 if(mpDrawViewShell->GetActualPage() != pPage)
     383             :                 {
     384           0 :                     sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
     385           0 :                     mpDrawViewShell->SwitchPage(nPageNum);
     386             :                 }
     387             :             }
     388             :         }
     389             :     }
     390             : 
     391           0 :     ::sd::View::Notify(rBC, rHint);
     392           0 : }
     393             : 
     394             : /**
     395             :  * Lock/Unlock PageOrderChangedHint
     396             :  */
     397             : 
     398           0 : void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
     399             : {
     400           0 :     if (bBlock)
     401           0 :         mnPOCHSmph++;
     402             :     else
     403             :     {
     404             :         DBG_ASSERT(mnPOCHSmph, "counter overflow");
     405           0 :         mnPOCHSmph--;
     406             :     }
     407           0 : }
     408             : 
     409             : /**
     410             :  * If presentation objects are selected, intercept stylesheet-positing at
     411             :  * masterpage.
     412             :  */
     413             : 
     414           0 : sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
     415             : {
     416           0 :     sal_Bool bResult = sal_True;
     417             : 
     418             :     // is there a masterpage edit?
     419           0 :     if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
     420             :     {
     421           0 :         if (IsPresObjSelected(sal_False, sal_True))
     422             :         {
     423             : 
     424           0 :             InfoBox(mpDrawViewShell->GetActiveWindow(),
     425           0 :                     SD_RESSTR(STR_ACTION_NOTPOSSIBLE)).Execute();
     426           0 :             bResult = sal_False;
     427             :         }
     428             :         else
     429             :         {
     430           0 :             bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
     431             :         }
     432             :     }
     433             :     else
     434             :     {
     435           0 :         bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
     436             :     }
     437           0 :     return bResult;
     438             : }
     439             : 
     440             : /**
     441             :  * Paint-method: Redirect event to the view
     442             :  */
     443             : 
     444           0 : void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
     445             : {
     446           0 :     if( mpVDev )
     447             :     {
     448           0 :         delete mpVDev;
     449           0 :         mpVDev = NULL;
     450             :     }
     451             : 
     452           0 :     sal_Bool bStandardPaint = sal_True;
     453             : 
     454           0 :     SdDrawDocument* pDoc = mpDocShell->GetDoc();
     455           0 :     if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
     456             :     {
     457           0 :         rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
     458           0 :         if(xSlideshow.is() && xSlideshow->isRunning())
     459             :         {
     460           0 :             OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
     461           0 :             if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
     462             :             {
     463           0 :                 if( pShowWindow == pOutDev )
     464           0 :                     PresPaint(rReg);
     465           0 :                 bStandardPaint = sal_False;
     466             :             }
     467           0 :         }
     468             :     }
     469             : 
     470           0 :     if(bStandardPaint)
     471             :     {
     472           0 :         ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
     473             :     }
     474           0 : }
     475             : 
     476             : /**
     477             :  * Paint-Event during running slide show
     478             :  */
     479             : 
     480           0 : void DrawView::PresPaint(const Region& rRegion)
     481             : {
     482           0 :     if(mpViewSh)
     483             :     {
     484           0 :         rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
     485           0 :         if( xSlideshow.is() && xSlideshow->isRunning() )
     486           0 :             xSlideshow->paint( rRegion.GetBoundRect() );
     487             :     }
     488           0 : }
     489             : 
     490             : /**
     491             :  * Decides if an object could get marked (eg. unreleased animation objects
     492             :  * in slide show).
     493             :  */
     494             : 
     495           0 : bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
     496             : {
     497           0 :     return FmFormView::IsObjMarkable(pObj, pPV);
     498             : }
     499             : 
     500             : /**
     501             :  * Make passed region visible (scrolling if necessary)
     502             :  */
     503             : 
     504           0 : void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
     505             : {
     506           0 :     if (!rRect.IsEmpty() && mpDrawViewShell)
     507             :     {
     508           0 :         mpDrawViewShell->MakeVisible(rRect, rWin);
     509             :     }
     510           0 : }
     511             : 
     512             : /**
     513             :  * Hide page.
     514             :  */
     515             : 
     516           0 : void DrawView::HideSdrPage()
     517             : {
     518           0 :     if (mpDrawViewShell)
     519             :     {
     520           0 :         mpDrawViewShell->HidePage();
     521             :     }
     522             : 
     523           0 :     ::sd::View::HideSdrPage();
     524           0 : }
     525             : 
     526           0 : void DrawView::DeleteMarked()
     527             : {
     528             :     OSL_TRACE( "DrawView::DeleteMarked() - enter" );
     529             : 
     530           0 :     sd::UndoManager* pUndoManager = mrDoc.GetUndoManager();
     531             :     DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
     532             : 
     533           0 :     if( pUndoManager )
     534             :     {
     535           0 :         OUString aUndo(SVX_RESSTR(STR_EditDelete));
     536           0 :         aUndo = aUndo.replaceFirst("%1", GetDescriptionOfMarkedObjects());
     537           0 :         pUndoManager->EnterListAction(aUndo, aUndo);
     538             :     }
     539             : 
     540           0 :     SdPage* pPage = 0;
     541           0 :     bool bResetLayout = false;
     542             : 
     543           0 :     const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
     544           0 :     if( nMarkCount )
     545             :     {
     546           0 :         SdrMarkList aList( GetMarkedObjectList() );
     547           0 :         for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
     548             :         {
     549           0 :             SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
     550           0 :             if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
     551             :             {
     552           0 :                 pPage = static_cast< SdPage* >( pObj->GetPage() );
     553             :                 PresObjKind ePresObjKind;
     554           0 :                 if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
     555             :                 {
     556           0 :                     switch( ePresObjKind )
     557             :                     {
     558             :                     case PRESOBJ_GRAPHIC:
     559             :                     case PRESOBJ_OBJECT:
     560             :                     case PRESOBJ_CHART:
     561             :                     case PRESOBJ_ORGCHART:
     562             :                     case PRESOBJ_TABLE:
     563             :                     case PRESOBJ_CALC:
     564             :                     case PRESOBJ_IMAGE:
     565             :                     case PRESOBJ_MEDIA:
     566           0 :                         ePresObjKind = PRESOBJ_OUTLINE;
     567           0 :                         break;
     568             :                     default:
     569           0 :                         break;
     570             :                     }
     571           0 :                     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
     572           0 :                     bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
     573           0 :                     Rectangle aRect( pObj->GetLogicRect() );
     574           0 :                     SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
     575             : 
     576             :                     // pUndoManager should not be NULL (see assert above)
     577             :                     // but since we have defensive code
     578             :                     // for it earlier and later in the function
     579             :                     // we might as well be consistant
     580           0 :                     if(pUndoManager)
     581             :                     {
     582             :                         // Move the new PresObj to the position before the
     583             :                         // object it will replace.
     584             :                         pUndoManager->AddUndoAction(
     585           0 :                             mrDoc.GetSdrUndoFactory().CreateUndoObjectOrdNum(
     586             :                                 *pNewObj,
     587             :                                 pNewObj->GetOrdNum(),
     588           0 :                                 pObj->GetOrdNum()));
     589             :                     }
     590           0 :                     pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
     591             : 
     592           0 :                     bResetLayout = true;
     593             : 
     594             :                     OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
     595             :                 }
     596             :             }
     597           0 :         }
     598             :     }
     599             : 
     600           0 :     ::sd::View::DeleteMarked();
     601             : 
     602           0 :     if( pPage && bResetLayout )
     603           0 :         pPage->SetAutoLayout( pPage->GetAutoLayout() );
     604             : 
     605           0 :     if( pUndoManager )
     606           0 :         pUndoManager->LeaveListAction();
     607             : 
     608             :     OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
     609           0 : }
     610             : 
     611             : } // end of namespace sd
     612             : 
     613             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10