LCOV - code coverage report
Current view: top level - sd/source/core - sdpage2.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 140 273 51.3 %
Date: 2015-06-13 12:38:46 Functions: 19 27 70.4 %
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 <vector>
      21             : #include <boost/ptr_container/ptr_vector.hpp>
      22             : 
      23             : #include <sfx2/docfile.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <editeng/outliner.hxx>
      26             : #include <sfx2/linkmgr.hxx>
      27             : #include <svx/svdotext.hxx>
      28             : #include <editeng/outlobj.hxx>
      29             : #include <svl/urihelper.hxx>
      30             : #include <editeng/xmlcnitm.hxx>
      31             : #include <svx/svditer.hxx>
      32             : 
      33             : #include "Annotation.hxx"
      34             : #include "notifydocumentevent.hxx"
      35             : #include "sdresid.hxx"
      36             : #include "sdpage.hxx"
      37             : #include "glob.hxx"
      38             : #include "glob.hrc"
      39             : #include "drawdoc.hxx"
      40             : #include "stlpool.hxx"
      41             : #include "pglink.hxx"
      42             : #include "anminfo.hxx"
      43             : 
      44             : #include "../ui/inc/strings.hrc"
      45             : #include "../ui/inc/DrawDocShell.hxx"
      46             : 
      47             : #include <tools/tenccvt.hxx>
      48             : #include <svl/itemset.hxx>
      49             : #include <rtl/strbuf.hxx>
      50             : 
      51             : using namespace ::sd;
      52             : using namespace ::com::sun::star;
      53             : using namespace ::com::sun::star::uno;
      54             : using namespace ::com::sun::star::office;
      55             : 
      56             : /*************************************************************************
      57             : |*
      58             : |* Sets: names of layout, master page links and templates for presentation
      59             : |* objects
      60             : |*
      61             : |* Preconditions: - The page has to know the correct model!
      62             : |*                - The corresponding master page has to be in the model.
      63             : |*                - The corresponding style sheets have to be in the style sheet
      64             : |*                  pool.
      65             : |*
      66             : |*  bReplaceStyleSheets = sal_True : Named style sheets are replaced
      67             : |*                        sal_False: All style sheets are reassigned
      68             : |*
      69             : |*  bSetMasterPage      = sal_True : search and assign master page
      70             : |*
      71             : |*  bReverseOrder       = sal_False: search master page from head to tail
      72             : |*                        sal_True : search master page from tail to head
      73             : |*                                   (for undo operations)
      74             : |*
      75             : \************************************************************************/
      76             : 
      77           1 : void SdPage::SetPresentationLayout(const OUString& rLayoutName,
      78             :                                    bool bReplaceStyleSheets,
      79             :                                    bool bSetMasterPage,
      80             :                                    bool bReverseOrder)
      81             : {
      82             :     /*********************************************************************
      83             :     |* Name of the layout of the page
      84             :     \********************************************************************/
      85           1 :     OUString aOldLayoutName(maLayoutName);    // merken
      86           2 :     OUStringBuffer aBuf(rLayoutName);
      87           1 :     aBuf.append(SD_LT_SEPARATOR).append(SdResId(STR_LAYOUT_OUTLINE).toString());
      88           1 :     maLayoutName = aBuf.makeStringAndClear();
      89             : 
      90             :     /*********************************************************************
      91             :     |* search and replace master page if necessary
      92             :     \********************************************************************/
      93           1 :     if (bSetMasterPage && !IsMasterPage())
      94             :     {
      95             :         SdPage* pMaster;
      96           0 :         SdPage* pFoundMaster = 0;
      97           0 :         sal_uInt16 nMaster = 0;
      98           0 :         sal_uInt16 nMasterCount = pModel->GetMasterPageCount();
      99             : 
     100           0 :         if( !bReverseOrder )
     101             :         {
     102           0 :             for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
     103             :             {
     104           0 :                 pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
     105           0 :                 if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
     106             :                 {
     107           0 :                     pFoundMaster = pMaster;
     108           0 :                     break;
     109             :                 }
     110             :             }
     111             :         }
     112             :         else
     113             :         {
     114           0 :             for ( nMaster = nMasterCount; nMaster > 0; nMaster-- )
     115             :             {
     116           0 :                 pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1));
     117           0 :                 if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
     118             :                 {
     119           0 :                     pFoundMaster = pMaster;
     120           0 :                     break;
     121             :                 }
     122             :             }
     123             :         }
     124             : 
     125             :         DBG_ASSERT(pFoundMaster, "Masterpage for presentation layout not found!");
     126             : 
     127             :         // this should never happen, but we play failsafe here
     128           0 :         if( pFoundMaster == 0 )
     129           0 :             pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind );
     130             : 
     131           0 :         if( pFoundMaster )
     132           0 :             TRG_SetMasterPage(*pFoundMaster);
     133             :     }
     134             : 
     135             :     /*********************************************************************
     136             :     |* templates for presentation objects
     137             :     \********************************************************************/
     138             :     // list with:
     139             :     // - pointer to templates for outline text object (old and new templates)
     140             :     // - replace-data for OutlinerParaObject
     141           2 :     std::vector<SfxStyleSheetBase*> aOutlineStyles;
     142           2 :     std::vector<SfxStyleSheetBase*> aOldOutlineStyles;
     143           2 :     boost::ptr_vector<StyleReplaceData> aReplList;
     144           1 :     bool bListsFilled = false;
     145             : 
     146           1 :     const size_t nObjCount = GetObjCount();
     147             : 
     148           3 :     for (size_t nObj = 0; nObj < nObjCount; ++nObj)
     149             :     {
     150           2 :         SdrTextObj* pObj = static_cast<SdrTextObj*>( GetObj(nObj) );
     151             : 
     152           4 :         if (pObj->GetObjInventor() == SdrInventor &&
     153           2 :             pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
     154             :         {
     155           0 :             if (!bListsFilled || !bReplaceStyleSheets)
     156             :             {
     157           0 :                 OUString aFullName;
     158           0 :                 OUString aOldFullName;
     159           0 :                 SfxStyleSheetBase* pSheet = NULL;
     160           0 :                 SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
     161             : 
     162           0 :                 for (sal_Int16 i = -1; i < 9; i++)
     163             :                 {
     164           0 :                     aOldFullName = aOldLayoutName + " " +
     165           0 :                                 OUString::number( (i <= 0 ) ? 1 : i + 1 );
     166           0 :                     aFullName = maLayoutName + " " +
     167           0 :                                 OUString::number( (i <= 0 ) ? 1 : i + 1);
     168           0 :                     pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE);
     169             :                     DBG_ASSERT(pSheet, "Old outline style sheet not found");
     170           0 :                     aOldOutlineStyles.push_back(pSheet);
     171             : 
     172           0 :                     pSheet = pStShPool->Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
     173             :                     DBG_ASSERT(pSheet, "New outline style sheet not found");
     174           0 :                     aOutlineStyles.push_back(pSheet);
     175             : 
     176           0 :                     if (bReplaceStyleSheets && pSheet)
     177             :                     {
     178             :                         // Replace instead Set
     179           0 :                         StyleReplaceData* pReplData = new StyleReplaceData;
     180           0 :                         pReplData->nNewFamily = pSheet->GetFamily();
     181           0 :                         pReplData->nFamily    = pSheet->GetFamily();
     182           0 :                         pReplData->aNewName   = aFullName;
     183           0 :                         pReplData->aName      = aOldFullName;
     184           0 :                         aReplList.push_back(pReplData);
     185             :                     }
     186             :                     else
     187             :                     {
     188           0 :                         OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     189             : 
     190           0 :                         if( pOPO )
     191           0 :                             pOPO->SetStyleSheets( i,  aFullName, SD_STYLE_FAMILY_MASTERPAGE );
     192             :                     }
     193             :                 }
     194             : 
     195           0 :                 bListsFilled = true;
     196             :             }
     197             : 
     198             : 
     199           0 :             std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin();
     200           0 :             std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin();
     201             : 
     202           0 :             while (iterOut != aOutlineStyles.end())
     203             :             {
     204           0 :                 SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(*iterOut);
     205           0 :                 SfxStyleSheet* pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut);
     206             : 
     207           0 :                 if (pSheet != pOldSheet)
     208             :                 {
     209           0 :                     if (pOldSheet)
     210           0 :                         pObj->EndListening(*pOldSheet);
     211             : 
     212           0 :                     if (pSheet && !pObj->IsListening(*pSheet))
     213           0 :                         pObj->StartListening(*pSheet);
     214             :                 }
     215             : 
     216           0 :                 ++iterOut;
     217           0 :                 ++iterOldOut;
     218             :             }
     219             : 
     220           0 :             OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     221           0 :             if ( bReplaceStyleSheets && pOPO )
     222             :             {
     223           0 :                 boost::ptr_vector<StyleReplaceData>::const_iterator it = aReplList.begin();
     224           0 :                 while (it != aReplList.end())
     225             :                 {
     226           0 :                     pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
     227           0 :                     ++it;
     228             :                 }
     229             :             }
     230             :         }
     231           4 :         else if (pObj->GetObjInventor() == SdrInventor &&
     232           2 :                  pObj->GetObjIdentifier() == OBJ_TITLETEXT)
     233             :         {
     234             :             // We do net get PresObjKind via GetPresObjKind() since there are
     235             :             // only PresObjListe considered. But we want to consider all "Title
     236             :             // objects" here (paste from clipboard etc.)
     237           1 :             SfxStyleSheet* pSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
     238             : 
     239           1 :             if (pSheet)
     240           1 :                 pObj->SetStyleSheet(pSheet, true);
     241             :         }
     242             :         else
     243             :         {
     244           1 :             SfxStyleSheet* pSheet = GetStyleSheetForPresObj(GetPresObjKind(pObj));
     245             : 
     246           1 :             if (pSheet)
     247           1 :                 pObj->SetStyleSheet(pSheet, true);
     248             :         }
     249           1 :     }
     250           1 : }
     251             : 
     252             : /*************************************************************************
     253             : |*
     254             : |* disconnect outline text object from templates for outline levels
     255             : |*
     256             : \************************************************************************/
     257             : 
     258        2329 : void SdPage::EndListenOutlineText()
     259             : {
     260        2329 :     SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE);
     261             : 
     262        2329 :     if (pOutlineTextObj)
     263             :     {
     264         353 :         SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(pModel->GetStyleSheetPool());
     265             :         DBG_ASSERT(pSPool, "StyleSheetPool missing");
     266         353 :         OUString aTrueLayoutName(maLayoutName);
     267         353 :         sal_Int32 nIndex = aTrueLayoutName.indexOf( SD_LT_SEPARATOR );
     268         353 :         if( nIndex != -1 )
     269         353 :             aTrueLayoutName = aTrueLayoutName.copy(0, nIndex);
     270             : 
     271         706 :         std::vector<SfxStyleSheetBase*> aOutlineStyles;
     272         353 :         pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
     273             : 
     274         353 :         std::vector<SfxStyleSheetBase*>::iterator iter;
     275        3530 :         for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
     276             :         {
     277        3177 :             SfxStyleSheet *pSheet = static_cast<SfxStyleSheet*>(*iter);
     278        3177 :             pOutlineTextObj->EndListening(*pSheet);
     279         353 :         }
     280             :     }
     281        2329 : }
     282             : 
     283             : /*************************************************************************
     284             : |*
     285             : |* Set new model
     286             : |*
     287             : \************************************************************************/
     288             : 
     289        2359 : void SdPage::SetModel(SdrModel* pNewModel)
     290             : {
     291        2359 :     DisconnectLink();
     292             : 
     293             :     // assign model
     294        2359 :     FmFormPage::SetModel(pNewModel);
     295             : 
     296        2359 :     ConnectLink();
     297        2359 : }
     298             : 
     299             : /*************************************************************************
     300             : |*
     301             : |* Is this page read-only?
     302             : |*
     303             : \************************************************************************/
     304             : 
     305           8 : bool SdPage::IsReadOnly() const
     306             : {
     307           8 :     return false;
     308             : }
     309             : 
     310             : /*************************************************************************
     311             : |*
     312             : |* Connect to sfx2::LinkManager
     313             : |*
     314             : \************************************************************************/
     315             : 
     316        3932 : void SdPage::ConnectLink()
     317             : {
     318        3932 :     sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
     319             : 
     320        7861 :     if (pLinkManager && !mpPageLink && !maFileName.isEmpty() && !maBookmarkName.isEmpty() &&
     321        3932 :         mePageKind==PK_STANDARD && !IsMasterPage() &&
     322           0 :         static_cast<SdDrawDocument*>(pModel)->IsNewOrLoadCompleted())
     323             :     {
     324             :         /**********************************************************************
     325             :         * Connect
     326             :         * Only standard pages are allowed to be linked
     327             :         **********************************************************************/
     328           0 :         ::sd::DrawDocShell* pDocSh = static_cast<SdDrawDocument*>(pModel)->GetDocSh();
     329             : 
     330           0 :         if (!pDocSh || !pDocSh->GetMedium()->GetOrigURL().equals(maFileName))
     331             :         {
     332             :             // No links to document owned pages!
     333           0 :             mpPageLink = new SdPageLink(this, maFileName, maBookmarkName);
     334           0 :             OUString aFilterName(SdResId(STR_IMPRESS));
     335             :             pLinkManager->InsertFileLink(*mpPageLink, OBJECT_CLIENT_FILE,
     336           0 :                                          maFileName, &aFilterName, &maBookmarkName);
     337           0 :             mpPageLink->Connect();
     338             :         }
     339             :     }
     340        3932 : }
     341             : 
     342             : /*************************************************************************
     343             : |*
     344             : |* Disconnect from sfx2::LinkManager
     345             : |*
     346             : \************************************************************************/
     347             : 
     348        6246 : void SdPage::DisconnectLink()
     349             : {
     350        6246 :     sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
     351             : 
     352        6246 :     if (pLinkManager && mpPageLink)
     353             :     {
     354             :         /**********************************************************************
     355             :         * Disconnect
     356             :         * (remove deletes *pGraphicLink implicit)
     357             :         **********************************************************************/
     358           0 :         pLinkManager->Remove(mpPageLink);
     359           0 :         mpPageLink=NULL;
     360             :     }
     361        6246 : }
     362             : 
     363             : /*************************************************************************
     364             : |*
     365             : |* Copy-Ctor
     366             : |*
     367             : \************************************************************************/
     368             : 
     369           1 : SdPage::SdPage(const SdPage& rSrcPage)
     370             : :   FmFormPage(rSrcPage)
     371             : ,   SdrObjUserCall()
     372           1 : ,   mpItems(NULL)
     373             : {
     374           1 :     mePageKind           = rSrcPage.mePageKind;
     375           1 :     meAutoLayout         = rSrcPage.meAutoLayout;
     376             : 
     377           1 :     mbSelected           = false;
     378           1 :     mnTransitionType    = rSrcPage.mnTransitionType;
     379           1 :     mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
     380           1 :     mbTransitionDirection = rSrcPage.mbTransitionDirection;
     381           1 :     mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
     382           1 :     mfTransitionDuration = rSrcPage.mfTransitionDuration;
     383           1 :     mePresChange            = rSrcPage.mePresChange;
     384           1 :     mfTime               = rSrcPage.mfTime;
     385           1 :     mbSoundOn            = rSrcPage.mbSoundOn;
     386           1 :     mbExcluded           = rSrcPage.mbExcluded;
     387             : 
     388           1 :     maLayoutName         = rSrcPage.maLayoutName;
     389           1 :     maSoundFile          = rSrcPage.maSoundFile;
     390           1 :     mbLoopSound          = rSrcPage.mbLoopSound;
     391           1 :     mbStopSound          = rSrcPage.mbStopSound;
     392           1 :     maCreatedPageName.clear();
     393           1 :     maFileName           = rSrcPage.maFileName;
     394           1 :     maBookmarkName       = rSrcPage.maBookmarkName;
     395           1 :     mbScaleObjects       = rSrcPage.mbScaleObjects;
     396           1 :     mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
     397           1 :     meCharSet            = rSrcPage.meCharSet;
     398           1 :     mnPaperBin           = rSrcPage.mnPaperBin;
     399           1 :     meOrientation        = rSrcPage.meOrientation;
     400             : 
     401           1 :     mpPageLink           = NULL;    // is set when inserting via ConnectLink()
     402             : 
     403           1 :     mbIsPrecious         = false;
     404           1 : }
     405             : 
     406           1 : void SdPage::lateInit(const SdPage& rSrcPage)
     407             : {
     408           1 :     FmFormPage::lateInit(rSrcPage);
     409             : 
     410             :     // use shape list directly to preserve constness of rSrcPage
     411           1 :     const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
     412           9 :     for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin();
     413           6 :          aIter != rShapeList.end(); ++aIter )
     414             :     {
     415           2 :         SdrObject* pObj = *aIter;
     416           2 :         InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
     417             :     }
     418             : 
     419             :     // header footer
     420           1 :     setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
     421           1 : }
     422             : 
     423             : /*************************************************************************
     424             : |*
     425             : |* Clone
     426             : |*
     427             : \************************************************************************/
     428             : 
     429           1 : SdrPage* SdPage::Clone() const
     430             : {
     431           1 :     return Clone(NULL);
     432             : }
     433             : 
     434           1 : SdrPage* SdPage::Clone(SdrModel* pNewModel) const
     435             : {
     436             :     DBG_ASSERT( pNewModel == 0, "sd::SdPage::Clone(), new page ignored, please check code! CL" );
     437             :     (void)pNewModel;
     438             : 
     439           1 :     SdPage* pNewPage = new SdPage(*this);
     440           1 :     pNewPage->lateInit( *this );
     441             : 
     442           1 :     cloneAnimations( *pNewPage );
     443             : 
     444             :     // fix user calls for duplicated slide
     445           1 :     SdrObjListIter aSourceIter( *this, IM_DEEPWITHGROUPS );
     446           2 :     SdrObjListIter aTargetIter( *pNewPage, IM_DEEPWITHGROUPS );
     447             : 
     448           4 :     while( aSourceIter.IsMore() && aTargetIter.IsMore() )
     449             :     {
     450           2 :         SdrObject* pSource = aSourceIter.Next();
     451           2 :         SdrObject* pTarget = aTargetIter.Next();
     452             : 
     453           2 :         if( pSource->GetUserCall() )
     454           2 :             pTarget->SetUserCall( pNewPage );
     455             :     }
     456             : 
     457           2 :     return pNewPage;
     458             : }
     459             : 
     460             : /*************************************************************************
     461             : |*
     462             : |* GetTextStyleSheetForObject
     463             : |*
     464             : \************************************************************************/
     465             : 
     466        1901 : SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
     467             : {
     468        1901 :     const PresObjKind eKind = GetPresObjKind(pObj);
     469        1901 :     if( eKind != PRESOBJ_NONE )
     470             :     {
     471        1060 :         return GetStyleSheetForPresObj(eKind);
     472             :     }
     473             : 
     474         841 :     return FmFormPage::GetTextStyleSheetForObject( pObj );
     475             : }
     476             : 
     477           0 : SfxItemSet* SdPage::getOrCreateItems()
     478             : {
     479           0 :     if( mpItems == NULL )
     480           0 :         mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
     481             : 
     482           0 :     return mpItems;
     483             : }
     484             : 
     485           0 : bool SdPage::setAlienAttributes( const com::sun::star::uno::Any& rAttributes )
     486             : {
     487           0 :     SfxItemSet* pSet = getOrCreateItems();
     488             : 
     489           0 :     SvXMLAttrContainerItem aAlienAttributes( SDRATTR_XMLATTRIBUTES );
     490           0 :     if( aAlienAttributes.PutValue( rAttributes, 0 ) )
     491             :     {
     492           0 :         pSet->Put( aAlienAttributes );
     493           0 :         return true;
     494             :     }
     495             : 
     496           0 :     return false;
     497             : }
     498             : 
     499          51 : void SdPage::getAlienAttributes( com::sun::star::uno::Any& rAttributes )
     500             : {
     501             :     const SfxPoolItem* pItem;
     502             : 
     503          51 :     if( (mpItems == NULL) || ( SfxItemState::SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, false, &pItem ) ) )
     504             :     {
     505          51 :         SvXMLAttrContainerItem aAlienAttributes;
     506          51 :         aAlienAttributes.QueryValue( rAttributes, 0 );
     507             :     }
     508             :     else
     509             :     {
     510           0 :         static_cast<const SvXMLAttrContainerItem*>(pItem)->QueryValue( rAttributes, 0 );
     511             :     }
     512          51 : }
     513             : 
     514           0 : void SdPage::RemoveEmptyPresentationObjects()
     515             : {
     516           0 :     SdrObjListIter  aShapeIter( *this, IM_DEEPWITHGROUPS );
     517             : 
     518             :     SdrObject* pShape;
     519           0 :     for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
     520             :     {
     521           0 :         if( pShape && pShape->IsEmptyPresObj() )
     522             :         {
     523           0 :             RemoveObject( pShape->GetOrdNum() );
     524           0 :             SdrObject::Free( pShape );
     525             :         }
     526             : 
     527           0 :     }
     528           0 : }
     529             : 
     530           2 : void SdPage::setTransitionType( sal_Int16 nTransitionType )
     531             : {
     532           2 :     mnTransitionType = nTransitionType;
     533           2 :     ActionChanged();
     534           2 : }
     535             : 
     536           2 : void SdPage::setTransitionSubtype ( sal_Int16 nTransitionSubtype )
     537             : {
     538           2 :     mnTransitionSubtype = nTransitionSubtype;
     539           2 :     ActionChanged();
     540           2 : }
     541             : 
     542           2 : void SdPage::setTransitionDirection ( bool bTransitionbDirection )
     543             : {
     544           2 :     mbTransitionDirection = bTransitionbDirection;
     545           2 :     ActionChanged();
     546           2 : }
     547             : 
     548           2 : void SdPage::setTransitionFadeColor ( sal_Int32 nTransitionFadeColor )
     549             : {
     550           2 :     mnTransitionFadeColor = nTransitionFadeColor;
     551           2 :     ActionChanged();
     552           2 : }
     553             : 
     554          14 : void SdPage::setTransitionDuration ( double fTranstionDuration )
     555             : {
     556          14 :     mfTransitionDuration = fTranstionDuration;
     557          14 :     ActionChanged();
     558          14 : }
     559             : 
     560           0 : OString SdPage::stringify() const
     561             : {
     562           0 :     OStringBuffer aString(100);
     563           0 :     aString.append((sal_Int32)mePageKind).append((sal_Int32)meAutoLayout).append(mbSelected).append((sal_Int32)mePresChange).append(mfTime).append(mbSoundOn).append(mbExcluded).
     564           0 :              append(OUStringToOString( maLayoutName, RTL_TEXTENCODING_UTF8 )).
     565           0 :              append(OUStringToOString(maSoundFile, RTL_TEXTENCODING_UTF8 )).
     566           0 :              append(mbLoopSound).append(mbStopSound).
     567             :              /*append(OUStringToOString(maCreatedPageName, RTL_TEXTENCODING_UTF8)).
     568             :              append(OUStringToOString(maFileName, RTL_TEXTENCODING_UTF8)).*/
     569           0 :              append(OUStringToOString(maBookmarkName, RTL_TEXTENCODING_UTF8)).
     570           0 :              append(mbScaleObjects).append(mbBackgroundFullSize).append((sal_Int32)meCharSet).append((sal_Int32)mnPaperBin).
     571           0 :              append((sal_Int32)meOrientation).append((sal_Int32)mnTransitionType).append((sal_Int32)mnTransitionSubtype).append(mbTransitionDirection).
     572           0 :              append(mnTransitionFadeColor).append(mfTransitionDuration);//.append(mbIsPrecious);
     573             : 
     574           0 :     const size_t n = GetObjCount();
     575           0 :     for(size_t i = 0; i < n; ++i)
     576           0 :         aString.append(GetObj(i)->stringify());
     577           0 :     return aString.makeStringAndClear();
     578             : }
     579             : 
     580           0 : sal_Int32 SdPage::getHash() const
     581             : {
     582           0 :     return stringify().hashCode();
     583             : }
     584             : 
     585           0 : void SdPage::createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation )
     586             : {
     587           0 :     sd::createAnnotation( xAnnotation, this );
     588           0 : }
     589             : 
     590           0 : void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIndex )
     591             : {
     592           0 :     if( (nIndex == -1) || (nIndex > (int)maAnnotations.size()) )
     593             :     {
     594           0 :         maAnnotations.push_back( xAnnotation );
     595             :     }
     596             :     else
     597             :     {
     598           0 :         maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
     599             :     }
     600             : 
     601           0 :     if( pModel && pModel->IsUndoEnabled() )
     602             :     {
     603           0 :         SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
     604           0 :         if( pAction )
     605           0 :             pModel->AddUndo( pAction );
     606             :     }
     607             : 
     608           0 :     SetChanged();
     609             : 
     610           0 :     if( pModel )
     611             :     {
     612           0 :         pModel->SetChanged();
     613           0 :         NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
     614             :     }
     615           0 : }
     616             : 
     617           0 : void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
     618             : {
     619           0 :     if( pModel && pModel->IsUndoEnabled() )
     620             :     {
     621           0 :         SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
     622           0 :         if( pAction )
     623           0 :             pModel->AddUndo( pAction );
     624             :     }
     625             : 
     626           0 :     AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
     627           0 :     if( iter != maAnnotations.end() )
     628           0 :         maAnnotations.erase( iter );
     629             : 
     630           0 :     if( pModel )
     631             :     {
     632           0 :         pModel->SetChanged();
     633           0 :         NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
     634             :     }
     635          66 : }
     636             : 
     637             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11