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

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

Generated by: LCOV version 1.10