LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - drawview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 50 253 19.8 %
Date: 2013-07-09 Functions: 14 22 63.6 %
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             : #ifndef SD_FRAME_VIEW
      61             : #include "FrameView.hxx"
      62             : #endif
      63             : #include "anminfo.hxx"
      64             : #include "slideshow.hxx"
      65             : #include <vcl/virdev.hxx>
      66             : #include <svx/sdrpaintwindow.hxx>
      67             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      68             : #include <svx/sdr/contact/viewcontact.hxx>
      69             : #include <svx/sdr/contact/displayinfo.hxx>
      70             : 
      71             : #include "undo/undomanager.hxx"
      72             : 
      73             : using namespace ::com::sun::star;
      74             : 
      75             : namespace sd {
      76             : 
      77        2088 : TYPEINIT1(DrawView, View);
      78             : 
      79             : /**
      80             :  * Shows the first page of document at position 0,0. In the case
      81             :  * that there is no page a page is created.
      82             :  */
      83             : 
      84         133 : DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
      85         133 : : ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
      86             : , mpDocShell(pDocSh)
      87             : , mpDrawViewShell(pShell)
      88             : , mpVDev(NULL)
      89         133 : , mnPOCHSmph(0)
      90             : {
      91         133 :     SetCurrentObj(OBJ_RECT, SdrInventor);
      92         133 : }
      93             : 
      94         395 : DrawView::~DrawView()
      95             : {
      96         133 :     delete mpVDev;
      97         262 : }
      98             : 
      99             : /**
     100             :  * Virtual method from SdrView, called at selection change.
     101             :  */
     102             : 
     103          66 : void DrawView::MarkListHasChanged()
     104             : {
     105          66 :     ::sd::View::MarkListHasChanged();
     106             : 
     107          66 :     if (mpDrawViewShell)
     108          66 :         mpDrawViewShell->SelectionHasChanged();
     109          66 : }
     110             : 
     111             : /**
     112             :  * Virtual method from SdrView, called at model change.
     113             :  */
     114             : 
     115         256 : void DrawView::ModelHasChanged()
     116             : {
     117         256 :     ::sd::View::ModelHasChanged();
     118             : 
     119             :     // force framer to rerender
     120         256 :     SfxStyleSheetBasePool* pSSPool = mrDoc.GetStyleSheetPool();
     121         256 :     pSSPool->Broadcast(SfxStyleSheetPoolHint(SFX_STYLESHEETPOOL_CHANGES));
     122             : 
     123         256 :     if( mpDrawViewShell )
     124         163 :         mpDrawViewShell->ModelHasChanged();
     125             : 
     126         256 : }
     127             : 
     128             : /**
     129             :  * Redirect attributes onto title and outline text and background
     130             :  * rectangle of a masterpage into templates, otherwise pass on baseclass.
     131             :  */
     132             : 
     133           0 : sal_Bool DrawView::SetAttributes(const SfxItemSet& rSet,
     134             :                                             sal_Bool bReplaceAll)
     135             : {
     136           0 :     sal_Bool bOk = sal_False;
     137             : 
     138             :     // is there a masterpage edit?
     139           0 :     if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE )
     140             :     {
     141           0 :         SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
     142           0 :         SdPage& rPage = *mpDrawViewShell->getCurrentPage();
     143           0 :         String aLayoutName = rPage.GetName();
     144           0 :         SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
     145             : 
     146           0 :         if (pEditObject)
     147             :         {
     148             :             // Textedit
     149           0 :             String aTemplateName(aLayoutName);
     150             : 
     151           0 :             sal_uInt32 nInv = pEditObject->GetObjInventor();
     152             : 
     153           0 :             if (nInv == SdrInventor)
     154             :             {
     155           0 :                 sal_uInt16 eObjKind = pEditObject->GetObjIdentifier();
     156           0 :                 PresObjKind ePresObjKind = rPage.GetPresObjKind(pEditObject);
     157             : 
     158           0 :                 if ( ePresObjKind == PRESOBJ_TITLE ||
     159             :                      ePresObjKind == PRESOBJ_NOTES )
     160             :                 {
     161             :                     // Presentation object (except outline)
     162           0 :                     SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
     163             :                     DBG_ASSERT(pSheet, "StyleSheet not found");
     164             : 
     165           0 :                     SfxItemSet aTempSet( pSheet->GetItemSet() );
     166           0 :                     aTempSet.Put( rSet );
     167           0 :                     aTempSet.ClearInvalidItems();
     168             : 
     169             :                     // Undo-Action
     170           0 :                     StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     171           0 :                     mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     172             : 
     173           0 :                     pSheet->GetItemSet().Put(aTempSet);
     174           0 :                     pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     175           0 :                     bOk = sal_True;
     176             :                 }
     177           0 :                 else if (eObjKind == OBJ_OUTLINETEXT)
     178             :                 {
     179             :                     // Presentation object outline
     180           0 :                     OutlinerView* pOV   = GetTextEditOutlinerView();
     181           0 :                     ::Outliner* pOutliner = pOV->GetOutliner();
     182             : 
     183           0 :                     aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
     184             : 
     185           0 :                     pOutliner->SetUpdateMode(sal_False);
     186           0 :                     mpDocSh->SetWaitCursor( sal_True );
     187             : 
     188             :                     // replace placeholder by template name
     189           0 :                     String aComment(SdResId(STR_UNDO_CHANGE_PRES_OBJECT));
     190           0 :                     xub_StrLen nPos = aComment.Search( (sal_Unicode)'$' );
     191           0 :                     aComment.Erase(nPos, 1);
     192           0 :                     aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
     193           0 :                     mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
     194             : 
     195           0 :                     std::vector<Paragraph*> aSelList;
     196           0 :                     pOV->CreateSelectionList(aSelList);
     197             : 
     198           0 :                     std::vector<Paragraph*>::reverse_iterator iter = aSelList.rbegin();
     199           0 :                     Paragraph* pPara = iter != aSelList.rend() ? *iter : NULL;
     200             : 
     201           0 :                     while (pPara)
     202             :                     {
     203           0 :                         sal_Int32 nParaPos = pOutliner->GetAbsPos( pPara );
     204           0 :                         sal_Int16 nDepth = pOutliner->GetDepth( nParaPos );
     205           0 :                         String aName(rPage.GetLayoutName());
     206           0 :                         aName += (sal_Unicode)(' ');
     207           0 :                         aName += OUString::number( (nDepth <= 0) ? 1 : nDepth + 1 );
     208           0 :                         SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     209             :                         DBG_ASSERT(pSheet, "StyleSheet not found");
     210             : 
     211           0 :                         SfxItemSet aTempSet( pSheet->GetItemSet() );
     212           0 :                         aTempSet.Put( rSet );
     213           0 :                         aTempSet.ClearInvalidItems();
     214             : 
     215           0 :                         if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
     216             :                         {
     217             :                             // no SvxNumBulletItem in outline level 1 to 8!
     218           0 :                             aTempSet.ClearItem( EE_PARA_NUMBULLET );
     219             :                         }
     220             : 
     221             :                         // Undo-Action
     222           0 :                         StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     223           0 :                         mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     224             : 
     225           0 :                         pSheet->GetItemSet().Put(aTempSet);
     226           0 :                         pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     227             : 
     228             :                         // now also broadcast any child sheets
     229             :                         sal_Int16 nChild;
     230           0 :                         for( nChild = nDepth + 1; nChild < 9; nChild++ )
     231             :                         {
     232           0 :                             String aSheetName(rPage.GetLayoutName());
     233           0 :                             aSheetName += (sal_Unicode)(' ');
     234           0 :                             aSheetName += OUString::number( nChild <= 0 ? 1 : nChild + 1 );
     235           0 :                             SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
     236             : 
     237           0 :                             if( pOutlSheet )
     238           0 :                                 pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     239           0 :                         }
     240             : 
     241           0 :                         ++iter;
     242           0 :                         pPara = iter != aSelList.rend() ? *iter : NULL;
     243             : 
     244           0 :                         if( !pPara && nDepth > 0 &&  rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
     245           0 :                             pOutliner->GetDepth( pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 )
     246           0 :                             pPara = pOutliner->GetParagraph( 0 );  // Put NumBulletItem in outline level 1
     247           0 :                     }
     248             : 
     249           0 :                     mpDocSh->SetWaitCursor( sal_False );
     250           0 :                     pOV->GetOutliner()->SetUpdateMode(sal_True);
     251             : 
     252           0 :                     mpDocSh->GetUndoManager()->LeaveListAction();
     253             : 
     254           0 :                     bOk = sal_True;
     255             :                 }
     256             :                 else
     257             :                 {
     258           0 :                     bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     259             :                 }
     260           0 :             }
     261             :         }
     262             :         else
     263             :         {
     264             :             // Selection
     265           0 :             const SdrMarkList& rList = GetMarkedObjectList();
     266           0 :             sal_uLong nMarkCount         = rList.GetMarkCount();
     267           0 :             for (sal_uLong nMark = 0; nMark < nMarkCount; nMark++)
     268             :             {
     269           0 :                 SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
     270           0 :                 sal_uInt32 nInv = pObject->GetObjInventor();
     271             : 
     272           0 :                 if (nInv == SdrInventor)
     273             :                 {
     274           0 :                     sal_uInt16 eObjKind = pObject->GetObjIdentifier();
     275           0 :                     PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
     276           0 :                     String aTemplateName(aLayoutName);
     277             : 
     278           0 :                     if (ePresObjKind == PRESOBJ_TITLE ||
     279             :                         ePresObjKind == PRESOBJ_NOTES)
     280             :                     {
     281             :                         // Presentation object (except outline)
     282           0 :                         SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
     283             :                         DBG_ASSERT(pSheet, "StyleSheet not found");
     284             : 
     285           0 :                         SfxItemSet aTempSet( pSheet->GetItemSet() );
     286           0 :                         aTempSet.Put( rSet );
     287           0 :                         aTempSet.ClearInvalidItems();
     288             : 
     289             :                         // Undo-Action
     290           0 :                         StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     291           0 :                         mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     292             : 
     293           0 :                         pSheet->GetItemSet().Put(aTempSet,false);
     294           0 :                         pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     295           0 :                         bOk = sal_True;
     296             :                     }
     297           0 :                     else if (eObjKind == OBJ_OUTLINETEXT)
     298             :                     {
     299             :                         // Presentation object outline
     300           0 :                         aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
     301           0 :                         for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
     302             :                         {
     303           0 :                             String aName(rPage.GetLayoutName());
     304           0 :                             aName += (sal_Unicode)(' ');
     305           0 :                             aName += OUString::number( (sal_Int32)nLevel );
     306             :                             SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->
     307           0 :                                                 Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
     308             :                             DBG_ASSERT(pSheet, "StyleSheet not found");
     309             : 
     310           0 :                             SfxItemSet aTempSet( pSheet->GetItemSet() );
     311             : 
     312           0 :                             if( nLevel > 1 )
     313             :                             {
     314             :                                 // for all levels over 1, clear all items that will be
     315             :                                 // hard set to level 1
     316           0 :                                 SfxWhichIter aWhichIter(rSet);
     317           0 :                                 sal_uInt16 nWhich(aWhichIter.FirstWhich());
     318           0 :                                 while( nWhich )
     319             :                                 {
     320           0 :                                     if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
     321           0 :                                         aTempSet.ClearItem( nWhich );
     322           0 :                                     nWhich = aWhichIter.NextWhich();
     323           0 :                                 }
     324             : 
     325             :                             }
     326             :                             else
     327             :                             {
     328             :                                 // put the items hard into level one
     329           0 :                                 aTempSet.Put( rSet );
     330             :                             }
     331             : 
     332           0 :                             aTempSet.ClearInvalidItems();
     333             : 
     334             :                             // Undo-Action
     335           0 :                             StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
     336           0 :                             mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     337             : 
     338           0 :                             pSheet->GetItemSet().Set(aTempSet,false);
     339           0 :                             pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     340           0 :                         }
     341             : 
     342             :                         // remove all hard set items from shape that are now set in style
     343           0 :                         SfxWhichIter aWhichIter(rSet);
     344           0 :                         sal_uInt16 nWhich(aWhichIter.FirstWhich());
     345           0 :                         while( nWhich )
     346             :                         {
     347           0 :                             if( SFX_ITEM_ON == rSet.GetItemState( nWhich ) )
     348           0 :                                 pObject->ClearMergedItem( nWhich );
     349           0 :                             nWhich = aWhichIter.NextWhich();
     350             :                         }
     351             : 
     352           0 :                         bOk = sal_True;
     353           0 :                     }
     354             :                 }
     355             :             }
     356             : 
     357           0 :             if(!bOk)
     358           0 :                 bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     359           0 :         }
     360             :     }
     361             :     else    // not at masterpage
     362             :     {
     363           0 :         bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
     364             :     }
     365             : 
     366           0 :     return (bOk);
     367             : }
     368             : 
     369             : /**
     370             :  * Notify for change of site arragement
     371             :  */
     372             : 
     373        2089 : void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     374             : {
     375        2089 :     if ( mpDrawViewShell && rHint.ISA(SdrHint) )
     376             :     {
     377        1646 :         SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();
     378             : 
     379        1646 :         if ( mnPOCHSmph == 0 && eHintKind == HINT_PAGEORDERCHG )
     380             :         {
     381         160 :             mpDrawViewShell->ResetActualPage();
     382             :         }
     383        1486 :         else if ( eHintKind == HINT_LAYERCHG || eHintKind == HINT_LAYERORDERCHG )
     384             :         {
     385           2 :             mpDrawViewShell->ResetActualLayer();
     386             :         }
     387             : 
     388             :         // switch to that page when it's not a master page
     389        1646 :         if(HINT_SWITCHTOPAGE == eHintKind)
     390             :         {
     391           0 :             const SdrPage* pPage = ((const SdrHint&)rHint).GetPage();
     392             : 
     393           0 :             if(pPage && !pPage->IsMasterPage())
     394             :             {
     395           0 :                 if(mpDrawViewShell->GetActualPage() != pPage)
     396             :                 {
     397           0 :                     sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) / 2; // Sdr --> Sd
     398           0 :                     mpDrawViewShell->SwitchPage(nPageNum);
     399             :                 }
     400             :             }
     401             :         }
     402             :     }
     403             : 
     404        2089 :     ::sd::View::Notify(rBC, rHint);
     405        2089 : }
     406             : 
     407             : /**
     408             :  * Lock/Unlock PageOrderChangedHint
     409             :  */
     410             : 
     411           0 : void DrawView::BlockPageOrderChangedHint(sal_Bool bBlock)
     412             : {
     413           0 :     if (bBlock)
     414           0 :         mnPOCHSmph++;
     415             :     else
     416             :     {
     417             :         DBG_ASSERT(mnPOCHSmph, "counter overflow");
     418           0 :         mnPOCHSmph--;
     419             :     }
     420           0 : }
     421             : 
     422             : /**
     423             :  * If presentation objects are selected, intercept stylesheet-positing at
     424             :  * masterpage.
     425             :  */
     426             : 
     427           0 : sal_Bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
     428             : {
     429           0 :     sal_Bool bResult = sal_True;
     430             : 
     431             :     // is there a masterpage edit?
     432           0 :     if (mpDrawViewShell && mpDrawViewShell->GetEditMode() == EM_MASTERPAGE)
     433             :     {
     434           0 :         if (IsPresObjSelected(sal_False, sal_True))
     435             :         {
     436             : 
     437           0 :             InfoBox(mpDrawViewShell->GetActiveWindow(),
     438           0 :                     String(SdResId(STR_ACTION_NOTPOSSIBLE))).Execute();
     439           0 :             bResult = sal_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         623 : void DrawView::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/)
     458             : {
     459         623 :     if( mpVDev )
     460             :     {
     461           0 :         delete mpVDev;
     462           0 :         mpVDev = NULL;
     463             :     }
     464             : 
     465         623 :     sal_Bool bStandardPaint = sal_True;
     466             : 
     467         623 :     SdDrawDocument* pDoc = mpDocShell->GetDoc();
     468         623 :     if( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
     469             :     {
     470          71 :         rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( pDoc ) );
     471          71 :         if(xSlideshow.is() && xSlideshow->isRunning())
     472             :         {
     473           0 :             OutputDevice* pShowWindow = ( OutputDevice* )xSlideshow->getShowWindow();
     474           0 :             if( (pShowWindow == pOutDev) || (xSlideshow->getAnimationMode() == ANIMATIONMODE_PREVIEW) )
     475             :             {
     476           0 :                 if( pShowWindow == pOutDev )
     477           0 :                     PresPaint(rReg);
     478           0 :                 bStandardPaint = sal_False;
     479             :             }
     480          71 :         }
     481             :     }
     482             : 
     483         623 :     if(bStandardPaint)
     484             :     {
     485         623 :         ::sd::View::CompleteRedraw(pOutDev, rReg, pRedirector);
     486             :     }
     487         623 : }
     488             : 
     489             : /**
     490             :  * Paint-Event during running slide show
     491             :  */
     492             : 
     493           0 : void DrawView::PresPaint(const Region& rRegion)
     494             : {
     495           0 :     if(mpViewSh)
     496             :     {
     497           0 :         rtl::Reference< SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
     498           0 :         if( xSlideshow.is() && xSlideshow->isRunning() )
     499           0 :             xSlideshow->paint( rRegion.GetBoundRect() );
     500             :     }
     501           0 : }
     502             : 
     503             : /**
     504             :  * Decides if an object could get marked (eg. unreleased animation objects
     505             :  * in slide show).
     506             :  */
     507             : 
     508           1 : sal_Bool DrawView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
     509             : {
     510           1 :     return FmFormView::IsObjMarkable(pObj, pPV);
     511             : }
     512             : 
     513             : /**
     514             :  * Make passed region visible (scrolling if necessary)
     515             :  */
     516             : 
     517           0 : void DrawView::MakeVisible(const Rectangle& rRect, ::Window& rWin)
     518             : {
     519           0 :     if (!rRect.IsEmpty() && mpDrawViewShell)
     520             :     {
     521           0 :         mpDrawViewShell->MakeVisible(rRect, rWin);
     522             :     }
     523           0 : }
     524             : 
     525             : /**
     526             :  * Hide page.
     527             :  */
     528             : 
     529         207 : void DrawView::HideSdrPage()
     530             : {
     531         207 :     if (mpDrawViewShell)
     532             :     {
     533          70 :         mpDrawViewShell->HidePage();
     534             :     }
     535             : 
     536         207 :     ::sd::View::HideSdrPage();
     537         207 : }
     538             : 
     539           0 : void DrawView::DeleteMarked()
     540             : {
     541             :     OSL_TRACE( "DrawView::DeleteMarked() - enter" );
     542             : 
     543           0 :     sd::UndoManager* pUndoManager = mrDoc.GetUndoManager();
     544             :     DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" );
     545             : 
     546           0 :     if( pUndoManager )
     547             :     {
     548           0 :         String aUndo( SVX_RES(STR_EditDelete) );
     549           0 :         String aSearchString("%1");
     550           0 :         aUndo.SearchAndReplace(aSearchString, GetDescriptionOfMarkedObjects());
     551           0 :         pUndoManager->EnterListAction(aUndo, aUndo);
     552             :     }
     553             : 
     554           0 :     SdPage* pPage = 0;
     555           0 :     bool bResetLayout = false;
     556             : 
     557           0 :     const sal_uLong nMarkCount = GetMarkedObjectList().GetMarkCount();
     558           0 :     if( nMarkCount )
     559             :     {
     560           0 :         SdrMarkList aList( GetMarkedObjectList() );
     561           0 :         for (sal_uLong 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          33 : } // end of namespace sd
     626             : 
     627             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10