LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdmodel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 617 1099 56.1 %
Date: 2012-08-25 Functions: 85 118 72.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 410 1276 32.1 %

           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 <svx/svdmodel.hxx>
      31                 :            : 
      32                 :            : #include <math.h>
      33                 :            : 
      34                 :            : #include <osl/endian.h>
      35                 :            : #include <rtl/logfile.hxx>
      36                 :            : #include <rtl/strbuf.hxx>
      37                 :            : #include <rtl/oustringostreaminserter.hxx>
      38                 :            : 
      39                 :            : #include <com/sun/star/lang/XComponent.hpp>
      40                 :            : #include <com/sun/star/document/XStorageBasedDocument.hpp>
      41                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      42                 :            : 
      43                 :            : #include <unotools/ucbstreamhelper.hxx>
      44                 :            : 
      45                 :            : #include <tools/string.hxx>
      46                 :            : #include <svl/whiter.hxx>
      47                 :            : #include <svx/xit.hxx>
      48                 :            : #include <svx/xbtmpit.hxx>
      49                 :            : #include <svx/xlndsit.hxx>
      50                 :            : #include <svx/xlnedit.hxx>
      51                 :            : #include <svx/xflgrit.hxx>
      52                 :            : #include <svx/xflftrit.hxx>
      53                 :            : #include <svx/xflhtit.hxx>
      54                 :            : #include <svx/xlnstit.hxx>
      55                 :            : 
      56                 :            : #include "svx/svditext.hxx"
      57                 :            : #include <editeng/editeng.hxx>   // for EditEngine::CreatePool()
      58                 :            : 
      59                 :            : #include <svx/xtable.hxx>
      60                 :            : 
      61                 :            : #include "svx/svditer.hxx"
      62                 :            : #include <svx/svdtrans.hxx>
      63                 :            : #include <svx/svdpage.hxx>
      64                 :            : #include <svx/svdlayer.hxx>
      65                 :            : #include <svx/svdundo.hxx>
      66                 :            : #include <svx/svdpool.hxx>
      67                 :            : #include <svx/svdobj.hxx>
      68                 :            : #include <svx/svdotext.hxx>  // for ReformatAllTextObjects and CalcFieldValue
      69                 :            : #include <svx/svdetc.hxx>
      70                 :            : #include <svx/svdoutl.hxx>
      71                 :            : #include <svx/svdoole2.hxx>
      72                 :            : #include "svx/svdglob.hxx"  // StringCache
      73                 :            : #include "svx/svdstr.hrc"   // object's name
      74                 :            : #include "svdoutlinercache.hxx"
      75                 :            : 
      76                 :            : #include "svx/xflclit.hxx"
      77                 :            : #include "svx/xflhtit.hxx"
      78                 :            : #include "svx/xlnclit.hxx"
      79                 :            : 
      80                 :            : #include "officecfg/Office/Common.hxx"
      81                 :            : #include "editeng/fontitem.hxx"
      82                 :            : #include <editeng/colritem.hxx>
      83                 :            : #include <editeng/fhgtitem.hxx>
      84                 :            : #include <svl/style.hxx>
      85                 :            : #include <editeng/numitem.hxx>
      86                 :            : #include <editeng/bulitem.hxx>
      87                 :            : #include <editeng/outlobj.hxx>
      88                 :            : #include "editeng/forbiddencharacterstable.hxx"
      89                 :            : #include <svl/zforlist.hxx>
      90                 :            : #include <comphelper/servicehelper.hxx>
      91                 :            : #include <comphelper/storagehelper.hxx>
      92                 :            : 
      93                 :            : #include <tools/tenccvt.hxx>
      94                 :            : #include <unotools/syslocale.hxx>
      95                 :            : 
      96                 :            : #include <vcl/svapp.hxx>
      97                 :            : #include <svx/sdr/properties/properties.hxx>
      98                 :            : #include <editeng/eeitem.hxx>
      99                 :            : #include <svl/itemset.hxx>
     100                 :            : 
     101                 :            : using namespace ::com::sun::star;
     102                 :            : using namespace ::com::sun::star::uno;
     103                 :            : using namespace ::com::sun::star::lang;
     104                 :            : 
     105                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     106                 :            : 
     107                 :            : struct SdrModelImpl
     108                 :            : {
     109                 :            :     SfxUndoManager* mpUndoManager;
     110                 :            :     SdrUndoFactory* mpUndoFactory;
     111                 :            :     bool mbAllowShapePropertyChangeListener;
     112                 :            : };
     113                 :            : 
     114                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     115                 :            : 
     116                 :            : DBG_NAME(SdrModel)
     117 [ -  + ][ -  + ]:        438 : TYPEINIT1(SdrModel,SfxBroadcaster);
     118                 :       3328 : void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbeddedHelper,
     119                 :            :     bool bUseExtColorTable, bool bLoadRefCounts)
     120                 :            : {
     121                 :       3328 :     mpImpl = new SdrModelImpl;
     122                 :       3328 :     mpImpl->mpUndoManager=0;
     123                 :       3328 :     mpImpl->mpUndoFactory=0;
     124                 :       3328 :     mpImpl->mbAllowShapePropertyChangeListener = false;
     125                 :       3328 :     mbInDestruction = false;
     126         [ +  - ]:       3328 :     aObjUnit=SdrEngineDefaults::GetMapFraction();
     127                 :       3328 :     eObjUnit=SdrEngineDefaults::GetMapUnit();
     128                 :       3328 :     eUIUnit=FUNIT_MM;
     129         [ +  - ]:       3328 :     aUIScale=Fraction(1,1);
     130                 :       3328 :     nUIUnitKomma=0;
     131                 :       3328 :     bUIOnlyKomma=sal_False;
     132                 :       3328 :     pLayerAdmin=NULL;
     133                 :       3328 :     pItemPool=pPool;
     134                 :       3328 :     bMyPool=sal_False;
     135                 :       3328 :     m_pEmbeddedHelper=_pEmbeddedHelper;
     136                 :       3328 :     pDrawOutliner=NULL;
     137                 :       3328 :     pHitTestOutliner=NULL;
     138                 :       3328 :     pRefOutDev=NULL;
     139                 :       3328 :     nProgressAkt=0;
     140                 :       3328 :     nProgressMax=0;
     141                 :       3328 :     nProgressOfs=0;
     142                 :       3328 :     pDefaultStyleSheet=NULL;
     143                 :       3328 :     pLinkManager=NULL;
     144                 :       3328 :     pUndoStack=NULL;
     145                 :       3328 :     pRedoStack=NULL;
     146                 :       3328 :     nMaxUndoCount=16;
     147                 :       3328 :     pAktUndoGroup=NULL;
     148                 :       3328 :     nUndoLevel=0;
     149                 :       3328 :     mbUndoEnabled=true;
     150                 :       3328 :     nProgressPercent=0;
     151                 :       3328 :     nLoadVersion=0;
     152                 :       3328 :     bExtColorTable=sal_False;
     153                 :       3328 :     mbChanged = sal_False;
     154                 :       3328 :     bInfoChanged=sal_False;
     155                 :       3328 :     bPagNumsDirty=sal_False;
     156                 :       3328 :     bMPgNumsDirty=sal_False;
     157                 :       3328 :     bPageNotValid=sal_False;
     158                 :       3328 :     bSavePortable=sal_False;
     159                 :       3328 :     bSaveCompressed=sal_False;
     160                 :       3328 :     bSaveNative=sal_False;
     161                 :       3328 :     bSwapGraphics=sal_False;
     162                 :       3328 :     nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT;
     163                 :       3328 :     bSaveOLEPreview=sal_False;
     164                 :       3328 :     bPasteResize=sal_False;
     165                 :       3328 :     bNoBitmapCaching=sal_False;
     166                 :       3328 :     bReadOnly=sal_False;
     167                 :       3328 :     nStreamCompressMode=COMPRESSMODE_NONE;
     168                 :       3328 :     nStreamNumberFormat=NUMBERFORMAT_INT_BIGENDIAN;
     169                 :       3328 :     nDefaultTabulator=0;
     170                 :       3328 :     mpNumberFormatter = NULL;
     171                 :       3328 :     bTransparentTextFrames=sal_False;
     172                 :       3328 :     bStarDrawPreviewMode = sal_False;
     173                 :       3328 :     nStarDrawPreviewMasterPageNum = SDRPAGE_NOTFOUND;
     174                 :       3328 :     mpForbiddenCharactersTable = NULL;
     175                 :       3328 :     mbModelLocked = false;
     176                 :       3328 :     mpOutlinerCache = NULL;
     177                 :       3328 :     mbKernAsianPunctuation = sal_False;
     178                 :       3328 :     mbAddExtLeading = sal_False;
     179                 :       3328 :     mnHandoutPageCount = 0;
     180                 :            : 
     181                 :            :     mnCharCompressType =
     182                 :            :         officecfg::Office::Common::AsianLayout::CompressCharacterDistance::
     183                 :       3328 :         get();
     184                 :            : 
     185                 :            : #ifdef OSL_LITENDIAN
     186                 :       3328 :     nStreamNumberFormat=NUMBERFORMAT_INT_LITTLEENDIAN;
     187                 :            : #endif
     188                 :       3328 :     bExtColorTable=bUseExtColorTable;
     189                 :            : 
     190         [ +  + ]:       3328 :     if ( pPool == NULL )
     191                 :            :     {
     192         [ +  - ]:       1942 :         pItemPool=new SdrItemPool(0L, bLoadRefCounts);
     193                 :            :         // Outliner doesn't have its own Pool, so use the EditEngine's
     194                 :       1942 :         SfxItemPool* pOutlPool=EditEngine::CreatePool( bLoadRefCounts );
     195                 :            :         // OutlinerPool as SecondaryPool of SdrPool
     196                 :       1942 :         pItemPool->SetSecondaryPool(pOutlPool);
     197                 :            :         // remember that I created both pools myself
     198                 :       1942 :         bMyPool=sal_True;
     199                 :            :     }
     200                 :       3328 :     pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
     201                 :            : 
     202                 :            : // using static SdrEngineDefaults only if default SvxFontHeight item is not available
     203                 :       3328 :     const SfxPoolItem* pPoolItem = pItemPool->GetPoolDefaultItem( EE_CHAR_FONTHEIGHT );
     204         [ +  + ]:       3328 :     if ( pPoolItem )
     205                 :       1386 :         nDefTextHgt = ((SvxFontHeightItem*)pPoolItem)->GetHeight();
     206                 :            :     else
     207                 :       1942 :         nDefTextHgt = SdrEngineDefaults::GetFontHeight();
     208                 :            : 
     209         [ +  - ]:       3328 :     pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) );
     210                 :            : 
     211                 :       3328 :     SetTextDefaults();
     212         [ +  - ]:       3328 :     pLayerAdmin=new SdrLayerAdmin;
     213                 :       3328 :     pLayerAdmin->SetModel(this);
     214                 :       3328 :     ImpSetUIUnit();
     215                 :            : 
     216                 :            :     // can't create DrawOutliner OnDemand, because I can't get the Pool,
     217                 :            :     // then (only from 302 onwards!)
     218                 :       3328 :     pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
     219                 :       3328 :     ImpSetOutlinerDefaults(pDrawOutliner, sal_True);
     220                 :            : 
     221                 :       3328 :     pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
     222                 :       3328 :     ImpSetOutlinerDefaults(pHitTestOutliner, sal_True);
     223                 :            : 
     224                 :       3328 :     ImpCreateTables();
     225                 :       3328 : }
     226                 :            : 
     227                 :       1386 : SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
     228                 :            :     aReadDate( DateTime::EMPTY ),
     229                 :            :     maMaPag(),
     230 [ +  - ][ +  - ]:       9702 :     maPages()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
     231                 :            : {
     232                 :            : #ifdef TIMELOG
     233                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
     234                 :            : #endif
     235                 :            : 
     236                 :            :     DBG_CTOR(SdrModel,NULL);
     237         [ +  - ]:       1386 :     ImpCtor(pPool, pPers, false, (bool)bLoadRefCounts);
     238   [ #  #  #  # ]:       1386 : }
     239                 :            : 
     240                 :        234 : SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
     241                 :            :     aReadDate( DateTime::EMPTY ),
     242                 :            :     maMaPag(),
     243                 :            :     maPages(),
     244 [ +  - ][ +  - ]:       1638 :     aTablePath(rPath)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
     245                 :            : {
     246                 :            : #ifdef TIMELOG
     247                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
     248                 :            : #endif
     249                 :            : 
     250                 :            :     DBG_CTOR(SdrModel,NULL);
     251         [ +  - ]:        234 :     ImpCtor(pPool, pPers, false, (bool)bLoadRefCounts);
     252   [ #  #  #  # ]:        234 : }
     253                 :            : 
     254                 :          0 : SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, sal_Bool bLoadRefCounts):
     255                 :            :     aReadDate( DateTime::EMPTY ),
     256                 :            :     maMaPag(),
     257 [ #  # ][ #  # ]:          0 :     maPages()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     258                 :            : {
     259                 :            : #ifdef TIMELOG
     260                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
     261                 :            : #endif
     262                 :            : 
     263                 :            :     DBG_CTOR(SdrModel,NULL);
     264         [ #  # ]:          0 :     ImpCtor(pPool,pPers,bUseExtColorTable, (bool)bLoadRefCounts);
     265   [ #  #  #  # ]:          0 : }
     266                 :            : 
     267                 :       1708 : SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable, sal_Bool bLoadRefCounts):
     268                 :            :     aReadDate( DateTime::EMPTY ),
     269                 :            :     maMaPag(),
     270                 :            :     maPages(),
     271 [ +  - ][ +  - ]:      11956 :     aTablePath(rPath)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
     272                 :            : {
     273                 :            : #ifdef TIMELOG
     274                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
     275                 :            : #endif
     276                 :            : 
     277                 :            :     DBG_CTOR(SdrModel,NULL);
     278         [ +  - ]:       1708 :     ImpCtor(pPool,pPers,bUseExtColorTable, (bool)bLoadRefCounts);
     279   [ #  #  #  # ]:       1708 : }
     280                 :            : 
     281                 :          0 : SdrModel::SdrModel(const SdrModel& /*rSrcModel*/):
     282                 :            :     SfxBroadcaster(),
     283                 :            :     tools::WeakBase< SdrModel >(),
     284                 :            :     aReadDate( DateTime::EMPTY ),
     285                 :            :     maMaPag(),
     286 [ #  # ][ #  # ]:          0 :     maPages()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     287                 :            : {
     288                 :            : #ifdef TIMELOG
     289                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
     290                 :            : #endif
     291                 :            : 
     292                 :            :     // not yet implemented
     293                 :            :     OSL_FAIL("SdrModel::CopyCtor() is not yet implemented.");
     294                 :          0 : }
     295                 :            : 
     296 [ +  - ][ +  - ]:      25784 : SdrModel::~SdrModel()
                 [ +  - ]
     297                 :            : {
     298                 :            : #ifdef TIMELOG
     299                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::~SdrModel(...)" );
     300                 :            : #endif
     301                 :            : 
     302                 :            :     DBG_DTOR(SdrModel,NULL);
     303                 :            : 
     304                 :       3223 :     mbInDestruction = true;
     305                 :            : 
     306 [ +  - ][ +  - ]:       3223 :     Broadcast(SdrHint(HINT_MODELCLEARED));
           [ +  -  #  # ]
     307                 :            : 
     308 [ +  + ][ +  - ]:       3223 :     delete mpOutlinerCache;
     309                 :            : 
     310         [ +  - ]:       3223 :     ClearUndoBuffer();
     311                 :            : #ifdef DBG_UTIL
     312                 :            :     if(pAktUndoGroup)
     313                 :            :     {
     314                 :            :         rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
     315                 :            :             "In the Dtor of the SdrModel there is an open Undo left: \""));
     316                 :            :         aStr.append(rtl::OUStringToOString(pAktUndoGroup->GetComment(), osl_getThreadTextEncoding()))
     317                 :            :             .append('\"');
     318                 :            :         OSL_FAIL(aStr.getStr());
     319                 :            :     }
     320                 :            : #endif
     321         [ -  + ]:       3223 :     if (pAktUndoGroup!=NULL)
     322 [ #  # ][ #  # ]:          0 :         delete pAktUndoGroup;
     323                 :            : 
     324         [ +  - ]:       3223 :     ClearModel(sal_True);
     325                 :            : 
     326 [ +  - ][ +  - ]:       3223 :     delete pLayerAdmin;
     327                 :            : 
     328                 :            :     // Delete DrawOutliner only after deleting ItemPool, because ItemPool
     329                 :            :     // references Items of the DrawOutliner!
     330 [ +  - ][ +  - ]:       3223 :     delete pHitTestOutliner;
     331 [ +  - ][ +  - ]:       3223 :     delete pDrawOutliner;
     332                 :            : 
     333                 :            :     // delete StyleSheetPool, derived classes should not do this since
     334                 :            :     // the DrawingEngine may need it in its destructor
     335         [ +  + ]:       3223 :     if( mxStyleSheetPool.is() )
     336                 :            :     {
     337 [ +  - ][ +  - ]:        175 :         Reference< XComponent > xComponent( dynamic_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), UNO_QUERY );
     338         [ +  - ]:        175 :         if( xComponent.is() ) try
     339                 :            :         {
     340 [ +  - ][ +  - ]:        175 :             xComponent->dispose();
     341                 :            :         }
     342         [ #  # ]:          0 :         catch( RuntimeException& )
     343                 :            :         {
     344                 :            :         }
     345                 :        175 :         mxStyleSheetPool.clear();
     346                 :            :     }
     347                 :            : 
     348         [ +  + ]:       3223 :     if (bMyPool)
     349                 :            :     {
     350                 :            :         // delete Pools if they're mine
     351         [ +  - ]:       1926 :         SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool();
     352         [ +  - ]:       1926 :         SfxItemPool::Free(pItemPool);
     353                 :            :         // OutlinerPool has to be deleted after deleting ItemPool, because
     354                 :            :         // ItemPool contains SetItems that themselves reference Items from OutlinerPool.
     355         [ +  - ]:       1926 :         SfxItemPool::Free(pOutlPool);
     356                 :            :     }
     357                 :            : 
     358         [ +  + ]:       3223 :     if( mpForbiddenCharactersTable )
     359         [ +  - ]:       1476 :         mpForbiddenCharactersTable->release();
     360                 :            : 
     361         [ -  + ]:       3223 :     if(mpNumberFormatter)
     362 [ #  # ][ #  # ]:          0 :         delete mpNumberFormatter;
     363                 :            : 
     364 [ +  + ][ +  - ]:       3223 :     delete mpImpl->mpUndoFactory;
     365                 :       3223 :     delete mpImpl;
     366         [ +  - ]:      27170 : }
           [ +  +  -  + ]
           [ #  #  #  # ]
     367                 :            : 
     368                 :         27 : bool SdrModel::IsInDestruction() const
     369                 :            : {
     370                 :         27 :     return mbInDestruction;
     371                 :            : }
     372                 :            : 
     373                 :            : // not yet implemented
     374                 :          0 : void SdrModel::operator=(const SdrModel&)
     375                 :            : {
     376                 :            :     OSL_FAIL("SdrModel::operator=() is not yet implemented.");
     377                 :          0 : }
     378                 :            : 
     379                 :          0 : bool SdrModel::operator==(const SdrModel&) const
     380                 :            : {
     381                 :            :     OSL_FAIL("SdrModel::operator==() is not yet implemented");
     382                 :          0 :     return sal_False;
     383                 :            : }
     384                 :            : 
     385                 :       1880 : void SdrModel::SetSwapGraphics( bool bSwap )
     386                 :            : {
     387                 :       1880 :     bSwapGraphics = bSwap;
     388                 :       1880 : }
     389                 :            : 
     390                 :          0 : bool SdrModel::IsReadOnly() const
     391                 :            : {
     392                 :          0 :     return bReadOnly;
     393                 :            : }
     394                 :            : 
     395                 :          0 : void SdrModel::SetReadOnly(bool bYes)
     396                 :            : {
     397                 :          0 :     bReadOnly=bYes;
     398                 :          0 : }
     399                 :            : 
     400                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     401                 :            : 
     402                 :       1781 : void SdrModel::SetMaxUndoActionCount(sal_uIntPtr nAnz)
     403                 :            : {
     404         [ -  + ]:       1781 :     if (nAnz<1) nAnz=1;
     405                 :       1781 :     nMaxUndoCount=nAnz;
     406         [ -  + ]:       1781 :     if (pUndoStack!=NULL) {
     407         [ #  # ]:          0 :         while (pUndoStack->size()>nMaxUndoCount) {
     408         [ #  # ]:          0 :             delete pUndoStack->back();
     409                 :          0 :             pUndoStack->pop_back();
     410                 :            :         }
     411                 :            :     }
     412                 :       1781 : }
     413                 :            : 
     414                 :       5004 : void SdrModel::ClearUndoBuffer()
     415                 :            : {
     416         [ +  + ]:       5004 :     if (pUndoStack!=NULL) {
     417         [ +  + ]:        112 :         while (!pUndoStack->empty()) {
     418         [ +  - ]:         56 :             delete pUndoStack->back();
     419                 :         56 :             pUndoStack->pop_back();
     420                 :            :         }
     421         [ +  - ]:         56 :         delete pUndoStack;
     422                 :         56 :         pUndoStack=NULL;
     423                 :            :     }
     424         [ -  + ]:       5004 :     if (pRedoStack!=NULL) {
     425         [ #  # ]:          0 :         while (!pRedoStack->empty()) {
     426         [ #  # ]:          0 :             delete pRedoStack->back();
     427                 :          0 :             pRedoStack->pop_back();
     428                 :            :         }
     429         [ #  # ]:          0 :         delete pRedoStack;
     430                 :          0 :         pRedoStack=NULL;
     431                 :            :     }
     432                 :       5004 : }
     433                 :            : 
     434                 :          0 : bool SdrModel::Undo()
     435                 :            : {
     436                 :          0 :     bool bRet = false;
     437         [ #  # ]:          0 :     if( mpImpl->mpUndoManager )
     438                 :            :     {
     439                 :            :         OSL_FAIL("svx::SdrModel::Undo(), method not supported with application undo manager!");
     440                 :            :     }
     441                 :            :     else
     442                 :            :     {
     443                 :          0 :         SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
     444         [ #  # ]:          0 :         if(pDo!=NULL)
     445                 :            :         {
     446                 :          0 :             const bool bWasUndoEnabled = mbUndoEnabled;
     447                 :          0 :             mbUndoEnabled = false;
     448         [ #  # ]:          0 :             pDo->Undo();
     449         [ #  # ]:          0 :             if(pRedoStack==NULL)
     450 [ #  # ][ #  # ]:          0 :                 pRedoStack=new std::deque<SfxUndoAction*>;
     451         [ #  # ]:          0 :             SfxUndoAction* p = pUndoStack->front();
     452         [ #  # ]:          0 :             pUndoStack->pop_front();
     453         [ #  # ]:          0 :             pRedoStack->push_front(p);
     454                 :          0 :             mbUndoEnabled = bWasUndoEnabled;
     455                 :            :         }
     456                 :            :     }
     457                 :          0 :     return bRet;
     458                 :            : }
     459                 :            : 
     460                 :          0 : bool SdrModel::Redo()
     461                 :            : {
     462                 :          0 :     bool bRet = false;
     463         [ #  # ]:          0 :     if( mpImpl->mpUndoManager )
     464                 :            :     {
     465                 :            :         OSL_FAIL("svx::SdrModel::Redo(), method not supported with application undo manager!");
     466                 :            :     }
     467                 :            :     else
     468                 :            :     {
     469                 :          0 :         SfxUndoAction* pDo=(SfxUndoAction*)GetRedoAction(0);
     470         [ #  # ]:          0 :         if(pDo!=NULL)
     471                 :            :         {
     472                 :          0 :             const bool bWasUndoEnabled = mbUndoEnabled;
     473                 :          0 :             mbUndoEnabled = false;
     474         [ #  # ]:          0 :             pDo->Redo();
     475         [ #  # ]:          0 :             if(pUndoStack==NULL)
     476 [ #  # ][ #  # ]:          0 :                 pUndoStack=new std::deque<SfxUndoAction*>;
     477         [ #  # ]:          0 :             SfxUndoAction* p = pRedoStack->front();
     478         [ #  # ]:          0 :             pRedoStack->pop_front();
     479         [ #  # ]:          0 :             pUndoStack->push_front(p);
     480                 :          0 :             mbUndoEnabled = bWasUndoEnabled;
     481                 :            :         }
     482                 :            :     }
     483                 :          0 :     return bRet;
     484                 :            : }
     485                 :            : 
     486                 :          0 : bool SdrModel::Repeat(SfxRepeatTarget& rView)
     487                 :            : {
     488                 :          0 :     bool bRet = false;
     489         [ #  # ]:          0 :     if( mpImpl->mpUndoManager )
     490                 :            :     {
     491                 :            :         OSL_FAIL("svx::SdrModel::Redo(), method not supported with application undo manager!");
     492                 :            :     }
     493                 :            :     else
     494                 :            :     {
     495                 :          0 :         SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
     496         [ #  # ]:          0 :         if(pDo!=NULL)
     497                 :            :         {
     498         [ #  # ]:          0 :             if(pDo->CanRepeat(rView))
     499                 :            :             {
     500                 :          0 :                 pDo->Repeat(rView);
     501                 :          0 :                 bRet = true;
     502                 :            :             }
     503                 :            :         }
     504                 :            :     }
     505                 :          0 :     return bRet;
     506                 :            : }
     507                 :            : 
     508                 :      11348 : void SdrModel::ImpPostUndoAction(SdrUndoAction* pUndo)
     509                 :            : {
     510                 :            :     DBG_ASSERT( mpImpl->mpUndoManager == 0, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" );
     511         [ +  - ]:      11348 :     if( IsUndoEnabled() )
     512                 :            :     {
     513         [ +  + ]:      11348 :         if (aUndoLink.IsSet())
     514                 :            :         {
     515                 :      11292 :             aUndoLink.Call(pUndo);
     516                 :            :         }
     517                 :            :         else
     518                 :            :         {
     519         [ +  - ]:         56 :             if (pUndoStack==NULL)
     520         [ +  - ]:         56 :                 pUndoStack=new std::deque<SfxUndoAction*>;
     521         [ +  - ]:         56 :             pUndoStack->push_front(pUndo);
     522         [ -  + ]:         56 :             while (pUndoStack->size()>nMaxUndoCount)
     523                 :            :             {
     524         [ #  # ]:          0 :                 delete pUndoStack->back();
     525                 :          0 :                 pUndoStack->pop_back();
     526                 :            :             }
     527         [ -  + ]:         56 :             if (pRedoStack!=NULL)
     528                 :          0 :                 pRedoStack->clear();
     529                 :            :         }
     530                 :            :     }
     531                 :            :     else
     532                 :            :     {
     533         [ #  # ]:          0 :         delete pUndo;
     534                 :            :     }
     535                 :      11348 : }
     536                 :            : 
     537                 :        319 : void SdrModel::BegUndo()
     538                 :            : {
     539         [ +  + ]:        319 :     if( mpImpl->mpUndoManager )
     540                 :            :     {
     541         [ +  - ]:         12 :         const String aEmpty;
     542         [ +  - ]:         12 :         mpImpl->mpUndoManager->EnterListAction(aEmpty,aEmpty);
     543         [ +  - ]:         12 :         nUndoLevel++;
     544                 :            :     }
     545         [ +  - ]:        307 :     else if( IsUndoEnabled() )
     546                 :            :     {
     547         [ +  - ]:        307 :         if(pAktUndoGroup==NULL)
     548                 :            :         {
     549         [ +  - ]:        307 :             pAktUndoGroup = new SdrUndoGroup(*this);
     550                 :        307 :             nUndoLevel=1;
     551                 :            :         }
     552                 :            :         else
     553                 :            :         {
     554                 :          0 :             nUndoLevel++;
     555                 :            :         }
     556                 :            :     }
     557                 :        319 : }
     558                 :            : 
     559                 :        367 : void SdrModel::BegUndo(const XubString& rComment)
     560                 :            : {
     561         [ +  + ]:        367 :     if( mpImpl->mpUndoManager )
     562                 :            :     {
     563         [ +  - ]:         66 :         const String aEmpty;
     564         [ +  - ]:         66 :         mpImpl->mpUndoManager->EnterListAction( rComment, aEmpty );
     565         [ +  - ]:         66 :         nUndoLevel++;
     566                 :            :     }
     567         [ +  - ]:        301 :     else if( IsUndoEnabled() )
     568                 :            :     {
     569                 :        301 :         BegUndo();
     570         [ +  - ]:        301 :         if (nUndoLevel==1)
     571                 :            :         {
     572                 :        301 :             pAktUndoGroup->SetComment(rComment);
     573                 :            :         }
     574                 :            :     }
     575                 :        367 : }
     576                 :            : 
     577                 :         54 : void SdrModel::BegUndo(const XubString& rComment, const XubString& rObjDescr, SdrRepeatFunc eFunc)
     578                 :            : {
     579         [ +  + ]:         54 :     if( mpImpl->mpUndoManager )
     580                 :            :     {
     581         [ +  - ]:         48 :         String aComment(rComment);
     582 [ +  + ][ +  - ]:         48 :         if( aComment.Len() && rObjDescr.Len() )
                 [ +  + ]
     583                 :            :         {
     584         [ +  - ]:         18 :             String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
     585 [ +  - ][ +  - ]:         18 :             aComment.SearchAndReplace(aSearchString, rObjDescr);
     586                 :            :         }
     587         [ +  - ]:         48 :         const String aEmpty;
     588         [ +  - ]:         48 :         mpImpl->mpUndoManager->EnterListAction( aComment,aEmpty );
     589 [ +  - ][ +  - ]:         48 :         nUndoLevel++;
     590                 :            :     }
     591         [ +  - ]:          6 :     else if( IsUndoEnabled() )
     592                 :            :     {
     593                 :          6 :         BegUndo();
     594         [ +  - ]:          6 :         if (nUndoLevel==1)
     595                 :            :         {
     596                 :          6 :             pAktUndoGroup->SetComment(rComment);
     597                 :          6 :             pAktUndoGroup->SetObjDescription(rObjDescr);
     598                 :          6 :             pAktUndoGroup->SetRepeatFunction(eFunc);
     599                 :            :         }
     600                 :            :     }
     601                 :         54 : }
     602                 :            : 
     603                 :        433 : void SdrModel::EndUndo()
     604                 :            : {
     605                 :            :     DBG_ASSERT(nUndoLevel!=0,"SdrModel::EndUndo(): UndoLevel is already 0!");
     606         [ +  + ]:        433 :     if( mpImpl->mpUndoManager )
     607                 :            :     {
     608         [ +  - ]:        126 :         if( nUndoLevel )
     609                 :            :         {
     610                 :        126 :             nUndoLevel--;
     611                 :        126 :             mpImpl->mpUndoManager->LeaveListAction();
     612                 :            :         }
     613                 :            :     }
     614                 :            :     else
     615                 :            :     {
     616 [ +  - ][ +  - ]:        307 :         if(pAktUndoGroup!=NULL && IsUndoEnabled())
                 [ +  - ]
     617                 :            :         {
     618                 :        307 :             nUndoLevel--;
     619         [ +  - ]:        307 :             if(nUndoLevel==0)
     620                 :            :             {
     621         [ +  - ]:        307 :                 if(pAktUndoGroup->GetActionCount()!=0)
     622                 :            :                 {
     623                 :        307 :                     SdrUndoAction* pUndo=pAktUndoGroup;
     624                 :        307 :                     pAktUndoGroup=NULL;
     625                 :        307 :                     ImpPostUndoAction(pUndo);
     626                 :            :                 }
     627                 :            :                 else
     628                 :            :                 {
     629                 :            :                     // was empty
     630         [ #  # ]:          0 :                     delete pAktUndoGroup;
     631                 :          0 :                     pAktUndoGroup=NULL;
     632                 :            :                 }
     633                 :            :             }
     634                 :            :         }
     635                 :            :     }
     636                 :        433 : }
     637                 :            : 
     638                 :          0 : void SdrModel::SetUndoComment(const XubString& rComment)
     639                 :            : {
     640                 :            :     DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is already 0!");
     641                 :            : 
     642         [ #  # ]:          0 :     if( mpImpl->mpUndoManager )
     643                 :            :     {
     644                 :            :         OSL_FAIL("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );
     645                 :            :     }
     646         [ #  # ]:          0 :     else if( IsUndoEnabled() )
     647                 :            :     {
     648         [ #  # ]:          0 :         if(nUndoLevel==1)
     649                 :            :         {
     650                 :          0 :             pAktUndoGroup->SetComment(rComment);
     651                 :            :         }
     652                 :            :     }
     653                 :          0 : }
     654                 :            : 
     655                 :         33 : void SdrModel::SetUndoComment(const XubString& rComment, const XubString& rObjDescr)
     656                 :            : {
     657                 :            :     DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is already 0!");
     658         [ +  + ]:         33 :     if( mpImpl->mpUndoManager )
     659                 :            :     {
     660                 :            :         OSL_FAIL("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );
     661                 :            :     }
     662                 :            :     else
     663                 :            :     {
     664         [ +  - ]:          3 :         if (nUndoLevel==1)
     665                 :            :         {
     666                 :          3 :             pAktUndoGroup->SetComment(rComment);
     667                 :          3 :             pAktUndoGroup->SetObjDescription(rObjDescr);
     668                 :            :         }
     669                 :            :     }
     670                 :         33 : }
     671                 :            : 
     672                 :      11844 : void SdrModel::AddUndo(SdrUndoAction* pUndo)
     673                 :            : {
     674         [ +  + ]:      11844 :     if( mpImpl->mpUndoManager )
     675                 :            :     {
     676                 :        464 :         mpImpl->mpUndoManager->AddUndoAction( pUndo );
     677                 :            :     }
     678         [ -  + ]:      11380 :     else if( !IsUndoEnabled() )
     679                 :            :     {
     680         [ #  # ]:          0 :         delete pUndo;
     681                 :            :     }
     682                 :            :     else
     683                 :            :     {
     684         [ +  + ]:      11380 :         if (pAktUndoGroup!=NULL)
     685                 :            :         {
     686                 :        339 :             pAktUndoGroup->AddAction(pUndo);
     687                 :            :         }
     688                 :            :         else
     689                 :            :         {
     690                 :      11041 :             ImpPostUndoAction(pUndo);
     691                 :            :         }
     692                 :            :     }
     693                 :      11844 : }
     694                 :            : 
     695                 :      21770 : void SdrModel::EnableUndo( bool bEnable )
     696                 :            : {
     697         [ +  + ]:      21770 :     if( mpImpl->mpUndoManager )
     698                 :            :     {
     699                 :         46 :         mpImpl->mpUndoManager->EnableUndo( bEnable );
     700                 :            :     }
     701                 :            :     else
     702                 :            :     {
     703                 :      21724 :         mbUndoEnabled = bEnable;
     704                 :            :     }
     705                 :      21770 : }
     706                 :            : 
     707                 :      79336 : bool SdrModel::IsUndoEnabled() const
     708                 :            : {
     709         [ +  + ]:      79336 :     if( mpImpl->mpUndoManager )
     710                 :            :     {
     711                 :        359 :         return mpImpl->mpUndoManager->IsUndoEnabled();
     712                 :            :     }
     713                 :            :     else
     714                 :            :     {
     715                 :      79336 :         return mbUndoEnabled;
     716                 :            :     }
     717                 :            : }
     718                 :            : 
     719                 :       3328 : void SdrModel::ImpCreateTables()
     720                 :            : {
     721         [ +  + ]:      23296 :     for( int i = 0; i < XPROPERTY_LIST_COUNT; i++ )
     722                 :            :     {
     723 [ +  + ][ +  + ]:      19968 :         if( !bExtColorTable || i != XCOLOR_LIST )
     724                 :            :             maProperties[i] = XPropertyList::CreatePropertyList (
     725         [ +  - ]:      18260 :                 (XPropertyListType) i, aTablePath, (XOutdevItemPool*)pItemPool );
     726                 :            :     }
     727                 :       3328 : }
     728                 :            : 
     729                 :       5313 : void SdrModel::ClearModel(sal_Bool bCalledFromDestructor)
     730                 :            : {
     731         [ +  - ]:       5313 :     if(bCalledFromDestructor)
     732                 :            :     {
     733                 :       5313 :         mbInDestruction = true;
     734                 :            :     }
     735                 :            : 
     736                 :            :     sal_Int32 i;
     737                 :            :     // delete all drawing pages
     738                 :       5313 :     sal_Int32 nAnz=GetPageCount();
     739         [ +  + ]:       7722 :     for (i=nAnz-1; i>=0; i--)
     740                 :            :     {
     741                 :       2409 :         DeletePage( (sal_uInt16)i );
     742                 :            :     }
     743                 :       5313 :     maPages.clear();
     744                 :       5313 :     PageListChanged();
     745                 :            : 
     746                 :            :     // delete all Masterpages
     747                 :       5313 :     nAnz=GetMasterPageCount();
     748         [ +  + ]:       5778 :     for(i=nAnz-1; i>=0; i--)
     749                 :            :     {
     750                 :        465 :         DeleteMasterPage( (sal_uInt16)i );
     751                 :            :     }
     752                 :       5313 :     maMaPag.clear();
     753                 :       5313 :     MasterPageListChanged();
     754                 :            : 
     755                 :       5313 :     pLayerAdmin->ClearLayer();
     756                 :       5313 : }
     757                 :            : 
     758                 :          0 : SdrModel* SdrModel::AllocModel() const
     759                 :            : {
     760         [ #  # ]:          0 :     SdrModel* pModel=new SdrModel;
     761                 :          0 :     pModel->SetScaleUnit(eObjUnit,aObjUnit);
     762                 :          0 :     return pModel;
     763                 :            : }
     764                 :            : 
     765                 :          0 : SdrPage* SdrModel::AllocPage(bool bMasterPage)
     766                 :            : {
     767         [ #  # ]:          0 :     return new SdrPage(*this,bMasterPage);
     768                 :            : }
     769                 :            : 
     770                 :       3328 : void SdrModel::SetTextDefaults() const
     771                 :            : {
     772                 :       3328 :     SetTextDefaults( pItemPool, nDefTextHgt );
     773                 :       3328 : }
     774                 :            : 
     775                 :       3428 : void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt )
     776                 :            : {
     777                 :            :     // set application-language specific dynamic pool language defaults
     778         [ +  - ]:       3428 :     SvxFontItem aSvxFontItem( EE_CHAR_FONTINFO) ;
     779         [ +  - ]:       3428 :     SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK);
     780         [ +  - ]:       3428 :     SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL);
     781 [ +  - ][ +  - ]:       3428 :     sal_uInt16 nLanguage(Application::GetSettings().GetLanguage());
     782                 :            : 
     783                 :            :     // get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default
     784         [ +  - ]:       3428 :     Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
     785         [ +  - ]:       3428 :     aSvxFontItem.SetFamily(aFont.GetFamily());
     786 [ +  - ][ +  - ]:       3428 :     aSvxFontItem.SetFamilyName(aFont.GetName());
     787 [ +  - ][ +  - ]:       3428 :     aSvxFontItem.SetStyleName(String());
                 [ +  - ]
     788         [ +  - ]:       3428 :     aSvxFontItem.SetPitch( aFont.GetPitch());
     789         [ +  - ]:       3428 :     aSvxFontItem.SetCharSet( aFont.GetCharSet() );
     790         [ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem(aSvxFontItem);
     791                 :            : 
     792                 :            :     // get DEFAULTFONT_CJK_TEXT and set at pool as dynamic default
     793         [ +  - ]:       3428 :     Font aFontCJK(OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
     794         [ +  - ]:       3428 :     aSvxFontItemCJK.SetFamily( aFontCJK.GetFamily());
     795 [ +  - ][ +  - ]:       3428 :     aSvxFontItemCJK.SetFamilyName(aFontCJK.GetName());
     796 [ +  - ][ +  - ]:       3428 :     aSvxFontItemCJK.SetStyleName(String());
                 [ +  - ]
     797         [ +  - ]:       3428 :     aSvxFontItemCJK.SetPitch( aFontCJK.GetPitch());
     798         [ +  - ]:       3428 :     aSvxFontItemCJK.SetCharSet( aFontCJK.GetCharSet());
     799         [ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem(aSvxFontItemCJK);
     800                 :            : 
     801                 :            :     // get DEFAULTFONT_CTL_TEXT and set at pool as dynamic default
     802         [ +  - ]:       3428 :     Font aFontCTL(OutputDevice::GetDefaultFont(DEFAULTFONT_CTL_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
     803         [ +  - ]:       3428 :     aSvxFontItemCTL.SetFamily(aFontCTL.GetFamily());
     804 [ +  - ][ +  - ]:       3428 :     aSvxFontItemCTL.SetFamilyName(aFontCTL.GetName());
     805 [ +  - ][ +  - ]:       3428 :     aSvxFontItemCTL.SetStyleName(String());
                 [ +  - ]
     806         [ +  - ]:       3428 :     aSvxFontItemCTL.SetPitch( aFontCTL.GetPitch() );
     807         [ +  - ]:       3428 :     aSvxFontItemCTL.SetCharSet( aFontCTL.GetCharSet());
     808         [ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem(aSvxFontItemCTL);
     809                 :            : 
     810                 :            :     // set dynamic FontHeight defaults
     811 [ +  - ][ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT ) );
                 [ +  - ]
     812 [ +  - ][ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CJK ) );
                 [ +  - ]
     813 [ +  - ][ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CTL ) );
                 [ +  - ]
     814                 :            : 
     815                 :            :     // set FontColor defaults
     816 [ +  - ][ +  - ]:       3428 :     pItemPool->SetPoolDefaultItem( SvxColorItem(SdrEngineDefaults::GetFontColor(), EE_CHAR_COLOR) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     817                 :       3428 : }
     818                 :            : 
     819                 :     562090 : SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const
     820                 :            : {
     821                 :     562090 :     pDrawOutliner->SetTextObj(pObj);
     822                 :     562090 :     return *pDrawOutliner;
     823                 :            : }
     824                 :            : 
     825                 :        824 : const SdrTextObj* SdrModel::GetFormattingTextObj() const
     826                 :            : {
     827         [ +  - ]:        824 :     if (pDrawOutliner!=NULL) {
     828                 :        824 :         return pDrawOutliner->GetTextObj();
     829                 :            :     }
     830                 :        824 :     return NULL;
     831                 :            : }
     832                 :            : 
     833                 :      19978 : void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, sal_Bool bInit )
     834                 :            : {
     835                 :            :     /**************************************************************************
     836                 :            :     * Initialization of the Outliners for drawing text and HitTest
     837                 :            :     **************************************************************************/
     838         [ +  + ]:      19978 :     if( bInit )
     839                 :            :     {
     840                 :       6656 :         pOutliner->EraseVirtualDevice();
     841                 :       6656 :         pOutliner->SetUpdateMode(sal_False);
     842                 :       6656 :         pOutliner->SetEditTextObjectPool(pItemPool);
     843                 :       6656 :         pOutliner->SetDefTab(nDefaultTabulator);
     844                 :            :     }
     845                 :            : 
     846                 :      19978 :     pOutliner->SetRefDevice(GetRefDevice());
     847         [ +  - ]:      19978 :     pOutliner->SetForbiddenCharsTable(GetForbiddenCharsTable());
     848                 :      19978 :     pOutliner->SetAsianCompressionMode( mnCharCompressType );
     849                 :      19978 :     pOutliner->SetKernAsianPunctuation( IsKernAsianPunctuation() );
     850                 :      19978 :     pOutliner->SetAddExtLeading( IsAddExtLeading() );
     851                 :            : 
     852         [ +  + ]:      19978 :     if ( !GetRefDevice() )
     853                 :            :     {
     854         [ +  - ]:      15330 :         MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit);
     855 [ +  - ][ +  - ]:      15330 :         pOutliner->SetRefMapMode(aMapMode);
     856                 :            :     }
     857                 :      19978 : }
     858                 :            : 
     859                 :       1994 : void SdrModel::SetRefDevice(OutputDevice* pDev)
     860                 :            : {
     861                 :       1994 :     pRefOutDev=pDev;
     862                 :       1994 :     ImpSetOutlinerDefaults( pDrawOutliner );
     863                 :       1994 :     ImpSetOutlinerDefaults( pHitTestOutliner );
     864                 :       1994 :     RefDeviceChanged();
     865                 :       1994 : }
     866                 :            : 
     867                 :       4127 : void SdrModel::ImpReformatAllTextObjects()
     868                 :            : {
     869         [ +  + ]:       4127 :     if( isLocked() )
     870                 :       4127 :         return;
     871                 :            : 
     872                 :       4100 :     sal_uInt16 nAnz=GetMasterPageCount();
     873                 :            :     sal_uInt16 nNum;
     874         [ -  + ]:       4100 :     for (nNum=0; nNum<nAnz; nNum++) {
     875                 :          0 :         GetMasterPage(nNum)->ReformatAllTextObjects();
     876                 :            :     }
     877                 :       4100 :     nAnz=GetPageCount();
     878         [ +  + ]:       6338 :     for (nNum=0; nNum<nAnz; nNum++) {
     879                 :       2238 :         GetPage(nNum)->ReformatAllTextObjects();
     880                 :            :     }
     881                 :            : }
     882                 :            : 
     883                 :            : /*  steps over all available pages and sends notify messages to
     884                 :            :     all edge objects that are connected to other objects so that
     885                 :            :     they may reposition themselves
     886                 :            : */
     887                 :        987 : void SdrModel::ImpReformatAllEdgeObjects()
     888                 :            : {
     889         [ +  - ]:        987 :     if( isLocked() )
     890                 :        987 :         return;
     891                 :            : 
     892                 :          0 :     sal_uInt16 nAnz=GetMasterPageCount();
     893                 :            :     sal_uInt16 nNum;
     894         [ #  # ]:          0 :     for (nNum=0; nNum<nAnz; nNum++)
     895                 :            :     {
     896                 :          0 :         GetMasterPage(nNum)->ReformatAllEdgeObjects();
     897                 :            :     }
     898                 :          0 :     nAnz=GetPageCount();
     899         [ #  # ]:          0 :     for (nNum=0; nNum<nAnz; nNum++)
     900                 :            :     {
     901                 :          0 :         GetPage(nNum)->ReformatAllEdgeObjects();
     902                 :            :     }
     903                 :            : }
     904                 :            : 
     905                 :          0 : uno::Reference<embed::XStorage> SdrModel::GetDocumentStorage() const
     906                 :            : {
     907                 :            :     uno::Reference<document::XStorageBasedDocument> const xSBD(
     908 [ #  # ][ #  # ]:          0 :             const_cast<SdrModel*>(this)->getUnoModel(), uno::UNO_QUERY);
     909         [ #  # ]:          0 :     if (!xSBD.is())
     910                 :            :     {
     911                 :            :         SAL_WARN("svx", "no UNO model");
     912         [ #  # ]:          0 :         return 0;
     913                 :            :     }
     914 [ #  # ][ #  # ]:          0 :     return xSBD->getDocumentStorage();
     915                 :            : }
     916                 :            : 
     917                 :            : uno::Reference<io::XInputStream>
     918                 :          0 : SdrModel::GetDocumentStream( ::rtl::OUString const& rURL,
     919                 :            :                 ::comphelper::LifecycleProxy & rProxy) const
     920                 :            : {
     921         [ #  # ]:          0 :     uno::Reference<embed::XStorage> const xStorage(GetDocumentStorage());
     922         [ #  # ]:          0 :     if (!xStorage.is())
     923                 :            :     {
     924                 :            :         SAL_WARN("svx", "no storage?");
     925         [ #  # ]:          0 :         return 0;
     926                 :            :     }
     927                 :            :     try {
     928                 :            :         uno::Reference<io::XStream> const xStream(
     929                 :            :             ::comphelper::OStorageHelper::GetStreamAtPackageURL(
     930         [ #  # ]:          0 :                 xStorage, rURL, embed::ElementModes::READ, rProxy));
     931 [ #  # ][ #  # ]:          0 :         return (xStream.is()) ? xStream->getInputStream() : 0;
         [ #  # ][ #  # ]
              [ #  #  # ]
     932                 :            :     }
     933         [ #  # ]:          0 :     catch (container::NoSuchElementException const&)
     934                 :            :     {
     935                 :            :         SAL_INFO("svx", "not found");
     936                 :            :     }
     937         [ #  # ]:          0 :     catch (uno::Exception const& e)
     938                 :            :     {
     939                 :            :         SAL_WARN("svx", "exception: '" << e.Message << "'");
     940                 :            :     }
     941         [ #  # ]:          0 :     return 0;
     942                 :            : }
     943                 :            : 
     944                 :            : // convert template attributes from the string into "hard" attributes
     945                 :          0 : void SdrModel::BurnInStyleSheetAttributes()
     946                 :            : {
     947                 :          0 :     sal_uInt16 nAnz=GetMasterPageCount();
     948                 :            :     sal_uInt16 nNum;
     949         [ #  # ]:          0 :     for (nNum=0; nNum<nAnz; nNum++) {
     950                 :          0 :         GetMasterPage(nNum)->BurnInStyleSheetAttributes();
     951                 :            :     }
     952                 :          0 :     nAnz=GetPageCount();
     953         [ #  # ]:          0 :     for (nNum=0; nNum<nAnz; nNum++) {
     954                 :          0 :         GetPage(nNum)->BurnInStyleSheetAttributes();
     955                 :            :     }
     956                 :          0 : }
     957                 :            : 
     958                 :       1994 : void SdrModel::RefDeviceChanged()
     959                 :            : {
     960         [ +  - ]:       1994 :     Broadcast(SdrHint(HINT_REFDEVICECHG));
     961                 :       1994 :     ImpReformatAllTextObjects();
     962                 :       1994 : }
     963                 :            : 
     964                 :        234 : void SdrModel::SetDefaultFontHeight(sal_uIntPtr nVal)
     965                 :            : {
     966         [ +  + ]:        234 :     if (nVal!=nDefTextHgt) {
     967                 :         56 :         nDefTextHgt=nVal;
     968         [ +  - ]:         56 :         Broadcast(SdrHint(HINT_DEFFONTHGTCHG));
     969                 :         56 :         ImpReformatAllTextObjects();
     970                 :            :     }
     971                 :        234 : }
     972                 :            : 
     973                 :        511 : void SdrModel::SetDefaultTabulator(sal_uInt16 nVal)
     974                 :            : {
     975         [ +  + ]:        511 :     if (nDefaultTabulator!=nVal) {
     976                 :        503 :         nDefaultTabulator=nVal;
     977                 :        503 :         Outliner& rOutliner=GetDrawOutliner();
     978                 :        503 :         rOutliner.SetDefTab(nVal);
     979         [ +  - ]:        503 :         Broadcast(SdrHint(HINT_DEFAULTTABCHG));
     980                 :        503 :         ImpReformatAllTextObjects();
     981                 :            :     }
     982                 :        511 : }
     983                 :            : 
     984                 :       4892 : void SdrModel::ImpSetUIUnit()
     985                 :            : {
     986 [ +  - ][ -  + ]:       4892 :     if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator())
                 [ -  + ]
     987                 :            :     {
     988         [ #  # ]:          0 :         aUIScale = Fraction(1,1);
     989                 :            :     }
     990                 :            : 
     991                 :            :     // set start values
     992                 :       4892 :     nUIUnitKomma = 0;
     993                 :       4892 :     sal_Int64 nMul(1);
     994                 :       4892 :     sal_Int64 nDiv(1);
     995                 :            : 
     996                 :            :     // normalize on meters resp. inch
     997   [ +  -  -  -  :       4892 :     switch (eObjUnit)
          -  -  -  -  -  
          +  -  -  -  -  
                      - ]
     998                 :            :     {
     999                 :       3506 :         case MAP_100TH_MM   : nUIUnitKomma+=5; break;
    1000                 :          0 :         case MAP_10TH_MM    : nUIUnitKomma+=4; break;
    1001                 :          0 :         case MAP_MM         : nUIUnitKomma+=3; break;
    1002                 :          0 :         case MAP_CM         : nUIUnitKomma+=2; break;
    1003                 :          0 :         case MAP_1000TH_INCH: nUIUnitKomma+=3; break;
    1004                 :          0 :         case MAP_100TH_INCH : nUIUnitKomma+=2; break;
    1005                 :          0 :         case MAP_10TH_INCH  : nUIUnitKomma+=1; break;
    1006                 :          0 :         case MAP_INCH       : nUIUnitKomma+=0; break;
    1007                 :          0 :         case MAP_POINT      : nDiv=72;     break;          // 1Pt   = 1/72"
    1008                 :       1386 :         case MAP_TWIP       : nDiv=144; nUIUnitKomma++; break; // 1Twip = 1/1440"
    1009                 :          0 :         case MAP_PIXEL      : break;
    1010                 :          0 :         case MAP_SYSFONT    : break;
    1011                 :          0 :         case MAP_APPFONT    : break;
    1012                 :          0 :         case MAP_RELATIVE   : break;
    1013                 :          0 :         default: break;
    1014                 :            :     } // switch
    1015                 :            : 
    1016                 :            :     // 1 mile    =  8 furlong = 63.360" = 1.609.344,0mm
    1017                 :            :     // 1 furlong = 10 chains  =  7.920" =   201.168,0mm
    1018                 :            :     // 1 chain   =  4 poles   =    792" =    20.116,8mm
    1019                 :            :     // 1 pole    =  5 1/2 yd  =    198" =     5.029,2mm
    1020                 :            :     // 1 yd      =  3 ft      =     36" =       914,4mm
    1021                 :            :     // 1 ft      = 12 "       =      1" =       304,8mm
    1022   [ -  -  +  -  :       4892 :     switch (eUIUnit)
          -  -  -  -  -  
          +  -  -  -  -  
                -  -  - ]
    1023                 :            :     {
    1024                 :          0 :         case FUNIT_NONE   : break;
    1025                 :            :         // metric
    1026                 :          0 :         case FUNIT_100TH_MM: nUIUnitKomma-=5; break;
    1027                 :       4714 :         case FUNIT_MM     : nUIUnitKomma-=3; break;
    1028                 :          0 :         case FUNIT_CM     : nUIUnitKomma-=2; break;
    1029                 :          0 :         case FUNIT_M      : nUIUnitKomma+=0; break;
    1030                 :          0 :         case FUNIT_KM     : nUIUnitKomma+=3; break;
    1031                 :            :         // Inch
    1032                 :          0 :         case FUNIT_TWIP   : nMul=144; nUIUnitKomma--;  break;  // 1Twip = 1/1440"
    1033                 :          0 :         case FUNIT_POINT  : nMul=72;     break;            // 1Pt   = 1/72"
    1034                 :          0 :         case FUNIT_PICA   : nMul=6;      break;            // 1Pica = 1/6"
    1035                 :        178 :         case FUNIT_INCH   : break;                         // 1"    = 1"
    1036                 :          0 :         case FUNIT_FOOT   : nDiv*=12;    break;            // 1Ft   = 12"
    1037                 :          0 :         case FUNIT_MILE   : nDiv*=6336; nUIUnitKomma++; break; // 1mile = 63360"
    1038                 :            :         // other
    1039                 :          0 :         case FUNIT_CUSTOM : break;
    1040                 :          0 :         case FUNIT_PERCENT: nUIUnitKomma+=2; break;
    1041                 :            :         // TODO: Add code to handle the following if needed (added to remove warning)
    1042                 :          0 :         case FUNIT_CHAR   : break;
    1043                 :          0 :         case FUNIT_LINE   : break;
    1044                 :            :     } // switch
    1045                 :            : 
    1046                 :            :     // check if mapping is from metric to inch and adapt
    1047                 :       4892 :     const bool bMapInch(IsInch(eObjUnit));
    1048                 :       4892 :     const bool bUIMetr(IsMetric(eUIUnit));
    1049                 :            : 
    1050 [ +  - ][ +  + ]:       4892 :     if (bMapInch && bUIMetr)
    1051                 :            :     {
    1052                 :       1386 :         nUIUnitKomma += 4;
    1053                 :       1386 :         nMul *= 254;
    1054                 :            :     }
    1055                 :            : 
    1056                 :            :     // check if mapping is from inch to metric and adapt
    1057                 :       4892 :     const bool bMapMetr(IsMetric(eObjUnit));
    1058                 :       4892 :     const bool bUIInch(IsInch(eUIUnit));
    1059                 :            : 
    1060 [ +  + ][ +  + ]:       4892 :     if (bMapMetr && bUIInch)
    1061                 :            :     {
    1062                 :        178 :         nUIUnitKomma -= 4;
    1063                 :        178 :         nDiv *= 254;
    1064                 :            :     }
    1065                 :            : 
    1066                 :            :     // use temporary fraction for reduction (fallback to 32bit here),
    1067                 :            :     // may need to be changed in the future, too
    1068 [ +  + ][ +  + ]:       4892 :     if(1 != nMul || 1 != nDiv)
    1069                 :            :     {
    1070         [ +  - ]:       1564 :         const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv));
    1071                 :       1564 :         nMul = aTemp.GetNumerator();
    1072                 :       1564 :         nDiv = aTemp.GetDenominator();
    1073                 :            :     }
    1074                 :            : 
    1075                 :            :     // #i89872# take Unit of Measurement into account
    1076 [ +  - ][ -  + ]:       4892 :     if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator())
                 [ -  + ]
    1077                 :            :     {
    1078                 :            :         // divide by UIScale
    1079                 :          0 :         nMul *= aUIScale.GetDenominator();
    1080                 :          0 :         nDiv *= aUIScale.GetNumerator();
    1081                 :            :     }
    1082                 :            : 
    1083                 :            :     // shorten trailing zeros for dividend
    1084         [ -  + ]:       4892 :     while(0 == (nMul % 10))
    1085                 :            :     {
    1086                 :          0 :         nUIUnitKomma--;
    1087                 :          0 :         nMul /= 10;
    1088                 :            :     }
    1089                 :            : 
    1090                 :            :     // shorten trailing zeros for divisor
    1091         [ -  + ]:       4892 :     while(0 == (nDiv % 10))
    1092                 :            :     {
    1093                 :          0 :         nUIUnitKomma++;
    1094                 :          0 :         nDiv /= 10;
    1095                 :            :     }
    1096                 :            : 
    1097                 :            :     // end preparations, set member values
    1098         [ +  - ]:       4892 :     aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv));
    1099                 :       4892 :     bUIOnlyKomma = (nMul == nDiv);
    1100                 :       4892 :     TakeUnitStr(eUIUnit, aUIUnitStr);
    1101                 :       4892 : }
    1102                 :            : 
    1103                 :          0 : void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
    1104                 :            : {
    1105 [ #  # ][ #  # ]:          0 :     if (eObjUnit!=eMap || aObjUnit!=rFrac) {
                 [ #  # ]
    1106                 :          0 :         eObjUnit=eMap;
    1107                 :          0 :         aObjUnit=rFrac;
    1108                 :          0 :         pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
    1109                 :          0 :         ImpSetUIUnit();
    1110                 :          0 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1111                 :          0 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1112                 :          0 :         ImpReformatAllTextObjects();
    1113                 :            :     }
    1114                 :          0 : }
    1115                 :            : 
    1116                 :       1942 : void SdrModel::SetScaleUnit(MapUnit eMap)
    1117                 :            : {
    1118         [ +  + ]:       1942 :     if (eObjUnit!=eMap) {
    1119                 :       1386 :         eObjUnit=eMap;
    1120                 :       1386 :         pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
    1121                 :       1386 :         ImpSetUIUnit();
    1122                 :       1386 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1123                 :       1386 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1124                 :       1386 :         ImpReformatAllTextObjects();
    1125                 :            :     }
    1126                 :       1942 : }
    1127                 :            : 
    1128                 :        234 : void SdrModel::SetScaleFraction(const Fraction& rFrac)
    1129                 :            : {
    1130         [ -  + ]:        234 :     if (aObjUnit!=rFrac) {
    1131                 :          0 :         aObjUnit=rFrac;
    1132                 :          0 :         ImpSetUIUnit();
    1133                 :          0 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1134                 :          0 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1135                 :          0 :         ImpReformatAllTextObjects();
    1136                 :            :     }
    1137                 :        234 : }
    1138                 :            : 
    1139                 :          4 : void SdrModel::SetUIUnit(FieldUnit eUnit)
    1140                 :            : {
    1141         [ -  + ]:          4 :     if (eUIUnit!=eUnit) {
    1142                 :          0 :         eUIUnit=eUnit;
    1143                 :          0 :         ImpSetUIUnit();
    1144                 :          0 :         ImpReformatAllTextObjects();
    1145                 :            :     }
    1146                 :          4 : }
    1147                 :            : 
    1148                 :          8 : void SdrModel::SetUIScale(const Fraction& rScale)
    1149                 :            : {
    1150         [ -  + ]:          8 :     if (aUIScale!=rScale) {
    1151                 :          0 :         aUIScale=rScale;
    1152                 :          0 :         ImpSetUIUnit();
    1153                 :          0 :         ImpReformatAllTextObjects();
    1154                 :            :     }
    1155                 :          8 : }
    1156                 :            : 
    1157                 :        178 : void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale)
    1158                 :            : {
    1159 [ -  + ][ #  # ]:        178 :     if (eUIUnit!=eUnit || aUIScale!=rScale) {
                 [ +  - ]
    1160                 :        178 :         eUIUnit=eUnit;
    1161                 :        178 :         aUIScale=rScale;
    1162                 :        178 :         ImpSetUIUnit();
    1163                 :        178 :         ImpReformatAllTextObjects();
    1164                 :            :     }
    1165                 :        178 : }
    1166                 :            : 
    1167                 :       4892 : void SdrModel::TakeUnitStr(FieldUnit eUnit, XubString& rStr)
    1168                 :            : {
    1169   [ -  -  +  -  :       4892 :     switch(eUnit)
          -  -  -  -  -  
             +  -  -  - ]
    1170                 :            :     {
    1171                 :            :         default:
    1172                 :            :         case FUNIT_NONE   :
    1173                 :            :         case FUNIT_CUSTOM :
    1174                 :            :         {
    1175         [ #  # ]:          0 :             rStr = String();
    1176                 :          0 :             break;
    1177                 :            :         }
    1178                 :            :         case FUNIT_100TH_MM:
    1179                 :            :         {
    1180         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("/100mm"));
    1181                 :          0 :             break;
    1182                 :            :         }
    1183                 :            :         case FUNIT_MM     :
    1184                 :            :         {
    1185         [ +  - ]:       4714 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("mm"));
    1186                 :       4714 :             break;
    1187                 :            :         }
    1188                 :            :         case FUNIT_CM     :
    1189                 :            :         {
    1190         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("cm"));
    1191                 :          0 :             break;
    1192                 :            :         }
    1193                 :            :         case FUNIT_M      :
    1194                 :            :         {
    1195         [ #  # ]:          0 :             rStr = String();
    1196                 :          0 :             rStr += sal_Unicode('m');
    1197                 :          0 :             break;
    1198                 :            :         }
    1199                 :            :         case FUNIT_KM     :
    1200                 :            :         {
    1201         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("km"));
    1202                 :          0 :             break;
    1203                 :            :         }
    1204                 :            :         case FUNIT_TWIP   :
    1205                 :            :         {
    1206         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("twip"));
    1207                 :          0 :             break;
    1208                 :            :         }
    1209                 :            :         case FUNIT_POINT  :
    1210                 :            :         {
    1211         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("pt"));
    1212                 :          0 :             break;
    1213                 :            :         }
    1214                 :            :         case FUNIT_PICA   :
    1215                 :            :         {
    1216         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("pica"));
    1217                 :          0 :             break;
    1218                 :            :         }
    1219                 :            :         case FUNIT_INCH   :
    1220                 :            :         {
    1221         [ +  - ]:        178 :             rStr = String();
    1222                 :        178 :             rStr += sal_Unicode('"');
    1223                 :        178 :             break;
    1224                 :            :         }
    1225                 :            :         case FUNIT_FOOT   :
    1226                 :            :         {
    1227         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("ft"));
    1228                 :          0 :             break;
    1229                 :            :         }
    1230                 :            :         case FUNIT_MILE   :
    1231                 :            :         {
    1232         [ #  # ]:          0 :             rStr = UniString(RTL_CONSTASCII_USTRINGPARAM("mile(s)"));
    1233                 :          0 :             break;
    1234                 :            :         }
    1235                 :            :         case FUNIT_PERCENT:
    1236                 :            :         {
    1237         [ #  # ]:          0 :             rStr = String();
    1238                 :          0 :             rStr += sal_Unicode('%');
    1239                 :          0 :             break;
    1240                 :            :         }
    1241                 :            :     }
    1242                 :       4892 : }
    1243                 :            : 
    1244                 :          0 : void SdrModel::TakeMetricStr(long nVal, rtl::OUString& rStr, bool bNoUnitChars, sal_Int32 nNumDigits) const
    1245                 :            : {
    1246                 :            :     // #i22167#
    1247                 :            :     // change to double precision usage to not lose decimal places
    1248                 :          0 :     const bool bNegative(nVal < 0L);
    1249         [ #  # ]:          0 :     SvtSysLocale aSysLoc;
    1250         [ #  # ]:          0 :     const LocaleDataWrapper& rLoc(aSysLoc.GetLocaleData());
    1251         [ #  # ]:          0 :     double fLocalValue(double(nVal) * double(aUIUnitFact));
    1252                 :            : 
    1253         [ #  # ]:          0 :     if(bNegative)
    1254                 :            :     {
    1255                 :          0 :         fLocalValue = -fLocalValue;
    1256                 :            :     }
    1257                 :            : 
    1258         [ #  # ]:          0 :     if( -1 == nNumDigits )
    1259                 :            :     {
    1260                 :          0 :         nNumDigits = rLoc.getNumDigits();
    1261                 :            :     }
    1262                 :            : 
    1263                 :          0 :     sal_Int32 nKomma(nUIUnitKomma);
    1264                 :            : 
    1265         [ #  # ]:          0 :     if(nKomma > nNumDigits)
    1266                 :            :     {
    1267                 :          0 :         const sal_Int32 nDiff(nKomma - nNumDigits);
    1268                 :          0 :         const double fFactor(pow(10.0, static_cast<const int>(nDiff)));
    1269                 :            : 
    1270                 :          0 :         fLocalValue /= fFactor;
    1271                 :          0 :         nKomma = nNumDigits;
    1272                 :            :     }
    1273         [ #  # ]:          0 :     else if(nKomma < nNumDigits)
    1274                 :            :     {
    1275                 :          0 :         const sal_Int32 nDiff(nNumDigits - nKomma);
    1276                 :          0 :         const double fFactor(pow(10.0, static_cast<const int>(nDiff)));
    1277                 :            : 
    1278                 :          0 :         fLocalValue *= fFactor;
    1279                 :          0 :         nKomma = nNumDigits;
    1280                 :            :     }
    1281                 :            : 
    1282                 :          0 :     rtl::OUStringBuffer aBuf;
    1283         [ #  # ]:          0 :     aBuf.append(static_cast<sal_Int32>(fLocalValue + 0.5));
    1284                 :            : 
    1285         [ #  # ]:          0 :     if(nKomma < 0)
    1286                 :            :     {
    1287                 :            :         // negative nKomma (decimal point) means: add zeros
    1288                 :          0 :         sal_Int32 nAnz(-nKomma);
    1289                 :            : 
    1290         [ #  # ]:          0 :         for(sal_Int32 i=0; i<nAnz; i++)
    1291         [ #  # ]:          0 :             aBuf.append(sal_Unicode('0'));
    1292                 :            : 
    1293                 :          0 :         nKomma = 0;
    1294                 :            :     }
    1295                 :            : 
    1296                 :            :     // the second condition needs to be <= since inside this loop
    1297                 :            :     // also the leading zero is inserted.
    1298 [ #  # ][ #  # ]:          0 :     if (nKomma > 0 && aBuf.getLength() <= nKomma)
                 [ #  # ]
    1299                 :            :     {
    1300                 :            :         // if necessary, add zeros before the decimal point
    1301                 :          0 :         sal_Int32 nAnz = nKomma - aBuf.getLength();
    1302                 :            : 
    1303 [ #  # ][ #  # ]:          0 :         if(nAnz >= 0 && rLoc.isNumLeadingZero())
                 [ #  # ]
    1304                 :          0 :             nAnz++;
    1305                 :            : 
    1306         [ #  # ]:          0 :         for(sal_Int32 i=0; i<nAnz; i++)
    1307         [ #  # ]:          0 :             aBuf.insert(0, sal_Unicode('0'));
    1308                 :            :     }
    1309                 :            : 
    1310         [ #  # ]:          0 :     sal_Unicode cDec( rLoc.getNumDecimalSep()[0] );
    1311                 :            : 
    1312                 :            :     // insert KommaChar (decimal point character)
    1313                 :          0 :     sal_Int32 nVorKomma = aBuf.getLength() - nKomma;
    1314                 :            : 
    1315         [ #  # ]:          0 :     if(nKomma > 0)
    1316         [ #  # ]:          0 :         aBuf.insert(nVorKomma, cDec);
    1317                 :            : 
    1318         [ #  # ]:          0 :     if(!rLoc.isNumTrailingZeros())
    1319                 :            :     {
    1320                 :            :         // Remove all trailing zeros.
    1321 [ #  # ][ #  # ]:          0 :         while (aBuf.getLength() && aBuf[aBuf.getLength()-1] == sal_Unicode('0'))
                 [ #  # ]
    1322         [ #  # ]:          0 :             aBuf.remove(aBuf.getLength()-1, 1);
    1323                 :            : 
    1324                 :            :         // Remove decimal if it's the last character.
    1325 [ #  # ][ #  # ]:          0 :         if (aBuf.getLength() && aBuf[aBuf.getLength()-1] == cDec)
                 [ #  # ]
    1326         [ #  # ]:          0 :             aBuf.remove(aBuf.getLength()-1, 1);
    1327                 :            :     }
    1328                 :            : 
    1329                 :            :     // if necessary, add separators before every third digit
    1330         [ #  # ]:          0 :     if( nVorKomma > 3 )
    1331                 :            :     {
    1332 [ #  # ][ #  # ]:          0 :         String aThoSep( rLoc.getNumThousandSep() );
    1333         [ #  # ]:          0 :         if ( aThoSep.Len() > 0 )
    1334                 :            :         {
    1335                 :          0 :             sal_Unicode cTho( aThoSep.GetChar(0) );
    1336                 :          0 :             sal_Int32 i(nVorKomma - 3);
    1337                 :            : 
    1338         [ #  # ]:          0 :             while(i > 0)
    1339                 :            :             {
    1340         [ #  # ]:          0 :                 aBuf.insert(i, cTho);
    1341                 :          0 :                 i -= 3;
    1342                 :            :             }
    1343         [ #  # ]:          0 :         }
    1344                 :            :     }
    1345                 :            : 
    1346         [ #  # ]:          0 :     if (!aBuf.getLength())
    1347         [ #  # ]:          0 :         aBuf.append(sal_Unicode('0'));
    1348                 :            : 
    1349         [ #  # ]:          0 :     if(bNegative)
    1350                 :            :     {
    1351         [ #  # ]:          0 :         aBuf.insert(0, sal_Unicode('-'));
    1352                 :            :     }
    1353                 :            : 
    1354         [ #  # ]:          0 :     if(!bNoUnitChars)
    1355 [ #  # ][ #  # ]:          0 :         aBuf.append(aUIUnitStr);
    1356                 :            : 
    1357 [ #  # ][ #  # ]:          0 :     rStr = aBuf.makeStringAndClear();
    1358                 :          0 : }
    1359                 :            : 
    1360                 :          0 : void SdrModel::TakeWinkStr(long nWink, rtl::OUString& rStr, bool bNoDegChar) const
    1361                 :            : {
    1362                 :          0 :     bool bNeg = nWink < 0;
    1363                 :            : 
    1364         [ #  # ]:          0 :     if(bNeg)
    1365                 :          0 :         nWink = -nWink;
    1366                 :            : 
    1367                 :          0 :     rtl::OUStringBuffer aBuf;
    1368         [ #  # ]:          0 :     aBuf.append(static_cast<sal_Int32>(nWink));
    1369                 :            : 
    1370         [ #  # ]:          0 :     SvtSysLocale aSysLoc;
    1371         [ #  # ]:          0 :     const LocaleDataWrapper& rLoc = aSysLoc.GetLocaleData();
    1372                 :          0 :     sal_Int32 nAnz = 2;
    1373                 :            : 
    1374         [ #  # ]:          0 :     if(rLoc.isNumLeadingZero())
    1375                 :          0 :         nAnz++;
    1376                 :            : 
    1377         [ #  # ]:          0 :     while(aBuf.getLength() < nAnz)
    1378         [ #  # ]:          0 :         aBuf.insert(0, sal_Unicode('0'));
    1379                 :            : 
    1380 [ #  # ][ #  # ]:          0 :     aBuf.insert(aBuf.getLength()-2, rLoc.getNumDecimalSep()[0]);
    1381                 :            : 
    1382         [ #  # ]:          0 :     if(bNeg)
    1383         [ #  # ]:          0 :         aBuf.insert(0, sal_Unicode('-'));
    1384                 :            : 
    1385         [ #  # ]:          0 :     if(!bNoDegChar)
    1386         [ #  # ]:          0 :         aBuf.append(DEGREE_CHAR);
    1387                 :            : 
    1388 [ #  # ][ #  # ]:          0 :     rStr = aBuf.makeStringAndClear();
    1389                 :          0 : }
    1390                 :            : 
    1391                 :          0 : void SdrModel::TakePercentStr(const Fraction& rVal, XubString& rStr, bool bNoPercentChar) const
    1392                 :            : {
    1393                 :          0 :     sal_Int32 nMul(rVal.GetNumerator());
    1394                 :          0 :     sal_Int32 nDiv(rVal.GetDenominator());
    1395                 :          0 :     sal_Bool bNeg(nMul < 0);
    1396                 :            : 
    1397         [ #  # ]:          0 :     if(nDiv < 0)
    1398                 :          0 :         bNeg = !bNeg;
    1399                 :            : 
    1400         [ #  # ]:          0 :     if(nMul < 0)
    1401                 :          0 :         nMul = -nMul;
    1402                 :            : 
    1403         [ #  # ]:          0 :     if(nDiv < 0)
    1404                 :          0 :         nDiv = -nDiv;
    1405                 :            : 
    1406                 :          0 :     nMul *= 100;
    1407                 :          0 :     nMul += nDiv/2;
    1408                 :          0 :     nMul /= nDiv;
    1409                 :            : 
    1410         [ #  # ]:          0 :     rStr = UniString::CreateFromInt32(nMul);
    1411                 :            : 
    1412         [ #  # ]:          0 :     if(bNeg)
    1413                 :          0 :         rStr.Insert(sal_Unicode('-'), 0);
    1414                 :            : 
    1415         [ #  # ]:          0 :     if(!bNoPercentChar)
    1416                 :          0 :         rStr += sal_Unicode('%');
    1417                 :          0 : }
    1418                 :            : 
    1419                 :    2591098 : void SdrModel::SetChanged(sal_Bool bFlg)
    1420                 :            : {
    1421                 :    2591098 :     mbChanged = bFlg;
    1422                 :    2591098 : }
    1423                 :            : 
    1424                 :         51 : void SdrModel::RecalcPageNums(bool bMaster)
    1425                 :            : {
    1426         [ +  + ]:         51 :     if(bMaster)
    1427                 :            :     {
    1428                 :          8 :         sal_uInt16 nAnz=sal_uInt16(maMaPag.size());
    1429                 :            :         sal_uInt16 i;
    1430         [ +  + ]:         72 :         for (i=0; i<nAnz; i++) {
    1431                 :         64 :             SdrPage* pPg=maMaPag[i];
    1432                 :         64 :             pPg->SetPageNum(i);
    1433                 :            :         }
    1434                 :          8 :         bMPgNumsDirty=sal_False;
    1435                 :            :     }
    1436                 :            :     else
    1437                 :            :     {
    1438                 :         43 :         sal_uInt16 nAnz=sal_uInt16(maPages.size());
    1439                 :            :         sal_uInt16 i;
    1440         [ +  + ]:        197 :         for (i=0; i<nAnz; i++) {
    1441                 :        154 :             SdrPage* pPg=maPages[i];
    1442                 :        154 :             pPg->SetPageNum(i);
    1443                 :            :         }
    1444                 :         43 :         bPagNumsDirty=sal_False;
    1445                 :            :     }
    1446                 :         51 : }
    1447                 :            : 
    1448                 :       2572 : void SdrModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
    1449                 :            : {
    1450         [ +  - ]:       2572 :     sal_uInt16 nAnz=GetPageCount();
    1451         [ +  + ]:       2572 :     if (nPos>nAnz) nPos=nAnz;
    1452 [ +  - ][ +  - ]:       2572 :     maPages.insert(maPages.begin()+nPos,pPage);
    1453         [ +  - ]:       2572 :     PageListChanged();
    1454         [ +  - ]:       2572 :     pPage->SetInserted(sal_True);
    1455         [ +  - ]:       2572 :     pPage->SetPageNum(nPos);
    1456         [ +  - ]:       2572 :     pPage->SetModel(this);
    1457         [ +  + ]:       2572 :     if (nPos<nAnz) bPagNumsDirty=sal_True;
    1458         [ +  - ]:       2572 :     SetChanged();
    1459         [ +  - ]:       2572 :     SdrHint aHint(HINT_PAGEORDERCHG);
    1460         [ +  - ]:       2572 :     aHint.SetPage(pPage);
    1461 [ +  - ][ +  - ]:       2572 :     Broadcast(aHint);
    1462                 :       2572 : }
    1463                 :            : 
    1464                 :       2421 : void SdrModel::DeletePage(sal_uInt16 nPgNum)
    1465                 :            : {
    1466                 :       2421 :     SdrPage* pPg=RemovePage(nPgNum);
    1467         [ +  - ]:       2421 :     delete pPg;
    1468                 :       2421 : }
    1469                 :            : 
    1470                 :       2444 : SdrPage* SdrModel::RemovePage(sal_uInt16 nPgNum)
    1471                 :            : {
    1472                 :       2444 :     SdrPage* pPg=maPages[nPgNum];
    1473 [ +  - ][ +  - ]:       2444 :     maPages.erase(maPages.begin()+nPgNum);
    1474         [ +  - ]:       2444 :     PageListChanged();
    1475         [ +  - ]:       2444 :     if (pPg!=NULL) {
    1476         [ +  - ]:       2444 :         pPg->SetInserted(sal_False);
    1477                 :            :     }
    1478                 :       2444 :     bPagNumsDirty=sal_True;
    1479         [ +  - ]:       2444 :     SetChanged();
    1480         [ +  - ]:       2444 :     SdrHint aHint(HINT_PAGEORDERCHG);
    1481         [ +  - ]:       2444 :     aHint.SetPage(pPg);
    1482         [ +  - ]:       2444 :     Broadcast(aHint);
    1483         [ +  - ]:       2444 :     return pPg;
    1484                 :            : }
    1485                 :            : 
    1486                 :          3 : void SdrModel::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
    1487                 :            : {
    1488                 :          3 :     SdrPage* pPg=maPages[nPgNum];
    1489 [ +  - ][ +  - ]:          3 :     maPages.erase(maPages.begin()+nPgNum);
    1490                 :          3 :     PageListChanged();
    1491         [ +  - ]:          3 :     if (pPg!=NULL) {
    1492                 :          3 :         pPg->SetInserted(sal_False);
    1493                 :          3 :         InsertPage(pPg,nNewPos);
    1494                 :            :     }
    1495                 :          3 : }
    1496                 :            : 
    1497                 :        481 : void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
    1498                 :            : {
    1499         [ +  - ]:        481 :     sal_uInt16 nAnz=GetMasterPageCount();
    1500         [ +  + ]:        481 :     if (nPos>nAnz) nPos=nAnz;
    1501 [ +  - ][ +  - ]:        481 :     maMaPag.insert(maMaPag.begin()+nPos,pPage);
    1502         [ +  - ]:        481 :     MasterPageListChanged();
    1503         [ +  - ]:        481 :     pPage->SetInserted(sal_True);
    1504         [ +  - ]:        481 :     pPage->SetPageNum(nPos);
    1505         [ +  - ]:        481 :     pPage->SetModel(this);
    1506         [ +  + ]:        481 :     if (nPos<nAnz) {
    1507                 :          4 :         bMPgNumsDirty=sal_True;
    1508                 :            :     }
    1509         [ +  - ]:        481 :     SetChanged();
    1510         [ +  - ]:        481 :     SdrHint aHint(HINT_PAGEORDERCHG);
    1511         [ +  - ]:        481 :     aHint.SetPage(pPage);
    1512 [ +  - ][ +  - ]:        481 :     Broadcast(aHint);
    1513                 :        481 : }
    1514                 :            : 
    1515                 :        468 : void SdrModel::DeleteMasterPage(sal_uInt16 nPgNum)
    1516                 :            : {
    1517                 :        468 :     SdrPage* pPg=RemoveMasterPage(nPgNum);
    1518 [ +  - ][ +  - ]:        468 :     if (pPg!=NULL) delete pPg;
    1519                 :        468 : }
    1520                 :            : 
    1521                 :        472 : SdrPage* SdrModel::RemoveMasterPage(sal_uInt16 nPgNum)
    1522                 :            : {
    1523                 :        472 :     SdrPage* pRetPg=maMaPag[nPgNum];
    1524 [ +  - ][ +  - ]:        472 :     maMaPag.erase(maMaPag.begin()+nPgNum);
    1525         [ +  - ]:        472 :     MasterPageListChanged();
    1526                 :            : 
    1527         [ +  - ]:        472 :     if(pRetPg)
    1528                 :            :     {
    1529                 :            :         // Now delete the links from the normal drawing pages to the deleted master page.
    1530         [ +  - ]:        472 :         sal_uInt16 nPageAnz(GetPageCount());
    1531                 :            : 
    1532         [ +  + ]:        484 :         for(sal_uInt16 np(0); np < nPageAnz; np++)
    1533                 :            :         {
    1534 [ +  - ][ +  - ]:         12 :             GetPage(np)->TRG_ImpMasterPageRemoved(*pRetPg);
    1535                 :            :         }
    1536                 :            : 
    1537         [ +  - ]:        472 :         pRetPg->SetInserted(sal_False);
    1538                 :            :     }
    1539                 :            : 
    1540                 :        472 :     bMPgNumsDirty=sal_True;
    1541         [ +  - ]:        472 :     SetChanged();
    1542         [ +  - ]:        472 :     SdrHint aHint(HINT_PAGEORDERCHG);
    1543         [ +  - ]:        472 :     aHint.SetPage(pRetPg);
    1544         [ +  - ]:        472 :     Broadcast(aHint);
    1545         [ +  - ]:        472 :     return pRetPg;
    1546                 :            : }
    1547                 :            : 
    1548                 :          0 : void SdrModel::MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
    1549                 :            : {
    1550                 :          0 :     SdrPage* pPg=maMaPag[nPgNum];
    1551 [ #  # ][ #  # ]:          0 :     maMaPag.erase(maMaPag.begin()+nPgNum);
    1552         [ #  # ]:          0 :     MasterPageListChanged();
    1553         [ #  # ]:          0 :     if (pPg!=NULL) {
    1554         [ #  # ]:          0 :         pPg->SetInserted(sal_False);
    1555 [ #  # ][ #  # ]:          0 :         maMaPag.insert(maMaPag.begin()+nNewPos,pPg);
    1556         [ #  # ]:          0 :         MasterPageListChanged();
    1557                 :            :     }
    1558                 :          0 :     bMPgNumsDirty=sal_True;
    1559         [ #  # ]:          0 :     SetChanged();
    1560         [ #  # ]:          0 :     SdrHint aHint(HINT_PAGEORDERCHG);
    1561         [ #  # ]:          0 :     aHint.SetPage(pPg);
    1562 [ #  # ][ #  # ]:          0 :     Broadcast(aHint);
    1563                 :          0 : }
    1564                 :            : 
    1565                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1566                 :            : 
    1567                 :          0 : void SdrModel::CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
    1568                 :            :                          sal_uInt16 nDestPos,
    1569                 :            :                          bool bUndo, bool bMoveNoCopy)
    1570                 :            : {
    1571 [ #  # ][ #  # ]:          0 :     if( bUndo && !IsUndoEnabled() )
                 [ #  # ]
    1572                 :          0 :         bUndo = false;
    1573                 :            : 
    1574         [ #  # ]:          0 :     if( bUndo )
    1575         [ #  # ]:          0 :         BegUndo(ImpGetResStr(STR_UndoMergeModel));
    1576                 :            : 
    1577                 :          0 :     sal_uInt16 nPageAnz=GetPageCount();
    1578                 :          0 :     sal_uInt16 nMaxPage=nPageAnz;
    1579                 :            : 
    1580         [ #  # ]:          0 :     if (nMaxPage!=0)
    1581                 :          0 :         nMaxPage--;
    1582         [ #  # ]:          0 :     if (nFirstPageNum>nMaxPage)
    1583                 :          0 :         nFirstPageNum=nMaxPage;
    1584         [ #  # ]:          0 :     if (nLastPageNum>nMaxPage)
    1585                 :          0 :         nLastPageNum =nMaxPage;
    1586                 :          0 :     bool bReverse=nLastPageNum<nFirstPageNum;
    1587         [ #  # ]:          0 :     if (nDestPos>nPageAnz)
    1588                 :          0 :         nDestPos=nPageAnz;
    1589                 :            : 
    1590                 :            :     // at first, save the pointers of the affected pages in an array
    1591                 :          0 :     sal_uInt16 nPageNum=nFirstPageNum;
    1592         [ #  # ]:          0 :     sal_uInt16 nCopyAnz=((!bReverse)?(nLastPageNum-nFirstPageNum):(nFirstPageNum-nLastPageNum))+1;
    1593                 :          0 :     SdrPage** pPagePtrs=new SdrPage*[nCopyAnz];
    1594                 :            :     sal_uInt16 nCopyNum;
    1595         [ #  # ]:          0 :     for(nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++)
    1596                 :            :     {
    1597                 :          0 :         pPagePtrs[nCopyNum]=GetPage(nPageNum);
    1598         [ #  # ]:          0 :         if (bReverse)
    1599                 :          0 :             nPageNum--;
    1600                 :            :         else
    1601                 :          0 :             nPageNum++;
    1602                 :            :     }
    1603                 :            : 
    1604                 :            :     // now copy the pages
    1605                 :          0 :     sal_uInt16 nDestNum=nDestPos;
    1606         [ #  # ]:          0 :     for (nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++)
    1607                 :            :     {
    1608                 :          0 :         SdrPage* pPg=pPagePtrs[nCopyNum];
    1609                 :          0 :         sal_uInt16 nPageNum2=pPg->GetPageNum();
    1610         [ #  # ]:          0 :         if (!bMoveNoCopy)
    1611                 :            :         {
    1612                 :          0 :             const SdrPage* pPg1=GetPage(nPageNum2);
    1613                 :          0 :             pPg=pPg1->Clone();
    1614                 :          0 :             InsertPage(pPg,nDestNum);
    1615         [ #  # ]:          0 :             if (bUndo)
    1616                 :          0 :                 AddUndo(GetSdrUndoFactory().CreateUndoCopyPage(*pPg));
    1617                 :          0 :             nDestNum++;
    1618                 :            :         }
    1619                 :            :         else
    1620                 :            :         {
    1621                 :            :             // TODO: Move is untested!
    1622         [ #  # ]:          0 :             if (nDestNum>nPageNum2)
    1623                 :          0 :                 nDestNum--;
    1624                 :            : 
    1625         [ #  # ]:          0 :             if(bUndo)
    1626                 :          0 :                 AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*GetPage(nPageNum2),nPageNum2,nDestNum));
    1627                 :            : 
    1628                 :          0 :             pPg=RemovePage(nPageNum2);
    1629                 :          0 :             InsertPage(pPg,nDestNum);
    1630                 :          0 :             nDestNum++;
    1631                 :            :         }
    1632                 :            : 
    1633         [ #  # ]:          0 :         if(bReverse)
    1634                 :          0 :             nPageNum2--;
    1635                 :            :         else
    1636                 :          0 :             nPageNum2++;
    1637                 :            :     }
    1638                 :            : 
    1639         [ #  # ]:          0 :     delete[] pPagePtrs;
    1640         [ #  # ]:          0 :     if(bUndo)
    1641                 :          0 :         EndUndo();
    1642                 :          0 : }
    1643                 :            : 
    1644                 :          0 : void SdrModel::Merge(SdrModel& rSourceModel,
    1645                 :            :                      sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
    1646                 :            :                      sal_uInt16 nDestPos,
    1647                 :            :                      bool bMergeMasterPages, bool bAllMasterPages,
    1648                 :            :                      bool bUndo, bool bTreadSourceAsConst)
    1649                 :            : {
    1650         [ #  # ]:          0 :     if (&rSourceModel==this)
    1651                 :            :     {
    1652                 :          0 :         CopyPages(nFirstPageNum,nLastPageNum,nDestPos,bUndo,!bTreadSourceAsConst);
    1653                 :          0 :         return;
    1654                 :            :     }
    1655                 :            : 
    1656 [ #  # ][ #  # ]:          0 :     if( bUndo && !IsUndoEnabled() )
                 [ #  # ]
    1657                 :          0 :         bUndo = false;
    1658                 :            : 
    1659         [ #  # ]:          0 :     if (bUndo)
    1660         [ #  # ]:          0 :         BegUndo(ImpGetResStr(STR_UndoMergeModel));
    1661                 :            : 
    1662                 :          0 :     sal_uInt16 nSrcPageAnz=rSourceModel.GetPageCount();
    1663                 :          0 :     sal_uInt16 nSrcMasterPageAnz=rSourceModel.GetMasterPageCount();
    1664                 :          0 :     sal_uInt16 nDstMasterPageAnz=GetMasterPageCount();
    1665 [ #  # ][ #  # ]:          0 :     bool bInsPages=(nFirstPageNum<nSrcPageAnz || nLastPageNum<nSrcPageAnz);
    1666         [ #  # ]:          0 :     sal_uInt16 nMaxSrcPage=nSrcPageAnz; if (nMaxSrcPage!=0) nMaxSrcPage--;
    1667         [ #  # ]:          0 :     if (nFirstPageNum>nMaxSrcPage) nFirstPageNum=nMaxSrcPage;
    1668         [ #  # ]:          0 :     if (nLastPageNum>nMaxSrcPage)  nLastPageNum =nMaxSrcPage;
    1669                 :          0 :     bool bReverse=nLastPageNum<nFirstPageNum;
    1670                 :            : 
    1671                 :          0 :     sal_uInt16*   pMasterMap=NULL;
    1672                 :          0 :     bool* pMasterNeed=NULL;
    1673                 :          0 :     sal_uInt16    nMasterNeed=0;
    1674 [ #  # ][ #  # ]:          0 :     if (bMergeMasterPages && nSrcMasterPageAnz!=0) {
    1675                 :            :         // determine which MasterPages from rSrcModel we need
    1676                 :          0 :         pMasterMap=new sal_uInt16[nSrcMasterPageAnz];
    1677                 :          0 :         pMasterNeed=new bool[nSrcMasterPageAnz];
    1678                 :          0 :         memset(pMasterMap,0xFF,nSrcMasterPageAnz*sizeof(sal_uInt16));
    1679         [ #  # ]:          0 :         if (bAllMasterPages) {
    1680                 :          0 :             memset(pMasterNeed, true, nSrcMasterPageAnz * sizeof(bool));
    1681                 :            :         } else {
    1682                 :          0 :             memset(pMasterNeed, false, nSrcMasterPageAnz * sizeof(bool));
    1683         [ #  # ]:          0 :             sal_uInt16 nAnf= bReverse ? nLastPageNum : nFirstPageNum;
    1684         [ #  # ]:          0 :             sal_uInt16 nEnd= bReverse ? nFirstPageNum : nLastPageNum;
    1685         [ #  # ]:          0 :             for (sal_uInt16 i=nAnf; i<=nEnd; i++) {
    1686                 :          0 :                 const SdrPage* pPg=rSourceModel.GetPage(i);
    1687         [ #  # ]:          0 :                 if(pPg->TRG_HasMasterPage())
    1688                 :            :                 {
    1689                 :          0 :                     SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
    1690                 :          0 :                     sal_uInt16 nMPgNum(rMasterPage.GetPageNum());
    1691                 :            : 
    1692         [ #  # ]:          0 :                     if(nMPgNum < nSrcMasterPageAnz)
    1693                 :            :                     {
    1694                 :          0 :                         pMasterNeed[nMPgNum] = true;
    1695                 :            :                     }
    1696                 :            :                 }
    1697                 :            :             }
    1698                 :            :         }
    1699                 :            :         // now determine the Mapping of the MasterPages
    1700                 :          0 :         sal_uInt16 nAktMaPagNum=nDstMasterPageAnz;
    1701         [ #  # ]:          0 :         for (sal_uInt16 i=0; i<nSrcMasterPageAnz; i++) {
    1702         [ #  # ]:          0 :             if (pMasterNeed[i]) {
    1703                 :          0 :                 pMasterMap[i]=nAktMaPagNum;
    1704                 :          0 :                 nAktMaPagNum++;
    1705                 :          0 :                 nMasterNeed++;
    1706                 :            :             }
    1707                 :            :         }
    1708                 :            :     }
    1709                 :            : 
    1710                 :            :     // get the MasterPages
    1711 [ #  # ][ #  # ]:          0 :     if (pMasterMap!=NULL && pMasterNeed!=NULL && nMasterNeed!=0) {
                 [ #  # ]
    1712         [ #  # ]:          0 :         for (sal_uInt16 i=nSrcMasterPageAnz; i>0;) {
    1713                 :          0 :             i--;
    1714         [ #  # ]:          0 :             if (pMasterNeed[i]) {
    1715                 :          0 :                 SdrPage* pPg=NULL;
    1716         [ #  # ]:          0 :                 if (bTreadSourceAsConst) {
    1717         [ #  # ]:          0 :                     const SdrPage* pPg1=rSourceModel.GetMasterPage(i);
    1718         [ #  # ]:          0 :                     pPg=pPg1->Clone();
    1719                 :            :                 } else {
    1720         [ #  # ]:          0 :                     pPg=rSourceModel.RemoveMasterPage(i);
    1721                 :            :                 }
    1722         [ #  # ]:          0 :                 if (pPg!=NULL) {
    1723                 :            :                     // Now append all of them to the end of the DstModel.
    1724                 :            :                     // Don't use InsertMasterPage(), because everything is
    1725                 :            :                     // inconsistent until all are in.
    1726 [ #  # ][ #  # ]:          0 :                     maMaPag.insert(maMaPag.begin()+nDstMasterPageAnz, pPg);
    1727         [ #  # ]:          0 :                     MasterPageListChanged();
    1728         [ #  # ]:          0 :                     pPg->SetInserted(sal_True);
    1729         [ #  # ]:          0 :                     pPg->SetModel(this);
    1730                 :          0 :                     bMPgNumsDirty=sal_True;
    1731 [ #  # ][ #  # ]:          0 :                     if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));
         [ #  # ][ #  # ]
    1732                 :            :                 } else {
    1733                 :            :                     OSL_FAIL("SdrModel::Merge(): MasterPage not found in SourceModel.");
    1734                 :            :                 }
    1735                 :            :             }
    1736                 :            :         }
    1737                 :            :     }
    1738                 :            : 
    1739                 :            :     // get the drawing pages
    1740         [ #  # ]:          0 :     if (bInsPages) {
    1741                 :          0 :         sal_uInt16 nSourcePos=nFirstPageNum;
    1742                 :          0 :         sal_uInt16 nMergeCount=sal_uInt16(Abs((long)((long)nFirstPageNum-nLastPageNum))+1);
    1743         [ #  # ]:          0 :         if (nDestPos>GetPageCount()) nDestPos=GetPageCount();
    1744         [ #  # ]:          0 :         while (nMergeCount>0) {
    1745                 :          0 :             SdrPage* pPg=NULL;
    1746         [ #  # ]:          0 :             if (bTreadSourceAsConst) {
    1747                 :          0 :                 const SdrPage* pPg1=rSourceModel.GetPage(nSourcePos);
    1748                 :          0 :                 pPg=pPg1->Clone();
    1749                 :            :             } else {
    1750                 :          0 :                 pPg=rSourceModel.RemovePage(nSourcePos);
    1751                 :            :             }
    1752         [ #  # ]:          0 :             if (pPg!=NULL) {
    1753                 :          0 :                 InsertPage(pPg,nDestPos);
    1754         [ #  # ]:          0 :                 if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));
    1755                 :            : 
    1756         [ #  # ]:          0 :                 if(pPg->TRG_HasMasterPage())
    1757                 :            :                 {
    1758                 :          0 :                     SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
    1759                 :          0 :                     sal_uInt16 nMaPgNum(rMasterPage.GetPageNum());
    1760                 :            : 
    1761         [ #  # ]:          0 :                     if (bMergeMasterPages)
    1762                 :            :                     {
    1763                 :          0 :                         sal_uInt16 nNeuNum(0xFFFF);
    1764                 :            : 
    1765         [ #  # ]:          0 :                         if(pMasterMap)
    1766                 :            :                         {
    1767                 :          0 :                             nNeuNum = pMasterMap[nMaPgNum];
    1768                 :            :                         }
    1769                 :            : 
    1770         [ #  # ]:          0 :                         if(nNeuNum != 0xFFFF)
    1771                 :            :                         {
    1772         [ #  # ]:          0 :                             if(bUndo)
    1773                 :            :                             {
    1774                 :          0 :                                 AddUndo(GetSdrUndoFactory().CreateUndoPageChangeMasterPage(*pPg));
    1775                 :            :                             }
    1776                 :            : 
    1777                 :          0 :                             pPg->TRG_SetMasterPage(*GetMasterPage(nNeuNum));
    1778                 :            :                         }
    1779                 :            :                         DBG_ASSERT(nNeuNum!=0xFFFF,"SdrModel::Merge(): Something is crooked with the mapping of the MasterPages.");
    1780                 :            :                     } else {
    1781         [ #  # ]:          0 :                         if (nMaPgNum>=nDstMasterPageAnz) {
    1782                 :            :                             // This is outside of the original area of the MasterPage of the DstModel.
    1783                 :          0 :                             pPg->TRG_ClearMasterPage();
    1784                 :            :                         }
    1785                 :            :                     }
    1786                 :            :                 }
    1787                 :            : 
    1788                 :            :             } else {
    1789                 :            :                 OSL_FAIL("SdrModel::Merge(): Drawing page not found in SourceModel.");
    1790                 :            :             }
    1791                 :          0 :             nDestPos++;
    1792         [ #  # ]:          0 :             if (bReverse) nSourcePos--;
    1793         [ #  # ]:          0 :             else if (bTreadSourceAsConst) nSourcePos++;
    1794                 :          0 :             nMergeCount--;
    1795                 :            :         }
    1796                 :            :     }
    1797                 :            : 
    1798         [ #  # ]:          0 :     delete [] pMasterMap;
    1799         [ #  # ]:          0 :     delete [] pMasterNeed;
    1800                 :            : 
    1801                 :          0 :     bMPgNumsDirty=sal_True;
    1802                 :          0 :     bPagNumsDirty=sal_True;
    1803                 :            : 
    1804                 :          0 :     SetChanged();
    1805                 :            :     // TODO: Missing: merging and mapping of layers
    1806                 :            :     // at the objects as well as at the MasterPageDescriptors
    1807         [ #  # ]:          0 :     if (bUndo) EndUndo();
    1808                 :            : }
    1809                 :            : 
    1810                 :          0 : void SdrModel::SetStarDrawPreviewMode(sal_Bool bPreview)
    1811                 :            : {
    1812 [ #  # ][ #  # ]:          0 :     if (!bPreview && bStarDrawPreviewMode && GetPageCount())
         [ #  # ][ #  # ]
    1813                 :            :     {
    1814                 :            :         // Resetting is not allowed, because the Model might not be loaded completely
    1815                 :            :         DBG_ASSERT(sal_False,"SdrModel::SetStarDrawPreviewMode(): Resetting not allowed, because Model might not be complete.");
    1816                 :            :     }
    1817                 :            :     else
    1818                 :            :     {
    1819                 :          0 :         bStarDrawPreviewMode = bPreview;
    1820                 :            :     }
    1821                 :          0 : }
    1822                 :            : 
    1823                 :       4013 : uno::Reference< uno::XInterface > SdrModel::getUnoModel()
    1824                 :            : {
    1825         [ +  + ]:       4013 :     if( !mxUnoModel.is() )
    1826         [ +  - ]:        222 :         mxUnoModel = createUnoModel();
    1827                 :            : 
    1828                 :       4013 :     return mxUnoModel;
    1829                 :            : }
    1830                 :            : 
    1831                 :          0 : void SdrModel::setUnoModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xModel )
    1832                 :            : {
    1833                 :          0 :     mxUnoModel = xModel;
    1834                 :          0 : }
    1835                 :            : 
    1836                 :          0 : uno::Reference< uno::XInterface > SdrModel::createUnoModel()
    1837                 :            : {
    1838                 :            :     OSL_FAIL( "SdrModel::createUnoModel() - base implementation should not be called!" );
    1839                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt;
    1840                 :          0 :     return xInt;
    1841                 :            : }
    1842                 :            : 
    1843                 :       2041 : void SdrModel::setLock( bool bLock )
    1844                 :            : {
    1845         [ +  + ]:       2041 :     if( mbModelLocked != bLock )
    1846                 :            :     {
    1847         [ +  + ]:       1978 :         if( sal_False == bLock )
    1848                 :            :         {
    1849                 :        987 :             ImpReformatAllEdgeObjects();
    1850                 :            :         }
    1851                 :       1978 :         mbModelLocked = bLock;
    1852                 :            :     }
    1853                 :       2041 : }
    1854                 :            : 
    1855                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1856                 :            : 
    1857                 :       5036 : void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel )
    1858                 :            : {
    1859 [ +  - ][ +  - ]:       5036 :     if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) )
                 [ +  - ]
    1860                 :            :     {
    1861         [ -  + ]:       5036 :         if( pNewModel == NULL )
    1862                 :          0 :             pNewModel = this;
    1863                 :            : 
    1864         [ +  - ]:       5036 :         SfxWhichIter aWhichIter(*pSourceSet);
    1865         [ +  - ]:       5036 :         sal_uInt16 nWhich(aWhichIter.FirstWhich());
    1866                 :            :         const SfxPoolItem *pPoolItem;
    1867                 :            : 
    1868         [ +  + ]:     689236 :         while(nWhich)
    1869                 :            :         {
    1870 [ +  - ][ +  + ]:     684200 :             if(SFX_ITEM_SET == pSourceSet->GetItemState(nWhich, sal_False, &pPoolItem))
    1871                 :            :             {
    1872                 :      25882 :                 const SfxPoolItem* pItem = pPoolItem;
    1873                 :            : 
    1874   [ -  -  +  +  :      25882 :                 switch( nWhich )
             -  -  -  + ]
    1875                 :            :                 {
    1876                 :            :                 case XATTR_FILLBITMAP:
    1877         [ #  # ]:          0 :                     pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pNewModel );
    1878                 :          0 :                     break;
    1879                 :            :                 case XATTR_LINEDASH:
    1880         [ #  # ]:          0 :                     pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pNewModel );
    1881                 :          0 :                     break;
    1882                 :            :                 case XATTR_LINESTART:
    1883         [ +  - ]:         13 :                     pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pNewModel );
    1884                 :         13 :                     break;
    1885                 :            :                 case XATTR_LINEEND:
    1886         [ +  - ]:         13 :                     pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pNewModel );
    1887                 :         13 :                     break;
    1888                 :            :                 case XATTR_FILLGRADIENT:
    1889         [ #  # ]:          0 :                     pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pNewModel );
    1890                 :          0 :                     break;
    1891                 :            :                 case XATTR_FILLFLOATTRANSPARENCE:
    1892                 :            :                     // allow all kinds of XFillFloatTransparenceItem to be set
    1893         [ #  # ]:          0 :                     pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pNewModel );
    1894                 :          0 :                     break;
    1895                 :            :                 case XATTR_FILLHATCH:
    1896         [ #  # ]:          0 :                     pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pNewModel );
    1897                 :          0 :                     break;
    1898                 :            :                 }
    1899                 :            : 
    1900                 :            :                 // set item
    1901         [ +  - ]:      25882 :                 if( pItem )
    1902                 :            :                 {
    1903         [ +  - ]:      25882 :                     pDestSet->Put(*pItem);
    1904                 :            : 
    1905                 :            :                     // delete item if it was a generated one
    1906         [ +  + ]:      25882 :                     if( pItem != pPoolItem)
    1907 [ +  - ][ +  - ]:         26 :                         delete (SfxPoolItem*)pItem;
    1908                 :            :                 }
    1909                 :            :             }
    1910         [ +  - ]:     684200 :             nWhich = aWhichIter.NextWhich();
    1911         [ +  - ]:       5036 :         }
    1912                 :            :     }
    1913                 :       5036 : }
    1914                 :            : 
    1915                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1916                 :            : 
    1917                 :       1890 : void SdrModel::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars )
    1918                 :            : {
    1919         [ -  + ]:       1890 :     if( mpForbiddenCharactersTable )
    1920                 :          0 :         mpForbiddenCharactersTable->release();
    1921                 :            : 
    1922                 :       1890 :     mpForbiddenCharactersTable = xForbiddenChars.get();
    1923                 :            : 
    1924         [ +  + ]:       1890 :     if( mpForbiddenCharactersTable )
    1925                 :       1568 :         mpForbiddenCharactersTable->acquire();
    1926                 :            : 
    1927                 :       1890 :     ImpSetOutlinerDefaults( pDrawOutliner );
    1928                 :       1890 :     ImpSetOutlinerDefaults( pHitTestOutliner );
    1929                 :       1890 : }
    1930                 :            : 
    1931                 :      43160 : rtl::Reference<SvxForbiddenCharactersTable> SdrModel::GetForbiddenCharsTable() const
    1932                 :            : {
    1933                 :      43160 :     return mpForbiddenCharactersTable;
    1934                 :            : }
    1935                 :            : 
    1936                 :       1721 : void SdrModel::SetCharCompressType( sal_uInt16 nType )
    1937                 :            : {
    1938         [ +  + ]:       1721 :     if( nType != mnCharCompressType )
    1939                 :            :     {
    1940                 :          5 :         mnCharCompressType = nType;
    1941                 :          5 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1942                 :          5 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1943                 :            :     }
    1944                 :       1721 : }
    1945                 :            : 
    1946                 :        335 : void SdrModel::SetKernAsianPunctuation( sal_Bool bEnabled )
    1947                 :            : {
    1948         [ +  + ]:        335 :     if( mbKernAsianPunctuation != (bool) bEnabled )
    1949                 :            :     {
    1950                 :          2 :         mbKernAsianPunctuation = bEnabled;
    1951                 :          2 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1952                 :          2 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1953                 :            :     }
    1954                 :        335 : }
    1955                 :            : 
    1956                 :       1386 : void SdrModel::SetAddExtLeading( sal_Bool bEnabled )
    1957                 :            : {
    1958         [ +  + ]:       1386 :     if( mbAddExtLeading != (bool) bEnabled )
    1959                 :            :     {
    1960                 :       1384 :         mbAddExtLeading = bEnabled;
    1961                 :       1384 :         ImpSetOutlinerDefaults( pDrawOutliner );
    1962                 :       1384 :         ImpSetOutlinerDefaults( pHitTestOutliner );
    1963                 :            :     }
    1964                 :       1386 : }
    1965                 :            : 
    1966                 :         10 : void SdrModel::ReformatAllTextObjects()
    1967                 :            : {
    1968                 :         10 :     ImpReformatAllTextObjects();
    1969                 :         10 : }
    1970                 :            : 
    1971                 :      23101 : SdrOutliner* SdrModel::createOutliner( sal_uInt16 nOutlinerMode )
    1972                 :            : {
    1973         [ +  + ]:      23101 :     if( NULL == mpOutlinerCache )
    1974         [ +  - ]:        155 :         mpOutlinerCache = new SdrOutlinerCache(this);
    1975                 :            : 
    1976                 :      23101 :     return mpOutlinerCache->createOutliner( nOutlinerMode );
    1977                 :            : }
    1978                 :            : 
    1979                 :      23101 : void SdrModel::disposeOutliner( SdrOutliner* pOutliner )
    1980                 :            : {
    1981         [ +  - ]:      23101 :     if( mpOutlinerCache )
    1982                 :            :     {
    1983                 :      23101 :         mpOutlinerCache->disposeOutliner( pOutliner );
    1984                 :            :     }
    1985                 :            :     else
    1986                 :            :     {
    1987         [ #  # ]:          0 :         delete pOutliner;
    1988                 :            :     }
    1989                 :      23101 : }
    1990                 :            : 
    1991                 :          0 : SvxNumType SdrModel::GetPageNumType() const
    1992                 :            : {
    1993                 :          0 :     return SVX_ARABIC;
    1994                 :            : }
    1995                 :            : 
    1996                 :       2601 : const SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum) const
    1997                 :            : {
    1998                 :            :     DBG_ASSERT(nPgNum < maPages.size(), "SdrModel::GetPage: Access out of range (!)");
    1999                 :       2601 :     return maPages[nPgNum];
    2000                 :            : }
    2001                 :            : 
    2002                 :      89134 : SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum)
    2003                 :            : {
    2004                 :            :     DBG_ASSERT(nPgNum < maPages.size(), "SdrModel::GetPage: Access out of range (!)");
    2005                 :      89134 :     return maPages[nPgNum];
    2006                 :            : }
    2007                 :            : 
    2008                 :      20279 : sal_uInt16 SdrModel::GetPageCount() const
    2009                 :            : {
    2010                 :      20279 :     return sal_uInt16(maPages.size());
    2011                 :            : }
    2012                 :            : 
    2013                 :       9072 : void SdrModel::PageListChanged()
    2014                 :            : {
    2015                 :       9072 : }
    2016                 :            : 
    2017                 :        715 : const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
    2018                 :            : {
    2019                 :            :     DBG_ASSERT(nPgNum < maMaPag.size(), "SdrModel::GetMasterPage: Access out of range (!)");
    2020                 :        715 :     return maMaPag[nPgNum];
    2021                 :            : }
    2022                 :            : 
    2023                 :       2774 : SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum)
    2024                 :            : {
    2025                 :            :     DBG_ASSERT(nPgNum < maMaPag.size(), "SdrModel::GetMasterPage: Access out of range (!)");
    2026                 :       2774 :     return maMaPag[nPgNum];
    2027                 :            : }
    2028                 :            : 
    2029                 :      12072 : sal_uInt16 SdrModel::GetMasterPageCount() const
    2030                 :            : {
    2031                 :      12072 :     return sal_uInt16(maMaPag.size());
    2032                 :            : }
    2033                 :            : 
    2034                 :       5138 : void SdrModel::MasterPageListChanged()
    2035                 :            : {
    2036                 :       5138 : }
    2037                 :            : 
    2038                 :        341 : void SdrModel::SetSdrUndoManager( SfxUndoManager* pUndoManager )
    2039                 :            : {
    2040                 :        341 :     mpImpl->mpUndoManager = pUndoManager;
    2041                 :        341 : }
    2042                 :            : 
    2043                 :          0 : SfxUndoManager* SdrModel::GetSdrUndoManager() const
    2044                 :            : {
    2045                 :          0 :     return mpImpl->mpUndoManager;
    2046                 :            : }
    2047                 :            : 
    2048                 :        497 : SdrUndoFactory& SdrModel::GetSdrUndoFactory() const
    2049                 :            : {
    2050         [ +  + ]:        497 :     if( !mpImpl->mpUndoFactory )
    2051                 :         64 :         mpImpl->mpUndoFactory = new SdrUndoFactory;
    2052                 :        497 :     return *mpImpl->mpUndoFactory;
    2053                 :            : }
    2054                 :            : 
    2055                 :        172 : void SdrModel::SetSdrUndoFactory( SdrUndoFactory* pUndoFactory )
    2056                 :            : {
    2057 [ +  - ][ +  - ]:        172 :     if( pUndoFactory && (pUndoFactory != mpImpl->mpUndoFactory) )
    2058                 :            :     {
    2059         [ -  + ]:        172 :         delete mpImpl->mpUndoFactory;
    2060                 :        172 :         mpImpl->mpUndoFactory = pUndoFactory;
    2061                 :            :     }
    2062                 :        172 : }
    2063                 :            : 
    2064                 :            : /* added for the reporting engine, but does not work
    2065                 :            :    correctly, so only enable it for this model */
    2066                 :          0 : void SdrModel::SetAllowShapePropertyChangeListener( bool bAllow )
    2067                 :            : {
    2068         [ #  # ]:          0 :     if( mpImpl )
    2069                 :            :     {
    2070                 :          0 :         mpImpl->mbAllowShapePropertyChangeListener = bAllow;
    2071                 :            :     }
    2072                 :          0 : }
    2073                 :            : 
    2074                 :            : namespace
    2075                 :            : {
    2076                 :            :     class theSdrModelUnoTunnelImplementationId : public rtl::Static< UnoTunnelIdInit, theSdrModelUnoTunnelImplementationId > {};
    2077                 :            : }
    2078                 :            : 
    2079                 :      11028 : const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImplementationId()
    2080                 :            : {
    2081                 :      11028 :     return theSdrModelUnoTunnelImplementationId::get().getSeq();
    2082                 :            : }
    2083                 :            : 
    2084                 :       1746 : void SdrModel::SetDrawingLayerPoolDefaults()
    2085                 :            : {
    2086         [ +  - ]:       1746 :     const String aNullStr;
    2087                 :       1746 :     const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE);
    2088                 :       1746 :     const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING);
    2089         [ +  - ]:       1746 :     const XHatch aNullHatch(aNullLineCol);
    2090                 :            : 
    2091 [ +  - ][ +  - ]:       1746 :     pItemPool->SetPoolDefaultItem( XFillColorItem(aNullStr,aNullFillCol) );
                 [ +  - ]
    2092 [ +  - ][ +  - ]:       1746 :     pItemPool->SetPoolDefaultItem( XFillHatchItem(pItemPool,aNullHatch) );
                 [ +  - ]
    2093 [ +  - ][ +  - ]:       1746 :     pItemPool->SetPoolDefaultItem( XLineColorItem(aNullStr,aNullLineCol) );
         [ +  - ][ +  - ]
    2094                 :       1746 : }
    2095                 :            : 
    2096                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2097                 :            : 
    2098 [ +  + ][ -  + ]:   18647129 : TYPEINIT1(SdrHint,SfxHint);
    2099                 :            : 
    2100                 :      24979 : SdrHint::SdrHint(SdrHintKind eNewHint)
    2101                 :            : :   mpPage(0L),
    2102                 :            :     mpObj(0L),
    2103                 :            :     mpObjList(0L),
    2104         [ +  - ]:      24979 :     meHint(eNewHint)
    2105                 :            : {
    2106                 :      24979 : }
    2107                 :            : 
    2108                 :     111454 : SdrHint::SdrHint(const SdrObject& rNewObj)
    2109         [ +  - ]:     111454 : :   mpPage(rNewObj.GetPage()),
    2110                 :            :     mpObj(&rNewObj),
    2111         [ +  - ]:     111454 :     mpObjList(rNewObj.GetObjList()),
    2112         [ +  - ]:     111454 :     meHint(HINT_OBJCHG)
    2113                 :            : {
    2114         [ +  - ]:     111454 :     maRectangle = rNewObj.GetLastBoundRect();
    2115                 :     111454 : }
    2116                 :            : 
    2117                 :       6602 : void SdrHint::SetPage(const SdrPage* pNewPage)
    2118                 :            : {
    2119                 :       6602 :     mpPage = pNewPage;
    2120                 :       6602 : }
    2121                 :            : 
    2122                 :          0 : void SdrHint::SetObject(const SdrObject* pNewObj)
    2123                 :            : {
    2124                 :          0 :     mpObj = pNewObj;
    2125                 :          0 : }
    2126                 :            : 
    2127                 :      91794 : void SdrHint::SetKind(SdrHintKind eNewKind)
    2128                 :            : {
    2129                 :      91794 :     meHint = eNewKind;
    2130                 :      91794 : }
    2131                 :            : 
    2132                 :       8469 : const SdrPage* SdrHint::GetPage() const
    2133                 :            : {
    2134                 :       8469 :     return mpPage;
    2135                 :            : }
    2136                 :            : 
    2137                 :     293713 : const SdrObject* SdrHint::GetObject() const
    2138                 :            : {
    2139                 :     293713 :     return mpObj;
    2140                 :            : }
    2141                 :            : 
    2142                 :    5868407 : SdrHintKind SdrHint::GetKind() const
    2143                 :            : {
    2144                 :    5868407 :     return meHint;
    2145                 :            : }
    2146                 :            : 
    2147                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10