LCOV - code coverage report
Current view: top level - libreoffice/sd/source/core - sdpage2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 37 264 14.0 %
Date: 2012-12-17 Functions: 6 27 22.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      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             : 
      49             : using namespace ::sd;
      50             : using namespace ::com::sun::star;
      51             : using namespace ::com::sun::star::uno;
      52             : using namespace ::com::sun::star::office;
      53             : 
      54             : extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
      55             : 
      56             : /*************************************************************************
      57             : |*
      58             : |* SetPresentationLayout, setzt: Layoutnamen, Masterpage-Verkn�pfung und
      59             : |* Vorlagen fuer Praesentationsobjekte
      60             : |*
      61             : |* Vorraussetzungen: - Die Seite muss bereits das richtige Model kennen!
      62             : |*                   - Die entsprechende Masterpage muss bereits im Model sein.
      63             : |*                   - Die entsprechenden StyleSheets muessen bereits im
      64             : |*                     im StyleSheetPool sein.
      65             : |*
      66             : |*  bReplaceStyleSheets = sal_True : Benannte StyleSheets werden ausgetauscht
      67             : |*                        sal_False: Alle StyleSheets werden neu zugewiesen
      68             : |*
      69             : |*  bSetMasterPage      = sal_True : MasterPage suchen und zuweisen
      70             : |*
      71             : |*  bReverseOrder       = sal_False: MasterPages von vorn nach hinten suchen
      72             : |*                        sal_True : MasterPages von hinten nach vorn suchen (fuer Undo-Action)
      73             : |*
      74             : \************************************************************************/
      75             : 
      76           0 : void SdPage::SetPresentationLayout(const String& rLayoutName,
      77             :                                    sal_Bool bReplaceStyleSheets,
      78             :                                    sal_Bool bSetMasterPage,
      79             :                                    sal_Bool bReverseOrder)
      80             : {
      81             :     /*********************************************************************
      82             :     |* Layoutname der Seite
      83             :     \********************************************************************/
      84           0 :     OUString aOldLayoutName(maLayoutName);    // merken
      85           0 :     OUStringBuffer aBuf(rLayoutName);
      86           0 :     aBuf.append(SD_LT_SEPARATOR).append(SdResId(STR_LAYOUT_OUTLINE).toString());
      87           0 :     maLayoutName = aBuf.makeStringAndClear();
      88             : 
      89             :     /*********************************************************************
      90             :     |* ggf. Masterpage suchen und setzen
      91             :     \********************************************************************/
      92           0 :     if (bSetMasterPage && !IsMasterPage())
      93             :     {
      94             :         SdPage* pMaster;
      95           0 :         SdPage* pFoundMaster = 0;
      96           0 :         sal_uInt16 nMaster = 0;
      97           0 :         sal_uInt16 nMasterCount = pModel->GetMasterPageCount();
      98             : 
      99           0 :         if( !bReverseOrder )
     100             :         {
     101           0 :             for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
     102             :             {
     103           0 :                 pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
     104           0 :                 if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
     105             :                 {
     106           0 :                     pFoundMaster = pMaster;
     107           0 :                     break;
     108             :                 }
     109             :             }
     110             :         }
     111             :         else
     112             :         {
     113           0 :             for ( nMaster = nMasterCount; nMaster > 0; nMaster-- )
     114             :             {
     115           0 :                 pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1));
     116           0 :                 if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
     117             :                 {
     118           0 :                     pFoundMaster = pMaster;
     119           0 :                     break;
     120             :                 }
     121             :             }
     122             :         }
     123             : 
     124             :         DBG_ASSERT(pFoundMaster, "Masterpage for presentation layout not found!");
     125             : 
     126             :         // this should never happen, but we play failsafe here
     127           0 :         if( pFoundMaster == 0 )
     128           0 :             pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind );
     129             : 
     130           0 :         if( pFoundMaster )
     131           0 :             TRG_SetMasterPage(*pFoundMaster);
     132             :     }
     133             : 
     134             :     /*********************************************************************
     135             :     |* Vorlagen fuer Praesentationsobjekte
     136             :     \********************************************************************/
     137             :     // Listen mit:
     138             :     // - Vorlagenzeigern fuer Gliederungstextobjekt (alte und neue Vorlagen)
     139             :     // -Replacedaten fuer OutlinerParaObject
     140           0 :     std::vector<SfxStyleSheetBase*> aOutlineStyles;
     141           0 :     std::vector<SfxStyleSheetBase*> aOldOutlineStyles;
     142           0 :     boost::ptr_vector<StyleReplaceData> aReplList;
     143           0 :     bool bListsFilled = false;
     144             : 
     145           0 :     sal_uLong nObjCount = GetObjCount();
     146             : 
     147           0 :     for (sal_uLong nObj = 0; nObj < nObjCount; nObj++)
     148             :     {
     149           0 :         SdrTextObj* pObj = (SdrTextObj*) GetObj(nObj);
     150             : 
     151           0 :         if (pObj->GetObjInventor() == SdrInventor &&
     152           0 :             pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
     153             :         {
     154           0 :             if (!bListsFilled || !bReplaceStyleSheets)
     155             :             {
     156           0 :                 String aFullName;
     157           0 :                 String aOldFullName;
     158           0 :                 SfxStyleSheetBase* pSheet = NULL;
     159           0 :                 SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
     160             : 
     161           0 :                 for (sal_Int16 i = -1; i < 9; i++)
     162             :                 {
     163           0 :                     aFullName = maLayoutName;
     164           0 :                     aOldFullName = aOldLayoutName;
     165           0 :                     aFullName += sal_Unicode( ' ' );
     166           0 :                     aFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1);
     167           0 :                     aOldFullName += sal_Unicode( ' ' );
     168           0 :                     aOldFullName += String::CreateFromInt32( (sal_Int32) (i <= 0 ) ? 1 : i + 1 );
     169             : 
     170           0 :                     pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE);
     171             :                     DBG_ASSERT(pSheet, "alte Gliederungsvorlage nicht gefunden");
     172           0 :                     aOldOutlineStyles.push_back(pSheet);
     173             : 
     174           0 :                     pSheet = pStShPool->Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE);
     175             :                     DBG_ASSERT(pSheet, "neue Gliederungsvorlage nicht gefunden");
     176           0 :                     aOutlineStyles.push_back(pSheet);
     177             : 
     178           0 :                     if (bReplaceStyleSheets && pSheet)
     179             :                     {
     180             :                         // Replace anstatt Set
     181           0 :                         StyleReplaceData* pReplData = new StyleReplaceData;
     182           0 :                         pReplData->nNewFamily = pSheet->GetFamily();
     183           0 :                         pReplData->nFamily    = pSheet->GetFamily();
     184           0 :                         pReplData->aNewName   = aFullName;
     185           0 :                         pReplData->aName      = aOldFullName;
     186           0 :                         aReplList.push_back(pReplData);
     187             :                     }
     188             :                     else
     189             :                     {
     190           0 :                         OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
     191             : 
     192           0 :                         if( pOPO )
     193           0 :                             pOPO->SetStyleSheets( i,  aFullName, SD_STYLE_FAMILY_MASTERPAGE );
     194             :                     }
     195             :                 }
     196             : 
     197           0 :                 bListsFilled = true;
     198             :             }
     199             : 
     200           0 :             SfxStyleSheet* pSheet = NULL;
     201           0 :             SfxStyleSheet* pOldSheet = NULL;
     202             : 
     203           0 :             std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin();
     204           0 :             std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin();
     205             : 
     206           0 :             while (iterOut != aOutlineStyles.end())
     207             :             {
     208           0 :                 pSheet = static_cast<SfxStyleSheet*>(*iterOut);
     209           0 :                 pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut);
     210             : 
     211           0 :                 if (pSheet != pOldSheet)
     212             :                 {
     213           0 :                     pObj->EndListening(*pOldSheet);
     214             : 
     215           0 :                     if (!pObj->IsListening(*pSheet))
     216           0 :                         pObj->StartListening(*pSheet);
     217             :                 }
     218             : 
     219           0 :                 ++iterOut;
     220           0 :                 ++iterOldOut;
     221             :             }
     222             : 
     223           0 :             OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject();
     224           0 :             if ( bReplaceStyleSheets && pOPO )
     225             :             {
     226           0 :                 boost::ptr_vector<StyleReplaceData>::const_iterator it = aReplList.begin();
     227           0 :                 while (it != aReplList.end())
     228             :                 {
     229           0 :                     pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily );
     230           0 :                     ++it;
     231             :                 }
     232             :             }
     233             :         }
     234           0 :         else if (pObj->GetObjInventor() == SdrInventor &&
     235           0 :                  pObj->GetObjIdentifier() == OBJ_TITLETEXT)
     236             :         {
     237             :             // PresObjKind nicht ueber GetPresObjKind() holen, da dort nur
     238             :             // die PresObjListe beruecksichtigt wird. Es sollen aber alle
     239             :             // "Titelobjekte" hier beruecksichtigt werden (Paste aus Clipboard usw.)
     240           0 :             SfxStyleSheet* pSheet = GetStyleSheetForPresObj(PRESOBJ_TITLE);
     241             : 
     242           0 :             if (pSheet)
     243           0 :                 pObj->SetStyleSheet(pSheet, sal_True);
     244             :         }
     245             :         else
     246             :         {
     247           0 :             SfxStyleSheet* pSheet = GetStyleSheetForPresObj(GetPresObjKind(pObj));
     248             : 
     249           0 :             if (pSheet)
     250           0 :                 pObj->SetStyleSheet(pSheet, sal_True);
     251             :         }
     252           0 :     }
     253           0 : }
     254             : 
     255             : 
     256             : /*************************************************************************
     257             : |*
     258             : |* das Gliederungstextobjekt bei den Vorlagen fuer die Gliederungsebenen
     259             : |* abmelden
     260             : |*
     261             : \************************************************************************/
     262             : 
     263         248 : void SdPage::EndListenOutlineText()
     264             : {
     265         248 :     SdrObject* pOutlineTextObj = GetPresObj(PRESOBJ_OUTLINE);
     266             : 
     267         248 :     if (pOutlineTextObj)
     268             :     {
     269          60 :         SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool();
     270             :         DBG_ASSERT(pSPool, "StyleSheetPool nicht gefunden");
     271          60 :         String aTrueLayoutName(maLayoutName);
     272          60 :         aTrueLayoutName.Erase( aTrueLayoutName.SearchAscii( SD_LT_SEPARATOR ));
     273             : 
     274          60 :         SfxStyleSheet *pSheet = NULL;
     275          60 :         std::vector<SfxStyleSheetBase*> aOutlineStyles;
     276          60 :         pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles);
     277             : 
     278          60 :         std::vector<SfxStyleSheetBase*>::iterator iter;
     279         600 :         for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter)
     280             :         {
     281         540 :             pSheet = static_cast<SfxStyleSheet*>(*iter);
     282         540 :             pOutlineTextObj->EndListening(*pSheet);
     283          60 :         }
     284             :     }
     285         248 : }
     286             : 
     287             : /*************************************************************************
     288             : |*
     289             : |* Neues Model setzen
     290             : |*
     291             : \************************************************************************/
     292             : 
     293         272 : void SdPage::SetModel(SdrModel* pNewModel)
     294             : {
     295         272 :     DisconnectLink();
     296             : 
     297             :     // Model umsetzen
     298         272 :     FmFormPage::SetModel(pNewModel);
     299             : 
     300         272 :     ConnectLink();
     301         272 : }
     302             : 
     303             : /*************************************************************************
     304             : |*
     305             : |* Ist die Seite read-only?
     306             : |*
     307             : \************************************************************************/
     308             : 
     309           0 : bool SdPage::IsReadOnly() const
     310             : {
     311           0 :     return false;
     312             : }
     313             : 
     314             : /*************************************************************************
     315             : |*
     316             : |* Beim sfx2::LinkManager anmelden
     317             : |*
     318             : \************************************************************************/
     319             : 
     320         476 : void SdPage::ConnectLink()
     321             : {
     322         476 :     sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
     323             : 
     324         476 :     if (pLinkManager && !mpPageLink && maFileName.Len() && maBookmarkName.Len() &&
     325           0 :         mePageKind==PK_STANDARD && !IsMasterPage() &&
     326           0 :         ( (SdDrawDocument*) pModel)->IsNewOrLoadCompleted())
     327             :     {
     328             :         /**********************************************************************
     329             :         * Anmelden
     330             :         * Nur Standardseiten duerfen gelinkt sein
     331             :         **********************************************************************/
     332           0 :         ::sd::DrawDocShell* pDocSh = ((SdDrawDocument*) pModel)->GetDocSh();
     333             : 
     334           0 :         if (!pDocSh || !pDocSh->GetMedium()->GetOrigURL().equals(maFileName))
     335             :         {
     336             :             // Keine Links auf Dokument-eigene Seiten!
     337           0 :             mpPageLink = new SdPageLink(this, maFileName, maBookmarkName);
     338           0 :             String aFilterName(SdResId(STR_IMPRESS));
     339             :             pLinkManager->InsertFileLink(*mpPageLink, OBJECT_CLIENT_FILE,
     340           0 :                                          maFileName, &aFilterName, &maBookmarkName);
     341           0 :             mpPageLink->Connect();
     342             :         }
     343             :     }
     344         476 : }
     345             : 
     346             : 
     347             : /*************************************************************************
     348             : |*
     349             : |* Beim sfx2::LinkManager abmelden
     350             : |*
     351             : \************************************************************************/
     352             : 
     353         712 : void SdPage::DisconnectLink()
     354             : {
     355         712 :     sfx2::LinkManager* pLinkManager = pModel!=NULL ? pModel->GetLinkManager() : NULL;
     356             : 
     357         712 :     if (pLinkManager && mpPageLink)
     358             :     {
     359             :         /**********************************************************************
     360             :         * Abmelden
     361             :         * (Bei Remove wird *pGraphicLink implizit deleted)
     362             :         **********************************************************************/
     363           0 :         pLinkManager->Remove(mpPageLink);
     364           0 :         mpPageLink=NULL;
     365             :     }
     366         712 : }
     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           0 :     SdrObject* pObj = 0;
     383           0 :     while((pObj = rSrcPage.maPresentationShapeList.getNextShape(pObj)) != 0)
     384           0 :         InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
     385             : 
     386           0 :     mbSelected           = sal_False;
     387           0 :     mnTransitionType    = rSrcPage.mnTransitionType;
     388           0 :     mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
     389           0 :     mbTransitionDirection = rSrcPage.mbTransitionDirection;
     390           0 :     mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
     391           0 :     mfTransitionDuration = rSrcPage.mfTransitionDuration;
     392           0 :     mePresChange            = rSrcPage.mePresChange;
     393           0 :     mnTime               = rSrcPage.mnTime;
     394           0 :     mbSoundOn            = rSrcPage.mbSoundOn;
     395           0 :     mbExcluded           = rSrcPage.mbExcluded;
     396             : 
     397           0 :     maLayoutName         = rSrcPage.maLayoutName;
     398           0 :     maSoundFile          = rSrcPage.maSoundFile;
     399           0 :     mbLoopSound          = rSrcPage.mbLoopSound;
     400           0 :     mbStopSound          = rSrcPage.mbStopSound;
     401           0 :     maCreatedPageName    = String();
     402           0 :     maFileName           = rSrcPage.maFileName;
     403           0 :     maBookmarkName       = rSrcPage.maBookmarkName;
     404           0 :     mbScaleObjects       = rSrcPage.mbScaleObjects;
     405           0 :     mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
     406           0 :     meCharSet            = rSrcPage.meCharSet;
     407           0 :     mnPaperBin           = rSrcPage.mnPaperBin;
     408           0 :     meOrientation        = rSrcPage.meOrientation;
     409             : 
     410             :     // header footer
     411           0 :     setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
     412             : 
     413           0 :     mpPageLink           = NULL;    // Wird beim Einfuegen ueber ConnectLink() gesetzt
     414           0 : }
     415             : 
     416             : 
     417             : 
     418             : /*************************************************************************
     419             : |*
     420             : |* Clone
     421             : |*
     422             : \************************************************************************/
     423             : 
     424           0 : SdrPage* SdPage::Clone() const
     425             : {
     426           0 :     return Clone(NULL);
     427             : }
     428             : 
     429           0 : SdrPage* SdPage::Clone(SdrModel* pNewModel) const
     430             : {
     431             :     DBG_ASSERT( pNewModel == 0, "sd::SdPage::Clone(), new page ignored, please check code! CL" );
     432             :     (void)pNewModel;
     433             : 
     434           0 :     SdPage* pNewPage = new SdPage(*this);
     435             : 
     436           0 :     cloneAnimations( *pNewPage );
     437             : 
     438             :     // fix user calls for duplicated slide
     439           0 :     SdrObjListIter aSourceIter( *this, IM_DEEPWITHGROUPS );
     440           0 :     SdrObjListIter aTargetIter( *pNewPage, IM_DEEPWITHGROUPS );
     441             : 
     442           0 :     while( aSourceIter.IsMore() && aTargetIter.IsMore() )
     443             :     {
     444           0 :         SdrObject* pSource = aSourceIter.Next();
     445           0 :         SdrObject* pTarget = aTargetIter.Next();
     446             : 
     447           0 :         if( pSource->GetUserCall() )
     448           0 :             pTarget->SetUserCall( pNewPage );
     449             :     }
     450             : 
     451           0 :     return pNewPage;
     452             : }
     453             : 
     454             : /*************************************************************************
     455             : |*
     456             : |* GetTextStyleSheetForObject
     457             : |*
     458             : \************************************************************************/
     459             : 
     460             : 
     461         328 : SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
     462             : {
     463         328 :     const PresObjKind eKind = ((SdPage*)this)->GetPresObjKind(pObj);
     464         328 :     if( eKind != PRESOBJ_NONE )
     465             :     {
     466          10 :         return ((SdPage*)this)->GetStyleSheetForPresObj(eKind);
     467             :     }
     468             : 
     469         318 :     return FmFormPage::GetTextStyleSheetForObject( pObj );
     470             : }
     471             : 
     472           0 : SfxItemSet* SdPage::getOrCreateItems()
     473             : {
     474           0 :     if( mpItems == NULL )
     475           0 :         mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
     476             : 
     477           0 :     return mpItems;
     478             : }
     479             : 
     480             : 
     481           0 : sal_Bool SdPage::setAlienAttributes( const com::sun::star::uno::Any& rAttributes )
     482             : {
     483           0 :     SfxItemSet* pSet = getOrCreateItems();
     484             : 
     485           0 :     SvXMLAttrContainerItem aAlienAttributes( SDRATTR_XMLATTRIBUTES );
     486           0 :     if( aAlienAttributes.PutValue( rAttributes, 0 ) )
     487             :     {
     488           0 :         pSet->Put( aAlienAttributes );
     489           0 :         return sal_True;
     490             :     }
     491             : 
     492           0 :     return sal_False;
     493             : }
     494             : 
     495           0 : void SdPage::getAlienAttributes( com::sun::star::uno::Any& rAttributes )
     496             : {
     497             :     const SfxPoolItem* pItem;
     498             : 
     499           0 :     if( (mpItems == NULL) || ( SFX_ITEM_SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, sal_False, &pItem ) ) )
     500             :     {
     501           0 :         SvXMLAttrContainerItem aAlienAttributes;
     502           0 :         aAlienAttributes.QueryValue( rAttributes, 0 );
     503             :     }
     504             :     else
     505             :     {
     506           0 :         ((SvXMLAttrContainerItem*)pItem)->QueryValue( rAttributes, 0 );
     507             :     }
     508           0 : }
     509             : 
     510           0 : void SdPage::RemoveEmptyPresentationObjects()
     511             : {
     512           0 :     SdrObjListIter  aShapeIter( *this, IM_DEEPWITHGROUPS );
     513             : 
     514             :     SdrObject* pShape;
     515           0 :     for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
     516             :     {
     517           0 :         if( pShape && pShape->IsEmptyPresObj() )
     518             :         {
     519           0 :             RemoveObject( pShape->GetOrdNum() );
     520           0 :             SdrObject::Free( pShape );
     521             :         }
     522             : 
     523           0 :     }
     524           0 : }
     525             : 
     526           0 : sal_Int16 SdPage::getTransitionType (void) const
     527             : {
     528           0 :     return mnTransitionType;
     529             : }
     530             : 
     531           0 : void SdPage::setTransitionType( sal_Int16 nTransitionType )
     532             : {
     533           0 :     mnTransitionType = nTransitionType;
     534           0 :     ActionChanged();
     535           0 : }
     536             : 
     537           0 : sal_Int16 SdPage::getTransitionSubtype (void) const
     538             : {
     539           0 :     return mnTransitionSubtype;
     540             : }
     541             : 
     542           0 : void SdPage::setTransitionSubtype ( sal_Int16 nTransitionSubtype )
     543             : {
     544           0 :     mnTransitionSubtype = nTransitionSubtype;
     545           0 :     ActionChanged();
     546           0 : }
     547             : 
     548           0 : sal_Bool SdPage::getTransitionDirection (void) const
     549             : {
     550           0 :     return mbTransitionDirection;
     551             : }
     552             : 
     553           0 : void SdPage::setTransitionDirection ( sal_Bool bTransitionbDirection )
     554             : {
     555           0 :     mbTransitionDirection = bTransitionbDirection;
     556           0 :     ActionChanged();
     557           0 : }
     558             : 
     559           0 : sal_Int32 SdPage::getTransitionFadeColor (void) const
     560             : {
     561           0 :     return mnTransitionFadeColor;
     562             : }
     563             : 
     564           0 : void SdPage::setTransitionFadeColor ( sal_Int32 nTransitionFadeColor )
     565             : {
     566           0 :     mnTransitionFadeColor = nTransitionFadeColor;
     567           0 :     ActionChanged();
     568           0 : }
     569             : 
     570           0 : double SdPage::getTransitionDuration (void) const
     571             : {
     572           0 :     return mfTransitionDuration;
     573             : }
     574             : 
     575          10 : void SdPage::setTransitionDuration ( double fTranstionDuration )
     576             : {
     577          10 :     mfTransitionDuration = fTranstionDuration;
     578          10 :     ActionChanged();
     579          10 : }
     580             : 
     581             : namespace sd {
     582             : extern void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage );
     583             : extern SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert );
     584             : }
     585             : 
     586           0 : void SdPage::createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation )
     587             : {
     588           0 :     sd::createAnnotation( xAnnotation, this );
     589           0 : }
     590             : 
     591           0 : void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIndex )
     592             : {
     593           0 :     if( (nIndex == -1) || (nIndex > (int)maAnnotations.size()) )
     594             :     {
     595           0 :         maAnnotations.push_back( xAnnotation );
     596             :     }
     597             :     else
     598             :     {
     599           0 :         maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
     600             :     }
     601             : 
     602           0 :     if( pModel && pModel->IsUndoEnabled() )
     603             :     {
     604           0 :         SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
     605           0 :         if( pAction )
     606           0 :             pModel->AddUndo( pAction );
     607             :     }
     608             : 
     609           0 :     SetChanged();
     610             : 
     611           0 :     if( pModel )
     612             :     {
     613           0 :         pModel->SetChanged();
     614           0 :         Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
     615           0 :         NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xSource );
     616             :     }
     617           0 : }
     618             : 
     619           0 : void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
     620             : {
     621           0 :     if( pModel && pModel->IsUndoEnabled() )
     622             :     {
     623           0 :         SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
     624           0 :         if( pAction )
     625           0 :             pModel->AddUndo( pAction );
     626             :     }
     627             : 
     628           0 :     AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
     629           0 :     if( iter != maAnnotations.end() )
     630           0 :         maAnnotations.erase( iter );
     631             : 
     632           0 :     if( pModel )
     633             :     {
     634           0 :         pModel->SetChanged();
     635           0 :         Reference< XInterface > xSource( xAnnotation, UNO_QUERY );
     636           0 :         NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationRemoved" ) ), xSource );
     637             :     }
     638           0 : }
     639             : 
     640             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10