LCOV - code coverage report
Current view: top level - sd/source/core - drawdoc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 201 375 53.6 %
Date: 2012-08-25 Functions: 22 30 73.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 227 762 29.8 %

           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 "PageListWatcher.hxx"
      31                 :            : #include <com/sun/star/text/WritingMode.hpp>
      32                 :            : #include <com/sun/star/document/PrinterIndependentLayout.hpp>
      33                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      34                 :            : #include <editeng/forbiddencharacterstable.hxx>
      35                 :            : 
      36                 :            : #include <svx/svxids.hrc>
      37                 :            : #include <svl/srchitem.hxx>
      38                 :            : #include <editeng/eeitem.hxx>
      39                 :            : #include <editeng/scriptspaceitem.hxx>
      40                 :            : 
      41                 :            : #include <unotools/useroptions.hxx>
      42                 :            : 
      43                 :            : #include <sfx2/printer.hxx>
      44                 :            : #include <sfx2/app.hxx>
      45                 :            : #include <sfx2/linkmgr.hxx>
      46                 :            : #include <svx/dialogs.hrc>
      47                 :            : #include "Outliner.hxx"
      48                 :            : #include "app.hxx"
      49                 :            : #include <editeng/editstat.hxx>
      50                 :            : #include <editeng/fontitem.hxx>
      51                 :            : #include <svl/flagitem.hxx>
      52                 :            : #include <svx/svdoattr.hxx>
      53                 :            : #include <svx/svdotext.hxx>
      54                 :            : #include <editeng/bulitem.hxx>
      55                 :            : #include <editeng/numitem.hxx>
      56                 :            : #include <svx/svditer.hxx>
      57                 :            : #include <editeng/unolingu.hxx>
      58                 :            : #include <svl/itempool.hxx>
      59                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      60                 :            : #include <svx/xtable.hxx>
      61                 :            : #include <com/sun/star/linguistic2/XHyphenator.hpp>
      62                 :            : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
      63                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      64                 :            : #include <editeng/outlobj.hxx>
      65                 :            : #include <unotools/saveopt.hxx>
      66                 :            : #include <comphelper/extract.hxx>
      67                 :            : #include <i18npool/mslangid.hxx>
      68                 :            : #include <unotools/charclass.hxx>
      69                 :            : #include <comphelper/processfactory.hxx>
      70                 :            : #include <unotools/pathoptions.hxx>
      71                 :            : #include <unotools/lingucfg.hxx>
      72                 :            : #include <unotools/linguprops.hxx>
      73                 :            : 
      74                 :            : #include "eetext.hxx"
      75                 :            : #include "drawdoc.hxx"
      76                 :            : #include "sdpage.hxx"
      77                 :            : #include "pglink.hxx"
      78                 :            : #include "sdattr.hxx"
      79                 :            : #include "glob.hrc"
      80                 :            : #include "glob.hxx"
      81                 :            : #include "stlpool.hxx"
      82                 :            : #include "sdiocmpt.hxx"
      83                 :            : #include "sdresid.hxx"
      84                 :            : #include "cusshow.hxx"
      85                 :            : #include "customshowlist.hxx"
      86                 :            : #include "../ui/inc/DrawDocShell.hxx"
      87                 :            : #include "../ui/inc/GraphicDocShell.hxx"
      88                 :            : #include "../ui/inc/sdxfer.hxx"
      89                 :            : #include "../ui/inc/ViewShell.hxx"
      90                 :            : #include "../ui/inc/optsitem.hxx"
      91                 :            : #include "../ui/inc/FrameView.hxx"
      92                 :            : 
      93                 :            : #include <tools/tenccvt.hxx>
      94                 :            : 
      95                 :            : using ::rtl::OUString;
      96                 :            : using namespace ::sd;
      97                 :            : using namespace ::com::sun::star;
      98                 :            : using namespace ::com::sun::star::uno;
      99                 :            : using namespace ::com::sun::star::lang;
     100                 :            : using namespace ::com::sun::star::linguistic2;
     101                 :            : 
     102                 :            : //////////////////////////////////////////////////////////////////////////////
     103                 :            : 
     104 [ +  + ][ +  - ]:       1992 : TYPEINIT1( SdDrawDocument, FmFormModel );
     105                 :            : 
     106                 :            : SdDrawDocument* SdDrawDocument::pDocLockedInsertingLinks = NULL;
     107                 :            : 
     108                 :            : //////////////////////////////////////////////////////////////////////////////
     109                 :            : 
     110                 :        178 : PresentationSettings::PresentationSettings()
     111                 :            : :   mbAll( true ),
     112                 :            :     mbEndless( false ),
     113                 :            :     mbCustomShow(false),
     114                 :            :     mbManual( false ),
     115                 :            :     mbMouseVisible( false ),
     116                 :            :     mbMouseAsPen( false ),
     117                 :            :     mbLockedPages( false ),
     118                 :            :     mbAlwaysOnTop( false ),
     119                 :            :     mbFullScreen( true ),
     120                 :            :     mbAnimationAllowed( true ),
     121                 :            :     mnPauseTimeout( 10 ),
     122                 :            :     mbShowPauseLogo( false ),
     123                 :        178 :     mbStartWithNavigator(false)
     124                 :            : {
     125                 :        178 : }
     126                 :            : 
     127                 :            : // ---------------------------------------------------------------------------
     128                 :            : 
     129                 :          0 : PresentationSettings::PresentationSettings( const PresentationSettings& r )
     130                 :            : :   maPresPage( r.maPresPage ),
     131                 :            :     mbAll( r.mbAll ),
     132                 :            :     mbEndless( r.mbEndless ),
     133                 :            :     mbCustomShow( r.mbCustomShow ),
     134                 :            :     mbManual( r.mbManual ),
     135                 :            :     mbMouseVisible( r.mbMouseVisible ),
     136                 :            :     mbMouseAsPen( r.mbMouseAsPen ),
     137                 :            :     mbLockedPages( r.mbLockedPages ),
     138                 :            :     mbAlwaysOnTop( r.mbAlwaysOnTop ),
     139                 :            :     mbFullScreen( r.mbFullScreen ),
     140                 :            :     mbAnimationAllowed( r.mbAnimationAllowed ),
     141                 :            :     mnPauseTimeout( r.mnPauseTimeout ),
     142                 :            :     mbShowPauseLogo( r.mbShowPauseLogo ),
     143                 :          0 :     mbStartWithNavigator( r.mbStartWithNavigator )
     144                 :            : {
     145                 :          0 : }
     146                 :            : 
     147                 :            : // ---------------------------------------------------------------------------
     148                 :            : 
     149                 :        178 : SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
     150         [ +  - ]:        356 : : FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh )
     151                 :            : , mpOutliner(NULL)
     152                 :            : , mpInternalOutliner(NULL)
     153                 :            : , mpWorkStartupTimer(NULL)
     154                 :            : , mpOnlineSpellingTimer(NULL)
     155                 :            : , mpOnlineSpellingList(NULL)
     156                 :            : , mpOnlineSearchItem(NULL)
     157                 :            : , mpCustomShowList(NULL)
     158                 :            : , mpDocSh(static_cast< ::sd::DrawDocShell*>(pDrDocSh))
     159                 :            : , mpCreatingTransferable( NULL )
     160                 :            : , mbHasOnlineSpellErrors(sal_False)
     161                 :            : , mbInitialOnlineSpellingEnabled(sal_True)
     162                 :            : , mbNewOrLoadCompleted(sal_False)
     163                 :            : , mbStartWithPresentation( false )
     164                 :            : , meLanguage( LANGUAGE_SYSTEM )
     165                 :            : , meLanguageCJK( LANGUAGE_SYSTEM )
     166                 :            : , meLanguageCTL( LANGUAGE_SYSTEM )
     167                 :            : , mePageNumType(SVX_ARABIC)
     168                 :            : , mbAllocDocSh(sal_False)
     169                 :            : , meDocType(eType)
     170                 :            : , mpCharClass(NULL)
     171                 :            : , mpLocale(NULL)
     172                 :            : , mpDrawPageListWatcher(0)
     173   [ +  -  +  - ]:        356 : , mpMasterPageListWatcher(0)
         [ +  - ][ +  - ]
     174                 :            : {
     175                 :            :     mpDrawPageListWatcher = ::std::auto_ptr<ImpDrawPageListWatcher>(
     176 [ +  - ][ +  - ]:        178 :         new ImpDrawPageListWatcher(*this));
                 [ +  - ]
     177                 :            :     mpMasterPageListWatcher = ::std::auto_ptr<ImpMasterPageListWatcher>(
     178 [ +  - ][ +  - ]:        178 :         new ImpMasterPageListWatcher(*this));
                 [ +  - ]
     179                 :            : 
     180         [ +  - ]:        178 :     SetObjectShell(pDrDocSh);       // fuer das VCDrawModel
     181                 :            : 
     182         [ +  + ]:        178 :     if (mpDocSh)
     183                 :            :     {
     184         [ +  - ]:        172 :         SetSwapGraphics(sal_True);
     185                 :            :     }
     186                 :            : 
     187                 :            :     // Masseinheit (von App) und Massstab (von SdMod) setzen
     188                 :            :     sal_Int32 nX, nY;
     189 [ +  - ][ +  - ]:        178 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType);
     190         [ +  - ]:        178 :     pOptions->GetScale( nX, nY );
     191                 :            : 
     192                 :            :     // Allow UI scale only for draw documents.
     193         [ +  + ]:        178 :     if( eType == DOCUMENT_TYPE_DRAW )
     194 [ +  - ][ +  - ]:        104 :         SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( nX, nY ) );  // user-defined
                 [ +  - ]
     195                 :            :     else
     196 [ +  - ][ +  - ]:         74 :         SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( 1, 1 ) );    // default
                 [ +  - ]
     197                 :            : 
     198         [ +  - ]:        178 :     SetScaleUnit(MAP_100TH_MM);
     199 [ +  - ][ +  - ]:        178 :     SetScaleFraction(Fraction(1, 1));
     200         [ +  - ]:        178 :     SetDefaultFontHeight(847);     // 24p
     201                 :            : 
     202         [ +  - ]:        178 :     pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
     203         [ +  - ]:        178 :     pItemPool->FreezeIdRanges();
     204         [ +  - ]:        178 :     SetTextDefaults();
     205                 :            : 
     206                 :            :     // die DrawingEngine muss auch wissen, wo er ist
     207 [ +  - ][ +  - ]:        178 :     FmFormModel::SetStyleSheetPool( new SdStyleSheetPool( GetPool(), this ) );
     208                 :            : 
     209                 :            :     // Dem DrawOutliner den StyleSheetPool setzen, damit Textobjekte richtig
     210                 :            :     // eingelesen werden koennen. Der Link zum StyleRequest-Handler des
     211                 :            :     // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
     212                 :            :     // Vorlagen existieren.
     213         [ +  - ]:        178 :     SdrOutliner& rOutliner = GetDrawOutliner();
     214 [ +  - ][ +  - ]:        178 :     rOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     215         [ +  - ]:        178 :     SetCalcFieldValueHdl( &rOutliner );
     216                 :            : 
     217                 :            :     // set linguistic options
     218                 :            :     {
     219         [ +  - ]:        178 :         const SvtLinguConfig    aLinguConfig;
     220         [ +  - ]:        178 :         SvtLinguOptions         aOptions;
     221         [ +  - ]:        178 :         aLinguConfig.GetOptions( aOptions );
     222                 :            : 
     223                 :            :         SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage,
     224 [ +  - ][ +  - ]:        178 :             ::com::sun::star::i18n::ScriptType::LATIN), EE_CHAR_LANGUAGE );
     225                 :            :         SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK,
     226 [ +  - ][ +  - ]:        178 :             ::com::sun::star::i18n::ScriptType::ASIAN), EE_CHAR_LANGUAGE_CJK );
     227                 :            :         SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL,
     228 [ +  - ][ +  - ]:        178 :             ::com::sun::star::i18n::ScriptType::COMPLEX), EE_CHAR_LANGUAGE_CTL );
     229                 :            : 
     230 [ +  - ][ +  - ]:        178 :         mbOnlineSpell = aOptions.bIsSpellAuto;
     231                 :            :     }
     232                 :            : 
     233         [ +  - ]:        178 :     LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage );
     234 [ +  - ][ +  - ]:        178 :     mpLocale = new ::com::sun::star::lang::Locale( MsLangId::convertLanguageToLocale( eRealLanguage ));
     235 [ +  - ][ +  - ]:        178 :     mpCharClass = new CharClass( *mpLocale );
     236                 :            : 
     237                 :            :     // If the current application language is a language that uses right-to-left text...
     238 [ +  - ][ +  - ]:        178 :     LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage();
     239 [ +  - ][ -  + ]:        178 :     if( MsLangId::isRightToLeft( eRealCTLLanguage ) )
     240                 :            :     {
     241                 :            :         // ... then we have to set this as a default
     242         [ #  # ]:          0 :         SetDefaultWritingMode( ::com::sun::star::text::WritingMode_RL_TB );
     243                 :            :     }
     244                 :            : 
     245                 :            :     // for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text
     246 [ +  - ][ +  - ]:        178 :     if (MsLangId::isKorean(eRealCTLLanguage) || (LANGUAGE_JAPANESE == eRealCTLLanguage))
         [ -  + ][ -  + ]
     247                 :            :     {
     248 [ #  # ][ #  # ]:          0 :         GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( sal_False, EE_PARA_ASIANCJKSPACING ) );
         [ #  # ][ #  # ]
     249                 :            :     }
     250                 :            : 
     251                 :            :     // DefTab und SpellOptions setzen
     252                 :            :     // Jetzt am Modul (SD)
     253         [ +  - ]:        178 :     sal_uInt16 nDefTab = pOptions->GetDefTab();
     254         [ +  - ]:        178 :     SetDefaultTabulator( nDefTab );
     255                 :            : 
     256                 :            :     try
     257                 :            :     {
     258         [ +  - ]:        178 :         Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
     259         [ +  - ]:        178 :         if ( xSpellChecker.is() )
     260         [ +  - ]:        178 :             rOutliner.SetSpeller( xSpellChecker );
     261                 :            : 
     262         [ +  - ]:        178 :         Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
     263         [ +  - ]:        178 :         if( xHyphenator.is() )
     264         [ +  - ]:        178 :             rOutliner.SetHyphenator( xHyphenator );
     265                 :            : 
     266 [ +  - ][ +  - ]:        178 :         SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessServiceFactory() ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     267                 :            :     }
     268         [ #  # ]:          0 :     catch(...)
     269                 :            :     {
     270                 :            :         OSL_FAIL("Can't get SpellChecker");
     271                 :            :     }
     272                 :            : 
     273 [ +  - ][ +  - ]:        178 :     rOutliner.SetDefaultLanguage( Application::GetSettings().GetLanguage() );
                 [ +  - ]
     274                 :            : 
     275         [ +  + ]:        178 :     if (mpDocSh)
     276                 :            :     {
     277 [ +  - ][ +  - ]:        172 :         SetLinkManager( new sfx2::LinkManager(mpDocSh) );
     278                 :            :     }
     279                 :            : 
     280         [ +  - ]:        178 :     sal_uLong nCntrl = rOutliner.GetControlWord();
     281                 :        178 :     nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
     282                 :        178 :     nCntrl |= EE_CNTRL_URLSFXEXECUTE;
     283                 :            : 
     284         [ +  - ]:        178 :     if (mbOnlineSpell)
     285                 :        178 :         nCntrl |= EE_CNTRL_ONLINESPELLING;
     286                 :            :     else
     287                 :          0 :         nCntrl &= ~EE_CNTRL_ONLINESPELLING;
     288                 :            : 
     289                 :        178 :     nCntrl &= ~ EE_CNTRL_ULSPACESUMMATION;
     290         [ +  + ]:        178 :     if ( meDocType != DOCUMENT_TYPE_IMPRESS )
     291                 :        104 :         SetSummationOfParagraphs( sal_False );
     292                 :            :     else
     293                 :            :     {
     294         [ +  - ]:         74 :         SetSummationOfParagraphs( pOptions->IsSummationOfParagraphs() );
     295 [ -  + ][ +  - ]:         74 :         if ( pOptions->IsSummationOfParagraphs() )
     296                 :          0 :             nCntrl |= EE_CNTRL_ULSPACESUMMATION;
     297                 :            :     }
     298         [ +  - ]:        178 :     rOutliner.SetControlWord(nCntrl);
     299                 :            : 
     300                 :            :     // Initialize the printer independent layout mode.
     301 [ +  - ][ +  - ]:        178 :     SetPrinterIndependentLayout (pOptions->GetPrinterIndependentLayout());
     302                 :            : 
     303                 :            :     // Dem HitTestOutliner den StyleSheetPool setzen.
     304                 :            :     // Der Link zum StyleRequest-Handler des
     305                 :            :     // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
     306                 :            :     // Vorlagen existieren.
     307 [ +  - ][ +  - ]:        178 :     SfxItemSet aSet2( pHitTestOutliner->GetEmptyItemSet() );
     308 [ +  - ][ +  - ]:        178 :     pHitTestOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)GetStyleSheetPool() );
     309                 :            : 
     310         [ +  - ]:        178 :     SetCalcFieldValueHdl( pHitTestOutliner );
     311                 :            : 
     312                 :            :     try
     313                 :            :     {
     314         [ +  - ]:        178 :         Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
     315         [ +  - ]:        178 :         if ( xSpellChecker.is() )
     316         [ +  - ]:        178 :             pHitTestOutliner->SetSpeller( xSpellChecker );
     317                 :            : 
     318         [ +  - ]:        178 :         Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
     319         [ +  - ]:        178 :         if( xHyphenator.is() )
     320         [ +  - ]:        178 :             pHitTestOutliner->SetHyphenator( xHyphenator );
     321                 :            :     }
     322         [ #  # ]:          0 :     catch(...)
     323                 :            :     {
     324                 :            :         OSL_FAIL("Can't get SpellChecker");
     325                 :            :     }
     326                 :            : 
     327 [ +  - ][ +  - ]:        178 :     pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() );
                 [ +  - ]
     328                 :            : 
     329         [ +  - ]:        178 :     sal_uLong nCntrl2 = pHitTestOutliner->GetControlWord();
     330                 :        178 :     nCntrl2 |= EE_CNTRL_ALLOWBIGOBJS;
     331                 :        178 :     nCntrl2 |= EE_CNTRL_URLSFXEXECUTE;
     332                 :        178 :     nCntrl2 &= ~EE_CNTRL_ONLINESPELLING;
     333                 :            : 
     334                 :        178 :     nCntrl2 &= ~ EE_CNTRL_ULSPACESUMMATION;
     335 [ +  - ][ -  + ]:        178 :     if ( pOptions->IsSummationOfParagraphs() )
     336                 :          0 :         nCntrl2 |= EE_CNTRL_ULSPACESUMMATION;
     337                 :            : 
     338         [ +  - ]:        178 :     pHitTestOutliner->SetControlWord( nCntrl2 );
     339                 :            : 
     340                 :            :     /**************************************************************************
     341                 :            :     * Layer anlegen
     342                 :            :     *
     343                 :            :     * Es werden auf Pages und MasterPages folgende Default-Layer angelegt:
     344                 :            :     *
     345                 :            :     * Layer STR_LAYOUT    : Standardlayer f�r alle Zeichenobjekte
     346                 :            :     *
     347                 :            :     * Layer STR_BCKGRND   : Hintergrund der MasterPage
     348                 :            :     *                       (auf normalen Pages z.Z. keine Verwendung)
     349                 :            :     *
     350                 :            :     * Layer STR_BCKGRNDOBJ: Objekte auf dem Hintergrund der MasterPage
     351                 :            :     *                       (auf normalen Pages z.Z. keine Verwendung)
     352                 :            :     *
     353                 :            :     * Layer STR_CONTROLS  : Standardlayer f�r Controls
     354                 :            :     *
     355                 :            :     **************************************************************************/
     356                 :            :     {
     357 [ +  - ][ +  - ]:        178 :         String aControlLayerName( SdResId(STR_LAYER_CONTROLS) );
     358                 :            : 
     359                 :        178 :         SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
     360 [ +  - ][ +  - ]:        178 :         rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_LAYOUT)) );
         [ +  - ][ +  - ]
     361 [ +  - ][ +  - ]:        178 :         rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRND)) );
         [ +  - ][ +  - ]
     362 [ +  - ][ +  - ]:        178 :         rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRNDOBJ)) );
         [ +  - ][ +  - ]
     363         [ +  - ]:        178 :         rLayerAdmin.NewLayer( aControlLayerName );
     364 [ +  - ][ +  - ]:        178 :         rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_MEASURELINES)) );
         [ +  - ][ +  - ]
     365                 :            : 
     366 [ +  - ][ +  - ]:        178 :         rLayerAdmin.SetControlLayerName(aControlLayerName);
     367         [ +  - ]:        178 :     }
     368                 :            : 
     369                 :            : 
     370                 :        178 : }
     371                 :            : 
     372                 :            : /*************************************************************************
     373                 :            : |*
     374                 :            : |* Destruktor
     375                 :            : |*
     376                 :            : \************************************************************************/
     377                 :            : 
     378 [ +  - ][ +  - ]:        175 : SdDrawDocument::~SdDrawDocument()
         [ +  - ][ +  - ]
                 [ +  - ]
     379                 :            : {
     380 [ +  - ][ +  - ]:        175 :     Broadcast(SdrHint(HINT_MODELCLEARED));
                 [ +  - ]
     381                 :            : 
     382         [ -  + ]:        175 :     if (mpWorkStartupTimer)
     383                 :            :     {
     384         [ #  # ]:          0 :         if ( mpWorkStartupTimer->IsActive() )
     385         [ #  # ]:          0 :             mpWorkStartupTimer->Stop();
     386                 :            : 
     387 [ #  # ][ #  # ]:          0 :         delete mpWorkStartupTimer;
     388                 :          0 :         mpWorkStartupTimer = NULL;
     389                 :            :     }
     390                 :            : 
     391         [ +  - ]:        175 :     StopOnlineSpelling();
     392 [ -  + ][ #  # ]:        175 :     delete mpOnlineSearchItem;
     393                 :        175 :     mpOnlineSearchItem = NULL;
     394                 :            : 
     395         [ +  - ]:        175 :     CloseBookmarkDoc();
     396         [ +  - ]:        175 :     SetAllocDocSh(sal_False);
     397                 :            : 
     398         [ +  - ]:        175 :     ClearModel(sal_True);
     399                 :            : 
     400         [ +  + ]:        175 :     if (pLinkManager)
     401                 :            :     {
     402                 :            :         // BaseLinks freigeben
     403         [ -  + ]:        169 :         if ( !pLinkManager->GetLinks().empty() )
     404                 :            :         {
     405         [ #  # ]:          0 :             pLinkManager->Remove( 0, pLinkManager->GetLinks().size() );
     406                 :            :         }
     407                 :            : 
     408 [ +  - ][ +  - ]:        169 :         delete pLinkManager;
     409                 :        169 :         pLinkManager = NULL;
     410                 :            :     }
     411                 :            : 
     412                 :        175 :     std::vector<sd::FrameView*>::iterator pIter;
     413 [ +  - ][ +  + ]:        190 :     for ( pIter = maFrameViewList.begin(); pIter != maFrameViewList.end(); ++pIter )
     414 [ +  - ][ +  - ]:         15 :         delete *pIter;
     415                 :            : 
     416         [ +  + ]:        175 :     if (mpCustomShowList)
     417                 :            :     {
     418         [ +  + ]:         13 :         for (sal_uLong j = 0; j < mpCustomShowList->size(); j++)
     419                 :            :         {
     420                 :            :             // Ggf. CustomShows loeschen
     421         [ +  - ]:          6 :             SdCustomShow* pCustomShow = (*mpCustomShowList)[j];
     422 [ +  - ][ +  - ]:          6 :             delete pCustomShow;
     423                 :            :         }
     424                 :            : 
     425         [ +  - ]:          7 :         delete mpCustomShowList;
     426                 :          7 :         mpCustomShowList = NULL;
     427                 :            :     }
     428                 :            : 
     429 [ -  + ][ #  # ]:        175 :     delete mpOutliner;
     430                 :        175 :     mpOutliner = NULL;
     431                 :            : 
     432 [ +  + ][ +  - ]:        175 :     delete mpInternalOutliner;
     433                 :        175 :     mpInternalOutliner = NULL;
     434                 :            : 
     435         [ +  - ]:        175 :     delete mpLocale;
     436                 :        175 :     mpLocale = NULL;
     437                 :            : 
     438 [ +  - ][ +  - ]:        175 :     delete mpCharClass;
     439                 :        175 :     mpCharClass = NULL;
     440         [ -  + ]:        350 : }
     441                 :            : 
     442                 :            : /*************************************************************************
     443                 :            : |*
     444                 :            : |* Diese Methode erzeugt ein neues Dokument (SdDrawDocument) und gibt einen
     445                 :            : |* Zeiger darauf zurueck. Die Drawing Engine benutzt diese Methode um das
     446                 :            : |* Dokument oder Teile davon ins Clipboard/DragServer stellen zu koennen.
     447                 :            : |*
     448                 :            : \************************************************************************/
     449                 :            : 
     450                 :          0 : SdrModel* SdDrawDocument::AllocModel() const
     451                 :            : {
     452                 :          0 :     SdDrawDocument* pNewModel = NULL;
     453                 :            : 
     454         [ #  # ]:          0 :     if( mpCreatingTransferable )
     455                 :            :     {
     456                 :            :         // Dokument wird fuer Drag&Drop/Clipboard erzeugt, dafuer muss dem Dokument eine DocShell (SvPersist) bekannt sein
     457                 :          0 :         SfxObjectShell*   pObj = NULL;
     458                 :          0 :         ::sd::DrawDocShell*     pNewDocSh = NULL;
     459                 :            : 
     460         [ #  # ]:          0 :         if( meDocType == DOCUMENT_TYPE_IMPRESS )
     461                 :            :             mpCreatingTransferable->SetDocShell( new ::sd::DrawDocShell(
     462 [ #  # ][ #  # ]:          0 :                 SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) );
     463                 :            :         else
     464                 :            :             mpCreatingTransferable->SetDocShell( new ::sd::GraphicDocShell(
     465 [ #  # ][ #  # ]:          0 :                 SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) );
     466                 :            : 
     467                 :          0 :         pNewDocSh = static_cast< ::sd::DrawDocShell*>( pObj = mpCreatingTransferable->GetDocShell() );
     468                 :          0 :         pNewDocSh->DoInitNew( NULL );
     469                 :          0 :         pNewModel = pNewDocSh->GetDoc();
     470                 :            : 
     471                 :            :         // Nur fuer Clipboard notwendig,
     472                 :            :         // fuer Drag&Drop erfolgt dieses im DragServer
     473                 :          0 :         SdStyleSheetPool* pOldStylePool = (SdStyleSheetPool*) GetStyleSheetPool();
     474                 :          0 :         SdStyleSheetPool* pNewStylePool = (SdStyleSheetPool*) pNewModel->GetStyleSheetPool();
     475                 :            : 
     476                 :          0 :         pNewStylePool->CopyGraphicSheets(*pOldStylePool);
     477                 :          0 :         pNewStylePool->CopyCellSheets(*pOldStylePool);
     478                 :          0 :         pNewStylePool->CopyTableStyles(*pOldStylePool);
     479                 :            : 
     480                 :            : 
     481         [ #  # ]:          0 :         for (sal_uInt16 i = 0; i < GetMasterSdPageCount(PK_STANDARD); i++)
     482                 :            :         {
     483                 :            :             // Alle Layouts der MasterPage mitnehmen
     484 [ #  # ][ #  # ]:          0 :             String aOldLayoutName(((SdDrawDocument*) this)->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName());
     485 [ #  # ][ #  # ]:          0 :             aOldLayoutName.Erase( aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ) );
     486         [ #  # ]:          0 :             SdStyleSheetVector aCreatedSheets;
     487         [ #  # ]:          0 :             pNewStylePool->CopyLayoutSheets(aOldLayoutName, *pOldStylePool, aCreatedSheets );
     488         [ #  # ]:          0 :         }
     489                 :            : 
     490                 :          0 :         pNewModel->NewOrLoadCompleted( DOC_LOADED );  // loaded from source document
     491                 :            :     }
     492         [ #  # ]:          0 :     else if( mbAllocDocSh )
     493                 :            :     {
     494                 :            :         // Es wird eine DocShell erzeugt, welche mit GetAllocedDocSh() zurueckgegeben wird
     495                 :          0 :         SdDrawDocument* pDoc = (SdDrawDocument*) this;
     496                 :          0 :         pDoc->SetAllocDocSh(sal_False);
     497                 :            :         pDoc->mxAllocedDocShRef = new ::sd::DrawDocShell(
     498         [ #  # ]:          0 :             SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType);
     499                 :          0 :         pDoc->mxAllocedDocShRef->DoInitNew(NULL);
     500                 :          0 :         pNewModel = pDoc->mxAllocedDocShRef->GetDoc();
     501                 :            :     }
     502                 :            :     else
     503                 :            :     {
     504         [ #  # ]:          0 :         pNewModel = new SdDrawDocument(meDocType, NULL);
     505                 :            :     }
     506                 :            : 
     507                 :          0 :     return pNewModel;
     508                 :            : }
     509                 :            : 
     510                 :            : /*************************************************************************
     511                 :            : |*
     512                 :            : |* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger
     513                 :            : |* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden
     514                 :            : |* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN
     515                 :            : |* der SdrPage sind).
     516                 :            : |*
     517                 :            : \************************************************************************/
     518                 :            : 
     519                 :       1028 : SdrPage* SdDrawDocument::AllocPage(bool bMasterPage)
     520                 :            : {
     521         [ +  - ]:       1028 :     return new SdPage(*this, NULL, bMasterPage);
     522                 :            : }
     523                 :            : 
     524                 :            : /*************************************************************************
     525                 :            : |*
     526                 :            : |* SetChanged(), das Model wurde geaendert
     527                 :            : |*
     528                 :            : \************************************************************************/
     529                 :            : 
     530                 :      47348 : void SdDrawDocument::SetChanged(sal_Bool bFlag)
     531                 :            : {
     532         [ +  + ]:      47348 :     if (mpDocSh)
     533                 :            :     {
     534 [ +  + ][ +  + ]:      47288 :         if (mbNewOrLoadCompleted && mpDocSh->IsEnableSetModified())
                 [ +  + ]
     535                 :            :         {
     536                 :            :             // weitergeben an Basisklasse
     537                 :       9524 :             FmFormModel::SetChanged(bFlag);
     538                 :            : 
     539                 :            :             // an ObjectShell weiterleiten
     540                 :       9524 :             mpDocSh->SetModified(bFlag);
     541                 :            :         }
     542                 :            :     }
     543                 :            :     else
     544                 :            :     {
     545                 :            :         // weitergeben an Basisklasse
     546                 :         60 :         FmFormModel::SetChanged(bFlag);
     547                 :            :     }
     548                 :      47348 : }
     549                 :            : 
     550                 :            : /*************************************************************************
     551                 :            : |*
     552                 :            : |* NbcSetChanged(), the model changed, don't call anybody else
     553                 :            : |*
     554                 :            : \************************************************************************/
     555                 :            : 
     556                 :       9885 : void SdDrawDocument::NbcSetChanged(sal_Bool bFlag)
     557                 :            : {
     558                 :            :     // forward to baseclass
     559                 :       9885 :     FmFormModel::SetChanged(bFlag);
     560                 :       9885 : }
     561                 :            : 
     562                 :            : /*************************************************************************
     563                 :            : |*
     564                 :            : |* NewOrLoadCompleted
     565                 :            : |*
     566                 :            : |* Wird gerufen, wenn das Dokument geladen wurde bzw. feststeht, dass es
     567                 :            : |* nicht mehr geladen wird.
     568                 :            : |*
     569                 :            : \************************************************************************/
     570                 :            : 
     571                 :        157 : void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode)
     572                 :            : {
     573         [ +  - ]:        157 :     if (eMode == NEW_DOC)
     574                 :            :     {
     575                 :            :         // Neues Dokument:
     576                 :            :         // Praesentations- und Standardvorlagen erzeugen,
     577                 :            :         // Pool fuer virtuelle Controls erzeugen
     578         [ +  - ]:        157 :         CreateLayoutTemplates();
     579         [ +  - ]:        157 :         CreateDefaultCellStyles();
     580                 :            : 
     581         [ +  - ]:        157 :         static_cast< SdStyleSheetPool* >( mxStyleSheetPool.get() )->CreatePseudosIfNecessary();
     582                 :            :     }
     583         [ #  # ]:          0 :     else if (eMode == DOC_LOADED)
     584                 :            :     {
     585                 :            :             // Dokument wurde geladen:
     586                 :            : 
     587         [ #  # ]:          0 :         CheckMasterPages();
     588                 :            : 
     589 [ #  # ][ #  # ]:          0 :         if ( GetMasterSdPageCount(PK_STANDARD) > 1 )
     590         [ #  # ]:          0 :             RemoveUnnecessaryMasterPages( NULL, sal_True, sal_False );
     591                 :            : 
     592 [ #  # ][ #  # ]:          0 :         for ( sal_uInt16 i = 0; i < GetPageCount(); i++ )
     593                 :            :         {
     594                 :            :             // Check for correct layout names
     595         [ #  # ]:          0 :             SdPage* pPage = (SdPage*) GetPage( i );
     596                 :            : 
     597         [ #  # ]:          0 :             if(pPage->TRG_HasMasterPage())
     598                 :            :             {
     599         [ #  # ]:          0 :                 SdPage& rMaster = (SdPage&)pPage->TRG_GetMasterPage();
     600                 :            : 
     601 [ #  # ][ #  # ]:          0 :                 if(rMaster.GetLayoutName() != pPage->GetLayoutName())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     602                 :            :                 {
     603 [ #  # ][ #  # ]:          0 :                     pPage->SetLayoutName(rMaster.GetLayoutName());
                 [ #  # ]
     604                 :            :                 }
     605                 :            :             }
     606                 :            :         }
     607                 :            : 
     608 [ #  # ][ #  # ]:          0 :         for ( sal_uInt16 nPage = 0; nPage < GetMasterPageCount(); nPage++)
     609                 :            :         {
     610                 :            :             // LayoutName and PageName must be the same
     611         [ #  # ]:          0 :             SdPage* pPage = (SdPage*) GetMasterPage( nPage );
     612                 :            : 
     613         [ #  # ]:          0 :             String aName( pPage->GetLayoutName() );
     614 [ #  # ][ #  # ]:          0 :             aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ) );
     615                 :            : 
     616 [ #  # ][ #  # ]:          0 :             if( aName != pPage->GetName() )
                 [ #  # ]
     617         [ #  # ]:          0 :                 pPage->SetName( aName );
     618         [ #  # ]:          0 :         }
     619                 :            : 
     620                 :            :         // Sprachabhaengige Namen der StandardLayer erzeugen
     621         [ #  # ]:          0 :         RestoreLayerNames();
     622                 :            : 
     623                 :            :         // Sprachabhaengige Namen der Vorlagen setzen
     624         [ #  # ]:          0 :         static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->UpdateStdNames();
     625                 :            : 
     626                 :            :         // Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle)
     627         [ #  # ]:          0 :         static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->CreatePseudosIfNecessary();
     628                 :            :     }
     629                 :            : 
     630                 :            :     // Standardvorlage an der Drawing Engine setzen
     631 [ +  - ][ +  - ]:        157 :     String aName( SdResId(STR_STANDARD_STYLESHEET_NAME));
     632         [ +  - ]:        157 :     SetDefaultStyleSheet(static_cast<SfxStyleSheet*>(mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_GRAPHICS)));
     633                 :            : 
     634                 :            :     // Draw-Outliner und  Dokument Outliner initialisieren,
     635                 :            :     // aber nicht den globalen Outliner, den der ist ja nicht
     636                 :            :     // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
     637         [ +  - ]:        157 :     ::Outliner& rDrawOutliner = GetDrawOutliner();
     638 [ +  - ][ +  - ]:        157 :     rDrawOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     639         [ +  - ]:        157 :     sal_uLong nCntrl = rDrawOutliner.GetControlWord();
     640         [ +  - ]:        157 :     if (mbOnlineSpell)
     641                 :        157 :         nCntrl |= EE_CNTRL_ONLINESPELLING;
     642                 :            :     else
     643                 :          0 :         nCntrl &= ~EE_CNTRL_ONLINESPELLING;
     644         [ +  - ]:        157 :     rDrawOutliner.SetControlWord(nCntrl);
     645                 :            : 
     646                 :            :     // HitTest-Outliner und  Dokument Outliner initialisieren,
     647                 :            :     // aber nicht den globalen Outliner, den der ist ja nicht
     648                 :            :     // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
     649 [ +  - ][ +  - ]:        157 :     pHitTestOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     650                 :            : 
     651         [ -  + ]:        157 :     if(mpOutliner)
     652                 :            :     {
     653 [ #  # ][ #  # ]:          0 :         mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     654                 :            :     }
     655         [ -  + ]:        157 :     if(mpInternalOutliner)
     656                 :            :     {
     657 [ #  # ][ #  # ]:          0 :         mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     658                 :            :     }
     659                 :            : 
     660         [ -  + ]:        157 :     if ( eMode == DOC_LOADED )
     661                 :            :     {
     662                 :            :         // Praesentationsobjekte muessen wieder Listener der entsprechenden
     663                 :            :         // Vorlagen werden
     664         [ #  # ]:          0 :         SdStyleSheetPool* pSPool = (SdStyleSheetPool*) GetStyleSheetPool();
     665                 :            :         sal_uInt16 nPage, nPageCount;
     666                 :            : 
     667                 :            :         // create missing layout style sheets for broken documents
     668                 :            :         //         that where created with the 5.2
     669         [ #  # ]:          0 :         nPageCount = GetMasterSdPageCount( PK_STANDARD );
     670         [ #  # ]:          0 :         for (nPage = 0; nPage < nPageCount; nPage++)
     671                 :            :         {
     672         [ #  # ]:          0 :             SdPage* pPage = GetMasterSdPage(nPage, PK_STANDARD);
     673 [ #  # ][ #  # ]:          0 :             pSPool->CreateLayoutStyleSheets( pPage->GetName(), sal_True );
     674                 :            :         }
     675                 :            : 
     676                 :            :         // Standard- und Notizseiten:
     677 [ #  # ][ #  # ]:          0 :         for (nPage = 0; nPage < GetPageCount(); nPage++)
     678                 :            :         {
     679         [ #  # ]:          0 :             SdPage* pPage = (SdPage*)GetPage(nPage);
     680         [ #  # ]:          0 :             NewOrLoadCompleted( pPage, pSPool );
     681                 :            :         }
     682                 :            : 
     683                 :            :         // Masterpages:
     684 [ #  # ][ #  # ]:          0 :         for (nPage = 0; nPage < GetMasterPageCount(); nPage++)
     685                 :            :         {
     686         [ #  # ]:          0 :             SdPage* pPage = (SdPage*)GetMasterPage(nPage);
     687                 :            : 
     688         [ #  # ]:          0 :             NewOrLoadCompleted( pPage, pSPool );
     689                 :            :         }
     690                 :            :     }
     691                 :            : 
     692                 :        157 :     mbNewOrLoadCompleted = sal_True;
     693                 :            : 
     694                 :            :     /**************************************************************************
     695                 :            :     * Alle gelinkten Pages aktualisieren
     696                 :            :     **************************************************************************/
     697                 :        157 :     SdPage* pPage = NULL;
     698         [ +  - ]:        157 :     sal_uInt16 nMaxSdPages = GetSdPageCount(PK_STANDARD);
     699                 :            : 
     700         [ -  + ]:        157 :     for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++)
     701                 :            :     {
     702         [ #  # ]:          0 :         pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD);
     703                 :            : 
     704 [ #  # ][ #  # ]:          0 :         if (pPage && pPage->GetFileName().Len() && pPage->GetBookmarkName().Len())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
     705                 :            :         {
     706         [ #  # ]:          0 :             pPage->SetModel(this);
     707                 :            :         }
     708                 :            :     }
     709                 :            : 
     710         [ +  - ]:        157 :     UpdateAllLinks();
     711                 :            : 
     712 [ +  - ][ +  - ]:        157 :     SetChanged( sal_False );
     713                 :        157 : }
     714                 :            : 
     715                 :            : /** updates all links, only links in this document should by resolved */
     716                 :        168 : void SdDrawDocument::UpdateAllLinks()
     717                 :            : {
     718 [ +  - ][ +  - ]:        168 :     if ( !pDocLockedInsertingLinks && pLinkManager && !pLinkManager->GetLinks().empty() )
         [ -  + ][ -  + ]
     719                 :            :     {
     720                 :          0 :         pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved
     721                 :            : 
     722                 :          0 :         pLinkManager->UpdateAllLinks();  // query box: update all links?
     723                 :            : 
     724         [ #  # ]:          0 :         if( pDocLockedInsertingLinks == this )
     725                 :          0 :             pDocLockedInsertingLinks = NULL;  // unlock inserting links
     726                 :            :     }
     727                 :        168 : }
     728                 :            : 
     729                 :            : /** this loops over the presentation objectes of a page and repairs some new settings
     730                 :            :     from old binary files and resets all default strings for empty presentation objects.
     731                 :            : */
     732                 :          0 : void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool )
     733                 :            : {
     734                 :          0 :     const sd::ShapeList& rPresentationShapes( pPage->GetPresentationShapeList() );
     735         [ #  # ]:          0 :     if(!rPresentationShapes.isEmpty())
     736                 :            :     {
     737                 :            :         // Listen mit Titel- und Gliederungsvorlagen erstellen
     738         [ #  # ]:          0 :         String aName = pPage->GetLayoutName();
     739 [ #  # ][ #  # ]:          0 :         aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ));
     740                 :            : 
     741         [ #  # ]:          0 :         std::vector<SfxStyleSheetBase*> aOutlineList;
     742         [ #  # ]:          0 :         pSPool->CreateOutlineSheetList(aName,aOutlineList);
     743                 :            : 
     744         [ #  # ]:          0 :         SfxStyleSheet* pTitleSheet = (SfxStyleSheet*)pSPool->GetTitleSheet(aName);
     745                 :            : 
     746         [ #  # ]:          0 :         SdrObject* pObj = rPresentationShapes.getNextShape(0);
     747                 :            : 
     748                 :            :         // jetzt nach Titel- und Gliederungstextobjekten suchen und
     749                 :            :         // Objekte zu Listenern machen
     750         [ #  # ]:          0 :         while(pObj)
     751                 :            :         {
     752 [ #  # ][ #  # ]:          0 :             if (pObj->GetObjInventor() == SdrInventor)
     753                 :            :             {
     754         [ #  # ]:          0 :                 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     755         [ #  # ]:          0 :                 sal_uInt16 nId = pObj->GetObjIdentifier();
     756                 :            : 
     757         [ #  # ]:          0 :                 if (nId == OBJ_TITLETEXT)
     758                 :            :                 {
     759 [ #  # ][ #  # ]:          0 :                     if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW )
         [ #  # ][ #  # ]
     760         [ #  # ]:          0 :                         pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT );
     761                 :            : 
     762                 :            :                     // sal_True: harte Attribute dabei nicht loeschen
     763         [ #  # ]:          0 :                     if (pTitleSheet)
     764         [ #  # ]:          0 :                         pObj->SetStyleSheet(pTitleSheet, sal_True);
     765                 :            :                 }
     766         [ #  # ]:          0 :                 else if (nId == OBJ_OUTLINETEXT)
     767                 :            :                 {
     768 [ #  # ][ #  # ]:          0 :                     if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW )
         [ #  # ][ #  # ]
     769         [ #  # ]:          0 :                         pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
     770                 :            : 
     771                 :          0 :                     std::vector<SfxStyleSheetBase*>::iterator iter;
     772 [ #  # ][ #  # ]:          0 :                     for (iter = aOutlineList.begin(); iter != aOutlineList.end(); ++iter)
                 [ #  # ]
     773                 :            :                     {
     774         [ #  # ]:          0 :                         SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(*iter);
     775                 :            : 
     776         [ #  # ]:          0 :                         if (pSheet)
     777                 :            :                         {
     778         [ #  # ]:          0 :                             pObj->StartListening(*pSheet);
     779                 :            : 
     780 [ #  # ][ #  # ]:          0 :                             if( iter == aOutlineList.begin())
     781                 :            :                                 // Textrahmen hoert auf StyleSheet der Ebene1
     782         [ #  # ]:          0 :                                 pObj->NbcSetStyleSheet(pSheet, sal_True);
     783                 :            :                         }
     784                 :            :                     }
     785                 :            :                 }
     786                 :            : 
     787 [ #  # ][ #  # ]:          0 :                 if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     788                 :            :                 {
     789         [ #  # ]:          0 :                     PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj);
     790         [ #  # ]:          0 :                     String aString( pPage->GetPresObjText(ePresObjKind) );
     791                 :            : 
     792         [ #  # ]:          0 :                     if (aString.Len())
     793                 :            :                     {
     794         [ #  # ]:          0 :                         sd::Outliner* pInternalOutl = GetInternalOutliner(sal_True);
     795         [ #  # ]:          0 :                         pPage->SetObjText( (SdrTextObj*) pObj, pInternalOutl, ePresObjKind, aString );
     796 [ #  # ][ #  # ]:          0 :                         pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), sal_True );
     797         [ #  # ]:          0 :                         pInternalOutl->Clear();
     798         [ #  # ]:          0 :                     }
     799                 :            :                 }
     800                 :            :             }
     801                 :            : 
     802         [ #  # ]:          0 :             pObj = rPresentationShapes.getNextShape(pObj);
     803         [ #  # ]:          0 :         }
     804                 :            :     }
     805                 :          0 : }
     806                 :            : 
     807                 :            : /*************************************************************************
     808                 :            : |*
     809                 :            : |* Lokaler Outliner, welcher fuer den Gliederungsmodus verwendet wird
     810                 :            : |* In diesen Outliner werden ggf. OutlinerViews inserted!
     811                 :            : |*
     812                 :            : \************************************************************************/
     813                 :            : 
     814                 :        215 : ::sd::Outliner* SdDrawDocument::GetOutliner(sal_Bool bCreateOutliner)
     815                 :            : {
     816 [ +  - ][ -  + ]:        215 :     if (!mpOutliner && bCreateOutliner)
     817                 :            :     {
     818         [ #  # ]:          0 :         mpOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT );
     819                 :            : 
     820         [ #  # ]:          0 :         if (mpDocSh)
     821                 :          0 :             mpOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
     822                 :            : 
     823                 :          0 :         mpOutliner->SetDefTab( nDefaultTabulator );
     824                 :          0 :         mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     825                 :            :     }
     826                 :            : 
     827                 :        215 :     return(mpOutliner);
     828                 :            : }
     829                 :            : 
     830                 :            : 
     831                 :            : /*************************************************************************
     832                 :            : |*
     833                 :            : |* Interner Outliner, welcher fuer die Erzeugung von Textobjekten
     834                 :            : |* verwendet wird.
     835                 :            : |* In diesen Outliner werden keine OutlinerViews inserted!
     836                 :            : |*
     837                 :            : \************************************************************************/
     838                 :            : 
     839                 :       1965 : ::sd::Outliner* SdDrawDocument::GetInternalOutliner(sal_Bool bCreateOutliner)
     840                 :            : {
     841 [ +  + ][ +  + ]:       1965 :     if ( !mpInternalOutliner && bCreateOutliner )
     842                 :            :     {
     843         [ +  - ]:        154 :         mpInternalOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT );
     844                 :            :         // MT:
     845                 :            :         // Dieser Outliner wird nur fuer das Erzeugen spezieller Textobjekte
     846                 :            :         // verwendet. Da in diesen Textobjekten keine Portion-Informationen
     847                 :            :         // gespeichert werden muessen, kann/soll der Update-Mode immer sal_False bleiben.
     848                 :        154 :         mpInternalOutliner->SetUpdateMode( sal_False );
     849                 :        154 :         mpInternalOutliner->EnableUndo( sal_False );
     850                 :            : 
     851         [ +  - ]:        154 :         if (mpDocSh)
     852                 :        154 :             mpInternalOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
     853                 :            : 
     854                 :        154 :         mpInternalOutliner->SetDefTab( nDefaultTabulator );
     855                 :        154 :         mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool());
     856                 :            :     }
     857                 :            : 
     858                 :            :     DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->GetUpdateMode() == sal_False ) , "InternalOutliner: UpdateMode = sal_True !" );
     859                 :            :     DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->IsUndoEnabled() == sal_False ), "InternalOutliner: Undo = sal_True !" );
     860                 :            : 
     861                 :            :     // MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer:
     862                 :            :     // Vorteile:
     863                 :            :     // a) Keine unnoetigen Clear-Aufrufe
     864                 :            :     // b) Kein Muell im Speicher.
     865                 :            :     DBG_ASSERT( !mpInternalOutliner || ( ( mpInternalOutliner->GetParagraphCount() == 1 ) && ( mpInternalOutliner->GetText( mpInternalOutliner->GetParagraph( 0 ) ).Len() == 0 ) ), "InternalOutliner: Nicht leer!" );
     866                 :            : 
     867                 :       1965 :     return mpInternalOutliner;
     868                 :            : }
     869                 :            : 
     870                 :            : /*************************************************************************
     871                 :            : |*
     872                 :            : |* OnlineSpelling ein/aus
     873                 :            : |*
     874                 :            : \************************************************************************/
     875                 :            : 
     876                 :          0 : void SdDrawDocument::SetOnlineSpell(sal_Bool bIn)
     877                 :            : {
     878                 :          0 :     mbOnlineSpell = bIn;
     879                 :          0 :     sal_uLong nCntrl = 0;
     880                 :            : 
     881         [ #  # ]:          0 :     if(mpOutliner)
     882                 :            :     {
     883                 :          0 :         nCntrl = mpOutliner->GetControlWord();
     884                 :            : 
     885         [ #  # ]:          0 :         if(mbOnlineSpell)
     886                 :          0 :             nCntrl |= EE_CNTRL_ONLINESPELLING;
     887                 :            :         else
     888                 :          0 :             nCntrl &= ~EE_CNTRL_ONLINESPELLING;
     889                 :            : 
     890                 :          0 :         mpOutliner->SetControlWord(nCntrl);
     891                 :            :     }
     892                 :            : 
     893         [ #  # ]:          0 :     if (mpInternalOutliner)
     894                 :            :     {
     895                 :          0 :         nCntrl = mpInternalOutliner->GetControlWord();
     896                 :            : 
     897         [ #  # ]:          0 :         if (mbOnlineSpell)
     898                 :          0 :             nCntrl |= EE_CNTRL_ONLINESPELLING;
     899                 :            :         else
     900                 :          0 :             nCntrl &= ~EE_CNTRL_ONLINESPELLING;
     901                 :            : 
     902                 :          0 :         mpInternalOutliner->SetControlWord(nCntrl);
     903                 :            :     }
     904                 :            : 
     905                 :          0 :     ::Outliner& rOutliner = GetDrawOutliner();
     906                 :            : 
     907                 :          0 :     nCntrl = rOutliner.GetControlWord();
     908                 :            : 
     909         [ #  # ]:          0 :     if (mbOnlineSpell)
     910                 :          0 :         nCntrl |= EE_CNTRL_ONLINESPELLING;
     911                 :            :     else
     912                 :          0 :         nCntrl &= ~EE_CNTRL_ONLINESPELLING;
     913                 :            : 
     914                 :          0 :     rOutliner.SetControlWord(nCntrl);
     915                 :            : 
     916         [ #  # ]:          0 :     if (mbOnlineSpell)
     917                 :            :     {
     918                 :          0 :         StartOnlineSpelling();
     919                 :            :     }
     920                 :            :     else
     921                 :            :     {
     922                 :          0 :         StopOnlineSpelling();
     923                 :            :     }
     924                 :          0 : }
     925                 :            : 
     926                 :            : 
     927                 :            : /*************************************************************************
     928                 :            : |*
     929                 :            : |* OnlineSpelling: Markierung ein/aus
     930                 :            : |*
     931                 :            : \************************************************************************/
     932                 :            : 
     933                 :        154 : uno::Reference< uno::XInterface > SdDrawDocument::createUnoModel()
     934                 :            : {
     935                 :        154 :     uno::Reference< uno::XInterface > xModel;
     936                 :            : 
     937                 :            :     try
     938                 :            :     {
     939         [ +  - ]:        154 :         if ( mpDocSh )
     940 [ +  - ][ +  - ]:        154 :             xModel = mpDocSh->GetModel();
                 [ #  # ]
     941                 :            :     }
     942         [ #  # ]:          0 :     catch( uno::RuntimeException& )
     943                 :            :     {
     944                 :            :     }
     945                 :            : 
     946                 :        154 :     return xModel;
     947                 :            : }
     948                 :            : 
     949                 :       2247 : SvxNumType SdDrawDocument::GetPageNumType() const
     950                 :            : {
     951                 :       2247 :     return mePageNumType;
     952                 :            : }
     953                 :            : 
     954                 :            : 
     955                 :            : 
     956                 :            : 
     957                 :        189 : void SdDrawDocument::SetPrinterIndependentLayout (sal_Int32 nMode)
     958                 :            : {
     959         [ +  - ]:        189 :     switch (nMode)
     960                 :            :     {
     961                 :            :         case ::com::sun::star::document::PrinterIndependentLayout::DISABLED:
     962                 :            :         case ::com::sun::star::document::PrinterIndependentLayout::ENABLED:
     963                 :            :             // Just store supported modes and inform the doc shell.
     964                 :        189 :             mnPrinterIndependentLayout = nMode;
     965                 :            : 
     966                 :            :             // Since it is possible that a SdDrawDocument is constructed without a
     967                 :            :             // SdDrawDocShell the pointer member mpDocSh needs to be tested
     968                 :            :             // before the call is executed. This is e.-g. used for copy/paste.
     969         [ +  + ]:        189 :             if(mpDocSh)
     970                 :            :             {
     971                 :        183 :                 mpDocSh->UpdateRefDevice ();
     972                 :            :             }
     973                 :            : 
     974                 :        189 :             break;
     975                 :            : 
     976                 :            :         default:
     977                 :            :             // Ignore unknown values.
     978                 :          0 :             break;
     979                 :            :     }
     980                 :        189 : }
     981                 :            : 
     982                 :        395 : sal_Int32 SdDrawDocument::GetPrinterIndependentLayout (void)
     983                 :            : {
     984                 :        395 :     return mnPrinterIndependentLayout;
     985                 :            : }
     986                 :            : 
     987                 :          8 : bool SdDrawDocument::IsStartWithPresentation() const
     988                 :            : {
     989                 :          8 :     return mbStartWithPresentation;
     990                 :            : }
     991                 :            : 
     992                 :          0 : void SdDrawDocument::SetStartWithPresentation( bool bStartWithPresentation )
     993                 :            : {
     994                 :          0 :     mbStartWithPresentation = bStartWithPresentation;
     995                 :          0 : }
     996                 :            : 
     997                 :       1260 : void SdDrawDocument::PageListChanged()
     998                 :            : {
     999                 :       1260 :     mpDrawPageListWatcher->Invalidate();
    1000                 :       1260 : }
    1001                 :            : 
    1002                 :       1128 : void SdDrawDocument::MasterPageListChanged()
    1003                 :            : {
    1004                 :       1128 :     mpMasterPageListWatcher->Invalidate();
    1005                 :       1128 : }
    1006                 :            : 
    1007                 :        356 : void SdDrawDocument::SetCalcFieldValueHdl(::Outliner* pOutliner)
    1008                 :            : {
    1009                 :        356 :     pOutliner->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl));
    1010                 :        356 : }
    1011                 :            : 
    1012                 :          0 : sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const rtl::OUString& rAuthor )
    1013                 :            : {
    1014                 :            :     // force current user to have first color
    1015         [ #  # ]:          0 :     if( maAnnotationAuthors.empty() )
    1016                 :            :     {
    1017         [ #  # ]:          0 :         SvtUserOptions aUserOptions;
    1018 [ #  # ][ #  # ]:          0 :         maAnnotationAuthors.push_back( aUserOptions.GetFullName() );
                 [ #  # ]
    1019                 :            :     }
    1020                 :            : 
    1021                 :          0 :     sal_uInt16 idx = 0;
    1022 [ #  # ][ #  # ]:          0 :     for( std::vector< OUString >::iterator iter( maAnnotationAuthors.begin() ); iter != maAnnotationAuthors.end(); iter++ )
                 [ #  # ]
    1023                 :            :     {
    1024         [ #  # ]:          0 :         if( (*iter) == rAuthor )
    1025                 :            :         {
    1026                 :          0 :             break;
    1027                 :            :         }
    1028                 :          0 :         idx++;
    1029                 :            :     }
    1030                 :            : 
    1031         [ #  # ]:          0 :     if( idx == maAnnotationAuthors.size() )
    1032                 :            :     {
    1033                 :          0 :         maAnnotationAuthors.push_back( rAuthor );
    1034                 :            :     }
    1035                 :            : 
    1036                 :          0 :     return idx;
    1037                 :            : }
    1038                 :            : 
    1039                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10