LCOV - code coverage report
Current view: top level - sd/source/ui/view - drawview.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 54 244 22.1 %
Date: 2015-06-13 12:38:46 Functions: 15 22 68.2 %
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        1668 : 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         259 : DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
      83         259 : : ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
      84             : , mpDocShell(pDocSh)
      85             : , mpDrawViewShell(pShell)
      86             : , mpVDev(NULL)
      87         259 : , mnPOCHSmph(0)
      88             : {
      89         259 :     SetCurrentObj(OBJ_RECT, SdrInventor);
      90         259 : }
      91             : 
      92         711 : DrawView::~DrawView()
      93             : {
      94         259 :     mpVDev.disposeAndClear();
      95         452 : }
      96             : 
      97             : /**
      98             :  * Virtual method from SdrView, called at selection change.
      99             :  */
     100             : 
     101         141 : void DrawView::MarkListHasChanged()
     102             : {
     103         141 :     ::sd::View::MarkListHasChanged();
     104             : 
     105         141 :     if (mpDrawViewShell)
     106         141 :         mpDrawViewShell->SelectionHasChanged();
     107         141 : }
     108             : 
     109             : /**
     110             :  * Virtual method from SdrView, called at model change.
     111             :  */
     112             : 
     113         314 : void DrawView::ModelHasChanged()
     114             : {
     115         314 :     ::sd::View::ModelHasChanged();
     116             : 
     117             :     // force framer to rerender
     118         314 :     SfxStyleSheetBasePool* pSSPool = mrDoc.GetStyleSheetPool();
     119         314 :     pSSPool->Broadcast(SfxStyleSheetPoolHint(SfxStyleSheetHintId::CREATED));
     120             : 
     121         314 :     if( mpDrawViewShell )
     122         212 :         mpDrawViewShell->ModelHasChanged();
     123             : 
     124         314 : }
     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 = static_cast<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 = static_cast<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        4560 : void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     375             : {
     376        4560 :     if ( mpDrawViewShell && dynamic_cast<const SdrHint*>(&rHint) )
     377             :     {
     378        4079 :         SdrHintKind eHintKind = static_cast<const SdrHint&>(rHint).GetKind();
     379             : 
     380        4079 :         if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
     381             :         {
     382         391 :             mpDrawViewShell->ResetActualPage();
     383             :         }
     384        3688 :         else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
     385             :         {
     386           8 :             mpDrawViewShell->ResetActualLayer();
     387             :         }
     388             : 
     389             :         // switch to that page when it's not a master page
     390        4079 :         if(HINT_SWITCHTOPAGE == eHintKind)
     391             :         {
     392           0 :             const SdrPage* pPage = static_cast<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        4560 :     ::sd::View::Notify(rBC, rHint);
     406        4560 : }
     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           0 :             ScopedVclPtr<InfoBox>::Create(mpDrawViewShell->GetActiveWindow(),
     438           0 :                     SD_RESSTR(STR_ACTION_NOTPOSSIBLE))->Execute();
     439           0 :             bResult = false;
     440             :         }
     441             :         else
     442             :         {
     443           0 :             bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
     444             :         }
     445             :     }
     446             :     else
     447             :     {
     448           0 :         bResult = ::sd::View::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
     449             :     }
     450           0 :     return bResult;
     451             : }
     452             : 
     453             : /**
     454             :  * Paint-method: Redirect event to the view
     455             :  */
     456             : 
     457        1049 : void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
     458             : {
     459        1049 :     if( mpVDev )
     460             :     {
     461           0 :         mpVDev.disposeAndClear();
     462             :     }
     463             : 
     464        1049 :     bool bStandardPaint = true;
     465             : 
     466        1049 :     SdDrawDocument* pDoc = mpDocShell->GetDoc();
     467        1049 :     if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
     468             :     {
     469          70 :         rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
     470          70 :         if(xSlideshow.is() && xSlideshow->isRunning())
     471             :         {
     472           0 :             OutputDevice* pShowWindow = xSlideshow->getShowWindow();
     473           0 :             if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
     474             :             {
     475           0 :                 if( pShowWindow == pOutDev )
     476           0 :                     PresPaint(rReg);
     477           0 :                 bStandardPaint = false;
     478             :             }
     479          70 :         }
     480             :     }
     481             : 
     482        1049 :     if(bStandardPaint)
     483             :     {
     484        1049 :         ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
     485             :     }
     486        1049 : }
     487             : 
     488             : /**
     489             :  * Paint-Event during running slide show
     490             :  */
     491             : 
     492           0 : void DrawView::PresPaint(const vcl::Region& rRegion)
     493             : {
     494           0 :     if(mpViewSh)
     495             :     {
     496           0 :         rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
     497           0 :         if( xSlideshow.is() && xSlideshow->isRunning() )
     498           0 :             xSlideshow->paint( rRegion.GetBoundRect() );
     499             :     }
     500           0 : }
     501             : 
     502             : /**
     503             :  * Decides if an object could get marked (eg. unreleased animation objects
     504             :  * in slide show).
     505             :  */
     506             : 
     507           7 : bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
     508             : {
     509           7 :     return FmFormView::IsObjMarkable(pObj, pPV);
     510             : }
     511             : 
     512             : /**
     513             :  * Make passed region visible (scrolling if necessary)
     514             :  */
     515             : 
     516           3 : void DrawView::MakeVisible(const Rectangle& rRect, vcl::Window& rWin)
     517             : {
     518           3 :     if (!rRect.IsEmpty() && mpDrawViewShell)
     519             :     {
     520           3 :         mpDrawViewShell->MakeVisible(rRect, rWin);
     521             :     }
     522           3 : }
     523             : 
     524             : /**
     525             :  * Hide page.
     526             :  */
     527             : 
     528         295 : void DrawView::HideSdrPage()
     529             : {
     530         295 :     if (mpDrawViewShell)
     531             :     {
     532         150 :         mpDrawViewShell->HidePage();
     533             :     }
     534             : 
     535         295 :     ::sd::View::HideSdrPage();
     536         295 : }
     537             : 
     538           0 : void DrawView::DeleteMarked()
     539             : {
     540             :     OSL_TRACE( "DrawView::DeleteMarked() - enter" );
     541             : 
     542           0 :     sd::UndoManager* pUndoManager = mrDoc.GetUndoManager();
     543             :     DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
     544             : 
     545           0 :     if( pUndoManager )
     546             :     {
     547           0 :         OUString aUndo(SVX_RESSTR(STR_EditDelete));
     548           0 :         aUndo = aUndo.replaceFirst("%1", GetDescriptionOfMarkedObjects());
     549           0 :         pUndoManager->EnterListAction(aUndo, aUndo);
     550             :     }
     551             : 
     552           0 :     SdPage* pPage = 0;
     553           0 :     bool bResetLayout = false;
     554             : 
     555           0 :     const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
     556           0 :     if( nMarkCount )
     557             :     {
     558           0 :         SdrMarkList aList( GetMarkedObjectList() );
     559           0 :         for (size_t nMark = 0; nMark < nMarkCount; ++nMark)
     560             :         {
     561           0 :             SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
     562           0 :             if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
     563             :             {
     564           0 :                 pPage = static_cast< SdPage* >( pObj->GetPage() );
     565             :                 PresObjKind ePresObjKind;
     566           0 :                 if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE))
     567             :                 {
     568           0 :                     switch( ePresObjKind )
     569             :                     {
     570             :                     case PRESOBJ_GRAPHIC:
     571             :                     case PRESOBJ_OBJECT:
     572             :                     case PRESOBJ_CHART:
     573             :                     case PRESOBJ_ORGCHART:
     574             :                     case PRESOBJ_TABLE:
     575             :                     case PRESOBJ_CALC:
     576             :                     case PRESOBJ_IMAGE:
     577             :                     case PRESOBJ_MEDIA:
     578           0 :                         ePresObjKind = PRESOBJ_OUTLINE;
     579           0 :                         break;
     580             :                     default:
     581           0 :                         break;
     582             :                     }
     583           0 :                     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
     584           0 :                     bool bVertical = pTextObj && pTextObj->IsVerticalWriting();
     585           0 :                     Rectangle aRect( pObj->GetLogicRect() );
     586           0 :                     SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
     587             : 
     588             :                     // pUndoManager should not be NULL (see assert above)
     589             :                     // but since we have defensive code
     590             :                     // for it earlier and later in the function
     591             :                     // we might as well be consistent
     592           0 :                     if(pUndoManager)
     593             :                     {
     594             :                         // Move the new PresObj to the position before the
     595             :                         // object it will replace.
     596             :                         pUndoManager->AddUndoAction(
     597           0 :                             mrDoc.GetSdrUndoFactory().CreateUndoObjectOrdNum(
     598             :                                 *pNewObj,
     599             :                                 pNewObj->GetOrdNum(),
     600           0 :                                 pObj->GetOrdNum()));
     601             :                     }
     602           0 :                     pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
     603             : 
     604           0 :                     bResetLayout = true;
     605             : 
     606             :                     OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" );
     607             :                 }
     608             :             }
     609           0 :         }
     610             :     }
     611             : 
     612           0 :     ::sd::View::DeleteMarked();
     613             : 
     614           0 :     if( pPage && bResetLayout )
     615           0 :         pPage->SetAutoLayout( pPage->GetAutoLayout() );
     616             : 
     617           0 :     if( pUndoManager )
     618           0 :         pUndoManager->LeaveListAction();
     619             : 
     620             :     OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" );
     621           0 : }
     622             : 
     623          66 : } // end of namespace sd
     624             : 
     625             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11