LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - unomodel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 774 1437 53.9 %
Date: 2012-08-25 Functions: 72 115 62.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 957 3000 31.9 %

           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 <com/sun/star/presentation/XPresentation2.hpp>
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      33                 :            : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
      34                 :            : #include <com/sun/star/lang/Locale.hpp>
      35                 :            : #include <com/sun/star/style/XStyle.hpp>
      36                 :            : #include <com/sun/star/awt/XDevice.hpp>
      37                 :            : 
      38                 :            : #include <com/sun/star/embed/Aspects.hpp>
      39                 :            : 
      40                 :            : #include <osl/mutex.hxx>
      41                 :            : #include <comphelper/sequence.hxx>
      42                 :            : #include <comphelper/servicehelper.hxx>
      43                 :            : #include <comphelper/serviceinfohelper.hxx>
      44                 :            : 
      45                 :            : #include <editeng/unofield.hxx>
      46                 :            : #include <unomodel.hxx>
      47                 :            : #include <sfx2/dispatch.hxx>
      48                 :            : #include <sfx2/bindings.hxx>
      49                 :            : #include <vcl/svapp.hxx>
      50                 :            : #include <editeng/UnoForbiddenCharsTable.hxx>
      51                 :            : #include <svx/svdoutl.hxx>
      52                 :            : #include <editeng/forbiddencharacterstable.hxx>
      53                 :            : #include <svx/UnoNamespaceMap.hxx>
      54                 :            : #include <svx/svdlayer.hxx>
      55                 :            : #include <svx/svdsob.hxx>
      56                 :            : #include <svx/unoapi.hxx>
      57                 :            : #include <svx/unofill.hxx>
      58                 :            : #include <svx/unopool.hxx>
      59                 :            : #include <svx/svdorect.hxx>
      60                 :            : #include <editeng/flditem.hxx>
      61                 :            : #include <toolkit/awt/vclxdevice.hxx>
      62                 :            : #include <svx/svdpool.hxx>
      63                 :            : #include <editeng/unolingu.hxx>
      64                 :            : #include <svx/svdpagv.hxx>
      65                 :            : #include <svtools/unoimap.hxx>
      66                 :            : #include <svx/unoshape.hxx>
      67                 :            : #include <editeng/unonrule.hxx>
      68                 :            : #include <editeng/eeitem.hxx>
      69                 :            : 
      70                 :            : // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
      71                 :            : #include <svx/xmleohlp.hxx>
      72                 :            : #include <svx/xmlgrhlp.hxx>
      73                 :            : #include "DrawDocShell.hxx"
      74                 :            : #include "ViewShellBase.hxx"
      75                 :            : #include <UnoDocumentSettings.hxx>
      76                 :            : 
      77                 :            : #include <drawdoc.hxx>
      78                 :            : #include <glob.hrc>
      79                 :            : #include <sdresid.hxx>
      80                 :            : #include <sdpage.hxx>
      81                 :            : 
      82                 :            : #include <strings.hrc>
      83                 :            : #include "unohelp.hxx"
      84                 :            : #include <unolayer.hxx>
      85                 :            : #include <unoprnms.hxx>
      86                 :            : #include <unopage.hxx>
      87                 :            : #include <unocpres.hxx>
      88                 :            : #include <unoobj.hxx>
      89                 :            : #include <stlpool.hxx>
      90                 :            : #include <unopback.hxx>
      91                 :            : #include <unokywds.hxx>
      92                 :            : #include "FrameView.hxx"
      93                 :            : #include "ClientView.hxx"
      94                 :            : #include "ViewShell.hxx"
      95                 :            : #include "app.hrc"
      96                 :            : #include <vcl/pdfextoutdevdata.hxx>
      97                 :            : #include <com/sun/star/presentation/AnimationEffect.hpp>
      98                 :            : #include <com/sun/star/presentation/AnimationSpeed.hpp>
      99                 :            : #include <com/sun/star/presentation/ClickAction.hpp>
     100                 :            : #include <svx/sdr/contact/viewobjectcontact.hxx>
     101                 :            : #include <svx/sdr/contact/viewcontact.hxx>
     102                 :            : #include <svx/sdr/contact/displayinfo.hxx>
     103                 :            : 
     104                 :            : #include <com/sun/star/office/XAnnotation.hpp>
     105                 :            : #include <com/sun/star/office/XAnnotationAccess.hpp>
     106                 :            : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
     107                 :            : #include <com/sun/star/geometry/RealPoint2D.hpp>
     108                 :            : #include <com/sun/star/util/DateTime.hpp>
     109                 :            : 
     110                 :            : using ::rtl::OUString;
     111                 :            : 
     112                 :            : #include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
     113                 :            : 
     114                 :            : using namespace ::osl;
     115                 :            : using namespace ::cppu;
     116                 :            : using namespace ::com::sun::star;
     117                 :            : 
     118                 :            : extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel );
     119                 :            : 
     120                 :            : class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
     121                 :            :                                  public SfxListener
     122                 :            : {
     123                 :            : public:
     124                 :            :     SdUnoForbiddenCharsTable( SdrModel* pModel );
     125                 :            :     ~SdUnoForbiddenCharsTable();
     126                 :            : 
     127                 :            :     // SfxListener
     128                 :            :     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
     129                 :            : protected:
     130                 :            :     virtual void onChange();
     131                 :            : 
     132                 :            : private:
     133                 :            :     SdrModel*   mpModel;
     134                 :            : };
     135                 :            : 
     136                 :         19 : SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel )
     137 [ +  - ][ +  - ]:         19 : : SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel )
     138                 :            : {
     139         [ +  - ]:         19 :     StartListening( *pModel );
     140                 :         19 : }
     141                 :            : 
     142                 :         10 : void SdUnoForbiddenCharsTable::onChange()
     143                 :            : {
     144         [ +  - ]:         10 :     if( mpModel )
     145                 :            :     {
     146                 :         10 :         mpModel->ReformatAllTextObjects();
     147                 :            :     }
     148                 :         10 : }
     149                 :            : 
     150         [ +  - ]:         19 : SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
     151                 :            : {
     152         [ +  - ]:         19 :     if( mpModel )
     153         [ +  - ]:         19 :         EndListening( *mpModel );
     154         [ -  + ]:         38 : }
     155                 :            : 
     156                 :          0 : void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
     157                 :            : {
     158 [ #  # ][ #  # ]:          0 :     const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
     159                 :            : 
     160         [ #  # ]:          0 :     if( pSdrHint )
     161                 :            :     {
     162         [ #  # ]:          0 :         if( HINT_MODELCLEARED == pSdrHint->GetKind() )
     163                 :            :         {
     164                 :          0 :             mpModel = NULL;
     165                 :            :         }
     166                 :            :     }
     167                 :          0 : }
     168                 :            : 
     169                 :            : ///////////////////////////////////////////////////////////////////////
     170                 :            : 
     171                 :            : const sal_Int32 WID_MODEL_LANGUAGE = 1;
     172                 :            : const sal_Int32 WID_MODEL_TABSTOP  = 2;
     173                 :            : const sal_Int32 WID_MODEL_VISAREA  = 3;
     174                 :            : const sal_Int32 WID_MODEL_MAPUNIT  = 4;
     175                 :            : const sal_Int32 WID_MODEL_FORBCHARS= 5;
     176                 :            : const sal_Int32 WID_MODEL_CONTFOCUS = 6;
     177                 :            : const sal_Int32 WID_MODEL_DSGNMODE  = 7;
     178                 :            : const sal_Int32 WID_MODEL_BASICLIBS = 8;
     179                 :            : const sal_Int32 WID_MODEL_RUNTIMEUID = 9;
     180                 :            : const sal_Int32 WID_MODEL_BUILDID = 10;
     181                 :            : const sal_Int32 WID_MODEL_HASVALIDSIGNATURES = 11;
     182                 :            : const sal_Int32 WID_MODEL_DIALOGLIBS = 12;
     183                 :            : 
     184                 :        172 : const SvxItemPropertySet* ImplGetDrawModelPropertySet()
     185                 :            : {
     186                 :            :     // Achtung: Der erste Parameter MUSS sortiert vorliegen !!!
     187                 :            :     const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] =
     188                 :            :     {
     189         [ +  - ]:         22 :         { MAP_CHAR_LEN("BuildId"),                      WID_MODEL_BUILDID,  &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
     190         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_CharLocale),           WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0),     0,  0},
     191         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_TabStop),              WID_MODEL_TABSTOP,  &::getCppuType((const sal_Int32*)0),        0,  0},
     192         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_VisibleArea),          WID_MODEL_VISAREA,  &::getCppuType((const awt::Rectangle*)0),   0,  0},
     193         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_MapUnit),              WID_MODEL_MAPUNIT,  &::getCppuType((const sal_Int16*)0),        beans::PropertyAttribute::READONLY, 0},
     194         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters),  WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 },
     195         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ),  WID_MODEL_CONTFOCUS,    &::getBooleanCppuType(),                    0,  0},
     196         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE,     &::getBooleanCppuType(),                    0,  0},
     197         [ +  - ]:         22 :         { MAP_CHAR_LEN("BasicLibraries"),               WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
     198         [ +  - ]:         22 :         { MAP_CHAR_LEN("DialogLibraries"),              WID_MODEL_DIALOGLIBS,   &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
     199         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_RuntimeUID),           WID_MODEL_RUNTIMEUID,   &::getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0 },
     200         [ +  - ]:         22 :         { MAP_CHAR_LEN(sUNO_Prop_HasValidSignatures),   WID_MODEL_HASVALIDSIGNATURES, &::getCppuType(static_cast< const sal_Bool * >(0)), beans::PropertyAttribute::READONLY, 0 },
     201                 :            :         { 0,0,0,0,0,0 }
     202 [ +  + ][ +  - ]:        194 :     };
                 [ #  # ]
     203 [ +  + ][ +  - ]:        172 :     static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
         [ +  - ][ +  - ]
                 [ #  # ]
     204                 :        172 :     return &aDrawModelPropertySet_Impl;
     205                 :            : }
     206                 :            : 
     207                 :            : // this ctor is used from the DocShell
     208                 :        172 : SdXImpressDocument::SdXImpressDocument (::sd::DrawDocShell* pShell, bool bClipBoard ) throw()
     209                 :            : :   SfxBaseModel( pShell ),
     210                 :            :     mpDocShell( pShell ),
     211                 :            :     mpDoc( pShell ? pShell->GetDoc() : NULL ),
     212                 :            :     mbDisposed(false),
     213 [ +  - ][ +  - ]:        344 :     mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
     214                 :            :     mbClipBoard( bClipBoard ),
     215 [ +  - ][ +  - ]:        516 :     mpPropSet( ImplGetDrawModelPropertySet() )
                 [ +  - ]
           [ +  -  +  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     216                 :            : {
     217         [ +  - ]:        172 :     if( mpDoc )
     218                 :            :     {
     219         [ +  - ]:        172 :         StartListening( *mpDoc );
     220                 :            :     }
     221                 :            :     else
     222                 :            :     {
     223                 :            :         OSL_FAIL("DocShell is invalid");
     224                 :            :     }
     225                 :        172 : }
     226                 :            : 
     227                 :          0 : SdXImpressDocument::SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard ) throw()
     228                 :            : :   SfxBaseModel( NULL ),
     229                 :            :     mpDocShell( NULL ),
     230                 :            :     mpDoc( pDoc ),
     231                 :            :     mbDisposed(false),
     232                 :          0 :     mbImpressDoc( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
     233                 :            :     mbClipBoard( bClipBoard ),
     234   [ #  #  #  # ]:          0 :     mpPropSet( ImplGetDrawModelPropertySet() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     235                 :            : {
     236         [ #  # ]:          0 :     if( mpDoc )
     237                 :            :     {
     238         [ #  # ]:          0 :         StartListening( *mpDoc );
     239                 :            :     }
     240                 :            :     else
     241                 :            :     {
     242                 :            :         OSL_FAIL("SdDrawDocument is invalid");
     243                 :            :     }
     244                 :          0 : }
     245                 :            : 
     246                 :            : /***********************************************************************
     247                 :            : *                                                                      *
     248                 :            : ***********************************************************************/
     249 [ +  - ][ +  - ]:        161 : SdXImpressDocument::~SdXImpressDocument() throw()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     250                 :            : {
     251         [ -  + ]:        322 : }
     252                 :            : 
     253                 :            : // XInterface
     254                 :      74776 : uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
     255                 :            : {
     256                 :      74776 :     uno::Any aAny;
     257                 :            : 
     258 [ +  + ][ +  - ]:      74776 :     QUERYINT(lang::XServiceInfo);
         [ +  - ][ +  - ]
     259 [ +  - ][ +  + ]:      74277 :     else QUERYINT(beans::XPropertySet);
         [ +  - ][ +  - ]
     260 [ +  - ][ +  + ]:      73776 :     else QUERYINT(lang::XMultiServiceFactory);
         [ +  - ][ +  - ]
     261 [ +  - ][ -  + ]:      72706 :     else QUERYINT(drawing::XDrawPageDuplicator);
         [ #  # ][ #  # ]
     262 [ +  - ][ +  + ]:      72706 :     else QUERYINT(drawing::XLayerSupplier);
         [ +  - ][ +  - ]
     263 [ +  - ][ +  + ]:      72679 :     else QUERYINT(drawing::XMasterPagesSupplier);
         [ +  - ][ +  - ]
     264 [ +  - ][ +  + ]:      72546 :     else QUERYINT(drawing::XDrawPagesSupplier);
         [ +  - ][ +  - ]
     265 [ +  - ][ +  + ]:      72192 :     else QUERYINT(presentation::XHandoutMasterSupplier);
         [ +  - ][ +  - ]
     266 [ +  - ][ +  + ]:      72145 :     else QUERYINT(document::XLinkTargetSupplier);
         [ +  - ][ +  - ]
     267 [ +  - ][ +  + ]:      72143 :     else QUERYINT(style::XStyleFamiliesSupplier);
         [ +  - ][ +  - ]
     268 [ +  - ][ +  + ]:      71632 :     else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
         [ +  - ][ +  - ]
     269 [ +  - ][ -  + ]:      71378 :     else QUERYINT(view::XRenderable);
         [ #  # ][ #  # ]
     270 [ +  + ][ +  - ]:      71378 :     else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) )
         [ +  + ][ +  + ]
     271 [ +  - ][ +  - ]:         13 :             aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
     272 [ +  + ][ +  - ]:      71365 :     else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) )
         [ +  + ][ +  + ]
     273 [ +  - ][ +  - ]:         15 :             aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
     274                 :            :     else
     275         [ +  - ]:      71350 :         return SfxBaseModel::queryInterface( rType );
     276                 :            : 
     277                 :      74776 :     return aAny;
     278                 :            : }
     279                 :            : 
     280                 :     187522 : void SAL_CALL SdXImpressDocument::acquire() throw ( )
     281                 :            : {
     282                 :     187522 :     SfxBaseModel::acquire();
     283                 :     187522 : }
     284                 :            : 
     285                 :     187500 : void SAL_CALL SdXImpressDocument::release() throw ( )
     286                 :            : {
     287         [ +  + ]:     187500 :     if (osl_decrementInterlockedCount( &m_refCount ) == 0)
     288                 :            :     {
     289                 :            :         // restore reference count:
     290                 :        161 :         osl_incrementInterlockedCount( &m_refCount );
     291         [ -  + ]:        161 :         if(!mbDisposed)
     292                 :            :         {
     293                 :            :             try
     294                 :            :             {
     295         [ #  # ]:          0 :                 dispose();
     296                 :            :             }
     297                 :          0 :             catch (const uno::RuntimeException& exc)
     298                 :            :             { // don't break throw ()
     299                 :            :                 OSL_FAIL(
     300                 :            :                     OUStringToOString(
     301                 :            :                         exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
     302                 :            :                 static_cast<void>(exc);
     303                 :            :             }
     304                 :            :         }
     305                 :        161 :         SfxBaseModel::release();
     306                 :            :     }
     307         [ #  # ]:     187500 : }
     308                 :            : 
     309                 :            : namespace
     310                 :            : {
     311                 :            :     class theSdXImpressDocumentUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdXImpressDocumentUnoTunnelId> {};
     312                 :            : }
     313                 :            : 
     314                 :            : // XUnoTunnel
     315                 :      12202 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() throw()
     316                 :            : {
     317                 :      12202 :     return theSdXImpressDocumentUnoTunnelId::get().getSeq();
     318                 :            : }
     319                 :            : 
     320                 :        587 : SdXImpressDocument* SdXImpressDocument::getImplementation( const uno::Reference< uno::XInterface >& xInt )
     321                 :            : {
     322         [ +  - ]:        587 :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
     323         [ +  - ]:        587 :     if( xUT.is() )
     324 [ +  - ][ +  - ]:        587 :         return reinterpret_cast<SdXImpressDocument*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( SdXImpressDocument::getUnoTunnelId() )));
     325                 :            :     else
     326                 :        587 :         return NULL;
     327                 :            : }
     328                 :            : 
     329                 :      11615 : sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException)
     330                 :            : {
     331         [ +  - ]:      11615 :     if( rIdentifier.getLength() == 16 )
     332                 :            :     {
     333         [ +  + ]:      11615 :         if( (0 == memcmp( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
     334                 :        587 :             return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     335                 :            : 
     336         [ -  + ]:      11028 :         if( (0 == memcmp( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
     337                 :          0 :             return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc));
     338                 :            :     }
     339                 :            : 
     340                 :      11615 :     return SfxBaseModel::getSomething( rIdentifier );
     341                 :            : }
     342                 :            : 
     343                 :            : // XTypeProvider
     344                 :        146 : uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes(  ) throw(uno::RuntimeException)
     345                 :            : {
     346         [ +  - ]:        146 :     ::SolarMutexGuard aGuard;
     347                 :            : 
     348         [ +  + ]:        146 :     if( maTypeSequence.getLength() == 0 )
     349                 :            :     {
     350         [ +  - ]:        130 :         const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() );
     351                 :        130 :         const sal_Int32 nBaseTypes = aBaseTypes.getLength();
     352                 :        130 :         const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
     353                 :            : 
     354         [ +  + ]:        130 :         const sal_Int32 nOwnTypes = mbImpressDoc ? 14 : 11;     // !DANGER! Keep this updated!
     355                 :            : 
     356         [ +  - ]:        130 :         maTypeSequence.realloc(  nBaseTypes + nOwnTypes );
     357         [ +  - ]:        130 :         uno::Type* pTypes = maTypeSequence.getArray();
     358                 :            : 
     359         [ +  - ]:        130 :         *pTypes++ = ITYPE(beans::XPropertySet);
     360         [ +  - ]:        130 :         *pTypes++ = ITYPE(lang::XServiceInfo);
     361         [ +  - ]:        130 :         *pTypes++ = ITYPE(lang::XMultiServiceFactory);
     362         [ +  - ]:        130 :         *pTypes++ = ITYPE(drawing::XDrawPageDuplicator);
     363         [ +  - ]:        130 :         *pTypes++ = ITYPE(drawing::XLayerSupplier);
     364         [ +  - ]:        130 :         *pTypes++ = ITYPE(drawing::XMasterPagesSupplier);
     365         [ +  - ]:        130 :         *pTypes++ = ITYPE(drawing::XDrawPagesSupplier);
     366         [ +  - ]:        130 :         *pTypes++ = ITYPE(document::XLinkTargetSupplier);
     367         [ +  - ]:        130 :         *pTypes++ = ITYPE(style::XStyleFamiliesSupplier);
     368         [ +  - ]:        130 :         *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory);
     369         [ +  - ]:        130 :         *pTypes++ = ITYPE(view::XRenderable);
     370         [ +  + ]:        130 :         if( mbImpressDoc )
     371                 :            :         {
     372         [ +  - ]:         26 :             *pTypes++ = ITYPE(presentation::XPresentationSupplier);
     373         [ +  - ]:         26 :             *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier);
     374         [ +  - ]:         26 :             *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier);
     375                 :            :         }
     376                 :            : 
     377         [ +  + ]:       4550 :         for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
     378         [ +  - ]:       4550 :             *pTypes++ = *pBaseTypes++;
     379                 :            :     }
     380                 :            : 
     381 [ +  - ][ +  - ]:        146 :     return maTypeSequence;
     382                 :            : }
     383                 :            : 
     384                 :            : namespace
     385                 :            : {
     386                 :            :     class theSdXImpressDocumentImplementationId : public rtl::Static< UnoTunnelIdInit, theSdXImpressDocumentImplementationId > {};
     387                 :            : }
     388                 :            : 
     389                 :        146 : uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId(  ) throw(uno::RuntimeException)
     390                 :            : {
     391                 :        146 :     return theSdXImpressDocumentImplementationId::get().getSeq();
     392                 :            : }
     393                 :            : 
     394                 :            : /***********************************************************************
     395                 :            : *                                                                      *
     396                 :            : ***********************************************************************/
     397                 :      20274 : void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     398                 :            : {
     399         [ +  + ]:      20274 :     if( mpDoc )
     400                 :            :     {
     401 [ +  - ][ +  + ]:      20079 :         const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
     402                 :            : 
     403         [ +  + ]:      20079 :         if( pSdrHint )
     404                 :            :         {
     405         [ +  + ]:       7540 :             if( hasEventListeners() )
     406                 :            :             {
     407         [ +  - ]:       3390 :                 document::EventObject aEvent;
     408 [ +  - ][ +  + ]:       3390 :                 if( SvxUnoDrawMSFactory::createEvent( mpDoc, pSdrHint, aEvent ) )
     409 [ +  - ][ +  - ]:       3390 :                     notifyEvent( aEvent );
     410                 :            :             }
     411                 :            : 
     412         [ -  + ]:       7540 :             if( pSdrHint->GetKind() == HINT_MODELCLEARED )
     413                 :            :             {
     414         [ #  # ]:          0 :                 if( mpDoc )
     415                 :          0 :                     EndListening( *mpDoc );
     416                 :          0 :                 mpDoc = NULL;
     417                 :          0 :                 mpDocShell = NULL;
     418                 :            :             }
     419                 :            :         }
     420                 :            :         else
     421                 :            :         {
     422 [ +  - ][ +  + ]:      12539 :             const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
     423                 :            : 
     424                 :            :             // ist unser SdDrawDocument gerade gestorben?
     425 [ +  + ][ -  + ]:      12539 :             if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
                 [ -  + ]
     426                 :            :             {
     427                 :            :                 // yup, also schnell ein neues erfragen
     428         [ #  # ]:          0 :                 if( mpDocShell )
     429                 :            :                 {
     430                 :          0 :                     SdDrawDocument *pNewDoc = mpDocShell->GetDoc();
     431                 :            : 
     432                 :            :                     // ist ueberhaupt ein neues da?
     433         [ #  # ]:          0 :                     if( pNewDoc != mpDoc )
     434                 :            :                     {
     435                 :          0 :                         mpDoc = pNewDoc;
     436         [ #  # ]:          0 :                         if(mpDoc)
     437                 :          0 :                             StartListening( *mpDoc );
     438                 :            :                     }
     439                 :            :                 }
     440                 :            :             }
     441                 :            :         }
     442                 :            :     }
     443                 :      20274 :     SfxBaseModel::Notify( rBC, rHint );
     444                 :      20274 : }
     445                 :            : 
     446                 :            : /******************************************************************************
     447                 :            : *                                                                             *
     448                 :            : ******************************************************************************/
     449                 :         41 : SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw()
     450                 :            : {
     451                 :         41 :     sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
     452                 :         41 :     SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
     453 [ +  - ][ +  - ]:         41 :     sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
                 [ +  - ]
     454 [ +  - ][ +  - ]:         41 :     sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
                 [ +  - ]
     455                 :            : 
     456                 :         41 :     SdPage* pStandardPage = NULL;
     457                 :            : 
     458         [ -  + ]:         41 :     if( 0 == nPageCount )
     459                 :            :     {
     460                 :            :         // this is only used for clipboard where we only have one page
     461         [ #  # ]:          0 :         pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
     462                 :            : 
     463                 :          0 :         Size aDefSize(21000, 29700);   // A4-Hochformat
     464         [ #  # ]:          0 :         pStandardPage->SetSize( aDefSize );
     465         [ #  # ]:          0 :         mpDoc->InsertPage(pStandardPage, 0);
     466                 :            :     }
     467                 :            :     else
     468                 :            :     {
     469                 :            :         // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll
     470         [ +  - ]:         41 :         SdPage* pPreviousStandardPage = mpDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD );
     471         [ +  - ]:         41 :         SetOfByte aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers();
     472                 :         41 :         sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd );
     473                 :         41 :         sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj );
     474                 :            : 
     475                 :            :         // AutoLayouts must be ready
     476         [ +  - ]:         41 :         mpDoc->StopWorkStartupDelay();
     477                 :            : 
     478                 :            :         /**************************************************************
     479                 :            :         * Es wird stets zuerst eine Standardseite und dann eine
     480                 :            :         * Notizseite erzeugt. Es ist sichergestellt, dass auf eine
     481                 :            :         * Standardseite stets die zugehoerige Notizseite folgt.
     482                 :            :         **************************************************************/
     483                 :            : 
     484         [ +  - ]:         41 :         sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
     485         [ +  - ]:         41 :         SdPage* pPreviousNotesPage = (SdPage*) mpDoc->GetPage( nStandardPageNum - 1 );
     486                 :         41 :         sal_uInt16 nNotesPageNum = nStandardPageNum + 1;
     487         [ +  - ]:         41 :         String aStandardPageName;
     488         [ +  - ]:         41 :         String aNotesPageName;
     489                 :            : 
     490                 :            :         /**************************************************************
     491                 :            :         * Standardpage
     492                 :            :         **************************************************************/
     493         [ -  + ]:         41 :         if( bDuplicate )
     494         [ #  # ]:          0 :             pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
     495                 :            :         else
     496         [ +  - ]:         41 :             pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
     497                 :            : 
     498 [ +  - ][ +  - ]:         41 :         pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
     499                 :         41 :         pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
     500                 :         41 :                                     pPreviousStandardPage->GetUppBorder(),
     501                 :         41 :                                     pPreviousStandardPage->GetRgtBorder(),
     502 [ +  - ][ +  - ]:         41 :                                     pPreviousStandardPage->GetLwrBorder() );
         [ +  - ][ +  - ]
                 [ +  - ]
     503 [ +  - ][ +  - ]:         41 :         pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() );
     504         [ +  - ]:         41 :         pStandardPage->SetName(aStandardPageName);
     505                 :            : 
     506                 :            :         // Seite hinter aktueller Seite einfuegen
     507         [ +  - ]:         41 :         mpDoc->InsertPage(pStandardPage, nStandardPageNum);
     508                 :            : 
     509         [ +  - ]:         41 :         if( !bDuplicate )
     510                 :            :         {
     511                 :            :             // MasterPage der aktuellen Seite verwenden
     512 [ +  - ][ +  - ]:         41 :             pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
     513 [ +  - ][ +  - ]:         41 :             pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
                 [ +  - ]
     514         [ +  - ]:         41 :             pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True );
     515                 :            :         }
     516                 :            : 
     517 [ +  - ][ +  - ]:         41 :         aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
         [ +  - ][ +  - ]
     518 [ +  - ][ +  - ]:         41 :         aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
         [ +  - ][ +  - ]
     519                 :         41 :         aVisibleLayers.Set(aBckgrnd, bIsPageBack);
     520                 :         41 :         aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
     521         [ +  - ]:         41 :         pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
     522                 :            : 
     523                 :            :         /**************************************************************
     524                 :            :         * Notespage
     525                 :            :         **************************************************************/
     526                 :         41 :         SdPage* pNotesPage = NULL;
     527                 :            : 
     528         [ -  + ]:         41 :         if( bDuplicate )
     529         [ #  # ]:          0 :             pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
     530                 :            :         else
     531         [ +  - ]:         41 :             pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
     532                 :            : 
     533 [ +  - ][ +  - ]:         41 :         pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
     534                 :         41 :         pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(),
     535                 :         41 :                                 pPreviousNotesPage->GetUppBorder(),
     536                 :         41 :                                 pPreviousNotesPage->GetRgtBorder(),
     537 [ +  - ][ +  - ]:         41 :                                 pPreviousNotesPage->GetLwrBorder() );
         [ +  - ][ +  - ]
                 [ +  - ]
     538 [ +  - ][ +  - ]:         41 :         pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
     539         [ +  - ]:         41 :         pNotesPage->SetName(aNotesPageName);
     540                 :         41 :         pNotesPage->SetPageKind(PK_NOTES);
     541                 :            : 
     542                 :            :         // Seite hinter aktueller Seite einfuegen
     543         [ +  - ]:         41 :         mpDoc->InsertPage(pNotesPage, nNotesPageNum);
     544                 :            : 
     545         [ +  - ]:         41 :         if( !bDuplicate )
     546                 :            :         {
     547                 :            :             // MasterPage der aktuellen Seite verwenden
     548 [ +  - ][ +  - ]:         41 :             pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
     549 [ +  - ][ +  - ]:         41 :             pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
                 [ +  - ]
     550         [ +  - ]:         41 :             pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True );
     551 [ +  - ][ +  - ]:         41 :         }
     552                 :            :     }
     553                 :            : 
     554                 :         41 :     SetModified();
     555                 :            : 
     556                 :         41 :     return( pStandardPage );
     557                 :            : }
     558                 :            : 
     559                 :       5220 : void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw()
     560                 :            : {
     561         [ +  - ]:       5220 :     if( mpDoc )
     562                 :       5220 :         mpDoc->SetChanged( bModified );
     563                 :       5220 : }
     564                 :            : 
     565                 :            : // XModel
     566                 :         28 : void SAL_CALL SdXImpressDocument    ::lockControllers(  )
     567                 :            :     throw(uno::RuntimeException)
     568                 :            : {
     569         [ +  - ]:         28 :     ::SolarMutexGuard aGuard;
     570                 :            : 
     571         [ -  + ]:         28 :     if( NULL == mpDoc )
     572         [ #  # ]:          0 :         throw lang::DisposedException();
     573                 :            : 
     574 [ +  - ][ +  - ]:         28 :     mpDoc->setLock(true);
     575                 :         28 : }
     576                 :            : 
     577                 :         28 : void SAL_CALL SdXImpressDocument::unlockControllers(  )
     578                 :            :     throw(uno::RuntimeException)
     579                 :            : {
     580         [ +  - ]:         28 :     ::SolarMutexGuard aGuard;
     581                 :            : 
     582         [ -  + ]:         28 :     if( NULL == mpDoc )
     583         [ #  # ]:          0 :         throw lang::DisposedException();
     584                 :            : 
     585         [ +  - ]:         28 :     if( mpDoc->isLocked() )
     586                 :            :     {
     587         [ +  - ]:         28 :         mpDoc->setLock(false);
     588         [ +  - ]:         28 :     }
     589                 :         28 : }
     590                 :            : 
     591                 :          8 : sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked(  )
     592                 :            :     throw(uno::RuntimeException)
     593                 :            : {
     594         [ +  - ]:          8 :     ::SolarMutexGuard aGuard;
     595                 :            : 
     596         [ -  + ]:          8 :     if( NULL == mpDoc )
     597         [ #  # ]:          0 :         throw lang::DisposedException();
     598                 :            : 
     599 [ +  - ][ -  + ]:          8 :     return mpDoc && mpDoc->isLocked();
                 [ +  - ]
     600                 :            : }
     601                 :            : 
     602                 :            : #include <comphelper/processfactory.hxx>
     603                 :            : 
     604                 :        298 : uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException )
     605                 :            : {
     606         [ +  - ]:        298 :     ::SolarMutexGuard aGuard;
     607                 :            : 
     608         [ -  + ]:        298 :     if( NULL == mpDoc )
     609         [ #  # ]:          0 :         throw lang::DisposedException();
     610                 :            : 
     611         [ +  - ]:        298 :     uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
     612                 :            : 
     613         [ +  + ]:        298 :     if( !xRet.is() )
     614                 :            :     {
     615                 :        144 :         const std::vector<sd::FrameView*> &rList = mpDoc->GetFrameViewList();
     616                 :            : 
     617         [ -  + ]:        144 :         if( !rList.empty() )
     618                 :            :         {
     619 [ #  # ][ #  # ]:          0 :             xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.IndexedPropertyValues"));
         [ #  # ][ #  # ]
                 [ #  # ]
     620                 :            : 
     621                 :            : 
     622         [ #  # ]:          0 :             uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY );
     623                 :            :             DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
     624         [ #  # ]:          0 :             if( xCont.is() )
     625                 :            :             {
     626         [ #  # ]:          0 :                 for( sal_uInt32 i = 0, n = rList.size(); i < n; i++ )
     627                 :            :                 {
     628                 :          0 :                     ::sd::FrameView* pFrameView = rList[ i ];
     629                 :            : 
     630         [ #  # ]:          0 :                     uno::Sequence< beans::PropertyValue > aSeq;
     631         [ #  # ]:          0 :                     pFrameView->WriteUserDataSequence( aSeq );
     632 [ #  # ][ #  # ]:          0 :                     xCont->insertByIndex( i, uno::makeAny( aSeq ) );
                 [ #  # ]
     633         [ #  # ]:          0 :                 }
     634                 :          0 :             }
     635                 :            :         }
     636                 :            :     }
     637                 :            : 
     638         [ +  - ]:        298 :     return xRet;
     639                 :            : }
     640                 :            : 
     641                 :         23 : void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException)
     642                 :            : {
     643         [ +  - ]:         23 :     ::SolarMutexGuard aGuard;
     644                 :            : 
     645         [ -  + ]:         23 :     if( NULL == mpDoc )
     646         [ #  # ]:          0 :         throw lang::DisposedException();
     647                 :            : 
     648         [ +  - ]:         23 :     SfxBaseModel::setViewData( xData );
     649 [ +  - ][ +  + ]:         23 :     if( mpDocShell && (mpDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() )
         [ +  - ][ +  + ]
     650                 :            :     {
     651 [ +  - ][ +  - ]:          3 :         const sal_Int32 nCount = xData->getCount();
     652                 :            : 
     653                 :          3 :         std::vector<sd::FrameView*>::iterator pIter;
     654                 :          3 :         std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
     655                 :            : 
     656 [ +  - ][ -  + ]:          3 :         for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter )
     657 [ #  # ][ #  # ]:          0 :             delete *pIter;
     658                 :            : 
     659                 :          3 :         rViews.clear();
     660                 :            : 
     661                 :            :         ::sd::FrameView* pFrameView;
     662         [ +  - ]:          3 :         uno::Sequence< beans::PropertyValue > aSeq;
     663         [ +  + ]:          6 :         for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
     664                 :            :         {
     665 [ +  - ][ +  - ]:          3 :             if( xData->getByIndex( nIndex ) >>= aSeq )
         [ +  - ][ +  - ]
     666                 :            :             {
     667 [ +  - ][ +  - ]:          3 :                 pFrameView = new ::sd::FrameView( mpDoc );
     668                 :            : 
     669         [ +  - ]:          3 :                 pFrameView->ReadUserDataSequence( aSeq );
     670         [ +  - ]:          3 :                 rViews.push_back( pFrameView );
     671                 :            :             }
     672         [ +  - ]:          3 :         }
     673         [ +  - ]:         23 :     }
     674                 :         23 : }
     675                 :            : 
     676                 :            : // XDrawPageDuplicator
     677                 :          0 : uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage )
     678                 :            :     throw(uno::RuntimeException)
     679                 :            : {
     680         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
     681                 :            : 
     682         [ #  # ]:          0 :     if( NULL == mpDoc )
     683         [ #  # ]:          0 :         throw lang::DisposedException();
     684                 :            : 
     685                 :            :     // pPage von xPage besorgen und dann die Id (nPos )ermitteln
     686         [ #  # ]:          0 :     SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
     687         [ #  # ]:          0 :     if( pSvxPage )
     688                 :            :     {
     689                 :          0 :         SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
     690         [ #  # ]:          0 :         sal_uInt16 nPos = pPage->GetPageNum();
     691                 :          0 :         nPos = ( nPos - 1 ) / 2;
     692                 :          0 :         pPage = InsertSdPage( nPos, sal_True );
     693         [ #  # ]:          0 :         if( pPage )
     694                 :            :         {
     695 [ #  # ][ #  # ]:          0 :             uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
     696                 :          0 :             return xDrawPage;
     697                 :            :         }
     698                 :            :     }
     699                 :            : 
     700                 :          0 :     uno::Reference< drawing::XDrawPage > xDrawPage;
     701         [ #  # ]:          0 :     return xDrawPage;
     702                 :            : }
     703                 :            : 
     704                 :            : 
     705                 :            : // XDrawPagesSupplier
     706                 :        418 : uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages()
     707                 :            :     throw(uno::RuntimeException)
     708                 :            : {
     709         [ +  - ]:        418 :     ::SolarMutexGuard aGuard;
     710                 :            : 
     711         [ -  + ]:        418 :     if( NULL == mpDoc )
     712         [ #  # ]:          0 :         throw lang::DisposedException();
     713                 :            : 
     714         [ +  - ]:        418 :     uno::Reference< drawing::XDrawPages >  xDrawPages( mxDrawPagesAccess );
     715                 :            : 
     716         [ +  + ]:        418 :     if( !xDrawPages.is() )
     717                 :            :     {
     718         [ +  - ]:        189 :         initializeDocument();
     719 [ +  - ][ +  - ]:        189 :         mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this);
                 [ +  - ]
     720                 :            :     }
     721                 :            : 
     722         [ +  - ]:        418 :     return xDrawPages;
     723                 :            : }
     724                 :            : 
     725                 :            : // XMasterPagesSupplier
     726                 :        173 : uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages()
     727                 :            :     throw(uno::RuntimeException)
     728                 :            : {
     729         [ +  - ]:        173 :     ::SolarMutexGuard aGuard;
     730                 :            : 
     731         [ -  + ]:        173 :     if( NULL == mpDoc )
     732         [ #  # ]:          0 :         throw lang::DisposedException();
     733                 :            : 
     734         [ +  - ]:        173 :     uno::Reference< drawing::XDrawPages >  xMasterPages( mxMasterPagesAccess );
     735                 :            : 
     736         [ +  + ]:        173 :     if( !xMasterPages.is() )
     737                 :            :     {
     738         [ +  - ]:        123 :         initializeDocument();
     739 [ +  - ][ +  - ]:        123 :         mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
                 [ +  - ]
     740                 :            :     }
     741                 :            : 
     742         [ +  - ]:        173 :     return xMasterPages;
     743                 :            : }
     744                 :            : 
     745                 :            : // XLayerManagerSupplier
     746                 :         27 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager(  )
     747                 :            :     throw(uno::RuntimeException)
     748                 :            : {
     749         [ +  - ]:         27 :     ::SolarMutexGuard aGuard;
     750                 :            : 
     751         [ -  + ]:         27 :     if( NULL == mpDoc )
     752         [ #  # ]:          0 :         throw lang::DisposedException();
     753                 :            : 
     754         [ +  - ]:         27 :     uno::Reference< container::XNameAccess >  xLayerManager( mxLayerManager );
     755                 :            : 
     756         [ +  - ]:         27 :     if( !xLayerManager.is() )
     757 [ +  - ][ +  - ]:         27 :         mxLayerManager = xLayerManager = new SdLayerManager(*this);
                 [ +  - ]
     758                 :            : 
     759         [ +  - ]:         27 :     return xLayerManager;
     760                 :            : }
     761                 :            : 
     762                 :            : // XCustomPresentationSupplier
     763                 :         15 : uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations()
     764                 :            :     throw(uno::RuntimeException)
     765                 :            : {
     766         [ +  - ]:         15 :     ::SolarMutexGuard aGuard;
     767                 :            : 
     768         [ -  + ]:         15 :     if( NULL == mpDoc )
     769         [ #  # ]:          0 :         throw lang::DisposedException();
     770                 :            : 
     771         [ +  - ]:         15 :     uno::Reference< container::XNameContainer >  xCustomPres( mxCustomPresentationAccess );
     772                 :            : 
     773         [ +  - ]:         15 :     if( !xCustomPres.is() )
     774 [ +  - ][ +  - ]:         15 :         mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this);
                 [ +  - ]
     775                 :            : 
     776         [ +  - ]:         15 :     return xCustomPres;
     777                 :            : }
     778                 :            : 
     779                 :            : extern uno::Reference< presentation::XPresentation > createPresentation( SdXImpressDocument& rModel );
     780                 :            : 
     781                 :            : // XPresentationSupplier
     782                 :         13 : uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation()
     783                 :            :     throw(uno::RuntimeException)
     784                 :            : {
     785         [ +  - ]:         13 :     ::SolarMutexGuard aGuard;
     786                 :            : 
     787         [ -  + ]:         13 :     if( NULL == mpDoc )
     788         [ #  # ]:          0 :         throw lang::DisposedException();
     789                 :            : 
     790 [ +  - ][ +  - ]:         13 :     return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() );
         [ +  - ][ +  - ]
     791                 :            : }
     792                 :            : 
     793                 :            : // XHandoutMasterSupplier
     794                 :         47 : uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage()
     795                 :            :     throw (uno::RuntimeException)
     796                 :            : {
     797         [ +  - ]:         47 :     ::SolarMutexGuard aGuard;
     798                 :            : 
     799         [ -  + ]:         47 :     if( NULL == mpDoc )
     800         [ #  # ]:          0 :         throw lang::DisposedException();
     801                 :            : 
     802                 :         47 :     uno::Reference< drawing::XDrawPage > xPage;
     803                 :            : 
     804         [ +  - ]:         47 :     if( mpDoc )
     805                 :            :     {
     806         [ +  - ]:         47 :         initializeDocument();
     807         [ +  - ]:         47 :         SdPage* pPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
     808         [ +  - ]:         47 :         if( pPage )
     809 [ +  - ][ +  - ]:         47 :             xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
                 [ +  - ]
     810                 :            :     }
     811         [ +  - ]:         47 :     return xPage;
     812                 :            : }
     813                 :            : 
     814                 :            : // XMultiServiceFactory ( SvxFmMSFactory )
     815                 :       1095 : uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier )
     816                 :            :     throw(uno::Exception, uno::RuntimeException)
     817                 :            : {
     818         [ +  - ]:       1095 :     ::SolarMutexGuard aGuard;
     819                 :            : 
     820         [ -  + ]:       1095 :     if( NULL == mpDoc )
     821         [ #  # ]:          0 :         throw lang::DisposedException();
     822                 :            : 
     823         [ +  + ]:       1095 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
     824                 :            :     {
     825         [ +  + ]:         26 :         if( !mxDashTable.is() )
     826 [ +  - ][ +  - ]:         17 :             mxDashTable = SvxUnoDashTable_createInstance( mpDoc );
     827                 :            : 
     828                 :         26 :         return mxDashTable;
     829                 :            :     }
     830         [ +  + ]:       1069 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
     831                 :            :     {
     832         [ +  + ]:         26 :         if( !mxGradientTable.is() )
     833 [ +  - ][ +  - ]:         17 :             mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc );
     834                 :            : 
     835                 :         26 :         return mxGradientTable;
     836                 :            :     }
     837         [ +  + ]:       1043 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
     838                 :            :     {
     839         [ +  + ]:         26 :         if( !mxHatchTable.is() )
     840 [ +  - ][ +  - ]:         17 :             mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc );
     841                 :            : 
     842                 :         26 :         return mxHatchTable;
     843                 :            :     }
     844         [ +  + ]:       1017 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
     845                 :            :     {
     846         [ +  + ]:         23 :         if( !mxBitmapTable.is() )
     847 [ +  - ][ +  - ]:         17 :             mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc );
     848                 :            : 
     849                 :         23 :         return mxBitmapTable;
     850                 :            :     }
     851         [ +  + ]:        994 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
     852                 :            :     {
     853         [ +  + ]:         23 :         if( !mxTransGradientTable.is() )
     854 [ +  - ][ +  - ]:         17 :             mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc );
     855                 :            : 
     856                 :         23 :         return mxTransGradientTable;
     857                 :            :     }
     858         [ +  + ]:        971 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
     859                 :            :     {
     860         [ +  + ]:         37 :         if( !mxMarkerTable.is() )
     861 [ +  - ][ +  - ]:         20 :             mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc );
     862                 :            : 
     863                 :         37 :         return mxMarkerTable;
     864                 :            :     }
     865         [ +  + ]:        934 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
     866                 :            :     {
     867         [ +  - ]:         34 :         return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY );
     868                 :            :     }
     869         [ +  + ]:        900 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) )
     870                 :            :     {
     871                 :            :         return uno::Reference< uno::XInterface >(
     872         [ +  - ]:         43 :             static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc )));
     873                 :            :     }
     874                 :            : 
     875         [ +  + ]:        857 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) )
     876                 :            :     {
     877         [ +  + ]:         23 :         if( !mxDrawingPool.is() )
     878 [ +  - ][ +  - ]:         17 :             mxDrawingPool = SdUnoCreatePool( mpDoc );
     879                 :            : 
     880                 :         23 :         return mxDrawingPool;
     881                 :            : 
     882                 :            :     }
     883                 :            : 
     884         [ -  + ]:        834 :     if ( aServiceSpecifier == sUNO_Service_ImageMapRectangleObject )
     885                 :            :     {
     886 [ #  # ][ #  # ]:          0 :         return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
     887                 :            :     }
     888                 :            : 
     889         [ -  + ]:        834 :     if ( aServiceSpecifier == sUNO_Service_ImageMapCircleObject )
     890                 :            :     {
     891 [ #  # ][ #  # ]:          0 :         return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
     892                 :            :     }
     893                 :            : 
     894         [ -  + ]:        834 :     if ( aServiceSpecifier == sUNO_Service_ImageMapPolygonObject )
     895                 :            :     {
     896 [ #  # ][ #  # ]:          0 :         return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
     897                 :            :     }
     898                 :            : 
     899         [ +  + ]:       1638 :     if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) ||
           [ +  +  +  - ]
           [ +  +  -  + ]
                 [ +  + ]
     900                 :        218 :         ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) ||
     901                 :        586 :         ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) )
     902                 :            :     {
     903                 :         30 :         return sd::DocumentSettings_createInstance( this );
     904                 :            :     }
     905                 :            : 
     906   [ +  +  -  + ]:       1597 :     if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) ||
                 [ +  + ]
     907                 :        793 :         ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) )
     908                 :            :     {
     909         [ +  - ]:         11 :         return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::DATE );
     910                 :            :     }
     911                 :            : 
     912   [ +  +  -  + ]:       1576 :     if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
                 [ +  + ]
     913                 :        783 :         (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
     914                 :            :     {
     915         [ +  - ]:         10 :         return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_HEADER );
     916                 :            :     }
     917                 :            : 
     918   [ +  +  -  + ]:       1551 :     if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
                 [ +  + ]
     919                 :        768 :         (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
     920                 :            :     {
     921         [ +  - ]:         15 :         return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_FOOTER );
     922                 :            :     }
     923                 :            : 
     924   [ +  +  -  + ]:       1521 :     if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
                 [ +  + ]
     925                 :        753 :         (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
     926                 :            :     {
     927         [ +  - ]:         15 :         return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_DATE_TIME );
     928                 :            :     }
     929                 :            : 
     930         [ +  + ]:        753 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
     931                 :            :     {
     932                 :            :         static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
     933                 :            : 
     934         [ +  - ]:         58 :         return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() );
     935                 :            :     }
     936                 :            : 
     937                 :            :     // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
     938         [ +  + ]:        695 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) )
     939                 :            :     {
     940 [ +  - ][ +  - ]:          2 :         return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE );
     941                 :            :     }
     942                 :            : 
     943         [ +  + ]:        693 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) )
     944                 :            :     {
     945 [ +  - ][ +  - ]:         11 :         return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ );
     946                 :            :     }
     947                 :            : 
     948         [ +  + ]:        682 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) )
     949                 :            :     {
     950         [ +  - ]:          2 :         ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
     951         [ -  + ]:          2 :         if( NULL == pPersist )
     952         [ #  # ]:          0 :             throw lang::DisposedException();
     953                 :            : 
     954 [ +  - ][ +  - ]:          2 :         return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE );
     955                 :            :     }
     956                 :            : 
     957         [ +  + ]:        680 :     if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) )
     958                 :            :     {
     959         [ +  - ]:         11 :         ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
     960         [ -  + ]:         11 :         if( NULL == pPersist )
     961         [ #  # ]:          0 :             throw lang::DisposedException();
     962                 :            : 
     963 [ +  - ][ +  - ]:         11 :         return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ );
     964                 :            :     }
     965                 :            : 
     966                 :        669 :     uno::Reference< uno::XInterface > xRet;
     967                 :            : 
     968         [ +  - ]:        669 :     const String aType( aServiceSpecifier );
     969 [ +  - ][ +  + ]:        669 :     if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
     970                 :            :     {
     971                 :        228 :         SvxShape* pShape = NULL;
     972                 :            : 
     973                 :        228 :         sal_uInt16 nType = OBJ_TEXT;
     974                 :            :         // create a shape wrapper
     975 [ +  - ][ +  + ]:        228 :         if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) )
     976                 :            :         {
     977                 :         20 :             nType = OBJ_TEXT;
     978                 :            :         }
     979 [ +  - ][ +  + ]:        208 :         else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) )
     980                 :            :         {
     981                 :         10 :             nType = OBJ_TEXT;
     982                 :            :         }
     983 [ +  - ][ +  + ]:        198 :         else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) )
     984                 :            :         {
     985                 :          4 :             nType = OBJ_TEXT;
     986                 :            :         }
     987 [ +  - ][ +  + ]:        194 :         else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
     988                 :            :         {
     989                 :          3 :             nType = OBJ_GRAF;
     990                 :            :         }
     991 [ +  - ][ +  + ]:        191 :         else if( aType.EqualsAscii( "PageShape", 26, 9 ) )
     992                 :            :         {
     993                 :         38 :             nType = OBJ_PAGE;
     994                 :            :         }
     995 [ +  - ][ -  + ]:        153 :         else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) )
     996                 :            :         {
     997                 :          0 :             nType = OBJ_OLE2;
     998                 :            :         }
     999 [ +  - ][ -  + ]:        153 :         else if( aType.EqualsAscii( "ChartShape", 26, 10 ) )
    1000                 :            :         {
    1001                 :          0 :             nType = OBJ_OLE2;
    1002                 :            :         }
    1003 [ +  - ][ -  + ]:        153 :         else if( aType.EqualsAscii( "CalcShape", 26, 9 ) )
    1004                 :            :         {
    1005                 :          0 :             nType = OBJ_OLE2;
    1006                 :            :         }
    1007 [ +  - ][ -  + ]:        153 :         else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
    1008                 :            :         {
    1009                 :          0 :             nType = OBJ_TABLE;
    1010                 :            :         }
    1011 [ +  - ][ -  + ]:        153 :         else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
    1012                 :            :         {
    1013                 :          0 :             nType = OBJ_OLE2;
    1014                 :            :         }
    1015 [ +  - ][ +  + ]:        153 :         else if( aType.EqualsAscii( "NotesShape", 26, 13 ) )
    1016                 :            :         {
    1017                 :         38 :             nType = OBJ_TEXT;
    1018                 :            :         }
    1019 [ +  - ][ +  + ]:        115 :         else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) )
    1020                 :            :         {
    1021                 :         42 :             nType = OBJ_PAGE;
    1022                 :            :         }
    1023 [ +  - ][ +  + ]:         73 :         else if( aType.EqualsAscii( "FooterShape", 26, 12 ) )
    1024                 :            :         {
    1025                 :         21 :             nType = OBJ_TEXT;
    1026                 :            :         }
    1027 [ +  - ][ +  + ]:         52 :         else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) )
    1028                 :            :         {
    1029                 :         10 :             nType = OBJ_TEXT;
    1030                 :            :         }
    1031 [ +  - ][ +  + ]:         42 :         else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) )
    1032                 :            :         {
    1033                 :         24 :             nType = OBJ_TEXT;
    1034                 :            :         }
    1035 [ +  - ][ +  - ]:         18 :         else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) )
    1036                 :            :         {
    1037                 :         18 :             nType = OBJ_TEXT;
    1038                 :            :         }
    1039 [ #  # ][ #  # ]:          0 :         else if( aType.EqualsAscii( "MediaShape", 26, 10 ) )
    1040                 :            :         {
    1041                 :          0 :             nType = OBJ_MEDIA;
    1042                 :            :         }
    1043                 :            :         else
    1044                 :            :         {
    1045         [ #  # ]:          0 :             throw lang::ServiceNotRegisteredException();
    1046                 :            :         }
    1047                 :            : 
    1048                 :            :         // create the API wrapper
    1049                 :        228 :         pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
    1050                 :            : 
    1051                 :            :         // set shape type
    1052 [ +  - ][ +  - ]:        228 :         if( pShape && !mbClipBoard )
    1053                 :        228 :             pShape->SetShapeType(aServiceSpecifier);
    1054                 :            : 
    1055         [ +  - ]:        228 :         xRet = (uno::XWeak*)pShape;
    1056                 :            :     }
    1057         [ +  + ]:        441 :     else if ( aServiceSpecifier == "com.sun.star.drawing.TableShape" )
    1058                 :            :     {
    1059                 :          6 :         SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor );
    1060 [ +  - ][ +  - ]:          6 :         if( pShape && !mbClipBoard )
    1061                 :          6 :             pShape->SetShapeType(aServiceSpecifier);
    1062                 :            : 
    1063         [ +  - ]:          6 :         xRet = (uno::XWeak*)pShape;
    1064                 :            :     }
    1065                 :            :     else
    1066                 :            :     {
    1067 [ +  + ][ +  - ]:        435 :         xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
    1068                 :            :     }
    1069                 :            : 
    1070         [ +  - ]:        659 :     uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY );
    1071         [ +  + ]:        659 :     if( xShape.is() )
    1072                 :            :     {
    1073                 :        621 :         xRet.clear();
    1074 [ +  - ][ +  - ]:        621 :         new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this );
    1075         [ +  - ]:        621 :         xRet = xShape;
    1076                 :        621 :         xShape.clear();
    1077                 :            :     }
    1078                 :            : 
    1079 [ +  - ][ +  - ]:       1095 :     return xRet;
    1080                 :            : }
    1081                 :            : 
    1082                 :        104 : uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames()
    1083                 :            :     throw(uno::RuntimeException)
    1084                 :            : {
    1085         [ +  - ]:        104 :     ::SolarMutexGuard aGuard;
    1086                 :            : 
    1087         [ -  + ]:        104 :     if( NULL == mpDoc )
    1088         [ #  # ]:          0 :         throw lang::DisposedException();
    1089                 :            : 
    1090         [ +  - ]:        104 :     const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
    1091                 :            : 
    1092 [ +  + ][ +  - ]:        104 :     uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) );
    1093                 :            : 
    1094                 :        104 :     sal_uInt16 i(0);
    1095                 :            : 
    1096         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.DashTable";
    1097         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.GradientTable";
    1098         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.HatchTable";
    1099         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.BitmapTable";
    1100         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.TransparencyGradientTable";
    1101         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.MarkerTable";
    1102         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.text.NumberingRules";
    1103         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.Background";
    1104         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.document.Settings";
    1105         [ +  - ]:        104 :     aSNS[i++] = sUNO_Service_ImageMapRectangleObject;
    1106         [ +  - ]:        104 :     aSNS[i++] = sUNO_Service_ImageMapCircleObject;
    1107         [ +  - ]:        104 :     aSNS[i++] = sUNO_Service_ImageMapPolygonObject;
    1108         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.xml.NamespaceMap";
    1109                 :            : 
    1110                 :            :     // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
    1111         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.document.ExportGraphicObjectResolver";
    1112         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.document.ImportGraphicObjectResolver";
    1113         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.document.ExportEmbeddedObjectResolver";
    1114         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.document.ImportEmbeddedObjectResolver";
    1115         [ +  - ]:        104 :     aSNS[i++] = "com.sun.star.drawing.TableShape";
    1116                 :            : 
    1117         [ +  + ]:        104 :     if(mbImpressDoc)
    1118                 :            :     {
    1119         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.TitleTextShape";
    1120         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.OutlinerShape";
    1121         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.SubtitleShape";
    1122         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.GraphicObjectShape";
    1123         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.ChartShape";
    1124         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.PageShape";
    1125         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.OLE2Shape";
    1126         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.TableShape";
    1127         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.OrgChartShape";
    1128         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.NotesShape";
    1129         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.HandoutShape";
    1130         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.DocumentSettings";
    1131         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.FooterShape";
    1132         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.HeaderShape";
    1133         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.SlideNumberShape";
    1134         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.DateTimeShape";
    1135         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.CalcShape";
    1136         [ +  - ]:         54 :         aSNS[i++] = "com.sun.star.presentation.MediaShape";
    1137                 :            :     }
    1138                 :            :     else
    1139                 :            :     {
    1140         [ +  - ]:         50 :         aSNS[i++] = "com.sun.star.drawing.DocumentSettings";
    1141                 :            :     }
    1142                 :            : 
    1143                 :            :     DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
    1144                 :            : 
    1145 [ +  - ][ +  - ]:        104 :     return comphelper::concatSequences( aSNS_ORG, aSNS );
         [ +  - ][ +  - ]
    1146                 :            : }
    1147                 :            : 
    1148                 :            : // lang::XServiceInfo
    1149                 :          0 : OUString SAL_CALL SdXImpressDocument::getImplementationName()
    1150                 :            :     throw(uno::RuntimeException)
    1151                 :            : {
    1152                 :          0 :     return OUString( "SdXImpressDocument" );
    1153                 :            : }
    1154                 :            : 
    1155                 :        367 : sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
    1156                 :            :     throw(uno::RuntimeException)
    1157                 :            : {
    1158         [ +  - ]:        367 :     ::SolarMutexGuard aGuard;
    1159                 :            : 
    1160   [ +  +  +  +  :        771 :     if ( ServiceName == "com.sun.star.document.OfficeDocument"
           -  + ][ +  + ]
    1161                 :        206 :       || ServiceName == "com.sun.star.drawing.GenericDrawingDocument"
    1162                 :        198 :       || ServiceName == "com.sun.star.drawing.DrawingDocumentFactory" )
    1163                 :            :     {
    1164                 :        169 :         return sal_True;
    1165                 :            :     }
    1166                 :            : 
    1167                 :        128 :     return ( ( mbImpressDoc && ServiceName == "com.sun.star.presentation.PresentationDocument" )
    1168   [ +  +  +  + ]:        495 :          || ( !mbImpressDoc && ServiceName == "com.sun.star.drawing.DrawingDocument" ) );
         [ +  + ][ +  + ]
                 [ +  - ]
    1169                 :            : }
    1170                 :            : 
    1171                 :        188 : uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException)
    1172                 :            : {
    1173         [ +  - ]:        188 :     ::SolarMutexGuard aGuard;
    1174                 :            : 
    1175         [ +  - ]:        188 :     uno::Sequence< OUString > aSeq( 4 );
    1176         [ +  - ]:        188 :     OUString* pServices = aSeq.getArray();
    1177                 :            : 
    1178                 :        188 :     *pServices++ = "com.sun.star.document.OfficeDocument";
    1179                 :        188 :     *pServices++ = "com.sun.star.drawing.GenericDrawingDocument";
    1180                 :        188 :     *pServices++ = "com.sun.star.drawing.DrawingDocumentFactory";
    1181                 :            : 
    1182         [ +  + ]:        188 :     if( mbImpressDoc )
    1183                 :         48 :         *pServices++ = "com.sun.star.presentation.PresentationDocument";
    1184                 :            :     else
    1185                 :        140 :         *pServices++ = "com.sun.star.drawing.DrawingDocument";
    1186                 :            : 
    1187         [ +  - ]:        188 :     return aSeq;
    1188                 :            : }
    1189                 :            : 
    1190                 :            : // XPropertySet
    1191                 :        157 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo(  )
    1192                 :            :     throw(uno::RuntimeException)
    1193                 :            : {
    1194         [ +  - ]:        157 :     ::SolarMutexGuard aGuard;
    1195 [ +  - ][ +  - ]:        157 :     return mpPropSet->getPropertySetInfo();
    1196                 :            : }
    1197                 :            : 
    1198                 :         31 : void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
    1199                 :            :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
    1200                 :            : {
    1201         [ +  - ]:         31 :     ::SolarMutexGuard aGuard;
    1202                 :            : 
    1203         [ -  + ]:         31 :     if( NULL == mpDoc )
    1204         [ #  # ]:          0 :         throw lang::DisposedException();
    1205                 :            : 
    1206         [ +  - ]:         31 :     const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
    1207                 :            : 
    1208 [ +  + ][ -  -  :         31 :     switch( pEntry ? pEntry->nWID : -1 )
          +  -  -  +  -  
                      + ]
    1209                 :            :     {
    1210                 :            :         case WID_MODEL_LANGUAGE:
    1211                 :            :         {
    1212                 :          0 :             lang::Locale aLocale;
    1213 [ #  # ][ #  # ]:          0 :             if(!(aValue >>= aLocale))
    1214         [ #  # ]:          0 :                 throw lang::IllegalArgumentException();
    1215                 :            : 
    1216 [ #  # ][ #  # ]:          0 :             mpDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE );
    1217                 :          0 :             break;
    1218                 :            :         }
    1219                 :            :         case WID_MODEL_TABSTOP:
    1220                 :            :         {
    1221                 :          0 :             sal_Int32 nValue = 0;
    1222 [ #  # ][ #  # ]:          0 :             if(!(aValue >>= nValue) || nValue < 0 )
                 [ #  # ]
    1223         [ #  # ]:          0 :                 throw lang::IllegalArgumentException();
    1224                 :            : 
    1225         [ #  # ]:          0 :             mpDoc->SetDefaultTabulator((sal_uInt16)nValue);
    1226                 :            :             break;
    1227                 :            :         }
    1228                 :            :         case WID_MODEL_VISAREA:
    1229                 :            :             {
    1230                 :         11 :                 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
    1231         [ +  - ]:         11 :                 if( !pEmbeddedObj )
    1232                 :            :                     break;
    1233                 :            : 
    1234                 :         11 :                 awt::Rectangle aVisArea;
    1235 [ +  - ][ +  - ]:         11 :                 if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
         [ -  + ][ -  + ]
                 [ +  - ]
    1236         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    1237                 :            : 
    1238 [ +  - ][ +  - ]:         11 :                 pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) );
    1239                 :            :             }
    1240                 :         11 :             break;
    1241                 :            :         case WID_MODEL_CONTFOCUS:
    1242                 :            :             {
    1243                 :          0 :                 sal_Bool bFocus = sal_False;
    1244         [ #  # ]:          0 :                 if( !(aValue >>= bFocus ) )
    1245         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    1246         [ #  # ]:          0 :                 mpDoc->SetAutoControlFocus( bFocus );
    1247                 :            :             }
    1248                 :          0 :             break;
    1249                 :            :         case WID_MODEL_DSGNMODE:
    1250                 :            :             {
    1251                 :          0 :                 sal_Bool bMode = sal_False;
    1252         [ #  # ]:          0 :                 if( !(aValue >>= bMode ) )
    1253         [ #  # ]:          0 :                     throw lang::IllegalArgumentException();
    1254         [ #  # ]:          0 :                 mpDoc->SetOpenInDesignMode( bMode );
    1255                 :            :             }
    1256                 :          0 :             break;
    1257                 :            :         case WID_MODEL_BUILDID:
    1258                 :         11 :             aValue >>= maBuildId;
    1259                 :         22 :             return;
    1260                 :            :         case WID_MODEL_MAPUNIT:
    1261                 :            :         case WID_MODEL_BASICLIBS:
    1262                 :            :         case WID_MODEL_RUNTIMEUID: // is read-only
    1263                 :            :         case WID_MODEL_DIALOGLIBS:
    1264         [ #  # ]:          0 :             throw beans::PropertyVetoException();
    1265                 :            :         default:
    1266         [ +  - ]:          9 :             throw beans::UnknownPropertyException();
    1267                 :            :     }
    1268                 :            : 
    1269 [ +  - ][ +  + ]:         31 :     SetModified();
    1270                 :            : }
    1271                 :            : 
    1272                 :        324 : uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName )
    1273                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1274                 :            : {
    1275         [ +  - ]:        324 :     ::SolarMutexGuard aGuard;
    1276                 :            : 
    1277                 :        324 :     uno::Any aAny;
    1278         [ +  + ]:        324 :     if( NULL == mpDoc )
    1279         [ +  - ]:        130 :         throw lang::DisposedException();
    1280                 :            : 
    1281         [ +  - ]:        194 :     const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
    1282                 :            : 
    1283 [ +  + ][ -  -  :        194 :     switch( pEntry ? pEntry->nWID : -1 )
          +  -  -  -  -  
          +  -  +  -  -  
                      + ]
    1284                 :            :     {
    1285                 :            :         case WID_MODEL_LANGUAGE:
    1286                 :            :         {
    1287         [ #  # ]:          0 :             LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE );
    1288                 :          0 :             lang::Locale aLocale;
    1289         [ #  # ]:          0 :             SvxLanguageToLocale( aLocale, eLang );
    1290         [ #  # ]:          0 :             aAny <<= aLocale;
    1291                 :          0 :             break;
    1292                 :            :         }
    1293                 :            :         case WID_MODEL_TABSTOP:
    1294         [ #  # ]:          0 :             aAny <<= (sal_Int32)mpDoc->GetDefaultTabulator();
    1295                 :          0 :             break;
    1296                 :            :         case WID_MODEL_VISAREA:
    1297                 :            :             {
    1298                 :         12 :                 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
    1299         [ +  - ]:         12 :                 if( !pEmbeddedObj )
    1300                 :            :                     break;
    1301                 :            : 
    1302         [ +  - ]:         12 :                 const Rectangle& aRect = pEmbeddedObj->GetVisArea();
    1303                 :         12 :                 awt::Rectangle aVisArea( aRect.nLeft, aRect.nTop, aRect.getWidth(), aRect.getHeight() );
    1304         [ +  - ]:         12 :                 aAny <<= aVisArea;
    1305                 :            :             }
    1306                 :         12 :             break;
    1307                 :            :         case WID_MODEL_MAPUNIT:
    1308                 :            :             {
    1309                 :          0 :                 SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
    1310         [ #  # ]:          0 :                 if( !pEmbeddedObj )
    1311                 :            :                     break;
    1312                 :            : 
    1313                 :          0 :                 sal_Int16 nMeasureUnit = 0;
    1314         [ #  # ]:          0 :                 SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit );
    1315         [ #  # ]:          0 :                 aAny <<= (sal_Int16)nMeasureUnit;
    1316                 :            :         }
    1317                 :          0 :         break;
    1318                 :            :         case WID_MODEL_FORBCHARS:
    1319                 :            :         {
    1320 [ #  # ][ #  # ]:          0 :             aAny <<= getForbiddenCharsTable();
    1321                 :            :         }
    1322                 :          0 :         break;
    1323                 :            :         case WID_MODEL_CONTFOCUS:
    1324         [ #  # ]:          0 :             aAny <<= (sal_Bool)mpDoc->GetAutoControlFocus();
    1325                 :          0 :             break;
    1326                 :            :         case WID_MODEL_DSGNMODE:
    1327         [ #  # ]:          0 :             aAny <<= mpDoc->GetOpenInDesignMode();
    1328                 :          0 :             break;
    1329                 :            :         case WID_MODEL_BASICLIBS:
    1330 [ +  - ][ +  - ]:          4 :             aAny <<= mpDocShell->GetBasicContainer();
    1331                 :          4 :             break;
    1332                 :            :         case WID_MODEL_DIALOGLIBS:
    1333 [ #  # ][ #  # ]:          0 :             aAny <<= mpDocShell->GetDialogContainer();
    1334                 :          0 :             break;
    1335                 :            :         case WID_MODEL_RUNTIMEUID:
    1336 [ +  - ][ +  - ]:         48 :             aAny <<= getRuntimeUID();
    1337                 :         48 :             break;
    1338                 :            :         case WID_MODEL_BUILDID:
    1339         [ #  # ]:          0 :             return uno::Any( maBuildId );
    1340                 :            :         case WID_MODEL_HASVALIDSIGNATURES:
    1341 [ #  # ][ #  # ]:          0 :             aAny <<= hasValidSignatures();
    1342                 :          0 :             break;
    1343                 :            :         default:
    1344         [ +  - ]:        130 :             throw beans::UnknownPropertyException();
    1345                 :            :     }
    1346                 :            : 
    1347         [ +  - ]:        324 :     return aAny;
    1348                 :            : }
    1349                 :            : 
    1350                 :          0 : void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1351                 :          0 : void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1352                 :          0 : void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1353                 :          0 : void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1354                 :            : 
    1355                 :            : // XLinkTargetSupplier
    1356                 :          2 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks()
    1357                 :            :     throw(uno::RuntimeException)
    1358                 :            : {
    1359         [ +  - ]:          2 :     ::SolarMutexGuard aGuard;
    1360                 :            : 
    1361         [ -  + ]:          2 :     if( NULL == mpDoc )
    1362         [ #  # ]:          0 :         throw lang::DisposedException();
    1363                 :            : 
    1364                 :          2 :     uno::Reference< container::XNameAccess > xLinks( mxLinks );
    1365         [ +  - ]:          2 :     if( !xLinks.is() )
    1366 [ +  - ][ +  - ]:          2 :         mxLinks = xLinks = new SdDocLinkTargets( *this );
                 [ +  - ]
    1367         [ +  - ]:          2 :     return xLinks;
    1368                 :            : }
    1369                 :            : 
    1370                 :            : // XStyleFamiliesSupplier
    1371                 :        528 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies(  )
    1372                 :            :     throw(uno::RuntimeException)
    1373                 :            : {
    1374         [ +  - ]:        528 :     ::SolarMutexGuard aGuard;
    1375                 :            : 
    1376         [ -  + ]:        528 :     if( NULL == mpDoc )
    1377         [ #  # ]:          0 :         throw lang::DisposedException();
    1378                 :            : 
    1379 [ +  - ][ -  + ]:        528 :     uno::Reference< container::XNameAccess > xStyles( dynamic_cast< container::XNameAccess* >( mpDoc->GetStyleSheetPool()) );
                 [ +  - ]
    1380         [ +  - ]:        528 :     return xStyles;
    1381                 :            : }
    1382                 :            : 
    1383                 :            : // XAnyCompareFactory
    1384                 :        254 : uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& )
    1385                 :            :     throw (uno::RuntimeException)
    1386                 :            : {
    1387                 :        254 :     return SvxCreateNumRuleCompare();
    1388                 :            : }
    1389                 :            : 
    1390                 :            : // XRenderable
    1391                 :          0 : sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection,
    1392                 :            :                                                          const uno::Sequence< beans::PropertyValue >&  )
    1393                 :            :     throw (lang::IllegalArgumentException, uno::RuntimeException)
    1394                 :            : {
    1395         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1396                 :          0 :     sal_Int32   nRet = 0;
    1397                 :            : 
    1398         [ #  # ]:          0 :     if( NULL == mpDoc )
    1399         [ #  # ]:          0 :         throw lang::DisposedException();
    1400                 :            : 
    1401         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aRenderer;
    1402                 :            : 
    1403 [ #  # ][ #  # ]:          0 :     if( mpDocShell && mpDoc )
    1404                 :            :     {
    1405                 :          0 :         uno::Reference< frame::XModel > xModel;
    1406                 :            : 
    1407         [ #  # ]:          0 :         rSelection >>= xModel;
    1408                 :            : 
    1409 [ #  # ][ #  # ]:          0 :         if( xModel == mpDocShell->GetModel() )
                 [ #  # ]
    1410         [ #  # ]:          0 :             nRet = mpDoc->GetSdPageCount( PK_STANDARD );
    1411                 :            :         else
    1412                 :            :         {
    1413                 :          0 :             uno::Reference< drawing::XShapes > xShapes;
    1414                 :            : 
    1415         [ #  # ]:          0 :             rSelection >>= xShapes;
    1416                 :            : 
    1417 [ #  # ][ #  # ]:          0 :             if( xShapes.is() && xShapes->getCount() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1418                 :          0 :                 nRet = 1;
    1419                 :          0 :         }
    1420                 :            :     }
    1421 [ #  # ][ #  # ]:          0 :     return nRet;
    1422                 :            : }
    1423                 :            : 
    1424                 :          0 : uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& ,
    1425                 :            :                                                                                 const uno::Sequence< beans::PropertyValue >& rxOptions )
    1426                 :            :     throw (lang::IllegalArgumentException, uno::RuntimeException)
    1427                 :            : {
    1428         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1429                 :            : 
    1430         [ #  # ]:          0 :     if( NULL == mpDoc )
    1431         [ #  # ]:          0 :         throw lang::DisposedException();
    1432                 :            : 
    1433                 :          0 :     sal_Bool bExportNotesPages = sal_False;
    1434         [ #  # ]:          0 :     for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
    1435                 :            :     {
    1436         [ #  # ]:          0 :         if ( rxOptions[ nProperty ].Name == "ExportNotesPages" )
    1437                 :          0 :             rxOptions[ nProperty].Value >>= bExportNotesPages;
    1438                 :            :     }
    1439         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aRenderer;
    1440 [ #  # ][ #  # ]:          0 :     if( mpDocShell && mpDoc )
    1441                 :            :     {
    1442                 :          0 :         awt::Size aPageSize;
    1443         [ #  # ]:          0 :         if ( bExportNotesPages )
    1444                 :            :         {
    1445 [ #  # ][ #  # ]:          0 :             Size aNotesPageSize = mpDoc->GetSdPage( 0, PK_NOTES )->GetSize();
    1446                 :          0 :             aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() );
    1447                 :            :         }
    1448                 :            :         else
    1449                 :            :         {
    1450         [ #  # ]:          0 :             const Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
    1451 [ #  # ][ #  # ]:          0 :             aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
    1452                 :            :         }
    1453         [ #  # ]:          0 :         aRenderer.realloc( 1 );
    1454                 :            : 
    1455         [ #  # ]:          0 :         aRenderer[ 0 ].Name = "PageSize" ;
    1456 [ #  # ][ #  # ]:          0 :         aRenderer[ 0 ].Value <<= aPageSize;
    1457                 :            :     }
    1458         [ #  # ]:          0 :     return aRenderer;
    1459                 :            : }
    1460                 :            : 
    1461                 :            : class ImplRenderPaintProc : public ::sdr::contact::ViewObjectContactRedirector
    1462                 :            : {
    1463                 :            :     const SdrLayerAdmin&    rLayerAdmin;
    1464                 :            :     SdrPageView*            pSdrPageView;
    1465                 :            :     vcl::PDFExtOutDevData*  pPDFExtOutDevData;
    1466                 :            : 
    1467                 :            :     vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject );
    1468                 :            : 
    1469                 :            : public:
    1470                 :            :     sal_Bool IsVisible  ( const SdrObject* pObj ) const;
    1471                 :            :     sal_Bool IsPrintable( const SdrObject* pObj ) const;
    1472                 :            : 
    1473                 :            :     ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData );
    1474                 :            :     virtual ~ImplRenderPaintProc();
    1475                 :            : 
    1476                 :            :     // all default implementations just call the same methods at the original. To do something
    1477                 :            :     // different, overload the method and at least do what the method does.
    1478                 :            :     virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
    1479                 :            :         const sdr::contact::ViewObjectContact& rOriginal,
    1480                 :            :         const sdr::contact::DisplayInfo& rDisplayInfo);
    1481                 :            : };
    1482                 :            : 
    1483                 :          0 : ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData )
    1484                 :            : :   ViewObjectContactRedirector(),
    1485                 :            :     rLayerAdmin         ( rLA ),
    1486                 :            :     pSdrPageView        ( pView ),
    1487                 :          0 :     pPDFExtOutDevData   ( pData )
    1488                 :            : {
    1489                 :          0 : }
    1490                 :            : 
    1491                 :          0 : ImplRenderPaintProc::~ImplRenderPaintProc()
    1492                 :            : {
    1493         [ #  # ]:          0 : }
    1494                 :            : 
    1495                 :          0 : sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc )
    1496                 :            : {
    1497                 :          0 :     sal_Int32 nPage = -1;
    1498                 :            : 
    1499                 :            :     OSL_TRACE("GotoBookmark %s",
    1500                 :            :         ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
    1501                 :            : 
    1502         [ #  # ]:          0 :     String aBookmark( rBookmark );
    1503                 :            : 
    1504 [ #  # ][ #  # ]:          0 :     if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
                 [ #  # ]
    1505 [ #  # ][ #  # ]:          0 :         aBookmark = rBookmark.Copy( 1 );
                 [ #  # ]
    1506                 :            : 
    1507                 :            :     // is the bookmark a page ?
    1508                 :            :     sal_Bool        bIsMasterPage;
    1509         [ #  # ]:          0 :     sal_uInt16      nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
    1510                 :          0 :     SdrObject*  pObj = NULL;
    1511                 :            : 
    1512         [ #  # ]:          0 :     if ( nPgNum == SDRPAGE_NOTFOUND )
    1513                 :            :     {
    1514                 :            :         // is the bookmark a object ?
    1515         [ #  # ]:          0 :         pObj = rDoc.GetObj( aBookmark );
    1516         [ #  # ]:          0 :         if (pObj)
    1517 [ #  # ][ #  # ]:          0 :             nPgNum = pObj->GetPage()->GetPageNum();
    1518                 :            :     }
    1519         [ #  # ]:          0 :     if ( nPgNum != SDRPAGE_NOTFOUND )
    1520                 :          0 :         nPage = ( nPgNum - 1 ) / 2;
    1521         [ #  # ]:          0 :     return nPage;
    1522                 :            : }
    1523                 :            : 
    1524                 :          0 : void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData )
    1525                 :            : {
    1526                 :            :     try
    1527                 :            :     {
    1528         [ #  # ]:          0 :         uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
    1529 [ #  # ][ #  # ]:          0 :         uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
    1530                 :            : 
    1531 [ #  # ][ #  # ]:          0 :         LanguageType eLanguage = Application::GetSettings().GetLanguage();
    1532 [ #  # ][ #  # ]:          0 :         while( xAnnotationEnumeration->hasMoreElements() )
                 [ #  # ]
    1533                 :            :         {
    1534 [ #  # ][ #  # ]:          0 :             uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
    1535                 :            : 
    1536 [ #  # ][ #  # ]:          0 :             geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
    1537 [ #  # ][ #  # ]:          0 :             uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
    1538 [ #  # ][ #  # ]:          0 :             util::DateTime aDateTime( xAnnotation->getDateTime() );
    1539                 :            : 
    1540                 :          0 :             Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
    1541                 :          0 :             Time aTime( Time::EMPTY );
    1542 [ #  # ][ #  # ]:          0 :             String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) );
         [ #  # ][ #  # ]
    1543                 :            : 
    1544         [ #  # ]:          0 :             vcl::PDFNote aNote;
    1545 [ #  # ][ #  # ]:          0 :             String sTitle( xAnnotation->getAuthor() );
                 [ #  # ]
    1546         [ #  # ]:          0 :             sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
    1547         [ #  # ]:          0 :             sTitle += aStr;
    1548         [ #  # ]:          0 :             aNote.Title = sTitle;
    1549 [ #  # ][ #  # ]:          0 :             aNote.Contents = xText->getString();
                 [ #  # ]
    1550                 :            :             rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ),
    1551 [ #  # ][ #  # ]:          0 :                 static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote );
    1552 [ #  # ][ #  # ]:          0 :         }
         [ #  # ][ #  # ]
    1553                 :            :     }
    1554                 :          0 :     catch (const uno::Exception&)
    1555                 :            :     {
    1556                 :            :     }
    1557                 :          0 : }
    1558                 :            : 
    1559                 :          0 : void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData )
    1560                 :            : {
    1561                 :          0 :     const rtl::OUString sGroup   ( "com.sun.star.drawing.GroupShape");
    1562                 :          0 :     const rtl::OUString sOnClick ( "OnClick" );
    1563                 :          0 :     const rtl::OUString sBookmark( "Bookmark" );
    1564                 :            : 
    1565 [ #  # ][ #  # ]:          0 :     if ( xShape->getShapeType().equals( sGroup ) )
                 [ #  # ]
    1566                 :            :     {
    1567         [ #  # ]:          0 :         uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY );
    1568         [ #  # ]:          0 :         if ( xIndexAccess.is() )
    1569                 :            :         {
    1570 [ #  # ][ #  # ]:          0 :             sal_Int32 i, nCount = xIndexAccess->getCount();
    1571         [ #  # ]:          0 :             for ( i = 0; i < nCount; i++ )
    1572                 :            :             {
    1573 [ #  # ][ #  # ]:          0 :                 uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
                 [ #  # ]
    1574         [ #  # ]:          0 :                 if ( xSubShape.is() )
    1575         [ #  # ]:          0 :                     ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData );
    1576                 :          0 :             }
    1577                 :          0 :         }
    1578                 :            :     }
    1579                 :            :     else
    1580                 :            :     {
    1581         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY );
    1582         [ #  # ]:          0 :         if( xShapePropSet.is() )
    1583                 :            :         {
    1584 [ #  # ][ #  # ]:          0 :             Size        aPageSize( rDoc.GetSdPage( 0, PK_STANDARD )->GetSize() );
    1585                 :          0 :             Point aPoint( 0, 0 );
    1586         [ #  # ]:          0 :             Rectangle   aPageRect( aPoint, aPageSize );
    1587                 :            : 
    1588 [ #  # ][ #  # ]:          0 :             awt::Point  aShapePos( xShape->getPosition() );
    1589 [ #  # ][ #  # ]:          0 :             awt::Size   aShapeSize( xShape->getSize() );
    1590         [ #  # ]:          0 :             Rectangle   aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) );
    1591                 :            : 
    1592                 :            :             presentation::ClickAction eCa;
    1593 [ #  # ][ #  # ]:          0 :             uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) );
    1594 [ #  # ][ #  # ]:          0 :             if ( aAny >>= eCa )
    1595                 :            :             {
    1596   [ #  #  #  #  :          0 :                 switch ( eCa )
                   #  # ]
    1597                 :            :                 {
    1598                 :            :                     case presentation::ClickAction_LASTPAGE :
    1599                 :            :                     {
    1600         [ #  # ]:          0 :                         sal_Int32 nCount = rDoc.GetSdPageCount( PK_STANDARD );
    1601         [ #  # ]:          0 :                         sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle );
    1602         [ #  # ]:          0 :                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1603         [ #  # ]:          0 :                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
    1604                 :            :                     }
    1605                 :          0 :                     break;
    1606                 :            :                     case presentation::ClickAction_FIRSTPAGE :
    1607                 :            :                     {
    1608         [ #  # ]:          0 :                         sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle );
    1609         [ #  # ]:          0 :                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1610         [ #  # ]:          0 :                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
    1611                 :            :                     }
    1612                 :          0 :                     break;
    1613                 :            :                     case presentation::ClickAction_PREVPAGE :
    1614                 :            :                     {
    1615         [ #  # ]:          0 :                         sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
    1616         [ #  # ]:          0 :                         if ( nDestPage )
    1617                 :          0 :                             nDestPage--;
    1618         [ #  # ]:          0 :                         sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
    1619         [ #  # ]:          0 :                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1620         [ #  # ]:          0 :                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
    1621                 :            :                     }
    1622                 :          0 :                     break;
    1623                 :            :                     case presentation::ClickAction_NEXTPAGE :
    1624                 :            :                     {
    1625         [ #  # ]:          0 :                         sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1;
    1626         [ #  # ]:          0 :                         sal_Int32 nLastPage = rDoc.GetSdPageCount( PK_STANDARD ) - 1;
    1627         [ #  # ]:          0 :                         if ( nDestPage > nLastPage )
    1628                 :          0 :                             nDestPage = nLastPage;
    1629         [ #  # ]:          0 :                         sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
    1630         [ #  # ]:          0 :                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1631         [ #  # ]:          0 :                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
    1632                 :            :                     }
    1633                 :          0 :                     break;
    1634                 :            : 
    1635                 :            :                     case presentation::ClickAction_PROGRAM :
    1636                 :            :                     case presentation::ClickAction_BOOKMARK :
    1637                 :            :                     case presentation::ClickAction_DOCUMENT :
    1638                 :            :                     {
    1639                 :          0 :                         rtl::OUString aBookmark;
    1640 [ #  # ][ #  # ]:          0 :                         xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark;
    1641         [ #  # ]:          0 :                         if( !aBookmark.isEmpty() )
    1642                 :            :                         {
    1643      [ #  #  # ]:          0 :                             switch( eCa )
    1644                 :            :                             {
    1645                 :            :                                 case presentation::ClickAction_DOCUMENT :
    1646                 :            :                                 case presentation::ClickAction_PROGRAM :
    1647                 :            :                                 {
    1648         [ #  # ]:          0 :                                     sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1649         [ #  # ]:          0 :                                     rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark );
    1650                 :            :                                 }
    1651                 :          0 :                                 break;
    1652                 :            :                                 case presentation::ClickAction_BOOKMARK :
    1653                 :            :                                 {
    1654 [ #  # ][ #  # ]:          0 :                                     sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
                 [ #  # ]
    1655         [ #  # ]:          0 :                                     if ( nPage != -1 )
    1656                 :            :                                     {
    1657         [ #  # ]:          0 :                                         sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle );
    1658         [ #  # ]:          0 :                                         sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
    1659         [ #  # ]:          0 :                                         rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
    1660                 :            :                                     }
    1661                 :            :                                 }
    1662                 :          0 :                                 break;
    1663                 :            :                                 default:
    1664                 :          0 :                                     break;
    1665                 :            :                             }
    1666                 :          0 :                         }
    1667                 :            :                     }
    1668                 :          0 :                     break;
    1669                 :            : 
    1670                 :            :                     case presentation::ClickAction_STOPPRESENTATION :
    1671                 :            :                     case presentation::ClickAction_SOUND :
    1672                 :            :                     case presentation::ClickAction_INVISIBLE :
    1673                 :            :                     case presentation::ClickAction_VERB :
    1674                 :            :                     case presentation::ClickAction_VANISH :
    1675                 :            :                     case presentation::ClickAction_MACRO :
    1676                 :            :                     default :
    1677                 :          0 :                     break;
    1678                 :            :                 }
    1679                 :          0 :             }
    1680                 :          0 :         }
    1681                 :          0 :     }
    1682                 :          0 : }
    1683                 :            : 
    1684                 :          0 : vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject )
    1685                 :            : {
    1686                 :          0 :     vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
    1687                 :            : 
    1688 [ #  # ][ #  # ]:          0 :     if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() )
                 [ #  # ]
    1689                 :            :     {
    1690                 :          0 :         sal_uInt32 nInventor   = rObject.GetObjInventor();
    1691                 :          0 :         sal_uInt16 nIdentifier = rObject.GetObjIdentifier();
    1692                 :          0 :         sal_Bool   bIsTextObj  = rObject.ISA( SdrTextObj );
    1693                 :            : 
    1694         [ #  # ]:          0 :         if ( nInventor == SdrInventor )
    1695                 :            :         {
    1696         [ #  # ]:          0 :             if ( nIdentifier == OBJ_GRUP )
    1697                 :          0 :                 eElement = vcl::PDFWriter::Section;
    1698         [ #  # ]:          0 :             else if ( nIdentifier == OBJ_TITLETEXT )
    1699                 :          0 :                 eElement = vcl::PDFWriter::Heading;
    1700         [ #  # ]:          0 :             else if ( nIdentifier == OBJ_OUTLINETEXT )
    1701                 :          0 :                 eElement = vcl::PDFWriter::Division;
    1702 [ #  # ][ #  # ]:          0 :             else if ( !bIsTextObj || !((SdrTextObj&)rObject).HasText() )
                 [ #  # ]
    1703                 :          0 :                 eElement = vcl::PDFWriter::Figure;
    1704                 :            :         }
    1705                 :            :     }
    1706                 :            : 
    1707                 :          0 :     return eElement;
    1708                 :            : }
    1709                 :            : 
    1710                 :          0 : drawinglayer::primitive2d::Primitive2DSequence ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
    1711                 :            :     const sdr::contact::ViewObjectContact& rOriginal,
    1712                 :            :     const sdr::contact::DisplayInfo& rDisplayInfo)
    1713                 :            : {
    1714                 :          0 :     SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
    1715                 :            : 
    1716         [ #  # ]:          0 :     if(pObject)
    1717                 :            :     {
    1718         [ #  # ]:          0 :         drawinglayer::primitive2d::Primitive2DSequence xRetval;
    1719                 :            : 
    1720 [ #  # ][ #  # ]:          0 :         if(pObject->GetPage())
    1721                 :            :         {
    1722 [ #  # ][ #  # ]:          0 :             if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
                 [ #  # ]
    1723                 :            :             {
    1724 [ #  # ][ #  # ]:          0 :                 if(IsVisible(pObject) && IsPrintable(pObject))
         [ #  # ][ #  # ]
                 [ #  # ]
    1725                 :            :                 {
    1726         [ #  # ]:          0 :                     const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject ));
    1727                 :          0 :                     const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement);
    1728                 :            : 
    1729 [ #  # ][ #  # ]:          0 :                     xRetval = ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
                 [ #  # ]
    1730                 :            : 
    1731 [ #  # ][ #  # ]:          0 :                     if(xRetval.hasElements() && bTagUsed)
                 [ #  # ]
    1732                 :            :                     {
    1733                 :            :                         // embed Primitive2DSequence in a structure tag element for
    1734                 :            :                         // exactly this purpose (StructureTagPrimitive2D)
    1735 [ #  # ][ #  # ]:          0 :                         const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::StructureTagPrimitive2D(eElement, xRetval));
                 [ #  # ]
    1736 [ #  # ][ #  # ]:          0 :                         xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
                 [ #  # ]
    1737                 :            :                     }
    1738                 :            :                 }
    1739                 :            :             }
    1740                 :            :         }
    1741                 :            : 
    1742 [ #  # ][ #  # ]:          0 :         return xRetval;
    1743                 :            :     }
    1744                 :            :     else
    1745                 :            :     {
    1746                 :            :         // not an object, maybe a page
    1747                 :          0 :         return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
    1748                 :            :     }
    1749                 :            : }
    1750                 :            : 
    1751                 :          0 : sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
    1752                 :            : {
    1753                 :          0 :     sal_Bool bVisible = sal_True;
    1754                 :          0 :     SdrLayerID nLayerId = pObj->GetLayer();
    1755         [ #  # ]:          0 :     if( pSdrPageView )
    1756                 :            :     {
    1757                 :          0 :         const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
    1758         [ #  # ]:          0 :         if ( pSdrLayer )
    1759                 :            :         {
    1760         [ #  # ]:          0 :             String aLayerName = pSdrLayer->GetName();
    1761 [ #  # ][ #  # ]:          0 :             bVisible = pSdrPageView->IsLayerVisible( aLayerName );
    1762                 :            :         }
    1763                 :            :     }
    1764                 :          0 :     return bVisible;
    1765                 :            : }
    1766                 :          0 : sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
    1767                 :            : {
    1768                 :          0 :     sal_Bool bPrintable = sal_True;
    1769                 :          0 :     SdrLayerID nLayerId = pObj->GetLayer();
    1770         [ #  # ]:          0 :     if( pSdrPageView )
    1771                 :            :     {
    1772                 :          0 :         const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
    1773         [ #  # ]:          0 :         if ( pSdrLayer )
    1774                 :            :         {
    1775         [ #  # ]:          0 :             String aLayerName = pSdrLayer->GetName();
    1776 [ #  # ][ #  # ]:          0 :             bPrintable = pSdrPageView->IsLayerPrintable( aLayerName );
    1777                 :            :         }
    1778                 :            :     }
    1779                 :          0 :     return bPrintable;
    1780                 :            : 
    1781                 :            : }
    1782                 :          0 : void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
    1783                 :            :                                           const uno::Sequence< beans::PropertyValue >& rxOptions )
    1784                 :            :     throw (lang::IllegalArgumentException, uno::RuntimeException)
    1785                 :            : {
    1786         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    1787                 :            : 
    1788         [ #  # ]:          0 :     if( NULL == mpDoc )
    1789         [ #  # ]:          0 :         throw lang::DisposedException();
    1790                 :            : 
    1791 [ #  # ][ #  # ]:          0 :     if( mpDocShell && mpDoc )
    1792                 :            :     {
    1793                 :          0 :         uno::Reference< awt::XDevice >  xRenderDevice;
    1794                 :          0 :         const sal_Int32                 nPageNumber = nRenderer + 1;
    1795                 :          0 :         PageKind                        ePageKind = PK_STANDARD;
    1796                 :          0 :         sal_Bool                        bExportNotesPages = sal_False;
    1797                 :            : 
    1798         [ #  # ]:          0 :         for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
    1799                 :            :         {
    1800         [ #  # ]:          0 :             if ( rxOptions[ nProperty ].Name == "RenderDevice" )
    1801         [ #  # ]:          0 :                 rxOptions[ nProperty ].Value >>= xRenderDevice;
    1802         [ #  # ]:          0 :             else if ( rxOptions[ nProperty ].Name == "ExportNotesPages" )
    1803                 :            :             {
    1804                 :          0 :                 rxOptions[ nProperty].Value >>= bExportNotesPages;
    1805         [ #  # ]:          0 :                 if ( bExportNotesPages )
    1806                 :          0 :                     ePageKind = PK_NOTES;
    1807                 :            :             }
    1808                 :            :         }
    1809                 :            : 
    1810 [ #  # ][ #  # ]:          0 :         if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1811                 :            :         {
    1812                 :          0 :             VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
    1813         [ #  # ]:          0 :             OutputDevice*   pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
    1814                 :            : 
    1815         [ #  # ]:          0 :             if( pOut )
    1816                 :            :             {
    1817 [ #  # ][ #  # ]:          0 :                 vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() );
         [ #  # ][ #  # ]
    1818                 :            : 
    1819 [ #  # ][ #  # ]:          0 :                 if ( !( (mpDoc->GetSdPage((sal_Int16) nPageNumber-1, PK_STANDARD))->IsExcluded() ) ||
         [ #  # ][ #  # ]
    1820         [ #  # ]:          0 :                     pPDFExtOutDevData->GetIsExportHiddenSlides() )
    1821                 :            :                 {
    1822 [ #  # ][ #  # ]:          0 :                     ::sd::ClientView* pView = new ::sd::ClientView( mpDocShell, pOut, NULL );
    1823 [ #  # ][ #  # ]:          0 :                     Rectangle               aVisArea = Rectangle( Point(), mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind )->GetSize() );
                 [ #  # ]
    1824         [ #  # ]:          0 :                     Region                  aRegion( aVisArea );
    1825                 :          0 :                     Point                   aOrigin;
    1826                 :            : 
    1827                 :          0 :                     ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
    1828         [ #  # ]:          0 :                     ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : NULL;
    1829                 :            : 
    1830         [ #  # ]:          0 :                     if  ( pOldSdView )
    1831         [ #  # ]:          0 :                         pOldSdView->SdrEndTextEdit();
    1832                 :            : 
    1833         [ #  # ]:          0 :                     pView->SetHlplVisible( sal_False );
    1834         [ #  # ]:          0 :                     pView->SetGridVisible( sal_False );
    1835         [ #  # ]:          0 :                     pView->SetBordVisible( sal_False );
    1836         [ #  # ]:          0 :                     pView->SetPageVisible( sal_False );
    1837         [ #  # ]:          0 :                     pView->SetGlueVisible( sal_False );
    1838                 :            : 
    1839 [ #  # ][ #  # ]:          0 :                     pOut->SetMapMode( MAP_100TH_MM );
                 [ #  # ]
    1840         [ #  # ]:          0 :                     pOut->IntersectClipRegion( aVisArea );
    1841                 :            : 
    1842                 :            : 
    1843                 :            : 
    1844                 :          0 :                     uno::Reference< frame::XModel > xModel;
    1845         [ #  # ]:          0 :                     rSelection >>= xModel;
    1846                 :            : 
    1847 [ #  # ][ #  # ]:          0 :                     if( xModel == mpDocShell->GetModel() )
                 [ #  # ]
    1848                 :            :                     {
    1849 [ #  # ][ #  # ]:          0 :                         pView->ShowSdrPage( mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind ));
    1850                 :          0 :                         SdrPageView* pPV = pView->GetSdrPageView();
    1851                 :            : 
    1852         [ #  # ]:          0 :                         if( pOldSdView )
    1853                 :            :                         {
    1854                 :          0 :                             SdrPageView* pOldPV = pOldSdView->GetSdrPageView();
    1855 [ #  # ][ #  # ]:          0 :                             if( pPV && pOldPV )
    1856                 :            :                             {
    1857         [ #  # ]:          0 :                                 pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() );
    1858                 :          0 :                                 pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() );
    1859                 :            :                             }
    1860                 :            :                         }
    1861                 :            : 
    1862                 :          0 :                         ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
    1863         [ #  # ]:          0 :                             pPV, pPDFExtOutDevData );
    1864                 :            : 
    1865                 :            :                         // background color for outliner :o
    1866                 :          0 :                         SdPage* pPage = (SdPage*)pPV->GetPage();
    1867         [ #  # ]:          0 :                         if( pPage )
    1868                 :            :                         {
    1869         [ #  # ]:          0 :                             SdrOutliner& rOutl = mpDoc->GetDrawOutliner( NULL );
    1870                 :          0 :                             bool bScreenDisplay(true);
    1871                 :            : 
    1872 [ #  # ][ #  # ]:          0 :                             if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType())
         [ #  # ][ #  # ]
    1873                 :            :                             {
    1874                 :            :                                 // #i75566# printing; suppress AutoColor BackgroundColor generation
    1875                 :            :                                 // for visibility reasons by giving GetPageBackgroundColor()
    1876                 :            :                                 // the needed hint
    1877                 :          0 :                                 bScreenDisplay = false;
    1878                 :            :                             }
    1879                 :            : 
    1880 [ #  # ][ #  # ]:          0 :                             if(bScreenDisplay && pOut && pOut->GetPDFWriter())
         [ #  # ][ #  # ]
    1881                 :            :                             {
    1882                 :            :                                 // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
    1883                 :          0 :                                 bScreenDisplay = false;
    1884                 :            :                             }
    1885                 :            : 
    1886                 :            :                             // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
    1887                 :            :                             // hint value if screen display. Only then the AutoColor mechanisms shall be applied
    1888 [ #  # ][ #  # ]:          0 :                             rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
    1889                 :            :                         }
    1890         [ #  # ]:          0 :                         pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
    1891                 :            : 
    1892         [ #  # ]:          0 :                         if ( pPDFExtOutDevData )
    1893                 :            :                         {
    1894                 :            :                             try
    1895                 :            :                             {
    1896                 :          0 :                                 uno::Any aAny;
    1897 [ #  # ][ #  # ]:          0 :                                 uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) );
    1898         [ #  # ]:          0 :                                 if ( xPage.is() )
    1899                 :            :                                 {
    1900 [ #  # ][ #  # ]:          0 :                                     if ( pPDFExtOutDevData->GetIsExportNotes() )
    1901         [ #  # ]:          0 :                                         ImplPDFExportComments( xPage, *pPDFExtOutDevData );
    1902         [ #  # ]:          0 :                                     uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY );
    1903         [ #  # ]:          0 :                                     if( xPagePropSet.is() )
    1904                 :            :                                     {
    1905                 :            :                                         // exporting object interactions to pdf
    1906                 :            : 
    1907                 :            :                                         // if necessary, the master page interactions will be exported first
    1908                 :          0 :                                         sal_Bool bIsBackgroundObjectsVisible = sal_False;   // #i39428# IsBackgroundObjectsVisible not available for Draw
    1909                 :          0 :                                         const rtl::OUString sIsBackgroundObjectsVisible( "IsBackgroundObjectsVisible" );
    1910 [ #  # ][ #  # ]:          0 :                                         if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sIsBackgroundObjectsVisible ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1911 [ #  # ][ #  # ]:          0 :                                             xPagePropSet->getPropertyValue( sIsBackgroundObjectsVisible ) >>= bIsBackgroundObjectsVisible;
    1912 [ #  # ][ #  # ]:          0 :                                         if ( mbImpressDoc && bIsBackgroundObjectsVisible && !pPDFExtOutDevData->GetIsExportNotesPages() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1913                 :            :                                         {
    1914         [ #  # ]:          0 :                                             uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY );
    1915         [ #  # ]:          0 :                                             if ( xMasterPageTarget.is() )
    1916                 :            :                                             {
    1917 [ #  # ][ #  # ]:          0 :                                                 uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
    1918         [ #  # ]:          0 :                                                 if ( xMasterPage.is() )
    1919                 :            :                                                 {
    1920         [ #  # ]:          0 :                                                     uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY );
    1921 [ #  # ][ #  # ]:          0 :                                                     sal_Int32 i, nCount = xShapes->getCount();
    1922         [ #  # ]:          0 :                                                     for ( i = 0; i < nCount; i++ )
    1923                 :            :                                                     {
    1924 [ #  # ][ #  # ]:          0 :                                                         aAny = xShapes->getByIndex( i );
    1925                 :          0 :                                                         uno::Reference< drawing::XShape > xShape;
    1926 [ #  # ][ #  # ]:          0 :                                                         if ( aAny >>= xShape )
    1927         [ #  # ]:          0 :                                                             ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
    1928                 :          0 :                                                     }
    1929                 :          0 :                                                 }
    1930                 :          0 :                                             }
    1931                 :            :                                         }
    1932                 :            : 
    1933                 :            :                                         // exporting slide page object interactions
    1934         [ #  # ]:          0 :                                         uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY );
    1935 [ #  # ][ #  # ]:          0 :                                         sal_Int32 i, nCount = xShapes->getCount();
    1936         [ #  # ]:          0 :                                         for ( i = 0; i < nCount; i++ )
    1937                 :            :                                         {
    1938 [ #  # ][ #  # ]:          0 :                                             aAny = xShapes->getByIndex( i );
    1939                 :          0 :                                             uno::Reference< drawing::XShape > xShape;
    1940 [ #  # ][ #  # ]:          0 :                                             if ( aAny >>= xShape )
    1941         [ #  # ]:          0 :                                                 ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
    1942                 :          0 :                                         }
    1943                 :            : 
    1944                 :            :                                         // exporting transition effects to pdf
    1945 [ #  # ][ #  # ]:          0 :                                         if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1946                 :            :                                         {
    1947                 :          0 :                                             const rtl::OUString sEffect( "Effect" );
    1948                 :          0 :                                             const rtl::OUString sSpeed ( "Speed" );
    1949                 :          0 :                                             sal_Int32 nTime = 800;
    1950                 :            :                                             presentation::AnimationSpeed aAs;
    1951 [ #  # ][ #  # ]:          0 :                                             if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1952                 :            :                                             {
    1953 [ #  # ][ #  # ]:          0 :                                                 aAny = xPagePropSet->getPropertyValue( sSpeed );
    1954 [ #  # ][ #  # ]:          0 :                                                 if ( aAny >>= aAs )
    1955                 :            :                                                 {
    1956      [ #  #  # ]:          0 :                                                     switch( aAs )
    1957                 :            :                                                     {
    1958                 :          0 :                                                         case presentation::AnimationSpeed_SLOW : nTime = 1500; break;
    1959                 :          0 :                                                         case presentation::AnimationSpeed_FAST : nTime = 300; break;
    1960                 :            :                                                         default:
    1961                 :          0 :                                                         case presentation::AnimationSpeed_MEDIUM : nTime = 800;
    1962                 :            :                                                     }
    1963                 :            :                                                 }
    1964                 :            :                                             }
    1965                 :            :                                             presentation::FadeEffect eFe;
    1966                 :          0 :                                             vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular;
    1967 [ #  # ][ #  # ]:          0 :                                             if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1968                 :            :                                             {
    1969 [ #  # ][ #  # ]:          0 :                                                 aAny = xPagePropSet->getPropertyValue( sEffect );
    1970 [ #  # ][ #  # ]:          0 :                                                 if ( aAny >>= eFe )
    1971                 :            :                                                 {
    1972   [ #  #  #  #  :          0 :                                                     switch( eFe )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
    1973                 :            :                                                     {
    1974                 :            :                                                         case presentation::FadeEffect_HORIZONTAL_LINES :
    1975                 :            :                                                         case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
    1976                 :          0 :                                                         case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break;
    1977                 :            : 
    1978                 :            :                                                         case presentation::FadeEffect_VERTICAL_LINES :
    1979                 :            :                                                         case presentation::FadeEffect_VERTICAL_CHECKERBOARD :
    1980                 :          0 :                                                         case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break;
    1981                 :            : 
    1982                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_RIGHT :
    1983                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
    1984                 :            :                                                         case presentation::FadeEffect_ROLL_FROM_LEFT :
    1985                 :            :                                                         case presentation::FadeEffect_FADE_FROM_UPPERLEFT :
    1986                 :            :                                                         case presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
    1987                 :            :                                                         case presentation::FadeEffect_FADE_FROM_LEFT :
    1988                 :          0 :                                                         case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break;
    1989                 :            : 
    1990                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_BOTTOM :
    1991                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
    1992                 :            :                                                         case presentation::FadeEffect_ROLL_FROM_TOP :
    1993                 :            :                                                         case presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
    1994                 :            :                                                         case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
    1995                 :            :                                                         case presentation::FadeEffect_FADE_FROM_TOP :
    1996                 :          0 :                                                         case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::WipeTopToBottom; break;
    1997                 :            : 
    1998                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_LEFT :
    1999                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
    2000                 :            :                                                         case presentation::FadeEffect_ROLL_FROM_RIGHT :
    2001                 :            : 
    2002                 :            :                                                         case presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
    2003                 :            :                                                         case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
    2004                 :            :                                                         case presentation::FadeEffect_FADE_FROM_RIGHT :
    2005                 :          0 :                                                         case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::WipeRightToLeft; break;
    2006                 :            : 
    2007                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_TOP :
    2008                 :            :                                                         case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
    2009                 :            :                                                         case presentation::FadeEffect_ROLL_FROM_BOTTOM :
    2010                 :            :                                                         case presentation::FadeEffect_FADE_FROM_LOWERLEFT :
    2011                 :            :                                                         case presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
    2012                 :            :                                                         case presentation::FadeEffect_FADE_FROM_BOTTOM :
    2013                 :          0 :                                                         case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::WipeBottomToTop; break;
    2014                 :            : 
    2015                 :          0 :                                                         case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::SplitHorizontalInward; break;
    2016                 :          0 :                                                         case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::SplitHorizontalOutward; break;
    2017                 :            : 
    2018                 :          0 :                                                         case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::SplitVerticalInward; break;
    2019                 :          0 :                                                         case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::SplitVerticalOutward; break;
    2020                 :            : 
    2021                 :          0 :                                                         case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::BoxInward; break;
    2022                 :          0 :                                                         case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::BoxOutward; break;
    2023                 :            : 
    2024                 :          0 :                                                         case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::Regular; break;
    2025                 :            : 
    2026                 :            :                                                         case presentation::FadeEffect_RANDOM :
    2027                 :            :                                                         case presentation::FadeEffect_DISSOLVE :
    2028                 :          0 :                                                         default: eType = vcl::PDFWriter::Dissolve; break;
    2029                 :            :                                                     }
    2030                 :            :                                                 }
    2031                 :            :                                             }
    2032                 :            : 
    2033 [ #  # ][ #  # ]:          0 :                                             if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    2034 [ #  # ][ #  # ]:          0 :                                                 xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2035                 :            :                                             {
    2036         [ #  # ]:          0 :                                                 pPDFExtOutDevData->SetPageTransition( eType, nTime, -1 );
    2037                 :          0 :                                             }
    2038                 :          0 :                                         }
    2039                 :          0 :                                     }
    2040                 :            :                                 }
    2041                 :            : 
    2042 [ #  # ][ #  # ]:          0 :                                 Size        aPageSize( mpDoc->GetSdPage( 0, PK_STANDARD )->GetSize() );
    2043                 :          0 :                                 Point aPoint( 0, 0 );
    2044         [ #  # ]:          0 :                                 Rectangle   aPageRect( aPoint, aPageSize );
    2045                 :            : 
    2046                 :            :                                 // resolving links found in this page by the method ImpEditEngine::Paint
    2047         [ #  # ]:          0 :                                 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
    2048                 :          0 :                                 std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
    2049                 :          0 :                                 std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
    2050 [ #  # ][ #  # ]:          0 :                                 while ( aIBeg != aIEnd )
    2051                 :            :                                 {
    2052 [ #  # ][ #  # ]:          0 :                                     sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc );
                 [ #  # ]
    2053         [ #  # ]:          0 :                                     if ( nPage != -1 )
    2054                 :            :                                     {
    2055         [ #  # ]:          0 :                                         if ( aIBeg->nLinkId != -1 )
    2056 [ #  # ][ #  # ]:          0 :                                             pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) );
    2057                 :            :                                         else
    2058         [ #  # ]:          0 :                                             pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::FitRectangle );
    2059                 :            :                                     }
    2060                 :            :                                     else
    2061         [ #  # ]:          0 :                                         pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark );
    2062                 :          0 :                                     ++aIBeg;
    2063                 :            :                                 }
    2064                 :          0 :                                 rBookmarks.clear();
    2065                 :            :                                 //---> #i56629, #i40318
    2066                 :            :                                 //get the page name, will be used as outline element in PDF bookmark pane
    2067 [ #  # ][ #  # ]:          0 :                                 String aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName();
                 [ #  # ]
    2068         [ #  # ]:          0 :                                 if( aPageName.Len() > 0 )
    2069                 :            :                                 {
    2070                 :            :                                     // insert the bookmark to this page into the NamedDestinations
    2071 [ #  # ][ #  # ]:          0 :                                     if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
    2072         [ #  # ]:          0 :                                         pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect,  nPageNumber - 1 );
    2073                 :            :                                     //
    2074                 :            :                                     // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
    2075                 :            :                                     // issue #i40318.
    2076                 :            :                                     //
    2077 [ #  # ][ #  # ]:          0 :                                     if( pPDFExtOutDevData->GetIsExportBookmarks() )
    2078                 :            :                                     {
    2079                 :            :                                         // Destination Export
    2080                 :            :                                         const sal_Int32 nDestId =
    2081         [ #  # ]:          0 :                                             pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
    2082                 :            : 
    2083                 :            :                                         // Create a new outline item:
    2084 [ #  # ][ #  # ]:          0 :                                         pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
    2085                 :            :                                     }
    2086 [ #  # ][ #  # ]:          0 :                                 }
    2087                 :            :                                 //<--- #i56629, #i40318
    2088                 :            :                             }
    2089         [ #  # ]:          0 :                             catch (const uno::Exception&)
    2090                 :            :                             {
    2091                 :            :                             }
    2092                 :            : 
    2093         [ #  # ]:          0 :                         }
    2094                 :            :                     }
    2095                 :            :                     else
    2096                 :            :                     {
    2097                 :          0 :                         uno::Reference< drawing::XShapes > xShapes;
    2098         [ #  # ]:          0 :                         rSelection >>= xShapes;
    2099                 :            : 
    2100 [ #  # ][ #  # ]:          0 :                         if( xShapes.is() && xShapes->getCount() )
         [ #  # ][ #  # ]
                 [ #  # ]
    2101                 :            :                         {
    2102                 :          0 :                         SdrPageView* pPV = NULL;
    2103                 :            : 
    2104                 :          0 :                         ImplRenderPaintProc  aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
    2105 [ #  # ][ #  # ]:          0 :                                             pOldSdView ? pOldSdView->GetSdrPageView() : NULL, pPDFExtOutDevData );
    2106                 :            : 
    2107 [ #  # ][ #  # ]:          0 :                             for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
                 [ #  # ]
    2108                 :            :                             {
    2109                 :          0 :                                 uno::Reference< drawing::XShape > xShape;
    2110 [ #  # ][ #  # ]:          0 :                                 xShapes->getByIndex( i ) >>= xShape;
                 [ #  # ]
    2111                 :            : 
    2112         [ #  # ]:          0 :                                 if( xShape.is() )
    2113                 :            :                                 {
    2114         [ #  # ]:          0 :                                     SvxShape* pShape = SvxShape::getImplementation( xShape );
    2115                 :            : 
    2116         [ #  # ]:          0 :                                     if( pShape )
    2117                 :            :                                     {
    2118         [ #  # ]:          0 :                                         SdrObject* pObj = pShape->GetSdrObject();
    2119 [ #  # ][ #  # ]:          0 :                                         if( pObj && pObj->GetPage()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2120         [ #  # ]:          0 :                                             && aImplRenderPaintProc.IsVisible( pObj )
    2121         [ #  # ]:          0 :                                                 && aImplRenderPaintProc.IsPrintable( pObj ) )
    2122                 :            :                                         {
    2123         [ #  # ]:          0 :                                             if( !pPV )
    2124 [ #  # ][ #  # ]:          0 :                                                 pPV = pView->ShowSdrPage( pObj->GetPage() );
    2125                 :            : 
    2126         [ #  # ]:          0 :                                             if( pPV )
    2127         [ #  # ]:          0 :                                                 pView->MarkObj( pObj, pPV );
    2128                 :            :                                         }
    2129                 :            :                                     }
    2130                 :            :                                 }
    2131                 :          0 :                             }
    2132 [ #  # ][ #  # ]:          0 :                             pView->DrawMarkedObj(*pOut);
    2133                 :          0 :                         }
    2134                 :            :                     }
    2135                 :            : 
    2136 [ #  # ][ #  # ]:          0 :                     delete pView;
                 [ #  # ]
    2137                 :            :                 }
    2138                 :            :             }
    2139                 :          0 :         }
    2140         [ #  # ]:          0 :     }
    2141                 :          0 : }
    2142                 :            : 
    2143                 :         19 : uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
    2144                 :            : {
    2145                 :         19 :     uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
    2146                 :            : 
    2147         [ +  - ]:         19 :     if( !xForb.is() )
    2148 [ +  - ][ +  - ]:         19 :         mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
         [ +  - ][ +  - ]
    2149                 :            : 
    2150                 :         19 :     return xForb;
    2151                 :            : }
    2152                 :            : 
    2153                 :        359 : void SdXImpressDocument::initializeDocument()
    2154                 :            : {
    2155         [ +  - ]:        359 :     if( !mbClipBoard )
    2156                 :            :     {
    2157      [ -  +  + ]:        359 :         switch( mpDoc->GetPageCount() )
    2158                 :            :         {
    2159                 :            :         case 1:
    2160                 :            :         {
    2161                 :            :             // nasty hack to detect clipboard document
    2162                 :          0 :             mbClipBoard = true;
    2163                 :          0 :             break;
    2164                 :            :         }
    2165                 :            :         case 0:
    2166                 :            :         {
    2167                 :          9 :             mpDoc->CreateFirstPages();
    2168                 :          9 :             mpDoc->StopWorkStartupDelay();
    2169                 :        359 :             break;
    2170                 :            :         }
    2171                 :            :         }
    2172                 :            :     }
    2173                 :        359 : }
    2174                 :            : 
    2175                 :        220 : void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException)
    2176                 :            : {
    2177         [ +  - ]:        220 :     if( !mbDisposed )
    2178                 :            :     {
    2179                 :            :         {
    2180         [ +  - ]:        220 :             ::SolarMutexGuard aGuard;
    2181                 :            : 
    2182         [ +  + ]:        220 :             if( mpDoc )
    2183                 :            :             {
    2184         [ +  - ]:        169 :                 EndListening( *mpDoc );
    2185                 :        169 :                 mpDoc = NULL;
    2186                 :            :             }
    2187                 :            : 
    2188                 :            :             // Call the base class dispose() before setting the mbDisposed flag
    2189                 :            :             // to true.  The reason for this is that if close() has not yet been
    2190                 :            :             // called this is done in SfxBaseModel::dispose().  At the end of
    2191                 :            :             // that dispose() is called again.  It is important to forward this
    2192                 :            :             // second dispose() to the base class, too.
    2193                 :            :             // As a consequence the following code has to be able to be run twice.
    2194         [ +  - ]:        220 :             SfxBaseModel::dispose();
    2195                 :        220 :             mbDisposed = true;
    2196                 :            : 
    2197         [ +  - ]:        220 :             uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies);
    2198         [ -  + ]:        220 :             if( xStyles.is() )
    2199                 :            :             {
    2200         [ #  # ]:          0 :                 uno::Reference< lang::XComponent > xComp( xStyles, uno::UNO_QUERY );
    2201         [ #  # ]:          0 :                 if( xComp.is() )
    2202 [ #  # ][ #  # ]:          0 :                     xComp->dispose();
    2203                 :            : 
    2204         [ #  # ]:          0 :                 xStyles = 0;
    2205                 :            :             }
    2206                 :            : 
    2207         [ +  - ]:        220 :             uno::Reference< presentation::XPresentation > xPresentation( mxPresentation );
    2208         [ -  + ]:        220 :             if( xPresentation.is() )
    2209                 :            :             {
    2210 [ #  # ][ #  # ]:          0 :                 uno::Reference< ::com::sun::star::presentation::XPresentation2 > xPres( mpDoc->getPresentation().get() );
                 [ #  # ]
    2211         [ #  # ]:          0 :                 uno::Reference< lang::XComponent > xPresComp( xPres, uno::UNO_QUERY );
    2212         [ #  # ]:          0 :                 if( xPresComp.is() )
    2213 [ #  # ][ #  # ]:          0 :                     xPresComp->dispose();
    2214                 :            :             }
    2215                 :            : 
    2216                 :        220 :             uno::Reference< container::XNameAccess > xLinks( mxLinks );
    2217         [ +  + ]:        220 :             if( xLinks.is() )
    2218                 :            :             {
    2219         [ +  - ]:          2 :                 uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
    2220         [ +  - ]:          2 :                 if( xComp.is() )
    2221 [ +  - ][ +  - ]:          2 :                     xComp->dispose();
    2222                 :            : 
    2223         [ +  - ]:          2 :                 xLinks = 0;
    2224                 :            :             }
    2225                 :            : 
    2226         [ +  - ]:        220 :             uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess );
    2227         [ +  + ]:        220 :             if( xDrawPagesAccess.is() )
    2228                 :            :             {
    2229         [ +  - ]:        123 :                 uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY );
    2230         [ +  - ]:        123 :                 if( xComp.is() )
    2231 [ +  - ][ +  - ]:        123 :                     xComp->dispose();
    2232                 :            : 
    2233         [ +  - ]:        123 :                 xDrawPagesAccess = 0;
    2234                 :            :             }
    2235                 :            : 
    2236         [ +  - ]:        220 :             uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess );
    2237         [ -  + ]:        220 :             if( xDrawPagesAccess.is() )
    2238                 :            :             {
    2239         [ #  # ]:          0 :                 uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY );
    2240         [ #  # ]:          0 :                 if( xComp.is() )
    2241 [ #  # ][ #  # ]:          0 :                     xComp->dispose();
    2242                 :            : 
    2243         [ #  # ]:          0 :                 xDrawPagesAccess = 0;
    2244                 :            :             }
    2245                 :            : 
    2246         [ +  - ]:        220 :             uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
    2247         [ +  + ]:        220 :             if( xLayerManager.is() )
    2248                 :            :             {
    2249         [ +  - ]:          4 :                 uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY );
    2250         [ +  - ]:          4 :                 if( xComp.is() )
    2251 [ +  - ][ +  - ]:          4 :                     xComp->dispose();
    2252                 :            : 
    2253         [ +  - ]:          4 :                 xLayerManager = 0;
    2254                 :            :             }
    2255                 :            : 
    2256         [ +  - ]:        220 :             uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess );
    2257         [ +  + ]:        220 :             if( xCustomPresentationAccess.is() )
    2258                 :            :             {
    2259         [ +  - ]:          4 :                 uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY );
    2260         [ -  + ]:          4 :                 if( xComp.is() )
    2261 [ #  # ][ #  # ]:          0 :                     xComp->dispose();
    2262                 :            : 
    2263         [ +  - ]:          4 :                 xCustomPresentationAccess = 0;
    2264                 :            :             }
    2265                 :            : 
    2266         [ +  - ]:        220 :             mxDashTable = 0;
    2267         [ +  - ]:        220 :             mxGradientTable = 0;
    2268         [ +  - ]:        220 :             mxHatchTable = 0;
    2269         [ +  - ]:        220 :             mxBitmapTable = 0;
    2270         [ +  - ]:        220 :             mxTransGradientTable = 0;
    2271         [ +  - ]:        220 :             mxMarkerTable = 0;
    2272 [ +  - ][ +  - ]:        220 :             mxDrawingPool = 0;
    2273                 :            :         }
    2274                 :            :     }
    2275                 :        220 : }
    2276                 :            : 
    2277                 :            : //=============================================================================
    2278                 :            : // class SdDrawPagesAccess
    2279                 :            : //=============================================================================
    2280                 :            : 
    2281                 :        189 : SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel )  throw()
    2282                 :        189 : :   mpModel( &rMyModel)
    2283                 :            : {
    2284                 :        189 : }
    2285                 :            : 
    2286                 :        189 : SdDrawPagesAccess::~SdDrawPagesAccess() throw()
    2287                 :            : {
    2288         [ -  + ]:        378 : }
    2289                 :            : 
    2290                 :            : // XIndexAccess
    2291                 :        329 : sal_Int32 SAL_CALL SdDrawPagesAccess::getCount()
    2292                 :            :     throw(uno::RuntimeException)
    2293                 :            : {
    2294         [ +  - ]:        329 :     ::SolarMutexGuard aGuard;
    2295                 :            : 
    2296         [ -  + ]:        329 :     if( NULL == mpModel )
    2297         [ #  # ]:          0 :         throw lang::DisposedException();
    2298                 :            : 
    2299 [ +  - ][ +  - ]:        329 :     return mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
    2300                 :            : }
    2301                 :            : 
    2302                 :        531 : uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index )
    2303                 :            :     throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
    2304                 :            : {
    2305         [ +  - ]:        531 :     ::SolarMutexGuard aGuard;
    2306                 :            : 
    2307         [ -  + ]:        531 :     if( NULL == mpModel )
    2308         [ #  # ]:          0 :         throw lang::DisposedException();
    2309                 :            : 
    2310                 :        531 :     uno::Any aAny;
    2311                 :            : 
    2312 [ +  - ][ +  + ]:        531 :     if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PK_STANDARD ) ) )
         [ +  + ][ +  - ]
    2313         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    2314                 :            : 
    2315         [ +  - ]:        529 :     SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD );
    2316         [ +  - ]:        529 :     if( pPage )
    2317                 :            :     {
    2318 [ +  - ][ +  - ]:        529 :         uno::Reference< drawing::XDrawPage >  xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
    2319         [ +  - ]:        529 :         aAny <<= xDrawPage;
    2320                 :            :     }
    2321                 :            : 
    2322         [ +  - ]:        531 :     return aAny;
    2323                 :            : }
    2324                 :            : 
    2325                 :            : // XNameAccess
    2326                 :          0 : uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
    2327                 :            : {
    2328         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    2329                 :            : 
    2330         [ #  # ]:          0 :     if( NULL == mpModel )
    2331         [ #  # ]:          0 :         throw lang::DisposedException();
    2332                 :            : 
    2333         [ #  # ]:          0 :     if( !aName.isEmpty() )
    2334                 :            :     {
    2335         [ #  # ]:          0 :         const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
    2336                 :            :         sal_uInt16 nPage;
    2337         [ #  # ]:          0 :         for( nPage = 0; nPage < nCount; nPage++ )
    2338                 :            :         {
    2339         [ #  # ]:          0 :             SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
    2340         [ #  # ]:          0 :             if(NULL == pPage)
    2341                 :          0 :                 continue;
    2342                 :            : 
    2343 [ #  # ][ #  # ]:          0 :             if( aName == SdDrawPage::getPageApiName( pPage ) )
    2344                 :            :             {
    2345                 :          0 :                 uno::Any aAny;
    2346 [ #  # ][ #  # ]:          0 :                 uno::Reference< drawing::XDrawPage >  xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
    2347         [ #  # ]:          0 :                 aAny <<= xDrawPage;
    2348                 :          0 :                 return aAny;
    2349                 :            :             }
    2350                 :            :         }
    2351                 :            :     }
    2352                 :            : 
    2353 [ #  # ][ #  # ]:          0 :     throw container::NoSuchElementException();
    2354                 :            : }
    2355                 :            : 
    2356                 :          0 : uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException)
    2357                 :            : {
    2358         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    2359                 :            : 
    2360         [ #  # ]:          0 :     if( NULL == mpModel )
    2361         [ #  # ]:          0 :         throw lang::DisposedException();
    2362                 :            : 
    2363         [ #  # ]:          0 :     const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
    2364         [ #  # ]:          0 :     uno::Sequence< OUString > aNames( nCount );
    2365         [ #  # ]:          0 :     OUString* pNames = aNames.getArray();
    2366                 :            : 
    2367                 :            :     sal_uInt16 nPage;
    2368         [ #  # ]:          0 :     for( nPage = 0; nPage < nCount; nPage++ )
    2369                 :            :     {
    2370         [ #  # ]:          0 :         SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
    2371         [ #  # ]:          0 :         *pNames++ = SdDrawPage::getPageApiName( pPage );
    2372                 :            :     }
    2373                 :            : 
    2374         [ #  # ]:          0 :     return aNames;
    2375                 :            : }
    2376                 :            : 
    2377                 :          0 : sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException)
    2378                 :            : {
    2379         [ #  # ]:          0 :     ::SolarMutexGuard aGuard;
    2380                 :            : 
    2381         [ #  # ]:          0 :     if( NULL == mpModel )
    2382         [ #  # ]:          0 :         throw lang::DisposedException();
    2383                 :            : 
    2384         [ #  # ]:          0 :     const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
    2385                 :            :     sal_uInt16 nPage;
    2386         [ #  # ]:          0 :     for( nPage = 0; nPage < nCount; nPage++ )
    2387                 :            :     {
    2388         [ #  # ]:          0 :         SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
    2389         [ #  # ]:          0 :         if(NULL == pPage)
    2390                 :          0 :             continue;
    2391                 :            : 
    2392 [ #  # ][ #  # ]:          0 :         if( aName == SdDrawPage::getPageApiName( pPage ) )
    2393                 :          0 :             return sal_True;
    2394                 :            :     }
    2395                 :            : 
    2396         [ #  # ]:          0 :     return sal_False;
    2397                 :            : }
    2398                 :            : 
    2399                 :            : // XElementAccess
    2400                 :          2 : uno::Type SAL_CALL SdDrawPagesAccess::getElementType()
    2401                 :            :     throw(uno::RuntimeException)
    2402                 :            : {
    2403                 :          2 :     return ITYPE( drawing::XDrawPage );
    2404                 :            : }
    2405                 :            : 
    2406                 :          2 : sal_Bool SAL_CALL SdDrawPagesAccess::hasElements()
    2407                 :            :     throw(uno::RuntimeException)
    2408                 :            : {
    2409                 :          2 :     return getCount() > 0;
    2410                 :            : }
    2411                 :            : 
    2412                 :            : // XDrawPages
    2413                 :            : 
    2414                 :            : /******************************************************************************
    2415                 :            : * Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die *
    2416                 :            : * dazugehoerige SdDrawPage zurueck.                                           *
    2417                 :            : ******************************************************************************/
    2418                 :         41 : uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
    2419                 :            :     throw(uno::RuntimeException)
    2420                 :            : {
    2421         [ +  - ]:         41 :     ::SolarMutexGuard aGuard;
    2422                 :            : 
    2423         [ -  + ]:         41 :     if( NULL == mpModel )
    2424         [ #  # ]:          0 :         throw lang::DisposedException();
    2425                 :            : 
    2426         [ +  - ]:         41 :     if( mpModel->mpDoc )
    2427                 :            :     {
    2428                 :         41 :         SdPage* pPage = mpModel->InsertSdPage( (sal_uInt16)nIndex );
    2429         [ +  - ]:         41 :         if( pPage )
    2430                 :            :         {
    2431 [ +  - ][ +  - ]:         41 :             uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
    2432                 :         41 :             return xDrawPage;
    2433                 :            :         }
    2434                 :            :     }
    2435                 :          0 :     uno::Reference< drawing::XDrawPage > xDrawPage;
    2436         [ +  - ]:         41 :     return xDrawPage;
    2437                 :            : }
    2438                 :            : 
    2439                 :            : /******************************************************************************
    2440                 :            : * Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen      *
    2441                 :            : * Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model *
    2442                 :            : * nach dem entfernen dieser Seite vorhanden ist.                              *
    2443                 :            : ******************************************************************************/
    2444                 :          2 : void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
    2445                 :            :         throw(uno::RuntimeException)
    2446                 :            : {
    2447         [ +  - ]:          2 :     ::SolarMutexGuard aGuard;
    2448                 :            : 
    2449 [ +  - ][ -  + ]:          2 :     if( NULL == mpModel || mpModel->mpDoc == NULL )
    2450         [ #  # ]:          0 :         throw lang::DisposedException();
    2451                 :            : 
    2452                 :          2 :     SdDrawDocument& rDoc = *mpModel->mpDoc;
    2453                 :            : 
    2454         [ +  - ]:          2 :     sal_uInt16 nPageCount = rDoc.GetSdPageCount( PK_STANDARD );
    2455         [ +  - ]:          2 :     if( nPageCount > 1 )
    2456                 :            :     {
    2457                 :            :         // pPage von xPage besorgen und dann die Id (nPos )ermitteln
    2458         [ +  - ]:          2 :         SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage );
    2459         [ +  - ]:          2 :         if( pSvxPage )
    2460                 :            :         {
    2461                 :          2 :             SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
    2462 [ +  - ][ +  - ]:          2 :             if(pPage && ( pPage->GetPageKind() == PK_STANDARD ) )
                 [ +  - ]
    2463                 :            :             {
    2464         [ +  - ]:          2 :                 sal_uInt16 nPage = pPage->GetPageNum();
    2465                 :            : 
    2466         [ +  - ]:          2 :                 SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) );
    2467                 :            : 
    2468         [ +  - ]:          2 :                 bool bUndo = rDoc.IsUndoEnabled();
    2469         [ +  - ]:          2 :                 if( bUndo )
    2470                 :            :                 {
    2471                 :            :                     // Add undo actions and delete the pages.  The order of adding
    2472                 :            :                     // the undo actions is important.
    2473 [ +  - ][ +  - ]:          2 :                     rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
         [ +  - ][ +  - ]
    2474 [ +  - ][ +  - ]:          2 :                     rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
                 [ +  - ]
    2475 [ +  - ][ +  - ]:          2 :                     rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
                 [ +  - ]
    2476                 :            :                 }
    2477                 :            : 
    2478         [ +  - ]:          2 :                 rDoc.RemovePage( nPage ); // the page
    2479         [ +  - ]:          2 :                 rDoc.RemovePage( nPage ); // the notes page
    2480                 :            : 
    2481         [ +  - ]:          2 :                 if( bUndo )
    2482                 :            :                 {
    2483         [ +  - ]:          2 :                     rDoc.EndUndo();
    2484                 :            :                 }
    2485                 :            :                 else
    2486                 :            :                 {
    2487 [ #  # ][ #  # ]:          0 :                     delete pNotesPage;
    2488 [ #  # ][ #  # ]:          0 :                     delete pPage;
    2489                 :            :                 }
    2490                 :            :             }
    2491                 :            :         }
    2492                 :            :     }
    2493                 :            : 
    2494         [ +  - ]:          2 :     mpModel->SetModified();
    2495                 :          2 : }
    2496                 :            : 
    2497                 :            : // XServiceInfo
    2498                 :            : const char pSdDrawPagesAccessService[] = "com.sun.star.drawing.DrawPages";
    2499                 :            : 
    2500                 :          0 : OUString SAL_CALL SdDrawPagesAccess::getImplementationName(  ) throw(uno::RuntimeException)
    2501                 :            : {
    2502                 :          0 :     return OUString( "SdDrawPagesAccess" );
    2503                 :            : }
    2504                 :            : 
    2505                 :          0 : sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
    2506                 :            : {
    2507                 :          0 :     return ServiceName == pSdDrawPagesAccessService;
    2508                 :            : }
    2509                 :            : 
    2510                 :          0 : uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames(  ) throw(uno::RuntimeException)
    2511                 :            : {
    2512                 :          0 :     OUString aService( pSdDrawPagesAccessService );
    2513         [ #  # ]:          0 :     uno::Sequence< OUString > aSeq( &aService, 1 );
    2514                 :          0 :     return aSeq;
    2515                 :            : }
    2516                 :            : 
    2517                 :            : // XComponent
    2518                 :        123 : void SAL_CALL SdDrawPagesAccess::dispose(  ) throw (uno::RuntimeException)
    2519                 :            : {
    2520                 :        123 :     mpModel = NULL;
    2521                 :        123 : }
    2522                 :            : 
    2523                 :          0 : void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2524                 :            : {
    2525                 :            :     OSL_FAIL( "not implemented!" );
    2526                 :          0 : }
    2527                 :            : 
    2528                 :          0 : void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2529                 :            : {
    2530                 :            :     OSL_FAIL( "not implemented!" );
    2531                 :          0 : }
    2532                 :            : 
    2533                 :            : //=============================================================================
    2534                 :            : // class SdMasterPagesAccess
    2535                 :            : //=============================================================================
    2536                 :            : 
    2537                 :        123 : SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw()
    2538                 :        123 : :   mpModel(&rMyModel)
    2539                 :            : {
    2540                 :        123 : }
    2541                 :            : 
    2542                 :        123 : SdMasterPagesAccess::~SdMasterPagesAccess() throw()
    2543                 :            : {
    2544         [ -  + ]:        246 : }
    2545                 :            : 
    2546                 :            : // XComponent
    2547                 :          0 : void SAL_CALL SdMasterPagesAccess::dispose(  ) throw (uno::RuntimeException)
    2548                 :            : {
    2549                 :          0 :     mpModel = NULL;
    2550                 :          0 : }
    2551                 :            : 
    2552                 :          0 : void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2553                 :            : {
    2554                 :            :     OSL_FAIL( "not implemented!" );
    2555                 :          0 : }
    2556                 :            : 
    2557                 :          0 : void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2558                 :            : {
    2559                 :            :     OSL_FAIL( "not implemented!" );
    2560                 :          0 : }
    2561                 :            : 
    2562                 :            : // XIndexAccess
    2563                 :        115 : sal_Int32 SAL_CALL SdMasterPagesAccess::getCount()
    2564                 :            :     throw(uno::RuntimeException)
    2565                 :            : {
    2566         [ +  - ]:        115 :     ::SolarMutexGuard aGuard;
    2567                 :            : 
    2568         [ -  + ]:        115 :     if( NULL == mpModel->mpDoc )
    2569         [ #  # ]:          0 :         throw lang::DisposedException();
    2570                 :            : 
    2571 [ +  - ][ +  - ]:        115 :     return mpModel->mpDoc->GetMasterSdPageCount(PK_STANDARD);
    2572                 :            : }
    2573                 :            : 
    2574                 :            : /******************************************************************************
    2575                 :            : * Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der *
    2576                 :            : * angegebennen Position im Model.                                             *
    2577                 :            : ******************************************************************************/
    2578                 :        172 : uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index )
    2579                 :            :     throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
    2580                 :            : {
    2581         [ +  - ]:        172 :     ::SolarMutexGuard aGuard;
    2582                 :            : 
    2583         [ -  + ]:        172 :     if( NULL == mpModel )
    2584         [ #  # ]:          0 :         throw lang::DisposedException();
    2585                 :            : 
    2586                 :        172 :     uno::Any aAny;
    2587                 :            : 
    2588 [ +  - ][ +  + ]:        172 :     if( (Index < 0) || (Index >= mpModel->mpDoc->GetMasterSdPageCount( PK_STANDARD ) ) )
         [ +  + ][ +  - ]
    2589         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    2590                 :            : 
    2591         [ +  - ]:        170 :     SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD );
    2592         [ +  - ]:        170 :     if( pPage )
    2593                 :            :     {
    2594 [ +  - ][ +  - ]:        170 :         uno::Reference< drawing::XDrawPage >  xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
    2595         [ +  - ]:        170 :         aAny <<= xDrawPage;
    2596                 :            :     }
    2597                 :            : 
    2598         [ +  - ]:        172 :     return aAny;
    2599                 :            : }
    2600                 :            : 
    2601                 :            : // XElementAccess
    2602                 :          2 : uno::Type SAL_CALL SdMasterPagesAccess::getElementType()
    2603                 :            :     throw(uno::RuntimeException)
    2604                 :            : {
    2605                 :          2 :     return ITYPE(drawing::XDrawPage);
    2606                 :            : }
    2607                 :            : 
    2608                 :          2 : sal_Bool SAL_CALL SdMasterPagesAccess::hasElements()
    2609                 :            :     throw(uno::RuntimeException)
    2610                 :            : {
    2611                 :          2 :     return getCount() > 0;
    2612                 :            : }
    2613                 :            : 
    2614                 :            : // XDrawPages
    2615                 :          8 : uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos )
    2616                 :            :     throw(uno::RuntimeException)
    2617                 :            : {
    2618         [ +  - ]:          8 :     ::SolarMutexGuard aGuard;
    2619                 :            : 
    2620         [ -  + ]:          8 :     if( NULL == mpModel )
    2621         [ #  # ]:          0 :         throw lang::DisposedException();
    2622                 :            : 
    2623                 :          8 :     uno::Reference< drawing::XDrawPage > xDrawPage;
    2624                 :            : 
    2625                 :          8 :     SdDrawDocument* mpDoc = mpModel->mpDoc;
    2626         [ +  - ]:          8 :     if( mpDoc )
    2627                 :            :     {
    2628                 :            :         // calculate internal index and check for range errors
    2629         [ +  - ]:          8 :         const sal_Int32 nMPageCount = mpDoc->GetMasterPageCount();
    2630                 :          8 :         nInsertPos = nInsertPos * 2 + 1;
    2631 [ +  - ][ -  + ]:          8 :         if( nInsertPos < 0 || nInsertPos > nMPageCount )
    2632                 :          0 :             nInsertPos = nMPageCount;
    2633                 :            : 
    2634                 :            :         // now generate a unique name for the new masterpage
    2635 [ +  - ][ +  - ]:          8 :         const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) );
    2636         [ +  - ]:          8 :         String aPrefix( aStdPrefix );
    2637                 :            : 
    2638                 :          8 :         sal_Bool bUnique = sal_True;
    2639                 :          8 :         sal_Int32 i = 0;
    2640         [ +  + ]:         22 :         do
    2641                 :            :         {
    2642                 :         22 :             bUnique = sal_True;
    2643         [ +  + ]:         66 :             for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ )
    2644                 :            :             {
    2645         [ +  - ]:         58 :                 SdPage* pPage = (SdPage*)mpDoc->GetMasterPage((sal_uInt16)nMaster);
    2646 [ +  - ][ +  - ]:         58 :                 if( pPage && pPage->GetName() == aPrefix )
         [ +  - ][ +  + ]
                 [ +  + ]
    2647                 :            :                 {
    2648                 :         14 :                     bUnique = sal_False;
    2649                 :         14 :                     break;
    2650                 :            :                 }
    2651                 :            :             }
    2652                 :            : 
    2653         [ +  + ]:         22 :             if( !bUnique )
    2654                 :            :             {
    2655                 :         14 :                 i++;
    2656         [ +  - ]:         14 :                 aPrefix = aStdPrefix;
    2657         [ +  - ]:         14 :                 aPrefix += sal_Unicode( ' ' );
    2658 [ +  - ][ +  - ]:         14 :                 aPrefix += String::CreateFromInt32( i );
                 [ +  - ]
    2659                 :            :             }
    2660                 :            : 
    2661                 :         22 :         } while( !bUnique );
    2662                 :            : 
    2663         [ +  - ]:          8 :         String aLayoutName( aPrefix );
    2664         [ +  - ]:          8 :         aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
    2665 [ +  - ][ +  - ]:          8 :         aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
         [ +  - ][ +  - ]
    2666                 :            : 
    2667                 :            :         // create styles
    2668 [ +  - ][ +  - ]:          8 :         ((SdStyleSheetPool*)mpDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix );
    2669                 :            : 
    2670                 :            :         // get the first page for initial size and border settings
    2671         [ +  - ]:          8 :         SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD );
    2672         [ +  - ]:          8 :         SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES);
    2673                 :            : 
    2674                 :            :         // create and instert new draw masterpage
    2675         [ +  - ]:          8 :         SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
    2676 [ +  - ][ +  - ]:          8 :         pMPage->SetSize( pPage->GetSize() );
    2677                 :          8 :         pMPage->SetBorder( pPage->GetLftBorder(),
    2678                 :          8 :                            pPage->GetUppBorder(),
    2679                 :          8 :                            pPage->GetRgtBorder(),
    2680 [ +  - ][ +  - ]:          8 :                            pPage->GetLwrBorder() );
         [ +  - ][ +  - ]
                 [ +  - ]
    2681 [ +  - ][ +  - ]:          8 :         pMPage->SetLayoutName( aLayoutName );
                 [ +  - ]
    2682         [ +  - ]:          8 :         mpDoc->InsertMasterPage(pMPage,  (sal_uInt16)nInsertPos);
    2683                 :            : 
    2684                 :            :         {
    2685                 :            :             // ensure default MasterPage fill
    2686         [ +  - ]:          8 :             pMPage->EnsureMasterPageDefaultBackground();
    2687                 :            :         }
    2688                 :            : 
    2689 [ +  - ][ +  - ]:          8 :         xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() );
                 [ +  - ]
    2690                 :            : 
    2691                 :            :         // create and instert new notes masterpage
    2692         [ +  - ]:          8 :         SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
    2693 [ +  - ][ +  - ]:          8 :         pMNotesPage->SetSize( pRefNotesPage->GetSize() );
    2694                 :          8 :         pMNotesPage->SetPageKind(PK_NOTES);
    2695                 :          8 :         pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
    2696                 :          8 :                                 pRefNotesPage->GetUppBorder(),
    2697                 :          8 :                                 pRefNotesPage->GetRgtBorder(),
    2698 [ +  - ][ +  - ]:          8 :                                 pRefNotesPage->GetLwrBorder() );
         [ +  - ][ +  - ]
                 [ +  - ]
    2699 [ +  - ][ +  - ]:          8 :         pMNotesPage->SetLayoutName( aLayoutName );
                 [ +  - ]
    2700         [ +  - ]:          8 :         mpDoc->InsertMasterPage(pMNotesPage,  (sal_uInt16)nInsertPos + 1);
    2701         [ +  - ]:          8 :         pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True);
    2702 [ +  - ][ +  - ]:          8 :         mpModel->SetModified();
                 [ +  - ]
    2703                 :            :     }
    2704                 :            : 
    2705         [ +  - ]:          8 :     return( xDrawPage );
    2706                 :            : }
    2707                 :            : 
    2708                 :            : /******************************************************************************
    2709                 :            : * Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen    *
    2710                 :            : * Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese     *
    2711                 :            : * Seite als Masterpage benutzt.                                               *
    2712                 :            : ******************************************************************************/
    2713                 :          2 : void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
    2714                 :            :     throw(uno::RuntimeException)
    2715                 :            : {
    2716         [ +  - ]:          2 :     ::SolarMutexGuard aGuard;
    2717                 :            : 
    2718 [ +  - ][ -  + ]:          2 :     if( NULL == mpModel || mpModel->mpDoc == NULL )
    2719         [ #  # ]:          0 :         throw lang::DisposedException();
    2720                 :            : 
    2721                 :          2 :     SdDrawDocument& rDoc = *mpModel->mpDoc;
    2722                 :            : 
    2723         [ +  - ]:          2 :     SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage );
    2724         [ -  + ]:          2 :     if(pSdPage == NULL)
    2725                 :            :         return;
    2726                 :            : 
    2727         [ -  + ]:          2 :     SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage());
    2728                 :            : 
    2729                 :            :     DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?");
    2730                 :            : 
    2731 [ +  - ][ +  - ]:          2 :     if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0))
         [ +  - ][ -  + ]
                 [ -  + ]
    2732                 :            :         return; //Todo: this should be excepted
    2733                 :            : 
    2734                 :            :     // only standard pages can be removed directly
    2735         [ +  - ]:          2 :     if( pPage->GetPageKind() == PK_STANDARD )
    2736                 :            :     {
    2737         [ +  - ]:          2 :         sal_uInt16 nPage = pPage->GetPageNum();
    2738                 :            : 
    2739         [ +  - ]:          2 :         SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) );
    2740                 :            : 
    2741         [ +  - ]:          2 :         bool bUndo = rDoc.IsUndoEnabled();
    2742         [ +  - ]:          2 :         if( bUndo )
    2743                 :            :         {
    2744                 :            :             // Add undo actions and delete the pages.  The order of adding
    2745                 :            :             // the undo actions is important.
    2746 [ +  - ][ +  - ]:          2 :             rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
         [ +  - ][ +  - ]
    2747 [ +  - ][ +  - ]:          2 :             rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
                 [ +  - ]
    2748 [ +  - ][ +  - ]:          2 :             rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
                 [ +  - ]
    2749                 :            :         }
    2750                 :            : 
    2751         [ +  - ]:          2 :         rDoc.RemoveMasterPage( nPage );
    2752         [ +  - ]:          2 :         rDoc.RemoveMasterPage( nPage );
    2753                 :            : 
    2754         [ +  - ]:          2 :         if( bUndo )
    2755                 :            :         {
    2756         [ +  - ]:          2 :             rDoc.EndUndo();
    2757                 :            :         }
    2758                 :            :         else
    2759                 :            :         {
    2760 [ #  # ][ #  # ]:          0 :             delete pNotesPage;
    2761 [ #  # ][ #  # ]:          2 :             delete pPage;
    2762                 :            :         }
    2763 [ +  - ][ +  - ]:          2 :     }
    2764                 :            : }
    2765                 :            : 
    2766                 :            : // XServiceInfo
    2767                 :            : const char pSdMasterPagesAccessService[] = "com.sun.star.drawing.MasterPages";
    2768                 :            : 
    2769                 :          0 : OUString SAL_CALL SdMasterPagesAccess::getImplementationName(  ) throw(uno::RuntimeException)
    2770                 :            : {
    2771                 :          0 :     return OUString( "SdMasterPagesAccess" );
    2772                 :            : }
    2773                 :            : 
    2774                 :          0 : sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
    2775                 :            : {
    2776                 :          0 :     return ServiceName == pSdMasterPagesAccessService;
    2777                 :            : }
    2778                 :            : 
    2779                 :          0 : uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames(  ) throw(uno::RuntimeException)
    2780                 :            : {
    2781                 :          0 :     OUString aService( pSdMasterPagesAccessService );
    2782         [ #  # ]:          0 :     uno::Sequence< OUString > aSeq( &aService, 1 );
    2783                 :          0 :     return aSeq;
    2784                 :            : }
    2785                 :            : 
    2786                 :            : //=============================================================================
    2787                 :            : // class SdDocLinkTargets
    2788                 :            : //=============================================================================
    2789                 :            : 
    2790                 :          2 : SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw()
    2791                 :          2 : : mpModel( &rMyModel )
    2792                 :            : {
    2793                 :          2 : }
    2794                 :            : 
    2795                 :          2 : SdDocLinkTargets::~SdDocLinkTargets() throw()
    2796                 :            : {
    2797         [ -  + ]:          4 : }
    2798                 :            : 
    2799                 :            : // XComponent
    2800                 :          2 : void SAL_CALL SdDocLinkTargets::dispose(  ) throw (uno::RuntimeException)
    2801                 :            : {
    2802                 :          2 :     mpModel = NULL;
    2803                 :          2 : }
    2804                 :            : 
    2805                 :          0 : void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2806                 :            : {
    2807                 :            :     OSL_FAIL( "not implemented!" );
    2808                 :          0 : }
    2809                 :            : 
    2810                 :          0 : void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >&  ) throw (uno::RuntimeException)
    2811                 :            : {
    2812                 :            :     OSL_FAIL( "not implemented!" );
    2813                 :          0 : }
    2814                 :            : 
    2815                 :            : // XNameAccess
    2816                 :          4 : uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName )
    2817                 :            :     throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
    2818                 :            : {
    2819         [ +  - ]:          4 :     ::SolarMutexGuard aGuard;
    2820                 :            : 
    2821         [ -  + ]:          4 :     if( NULL == mpModel )
    2822         [ #  # ]:          0 :         throw lang::DisposedException();
    2823                 :            : 
    2824                 :          4 :     SdPage* pPage = FindPage( aName );
    2825                 :            : 
    2826         [ +  + ]:          4 :     if( pPage == NULL )
    2827         [ +  - ]:          2 :         throw container::NoSuchElementException();
    2828                 :            : 
    2829                 :          2 :     uno::Any aAny;
    2830                 :            : 
    2831 [ +  - ][ +  - ]:          2 :     uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY );
    2832         [ +  - ]:          2 :     if( xProps.is() )
    2833         [ +  - ]:          2 :         aAny <<= xProps;
    2834                 :            : 
    2835         [ +  - ]:          4 :     return aAny;
    2836                 :            : }
    2837                 :            : 
    2838                 :          2 : uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames()
    2839                 :            :     throw(uno::RuntimeException)
    2840                 :            : {
    2841         [ +  - ]:          2 :     ::SolarMutexGuard aGuard;
    2842                 :            : 
    2843         [ -  + ]:          2 :     if( NULL == mpModel )
    2844         [ #  # ]:          0 :         throw lang::DisposedException();
    2845                 :            : 
    2846                 :          2 :     SdDrawDocument* mpDoc = mpModel->GetDoc();
    2847         [ -  + ]:          2 :     if( mpDoc == NULL )
    2848                 :            :     {
    2849         [ #  # ]:          0 :         uno::Sequence< OUString > aSeq;
    2850 [ #  # ][ #  # ]:          0 :         return aSeq;
    2851                 :            :     }
    2852                 :            : 
    2853         [ +  - ]:          2 :     if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW )
    2854                 :            :     {
    2855         [ +  - ]:          2 :         const sal_uInt16 nMaxPages = mpDoc->GetSdPageCount( PK_STANDARD );
    2856         [ +  - ]:          2 :         const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterSdPageCount( PK_STANDARD );
    2857                 :            : 
    2858         [ +  - ]:          2 :         uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
    2859         [ +  - ]:          2 :         OUString* pStr = aSeq.getArray();
    2860                 :            : 
    2861                 :            :         sal_uInt16 nPage;
    2862                 :            :         // standard pages
    2863         [ +  + ]:          4 :         for( nPage = 0; nPage < nMaxPages; nPage++ )
    2864 [ +  - ][ +  - ]:          2 :             *pStr++ = mpDoc->GetSdPage( nPage, PK_STANDARD )->GetName();
                 [ +  - ]
    2865                 :            : 
    2866                 :            :         // master pages
    2867         [ +  + ]:          4 :         for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
    2868 [ +  - ][ +  - ]:          2 :             *pStr++ = mpDoc->GetMasterSdPage( nPage, PK_STANDARD )->GetName();
                 [ +  - ]
    2869 [ +  - ][ +  - ]:          2 :         return aSeq;
    2870                 :            :     }
    2871                 :            :     else
    2872                 :            :     {
    2873         [ #  # ]:          0 :         const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
    2874         [ #  # ]:          0 :         const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
    2875                 :            : 
    2876         [ #  # ]:          0 :         uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
    2877         [ #  # ]:          0 :         OUString* pStr = aSeq.getArray();
    2878                 :            : 
    2879                 :            :         sal_uInt16 nPage;
    2880                 :            :         // standard pages
    2881         [ #  # ]:          0 :         for( nPage = 0; nPage < nMaxPages; nPage++ )
    2882 [ #  # ][ #  # ]:          0 :             *pStr++ = ((SdPage*)mpDoc->GetPage( nPage ))->GetName();
                 [ #  # ]
    2883                 :            : 
    2884                 :            :         // master pages
    2885         [ #  # ]:          0 :         for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
    2886 [ #  # ][ #  # ]:          0 :             *pStr++ = ((SdPage*)mpDoc->GetMasterPage( nPage ))->GetName();
                 [ #  # ]
    2887 [ #  # ][ #  # ]:          0 :         return aSeq;
    2888         [ +  - ]:          2 :     }
    2889                 :            : }
    2890                 :            : 
    2891                 :          4 : sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName )
    2892                 :            :     throw(uno::RuntimeException)
    2893                 :            : {
    2894         [ +  - ]:          4 :     ::SolarMutexGuard aGuard;
    2895                 :            : 
    2896         [ -  + ]:          4 :     if( NULL == mpModel )
    2897         [ #  # ]:          0 :         throw lang::DisposedException();
    2898                 :            : 
    2899         [ +  - ]:          4 :     return FindPage( aName ) != NULL;
    2900                 :            : }
    2901                 :            : 
    2902                 :            : // container::XElementAccess
    2903                 :          2 : uno::Type SAL_CALL SdDocLinkTargets::getElementType()
    2904                 :            :     throw(uno::RuntimeException)
    2905                 :            : {
    2906                 :          2 :     return ITYPE(beans::XPropertySet);
    2907                 :            : }
    2908                 :            : 
    2909                 :          2 : sal_Bool SAL_CALL SdDocLinkTargets::hasElements()
    2910                 :            :     throw(uno::RuntimeException)
    2911                 :            : {
    2912         [ +  - ]:          2 :     ::SolarMutexGuard aGuard;
    2913                 :            : 
    2914         [ -  + ]:          2 :     if( NULL == mpModel )
    2915         [ #  # ]:          0 :         throw lang::DisposedException();
    2916                 :            : 
    2917         [ +  - ]:          2 :     return mpModel->GetDoc() != NULL;
    2918                 :            : }
    2919                 :            : 
    2920                 :          8 : SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw()
    2921                 :            : {
    2922                 :          8 :     SdDrawDocument* mpDoc = mpModel->GetDoc();
    2923         [ -  + ]:          8 :     if( mpDoc == NULL )
    2924                 :          0 :         return NULL;
    2925                 :            : 
    2926         [ +  - ]:          8 :     const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
    2927         [ +  - ]:          8 :     const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
    2928                 :            : 
    2929                 :            :     sal_uInt16 nPage;
    2930                 :            :     SdPage* pPage;
    2931                 :            : 
    2932         [ +  - ]:          8 :     const String aName( rName );
    2933                 :            : 
    2934                 :          8 :     const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW;
    2935                 :            : 
    2936                 :            :     // standard pages
    2937         [ +  + ]:         24 :     for( nPage = 0; nPage < nMaxPages; nPage++ )
    2938                 :            :     {
    2939         [ +  - ]:         20 :         pPage = (SdPage*)mpDoc->GetPage( nPage );
    2940 [ +  - ][ +  - ]:         20 :         if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
    2941                 :          4 :             return pPage;
    2942                 :            :     }
    2943                 :            : 
    2944                 :            :     // master pages
    2945         [ +  + ]:         16 :     for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
    2946                 :            :     {
    2947         [ +  - ]:         12 :         pPage = (SdPage*)mpDoc->GetMasterPage( nPage );
    2948 [ +  - ][ +  - ]:         12 :         if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
    2949                 :          0 :             return pPage;
    2950                 :            :     }
    2951                 :            : 
    2952         [ +  - ]:          8 :     return NULL;
    2953                 :            : }
    2954                 :            : 
    2955                 :            : // XServiceInfo
    2956                 :          0 : OUString SAL_CALL SdDocLinkTargets::getImplementationName()
    2957                 :            :     throw(uno::RuntimeException)
    2958                 :            : {
    2959                 :          0 :     return OUString( "SdDocLinkTargets" );
    2960                 :            : }
    2961                 :            : 
    2962                 :          0 : sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName )
    2963                 :            :     throw(uno::RuntimeException)
    2964                 :            : {
    2965                 :          0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
    2966                 :            : }
    2967                 :            : 
    2968                 :          0 : uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
    2969                 :            :     throw(uno::RuntimeException)
    2970                 :            : {
    2971                 :          0 :     const OUString aSN( "com.sun.star.document.LinkTargets" );
    2972         [ #  # ]:          0 :     uno::Sequence< OUString > aSeq( &aSN, 1 );
    2973                 :          0 :     return aSeq;
    2974                 :            : }
    2975                 :            : 
    2976                 :          0 : rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument* pDocument )
    2977                 :            : {
    2978                 :          0 :     rtl::Reference< SdXImpressDocument > xRet;
    2979         [ #  # ]:          0 :     if( pDocument )
    2980                 :            :     {
    2981                 :          0 :         ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh();
    2982         [ #  # ]:          0 :         if( pDocShell )
    2983                 :            :         {
    2984         [ #  # ]:          0 :             uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
    2985                 :            : 
    2986 [ #  # ][ #  # ]:          0 :             xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
    2987                 :            :         }
    2988                 :            :     }
    2989                 :            : 
    2990                 :          0 :     return xRet;
    2991                 :            : }
    2992                 :            : 
    2993                 :          0 : void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName )
    2994                 :            : {
    2995         [ #  # ]:          0 :     rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
    2996                 :            : 
    2997         [ #  # ]:          0 :     if( xModel.is() )
    2998                 :            :     {
    2999         [ #  # ]:          0 :         uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) );
    3000         [ #  # ]:          0 :         ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
    3001 [ #  # ][ #  # ]:          0 :         xModel->notifyEvent(aEvent );
    3002                 :          0 :     }
    3003                 :          0 : }
    3004                 :            : 
    3005                 :          0 : void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
    3006                 :            : {
    3007         [ #  # ]:          0 :     rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
    3008                 :            : 
    3009         [ #  # ]:          0 :     if( xModel.is() )
    3010                 :            :     {
    3011         [ #  # ]:          0 :         ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
    3012 [ #  # ][ #  # ]:          0 :         xModel->notifyEvent(aEvent );
    3013                 :          0 :     }
    3014                 :          0 : }
    3015                 :            : 
    3016                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10