LCOV - code coverage report
Current view: top level - sd/source/core - sdpage2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 70 264 26.5 %
Date: 2012-08-25 Functions: 17 27 63.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 32 512 6.2 %

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

Generated by: LCOV version 1.10