LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - UnoDocumentSettings.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 434 593 73.2 %
Date: 2012-08-25 Functions: 18 32 56.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 412 950 43.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <vector>
      31                 :            : #include <com/sun/star/embed/XStorage.hpp>
      32                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      33                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      34                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      37                 :            : #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
      38                 :            : #include <cppuhelper/implbase3.hxx>
      39                 :            : #include <comphelper/propertysethelper.hxx>
      40                 :            : #include <comphelper/propertysetinfo.hxx>
      41                 :            : #include <tools/urlobj.hxx>
      42                 :            : #include <svx/xtable.hxx>
      43                 :            : #include <osl/diagnose.h>
      44                 :            : #include <osl/mutex.hxx>
      45                 :            : #include <vcl/svapp.hxx>
      46                 :            : 
      47                 :            : #include "drawdoc.hxx"
      48                 :            : #include "DrawDocShell.hxx"
      49                 :            : #include "unomodel.hxx"
      50                 :            : 
      51                 :            : #include "optsitem.hxx"
      52                 :            : #include <sfx2/printer.hxx>
      53                 :            : #include "sdattr.hxx"
      54                 :            : #include "../inc/ViewShell.hxx"
      55                 :            : #include "../inc/FrameView.hxx"
      56                 :            : #include "Outliner.hxx"
      57                 :            : #include <xmloff/settingsstore.hxx>
      58                 :            : #include <editeng/editstat.hxx>
      59                 :            : #include <svx/unoapi.hxx>
      60                 :            : 
      61                 :            : #define MAP_LEN(x) x, sizeof(x)-1
      62                 :            : 
      63                 :            : using namespace ::comphelper;
      64                 :            : using namespace ::osl;
      65                 :            : using ::rtl::OUString;
      66                 :            : using namespace ::cppu;
      67                 :            : using namespace ::com::sun::star;
      68                 :            : using namespace ::com::sun::star::uno;
      69                 :            : using namespace ::com::sun::star::util;
      70                 :            : using namespace ::com::sun::star::container;
      71                 :            : using namespace ::com::sun::star::drawing;
      72                 :            : using namespace ::com::sun::star::lang;
      73                 :            : using namespace ::com::sun::star::document;
      74                 :            : using namespace ::com::sun::star::frame;
      75                 :            : using namespace ::com::sun::star::beans;
      76                 :            : using namespace ::com::sun::star::i18n;
      77                 :            : 
      78                 :            : namespace sd
      79                 :            : {
      80                 :            :     class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
      81                 :            :                              public comphelper::PropertySetHelper,
      82                 :            :                              public DocumentSettingsSerializer
      83                 :            :     {
      84                 :            :     public:
      85                 :            :         DocumentSettings( SdXImpressDocument* pModel );
      86                 :            :         virtual ~DocumentSettings() throw();
      87                 :            : 
      88                 :            :         // XInterface
      89                 :            :         virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
      90                 :            :         virtual void SAL_CALL acquire(  ) throw ();
      91                 :            :         virtual void SAL_CALL release(  ) throw ();
      92                 :            : 
      93                 :            :         // XPropertySet
      94                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
      95                 :            :         virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      96                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      97                 :            :         virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      98                 :            :         virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
      99                 :            :         virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     100                 :            :         virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     101                 :            : 
     102                 :            :         // XMultiPropertySet
     103                 :            :         virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     104                 :            :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
     105                 :            :         virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     106                 :            :         virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     107                 :            :         virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     108                 :            : 
     109                 :            :         // XServiceInfo
     110                 :            :         virtual OUString SAL_CALL getImplementationName(  ) throw(RuntimeException);
     111                 :            :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
     112                 :            :         virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(RuntimeException);
     113                 :            : 
     114                 :            :         // DocumentSettingsSerializer cf. xmloff
     115                 :            :         virtual uno::Sequence<beans::PropertyValue>
     116                 :            :                 filterStreamsFromStorage(const uno::Reference< embed::XStorage > &xStorage,
     117                 :            :                                          const uno::Sequence<beans::PropertyValue>& aConfigProps );
     118                 :            :         virtual uno::Sequence<beans::PropertyValue>
     119                 :            :                 filterStreamsToStorage(const uno::Reference< embed::XStorage > &xStorage,
     120                 :            :                                        const uno::Sequence<beans::PropertyValue>& aConfigProps );
     121                 :            : 
     122                 :            :     protected:
     123                 :            :         virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
     124                 :            :         virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
     125                 :            : 
     126                 :            :     private:
     127                 :            :         bool LoadList( XPropertyListType t, const rtl::OUString &rPath,
     128                 :            :                        const uno::Reference< embed::XStorage > &xStorage );
     129                 :            :         void AssignURL( XPropertyListType t, const Any* pValue, bool *pOk, bool *pChanged );
     130                 :            :         void ExtractURL( XPropertyListType t, Any* pValue );
     131                 :            :         Reference< XModel >     mxModel;
     132                 :            :         SdXImpressDocument*     mpModel;
     133                 :            :     };
     134                 :            : 
     135                 :         30 :     Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel )
     136                 :            :         throw( Exception )
     137                 :            :     {
     138                 :            :         DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" );
     139         [ +  - ]:         30 :         return (XWeak*)new DocumentSettings( pModel );
     140                 :            :     }
     141                 :            : 
     142                 :            : enum SdDocumentSettingsPropertyHandles
     143                 :            : {
     144                 :            :     HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
     145                 :            :     HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME,
     146                 :            :     HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
     147                 :            :     HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
     148                 :            :     HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
     149                 :            :     HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
     150                 :            :     HANDLE_PRINTER_INDEPENDENT_LAYOUT
     151                 :            :     // #i33095#
     152                 :            :     ,HANDLE_LOAD_READONLY, HANDLE_SAVE_VERSION
     153                 :            :     ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL
     154                 :            : };
     155                 :            : 
     156                 :            : #define MID_PRINTER 1
     157                 :            : 
     158                 :         30 :     PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw )
     159                 :            :     {
     160                 :            :         static PropertyMapEntry aImpressSettingsInfoMap[] =
     161                 :            :         {
     162         [ +  - ]:          7 :             { MAP_LEN("IsPrintDrawing"),        HANDLE_PRINTDRAWING,        &::getBooleanCppuType(),                0,  MID_PRINTER },
     163         [ +  - ]:          7 :             { MAP_LEN("IsPrintNotes"),          HANDLE_PRINTNOTES,          &::getBooleanCppuType(),                0,  MID_PRINTER },
     164         [ +  - ]:          7 :             { MAP_LEN("IsPrintHandout"),        HANDLE_PRINTHANDOUT,        &::getBooleanCppuType(),                0,  MID_PRINTER },
     165         [ +  - ]:          7 :             { MAP_LEN("IsPrintOutline"),        HANDLE_PRINTOUTLINE,        &::getBooleanCppuType(),                0,  MID_PRINTER },
     166         [ +  - ]:          7 :             { MAP_LEN("SlidesPerHandout"),      HANDLE_SLIDESPERHANDOUT,    &::getCppuType((const sal_Int16*)0),    0,  MID_PRINTER },
     167         [ +  - ]:          7 :             { MAP_LEN("HandoutsHorizontal"),    HANDLE_HANDOUTHORIZONTAL,   &::getBooleanCppuType(),                0,  MID_PRINTER },
     168                 :            :             { NULL, 0, 0, NULL, 0, 0 }
     169 [ +  + ][ +  - ]:         37 :         };
                 [ #  # ]
     170                 :            : 
     171                 :            :         static PropertyMapEntry aDrawSettingsInfoMap[] =
     172                 :            :         {
     173         [ +  - ]:          7 :             { MAP_LEN("MeasureUnit"),           HANDLE_MEASUREUNIT,         &::getCppuType((const sal_Int16*)0),    0,  0 },
     174         [ +  - ]:          7 :             { MAP_LEN("ScaleNumerator"),        HANDLE_SCALE_NUM,           &::getCppuType((const sal_Int32*)0),    0,  0 },
     175         [ +  - ]:          7 :             { MAP_LEN("ScaleDenominator"),      HANDLE_SCALE_DOM,           &::getCppuType((const sal_Int32*)0),    0,  0 },
     176                 :            :             { NULL, 0, 0, NULL, 0, 0 }
     177 [ +  + ][ +  - ]:         37 :         };
                 [ #  # ]
     178                 :            : 
     179                 :            :         static PropertyMapEntry aCommonSettingsInfoMap[] =
     180                 :            :         {
     181         [ +  - ]:          7 :             { MAP_LEN("DefaultTabStop"),        HANDLE_TABSTOP,             &::getCppuType((const sal_Int32*)0),    0,  0 },
     182         [ +  - ]:          7 :             { MAP_LEN("PrinterName"),           HANDLE_PRINTERNAME,         &::getCppuType((const OUString*)0),     0,  0 },
     183         [ +  - ]:          7 :             { MAP_LEN("PrinterSetup"),          HANDLE_PRINTERJOB,          &::getCppuType((const uno::Sequence < sal_Int8 > *)0),  0, MID_PRINTER },
     184                 :            : 
     185         [ +  - ]:          7 :             { MAP_LEN("IsPrintPageName"),       HANDLE_PRINTPAGENAME,       &::getBooleanCppuType(),                0,  MID_PRINTER },
     186         [ +  - ]:          7 :             { MAP_LEN("IsPrintDate"),           HANDLE_PRINTDATE,           &::getBooleanCppuType(),                0,  MID_PRINTER },
     187         [ +  - ]:          7 :             { MAP_LEN("IsPrintTime"),           HANDLE_PRINTTIME,           &::getBooleanCppuType(),                0,  MID_PRINTER },
     188         [ +  - ]:          7 :             { MAP_LEN("IsPrintHiddenPages"),    HANDLE_PRINTHIDENPAGES,     &::getBooleanCppuType(),                0,  MID_PRINTER },
     189         [ +  - ]:          7 :             { MAP_LEN("IsPrintFitPage"),        HANDLE_PRINTFITPAGE,        &::getBooleanCppuType(),                0,  MID_PRINTER },
     190         [ +  - ]:          7 :             { MAP_LEN("IsPrintTilePage"),       HANDLE_PRINTTILEPAGE,       &::getBooleanCppuType(),                0,  MID_PRINTER },
     191         [ +  - ]:          7 :             { MAP_LEN("IsPrintBooklet"),        HANDLE_PRINTBOOKLET,        &::getBooleanCppuType(),                0,  MID_PRINTER },
     192         [ +  - ]:          7 :             { MAP_LEN("IsPrintBookletFront"),   HANDLE_PRINTBOOKLETFRONT,   &::getBooleanCppuType(),                0,  MID_PRINTER },
     193         [ +  - ]:          7 :             { MAP_LEN("IsPrintBookletBack"),    HANDLE_PRINTBOOKLETBACK,    &::getBooleanCppuType(),                0,  MID_PRINTER },
     194         [ +  - ]:          7 :             { MAP_LEN("PrintQuality"),          HANDLE_PRINTQUALITY,        &::getCppuType((const sal_Int32*)0),    0,  MID_PRINTER },
     195         [ +  - ]:          7 :             { MAP_LEN("ColorTableURL"),         HANDLE_COLORTABLEURL,       &::getCppuType((const OUString*)0),     0,  0 },
     196         [ +  - ]:          7 :             { MAP_LEN("DashTableURL"),          HANDLE_DASHTABLEURL,        &::getCppuType((const OUString*)0),     0,  0 },
     197         [ +  - ]:          7 :             { MAP_LEN("LineEndTableURL"),       HANDLE_LINEENDTABLEURL,     &::getCppuType((const OUString*)0),     0,  0 },
     198         [ +  - ]:          7 :             { MAP_LEN("HatchTableURL"),         HANDLE_HATCHTABLEURL,       &::getCppuType((const OUString*)0),     0,  0 },
     199         [ +  - ]:          7 :             { MAP_LEN("GradientTableURL"),      HANDLE_GRADIENTTABLEURL,    &::getCppuType((const OUString*)0),     0,  0 },
     200         [ +  - ]:          7 :             { MAP_LEN("BitmapTableURL"),        HANDLE_BITMAPTABLEURL,      &::getCppuType((const OUString*)0),     0,  0 },
     201                 :            : 
     202         [ +  - ]:          7 :             { MAP_LEN("ForbiddenCharacters"),   HANDLE_FORBIDDENCHARS,      &::getCppuType((const Reference< XForbiddenCharacters >*)0),    0, 0 },
     203         [ +  - ]:          7 :             { MAP_LEN("ApplyUserData"),         HANDLE_APPLYUSERDATA,       &::getBooleanCppuType(),                0,  0 },
     204                 :            : 
     205         [ +  - ]:          7 :             { MAP_LEN("PageNumberFormat"),      HANDLE_PAGENUMFMT,          &::getCppuType((const sal_Int32*)0),    0,  0 },
     206         [ +  - ]:          7 :             { MAP_LEN("ParagraphSummation"),    HANDLE_PARAGRAPHSUMMATION,  &::getBooleanCppuType(),                0,  0 },
     207         [ +  - ]:          7 :             { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS,      &::getCppuType((sal_Int16*)0),          0,  0 },
     208         [ +  - ]:          7 :             { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT,          &::getBooleanCppuType(),                0,  0 },
     209         [ +  - ]:          7 :             { MAP_LEN("UpdateFromTemplate"),    HANDLE_UPDATEFROMTEMPLATE,  &::getBooleanCppuType(),                0,  0 },
     210         [ +  - ]:          7 :             { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0,  0 },
     211                 :            :             // --> #i33095#
     212         [ +  - ]:          7 :             { MAP_LEN("LoadReadonly"),          HANDLE_LOAD_READONLY,       &::getBooleanCppuType(),                0,  0 },
     213         [ +  - ]:          7 :             { MAP_LEN("SaveVersionOnClose"),    HANDLE_SAVE_VERSION,        &::getBooleanCppuType(),                0,  0 },
     214                 :            :             { NULL, 0, 0, NULL, 0, 0 }
     215 [ +  + ][ +  - ]:         37 :         };
                 [ #  # ]
     216                 :            : 
     217                 :         30 :         PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap );
     218         [ +  + ]:         30 :         pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap );
     219                 :            : 
     220                 :         30 :         return pInfo;
     221                 :            :     }
     222                 :            : }
     223                 :            : 
     224                 :            : using namespace ::sd;
     225                 :            : 
     226                 :         30 : DocumentSettings::DocumentSettings( SdXImpressDocument* pModel )
     227                 :         30 : :   PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ),
     228                 :            :     mxModel( pModel ),
     229 [ +  - ][ +  - ]:         60 :     mpModel( pModel )
                 [ +  - ]
     230                 :            : {
     231                 :         30 : }
     232                 :            : 
     233                 :         30 : DocumentSettings::~DocumentSettings() throw()
     234                 :            : {
     235         [ -  + ]:         60 : }
     236                 :            : 
     237                 :         66 : bool DocumentSettings::LoadList( XPropertyListType t, const rtl::OUString &rInPath,
     238                 :            :                                  const uno::Reference< embed::XStorage > &xStorage )
     239                 :            : {
     240                 :         66 :     SdDrawDocument* pDoc = mpModel->GetDoc();
     241                 :            : 
     242                 :         66 :     sal_Int32 nSlash = rInPath.lastIndexOf('/');
     243                 :         66 :     rtl::OUString aPath, aName;
     244         [ -  + ]:         66 :     if (nSlash < -1)
     245                 :          0 :         aName = rInPath;
     246                 :            :     else {
     247                 :         66 :         aName = rInPath.copy( nSlash + 1 );
     248                 :         66 :         aPath = rInPath.copy( 0, nSlash );
     249                 :            :     }
     250                 :            : 
     251                 :            :     XPropertyListRef pList = XPropertyList::CreatePropertyList(
     252 [ +  - ][ +  - ]:         66 :         t, aPath, (XOutdevItemPool*)&pDoc->GetPool() );
                 [ +  - ]
     253 [ +  - ][ +  - ]:         66 :     pList->SetName( aName );
                 [ +  - ]
     254                 :            : 
     255 [ +  - ][ +  + ]:         66 :     if( pList->LoadFrom( xStorage, rInPath ) )
     256                 :            :     {
     257         [ +  - ]:         48 :         pDoc->SetPropertyList( pList );
     258                 :         48 :         return true;
     259                 :            :     }
     260                 :            : 
     261                 :         66 :     return false;
     262                 :            : }
     263                 :            : 
     264                 :          0 : void DocumentSettings::AssignURL( XPropertyListType t, const Any* pValue,
     265                 :            :                                   bool *pOk, bool *pChanged )
     266                 :            : {
     267                 :          0 :     OUString aURL;
     268         [ #  # ]:          0 :     if( !(bool)( *pValue >>= aURL ) )
     269                 :          0 :         return;
     270                 :            : 
     271 [ #  # ][ #  # ]:          0 :     if( LoadList( t, aURL, uno::Reference< embed::XStorage >() ) )
     272         [ #  # ]:          0 :         *pOk = *pChanged = true;
     273                 :            : }
     274                 :            : 
     275                 :            : static struct {
     276                 :            :     const char *pName;
     277                 :            :     XPropertyListType t;
     278                 :            : } aURLPropertyNames[] = {
     279                 :            :     { "ColorTableURL", XCOLOR_LIST },
     280                 :            :     { "DashTableURL", XDASH_LIST },
     281                 :            :     { "LineEndTableURL", XLINE_END_LIST },
     282                 :            :     { "HatchTableURL", XHATCH_LIST },
     283                 :            :     { "GradientTableURL", XGRADIENT_LIST },
     284                 :            :     { "BitmapTableURL", XBITMAP_LIST }
     285                 :            : };
     286                 :            : 
     287                 :        369 : static XPropertyListType getTypeOfName( const rtl::OUString &aName )
     288                 :            : {
     289         [ +  + ]:       2352 :     for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) {
     290         [ +  + ]:       2049 :         if( aName.equalsAscii( aURLPropertyNames[i].pName ) )
     291                 :         66 :             return aURLPropertyNames[i].t;
     292                 :            :     }
     293                 :        369 :     return (XPropertyListType) -1;
     294                 :            : }
     295                 :            : 
     296                 :          0 : static rtl::OUString getNameOfType( XPropertyListType t )
     297                 :            : {
     298         [ #  # ]:          0 :     for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) {
     299         [ #  # ]:          0 :         if( t == aURLPropertyNames[i].t )
     300                 :            :             return rtl::OUString( aURLPropertyNames[i].pName,
     301                 :          0 :                                   strlen( aURLPropertyNames[i].pName ) - 3,
     302                 :          0 :                                   RTL_TEXTENCODING_UTF8 );
     303                 :            :     }
     304                 :          0 :     return rtl::OUString();
     305                 :            : }
     306                 :            : 
     307                 :            : uno::Sequence<beans::PropertyValue>
     308                 :         11 :         DocumentSettings::filterStreamsFromStorage(
     309                 :            :                 const uno::Reference< embed::XStorage > &xStorage,
     310                 :            :                 const uno::Sequence<beans::PropertyValue>& aConfigProps )
     311                 :            : {
     312                 :         11 :     uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() );
     313                 :         11 :     int nRet = 0;
     314         [ +  + ]:        380 :     for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ )
     315                 :            :     {
     316         [ +  - ]:        369 :         XPropertyListType t = getTypeOfName( aConfigProps[i].Name );
     317         [ +  + ]:        369 :         if (t < 0)
     318         [ +  - ]:        303 :             aRet[nRet++] = aConfigProps[i];
     319                 :            :         else
     320                 :            :         {
     321                 :         66 :             rtl::OUString aURL;
     322                 :         66 :             aConfigProps[i].Value >>= aURL;
     323         [ +  - ]:         66 :             LoadList( t, aURL, xStorage );
     324                 :            :         }
     325                 :            :     }
     326         [ +  - ]:         11 :     aRet.realloc( nRet );
     327                 :         11 :     return aRet;
     328                 :            : }
     329                 :            : 
     330                 :            : uno::Sequence<beans::PropertyValue>
     331                 :         12 :         DocumentSettings::filterStreamsToStorage(
     332                 :            :                 const uno::Reference< embed::XStorage > &xStorage,
     333                 :            :                 const uno::Sequence<beans::PropertyValue>& aConfigProps )
     334                 :            : {
     335         [ +  - ]:         12 :     uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() );
     336                 :            : 
     337                 :         12 :     bool bHasEmbed = false;
     338                 :         12 :     SdDrawDocument* pDoc = mpModel->GetDoc();
     339         [ +  + ]:         84 :     for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ )
     340                 :            :     {
     341         [ +  - ]:         72 :         XPropertyListRef pList = pDoc->GetPropertyList( (XPropertyListType) i );
     342 [ +  - ][ -  + ]:         72 :         if( ( bHasEmbed = pList.is() && pList->IsEmbedInDocument() ) )
                 [ -  + ]
     343                 :            :             break;
     344         [ +  - ]:         72 :     }
     345         [ +  - ]:         12 :     if( !bHasEmbed )
     346         [ +  - ]:         12 :         return aConfigProps;
     347                 :            : 
     348                 :            :     try {
     349                 :            :         // create Settings/ sub storage.
     350                 :          0 :         uno::Reference< embed::XStorage > xSubStorage;
     351         [ #  # ]:          0 :         xSubStorage = xStorage->openStorageElement( "Settings" ,
     352 [ #  # ][ #  # ]:          0 :             embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
     353         [ #  # ]:          0 :         if( !xSubStorage.is() )
     354         [ #  # ]:          0 :             return aRet;
     355                 :            : 
     356                 :            :         // now populate it
     357         [ #  # ]:          0 :         for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ )
     358                 :            :         {
     359         [ #  # ]:          0 :             XPropertyListType t = getTypeOfName( aConfigProps[i].Name );
     360         [ #  # ]:          0 :             aRet[i] = aConfigProps[i];
     361         [ #  # ]:          0 :             if (t >= 0) {
     362         [ #  # ]:          0 :                 XPropertyListRef pList = pDoc->GetPropertyList( t );
     363 [ #  # ][ #  # ]:          0 :                 if( !pList.is() || !pList->IsEmbedInDocument() )
                 [ #  # ]
     364                 :          0 :                     continue; // no change ...
     365                 :            :                 else
     366                 :            :                 {
     367                 :            :                     // Such specific path construction is grim.
     368                 :          0 :                     rtl::OUString aValue;
     369         [ #  # ]:          0 :                     aRet[i].Value >>= aValue;
     370                 :            : 
     371 [ #  # ][ #  # ]:          0 :                     rtl::OUStringBuffer aName( getNameOfType( t ) );
     372                 :          0 :                     rtl::OUString aResult;
     373 [ #  # ][ #  # ]:          0 :                     if( pList->SaveTo( xSubStorage, aName.makeStringAndClear(), &aResult ) )
                 [ #  # ]
     374                 :            :                     {
     375                 :          0 :                         rtl::OUString aRealPath( "Settings/" );
     376                 :          0 :                         aRealPath += aResult;
     377 [ #  # ][ #  # ]:          0 :                         aRet[i].Value <<= aRealPath;
     378                 :          0 :                     }
     379         [ #  # ]:          0 :                 }
     380                 :            :             }
     381                 :            :         }
     382                 :            : 
     383                 :            :         // surprisingly difficult to make it really exist
     384         [ #  # ]:          0 :         uno::Reference< embed::XTransactedObject > xTrans( xSubStorage, UNO_QUERY );
     385         [ #  # ]:          0 :         if( xTrans.is() )
     386 [ #  # ][ #  # ]:          0 :             xTrans->commit();
     387         [ #  # ]:          0 :         uno::Reference< lang::XComponent > xComp( xSubStorage, UNO_QUERY );
     388         [ #  # ]:          0 :         if( xComp.is() )
     389 [ #  # ][ #  # ]:          0 :             xSubStorage->dispose();
         [ #  # ][ #  # ]
     390         [ #  # ]:          0 :     } catch (const uno::Exception &e) {
     391                 :            :         (void)e;
     392                 :            : //        fprintf (stderr, "saving etc. exception '%s'\n",
     393                 :            : //                 rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
     394                 :            :     }
     395                 :            : 
     396 [ #  # ][ +  - ]:         12 :     return aRet;
     397                 :            : }
     398                 :            : 
     399                 :        303 : void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
     400                 :            : {
     401         [ +  - ]:        303 :     ::SolarMutexGuard aGuard;
     402                 :            : 
     403                 :        303 :     SdDrawDocument* pDoc = mpModel->GetDoc();
     404                 :        303 :     ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
     405 [ -  + ][ +  - ]:        303 :     if( NULL == pDoc || NULL == pDocSh )
     406         [ #  # ]:          0 :         throw UnknownPropertyException();
     407                 :            : 
     408                 :        303 :     sal_Bool bValue = sal_False;
     409                 :        303 :     bool bOk, bChanged = false, bOptionsChanged = false;
     410                 :            : 
     411         [ +  - ]:        303 :     SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
     412                 :            : 
     413         [ +  - ]:        303 :     SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
     414         [ +  + ]:        303 :     if( pPrinter )
     415                 :            :     {
     416                 :          9 :         SdOptionsPrintItem* pPrinterOptions = NULL;
     417 [ +  - ][ -  + ]:          9 :         if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
     418         [ #  # ]:          9 :             aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
     419                 :            :     }
     420                 :            :     else
     421                 :            :     {
     422 [ +  - ][ +  - ]:        294 :         aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
                 [ +  - ]
     423                 :            :     }
     424                 :        303 :     SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
     425                 :            : 
     426         [ +  + ]:        606 :     for( ; *ppEntries; ppEntries++, pValues++ )
     427                 :            :     {
     428                 :        303 :         bOk = false;
     429                 :            : 
     430   [ -  -  -  -  :        303 :         switch( (*ppEntries)->mnHandle )
          -  -  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
             +  +  +  +  
                      - ]
     431                 :            :         {
     432                 :            :             case HANDLE_COLORTABLEURL:
     433         [ #  # ]:          0 :                 AssignURL( XCOLOR_LIST, pValues, &bOk, &bChanged );
     434                 :          0 :                 break;
     435                 :            : 
     436                 :            :             case HANDLE_DASHTABLEURL:
     437         [ #  # ]:          0 :                 AssignURL( XDASH_LIST, pValues, &bOk, &bChanged );
     438                 :          0 :                 break;
     439                 :            : 
     440                 :            :             case HANDLE_LINEENDTABLEURL:
     441         [ #  # ]:          0 :                 AssignURL( XLINE_END_LIST, pValues, &bOk, &bChanged );
     442                 :          0 :                 break;
     443                 :            : 
     444                 :            :             case HANDLE_HATCHTABLEURL:
     445         [ #  # ]:          0 :                 AssignURL( XHATCH_LIST, pValues, &bOk, &bChanged );
     446                 :          0 :                 break;
     447                 :            : 
     448                 :            :             case HANDLE_GRADIENTTABLEURL:
     449         [ #  # ]:          0 :                 AssignURL( XGRADIENT_LIST, pValues, &bOk, &bChanged );
     450                 :          0 :                 break;
     451                 :            : 
     452                 :            :             case HANDLE_BITMAPTABLEURL:
     453         [ #  # ]:          0 :                 AssignURL( XBITMAP_LIST, pValues, &bOk, &bChanged );
     454                 :          0 :                 break;
     455                 :            : 
     456                 :            :             case HANDLE_FORBIDDENCHARS:
     457                 :          7 :                 bOk = true;
     458                 :          7 :                 break;
     459                 :            : 
     460                 :            :             case HANDLE_APPLYUSERDATA:
     461                 :            :                 {
     462                 :         11 :                     sal_Bool bApplyUserData = sal_False;
     463         [ +  - ]:         11 :                     if( *pValues >>= bApplyUserData )
     464                 :            :                     {
     465         [ +  - ]:         11 :                         bChanged = ( bApplyUserData != pDocSh->IsUseUserData() );
     466         [ +  - ]:         11 :                         pDocSh->SetUseUserData( bApplyUserData );
     467                 :         11 :                         bOk = true;
     468                 :            :                     }
     469                 :            :                 }
     470                 :         11 :                 break;
     471                 :            :             case HANDLE_PRINTDRAWING:
     472         [ +  - ]:          7 :                 if( *pValues >>= bValue )
     473                 :            :                 {
     474 [ +  - ][ -  + ]:          7 :                     if( aPrintOpts.IsDraw() != bValue )
     475                 :            :                     {
     476         [ #  # ]:          0 :                         aPrintOpts.SetDraw( bValue );
     477                 :          0 :                         bOptionsChanged = true;
     478                 :            :                     }
     479                 :            : 
     480                 :          7 :                     bOk = true;
     481                 :            :                 }
     482                 :          7 :                 break;
     483                 :            :             case HANDLE_PRINTNOTES:
     484         [ +  - ]:          7 :                 if( *pValues >>= bValue )
     485                 :            :                 {
     486 [ +  - ][ -  + ]:          7 :                     if( aPrintOpts.IsNotes() != bValue )
     487                 :            :                     {
     488         [ #  # ]:          0 :                         aPrintOpts.SetNotes( bValue );
     489                 :          0 :                         bOptionsChanged = true;
     490                 :            :                     }
     491                 :            : 
     492                 :          7 :                     bOk = true;
     493                 :            :                 }
     494                 :          7 :                 break;
     495                 :            :             case HANDLE_PRINTHANDOUT:
     496         [ +  - ]:          7 :                 if( *pValues >>= bValue )
     497                 :            :                 {
     498 [ +  - ][ -  + ]:          7 :                     if( aPrintOpts.IsHandout() != bValue)
     499                 :            :                     {
     500         [ #  # ]:          0 :                         aPrintOpts.SetHandout( bValue );
     501                 :          0 :                         bOptionsChanged = true;
     502                 :            :                     }
     503                 :            : 
     504                 :          7 :                     bOk = true;
     505                 :            :                 }
     506                 :          7 :                 break;
     507                 :            :             case HANDLE_PRINTOUTLINE:
     508         [ +  - ]:          7 :                 if( *pValues >>= bValue )
     509                 :            :                 {
     510 [ +  - ][ -  + ]:          7 :                     if( aPrintOpts.IsOutline() != bValue)
     511                 :            :                     {
     512         [ #  # ]:          0 :                         aPrintOpts.SetOutline( bValue );
     513                 :          0 :                         bOptionsChanged = true;
     514                 :            :                     }
     515                 :          7 :                     bOk = true;
     516                 :            :                 }
     517                 :          7 :                 break;
     518                 :            :             case HANDLE_SLIDESPERHANDOUT:
     519                 :            :                 {
     520                 :          7 :                     sal_Int16 nValue = 0;
     521 [ +  - ][ +  - ]:          7 :                     if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) )
         [ +  - ][ +  - ]
     522                 :            :                     {
     523 [ +  - ][ -  + ]:          7 :                         if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue )
     524                 :            :                         {
     525         [ #  # ]:          0 :                             aPrintOpts.SetHandoutPages( static_cast< sal_uInt16 >( nValue ) );
     526                 :          0 :                             bOptionsChanged = true;
     527                 :            :                         }
     528                 :          7 :                         bOk = true;
     529                 :            :                     }
     530                 :            :                 }
     531                 :          7 :                 break;
     532                 :            :             case HANDLE_HANDOUTHORIZONTAL:
     533         [ +  - ]:          7 :                 if( *pValues >>= bValue )
     534                 :            :                 {
     535 [ +  - ][ -  + ]:          7 :                     if( aPrintOpts.IsHandoutHorizontal() != bValue )
     536                 :            :                     {
     537         [ #  # ]:          0 :                         aPrintOpts.SetHandoutHorizontal( bValue );
     538                 :          0 :                         bOptionsChanged = true;
     539                 :            :                     }
     540                 :          7 :                     bOk = true;
     541                 :            :                 }
     542                 :          7 :                 break;
     543                 :            : 
     544                 :            :             case HANDLE_PRINTPAGENAME:
     545         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     546                 :            :                 {
     547 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsPagename() != bValue)
     548                 :            :                     {
     549         [ #  # ]:          0 :                         aPrintOpts.SetPagename( bValue );
     550                 :          0 :                         bOptionsChanged = true;
     551                 :            :                     }
     552                 :         11 :                     bOk = true;
     553                 :            :                 }
     554                 :         11 :                 break;
     555                 :            :             case HANDLE_PRINTDATE:
     556         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     557                 :            :                 {
     558 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsDate() != bValue)
     559                 :            :                     {
     560         [ #  # ]:          0 :                         aPrintOpts.SetDate( bValue );
     561                 :          0 :                         bOptionsChanged = true;
     562                 :            :                     }
     563                 :         11 :                     bOk = true;
     564                 :            :                 }
     565                 :         11 :                 break;
     566                 :            :             case HANDLE_PRINTTIME:
     567         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     568                 :            :                 {
     569 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsDate() != bValue)
     570                 :            :                     {
     571         [ #  # ]:          0 :                         aPrintOpts.SetTime( bValue );
     572                 :          0 :                         bOptionsChanged = true;
     573                 :            :                     }
     574                 :         11 :                     bOk = true;
     575                 :            :                 }
     576                 :         11 :                 break;
     577                 :            :             case HANDLE_PRINTHIDENPAGES:
     578         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     579                 :            :                 {
     580 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsHiddenPages() != bValue)
     581                 :            :                     {
     582         [ #  # ]:          0 :                         aPrintOpts.SetHiddenPages( bValue );
     583                 :          0 :                         bOptionsChanged = true;
     584                 :            :                     }
     585                 :         11 :                     bOk = true;
     586                 :            :                 }
     587                 :         11 :                 break;
     588                 :            :             case HANDLE_PRINTFITPAGE:
     589         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     590                 :            :                 {
     591 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsPagesize() != bValue)
     592                 :            :                     {
     593         [ #  # ]:          0 :                         aPrintOpts.SetPagesize( bValue );
     594                 :          0 :                         bOptionsChanged = true;
     595                 :            :                     }
     596                 :         11 :                     bOk = true;
     597                 :            :                 }
     598                 :         11 :                 break;
     599                 :            :             case HANDLE_PRINTTILEPAGE:
     600         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     601                 :            :                 {
     602 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsPagetile() != bValue)
     603                 :            :                     {
     604         [ #  # ]:          0 :                         aPrintOpts.SetPagetile( bValue );
     605                 :          0 :                         bOptionsChanged = true;
     606                 :            :                     }
     607                 :         11 :                     bOk = true;
     608                 :            :                 }
     609                 :         11 :                 break;
     610                 :            :             case HANDLE_PRINTBOOKLET:
     611         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     612                 :            :                 {
     613 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsBooklet() != bValue)
     614                 :            :                     {
     615         [ #  # ]:          0 :                         aPrintOpts.SetBooklet( bValue );
     616                 :          0 :                         bOptionsChanged = true;
     617                 :            :                     }
     618                 :         11 :                     bOk = true;
     619                 :            :                 }
     620                 :         11 :                 break;
     621                 :            :             case HANDLE_PRINTBOOKLETFRONT:
     622         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     623                 :            :                 {
     624 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsFrontPage() != bValue)
     625                 :            :                     {
     626         [ #  # ]:          0 :                         aPrintOpts.SetFrontPage( bValue );
     627                 :          0 :                         bOptionsChanged = true;
     628                 :            :                     }
     629                 :         11 :                     bOk = true;
     630                 :            :                 }
     631                 :         11 :                 break;
     632                 :            :             case HANDLE_PRINTBOOKLETBACK:
     633         [ +  - ]:         11 :                 if( *pValues >>= bValue )
     634                 :            :                 {
     635 [ +  - ][ -  + ]:         11 :                     if( aPrintOpts.IsBackPage() != bValue)
     636                 :            :                     {
     637         [ #  # ]:          0 :                         aPrintOpts.SetBackPage( bValue );
     638                 :          0 :                         bOptionsChanged = true;
     639                 :            :                     }
     640                 :         11 :                     bOk = true;
     641                 :            :                 }
     642                 :         11 :                 break;
     643                 :            :             case HANDLE_PRINTQUALITY:
     644                 :            :                 {
     645                 :         11 :                     sal_Int32 nValue = 0;
     646         [ +  - ]:         11 :                     if( *pValues >>= nValue )
     647                 :            :                     {
     648 [ +  - ][ -  + ]:         11 :                         if( aPrintOpts.GetOutputQuality() != nValue)
     649                 :            :                         {
     650         [ #  # ]:          0 :                             aPrintOpts.SetOutputQuality( (sal_uInt16)nValue );
     651                 :          0 :                             bOptionsChanged = true;
     652                 :            :                         }
     653                 :         11 :                         bOk = true;
     654                 :            :                     }
     655                 :            :                 }
     656                 :         11 :                 break;
     657                 :            :             case HANDLE_MEASUREUNIT:
     658                 :            :                 {
     659                 :          4 :                     sal_Int16 nValue = 0;
     660         [ +  - ]:          4 :                     if( *pValues >>= nValue )
     661                 :            :                     {
     662                 :            :                         short nFieldUnit;
     663         [ +  - ]:          4 :                         if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
     664                 :            :                         {
     665         [ +  - ]:          4 :                             pDoc->SetUIUnit((FieldUnit)nFieldUnit );
     666                 :          4 :                             bOk = true;
     667                 :            :                         }
     668                 :            :                     }
     669                 :            :                 }
     670                 :          4 :                 break;
     671                 :            :             case HANDLE_SCALE_NUM:
     672                 :            :                 {
     673                 :          4 :                     sal_Int32 nValue = 0;
     674         [ +  - ]:          4 :                     if( *pValues >>= nValue )
     675                 :            :                     {
     676         [ +  - ]:          4 :                         Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
     677         [ +  - ]:          4 :                         pDoc->SetUIScale( aFract );
     678                 :          4 :                         bOk = true;
     679                 :          4 :                         bChanged = true;
     680                 :            :                     }
     681                 :            :                 }
     682                 :          4 :                 break;
     683                 :            :             case HANDLE_SCALE_DOM:
     684                 :            :                 {
     685                 :          4 :                     sal_Int32 nValue = 0;
     686         [ +  - ]:          4 :                     if( *pValues >>= nValue )
     687                 :            :                     {
     688         [ +  - ]:          4 :                         Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
     689         [ +  - ]:          4 :                         pDoc->SetUIScale( aFract );
     690                 :          4 :                         bOk = true;
     691                 :          4 :                         bChanged = true;
     692                 :            :                     }
     693                 :            :                 }
     694                 :          4 :                 break;
     695                 :            : 
     696                 :            :             case HANDLE_TABSTOP:
     697                 :            :                 {
     698                 :         11 :                     sal_Int32 nValue = 0;
     699 [ +  - ][ +  - ]:         11 :                     if( (*pValues >>= nValue) && (nValue >= 0) )
                 [ +  - ]
     700                 :            :                     {
     701         [ +  - ]:         11 :                         pDoc->SetDefaultTabulator((sal_uInt16)nValue);
     702                 :         11 :                         bOk = true;
     703                 :         11 :                         bChanged = true;
     704                 :            :                     }
     705                 :            :                 }
     706                 :         11 :                 break;
     707                 :            :             case HANDLE_PAGENUMFMT:
     708                 :            :                 {
     709                 :         11 :                     sal_Int32 nValue = 0;
     710 [ +  - ][ +  - ]:         11 :                     if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) )
         [ +  - ][ +  - ]
     711                 :            :                     {
     712                 :         11 :                         pDoc->SetPageNumType((SvxNumType)nValue);
     713                 :         11 :                         bOk = true;
     714                 :         11 :                         bChanged = true;
     715                 :            :                     }
     716                 :            :                 }
     717                 :         11 :                 break;
     718                 :            :             case HANDLE_PRINTERNAME:
     719                 :            :                 {
     720                 :         11 :                     OUString aPrinterName;
     721         [ +  - ]:         11 :                     if( *pValues >>= aPrinterName )
     722                 :            :                     {
     723                 :         11 :                         bOk = true;
     724 [ +  + ][ -  + ]:         11 :                         if( !aPrinterName.isEmpty() && pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
                 [ -  + ]
     725                 :            :                         {
     726         [ #  # ]:          0 :                             SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_True );
     727         [ #  # ]:          0 :                             if (pTempPrinter)
     728                 :            :                             {
     729 [ #  # ][ #  # ]:          0 :                                 SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
         [ #  # ][ #  # ]
                 [ #  # ]
     730         [ #  # ]:          0 :                                 pDocSh->SetPrinter( pNewPrinter );
     731                 :            :                             }
     732                 :            :                         }
     733                 :         11 :                     }
     734                 :            :                 }
     735                 :         11 :                 break;
     736                 :            :             case HANDLE_PRINTERJOB:
     737                 :            :                 {
     738         [ +  - ]:         11 :                     Sequence < sal_Int8 > aSequence;
     739 [ +  - ][ +  - ]:         11 :                     if ( *pValues >>= aSequence )
     740                 :            :                     {
     741                 :         11 :                         bOk = true;
     742                 :         11 :                         sal_uInt32 nSize = aSequence.getLength();
     743         [ +  + ]:         11 :                         if( nSize )
     744                 :            :                         {
     745 [ +  - ][ +  - ]:          3 :                             SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
     746         [ +  - ]:          3 :                             aStream.Seek ( STREAM_SEEK_TO_BEGIN );
     747                 :            :                             SfxItemSet* pItemSet;
     748                 :            : 
     749         [ -  + ]:          3 :                             if( pPrinter )
     750                 :            :                             {
     751         [ #  # ]:          0 :                                 pItemSet = pPrinter->GetOptions().Clone();
     752                 :            :                             }
     753                 :            :                             else
     754                 :            :                             {
     755                 :            :                                 pItemSet = new SfxItemSet(pDoc->GetPool(),
     756                 :            :                                             SID_PRINTER_NOTFOUND_WARN,  SID_PRINTER_NOTFOUND_WARN,
     757                 :            :                                             SID_PRINTER_CHANGESTODOC,   SID_PRINTER_CHANGESTODOC,
     758                 :            :                                             ATTR_OPTIONS_PRINT,         ATTR_OPTIONS_PRINT,
     759 [ +  - ][ +  - ]:          3 :                                             0 );
     760                 :            :                             }
     761                 :            : 
     762         [ +  - ]:          3 :                             pPrinter = SfxPrinter::Create ( aStream, pItemSet );
     763                 :            : 
     764         [ +  - ]:          3 :                             MapMode aMM (pPrinter->GetMapMode());
     765         [ +  - ]:          3 :                             aMM.SetMapUnit(MAP_100TH_MM);
     766         [ +  - ]:          3 :                             pPrinter->SetMapMode(aMM);
     767                 :            : 
     768         [ +  - ]:          3 :                             pDocSh->SetPrinter( pPrinter );
     769                 :            : 
     770 [ +  - ][ +  - ]:          3 :                             pPrinter = NULL;
     771                 :            :                         }
     772         [ +  - ]:         11 :                     }
     773                 :            :                 }
     774                 :         11 :                 break;
     775                 :            : 
     776                 :            :             case HANDLE_PARAGRAPHSUMMATION :
     777                 :            :             {
     778                 :         11 :                 sal_Bool bIsSummationOfParagraphs = sal_False;
     779         [ +  - ]:         11 :                 if ( *pValues >>= bIsSummationOfParagraphs )
     780                 :            :                 {
     781                 :         11 :                     bOk = true;
     782                 :         11 :                     bChanged = true;
     783         [ +  + ]:         11 :                     if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
     784                 :            :                     {
     785         [ -  + ]:          7 :                         sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0;
     786                 :            :                         sal_uInt32 nCntrl;
     787                 :            : 
     788                 :          7 :                         pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs );
     789         [ +  - ]:          7 :                         SdDrawDocument* pDocument = pDocSh->GetDoc();
     790         [ +  - ]:          7 :                         SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
     791         [ +  - ]:          7 :                         nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
     792         [ +  - ]:          7 :                         rOutl.SetControlWord( nCntrl | nSum );
     793         [ +  - ]:          7 :                         ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
     794         [ -  + ]:          7 :                         if( pOutl )
     795                 :            :                         {
     796         [ #  # ]:          0 :                             nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
     797         [ #  # ]:          0 :                             pOutl->SetControlWord( nCntrl | nSum );
     798                 :            :                         }
     799         [ +  - ]:          7 :                         pOutl = pDocument->GetInternalOutliner( sal_False );
     800         [ +  - ]:          7 :                         if( pOutl )
     801                 :            :                         {
     802         [ +  - ]:          7 :                             nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
     803         [ +  - ]:          7 :                             pOutl->SetControlWord( nCntrl | nSum );
     804                 :            :                         }
     805                 :            :                     }
     806                 :            :                 }
     807                 :            :             }
     808                 :         11 :             break;
     809                 :            : 
     810                 :            :             case HANDLE_CHARCOMPRESS:
     811                 :            :             {
     812                 :         11 :                 sal_Int16 nCharCompressType = 0;
     813         [ +  - ]:         11 :                 if( *pValues >>= nCharCompressType )
     814                 :            :                 {
     815                 :         11 :                     bOk = true;
     816                 :            : 
     817         [ +  - ]:         11 :                     pDoc->SetCharCompressType( (sal_uInt16)nCharCompressType );
     818         [ +  - ]:         11 :                     SdDrawDocument* pDocument = pDocSh->GetDoc();
     819         [ +  - ]:         11 :                     SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
     820         [ +  - ]:         11 :                     rOutl.SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
     821         [ +  - ]:         11 :                     ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
     822         [ -  + ]:         11 :                     if( pOutl )
     823                 :            :                     {
     824         [ #  # ]:          0 :                         pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
     825                 :            :                     }
     826         [ +  - ]:         11 :                     pOutl = pDocument->GetInternalOutliner( sal_False );
     827         [ +  - ]:         11 :                     if( pOutl )
     828                 :            :                     {
     829         [ +  - ]:         11 :                         pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
     830                 :            :                     }
     831                 :            :                 }
     832                 :            :                 break;
     833                 :            : 
     834                 :            :             }
     835                 :            :             case HANDLE_ASIANPUNCT:
     836                 :            :             {
     837                 :         11 :                 sal_Bool bAsianPunct = sal_False;
     838         [ +  - ]:         11 :                 if( *pValues >>= bAsianPunct )
     839                 :            :                 {
     840                 :         11 :                     bOk = true;
     841                 :            : 
     842         [ +  - ]:         11 :                     pDoc->SetKernAsianPunctuation( bAsianPunct );
     843         [ +  - ]:         11 :                     SdDrawDocument* pDocument = pDocSh->GetDoc();
     844         [ +  - ]:         11 :                     SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False );
     845         [ +  - ]:         11 :                     rOutl.SetKernAsianPunctuation( bAsianPunct );
     846         [ +  - ]:         11 :                     ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
     847         [ -  + ]:         11 :                     if( pOutl )
     848                 :            :                     {
     849         [ #  # ]:          0 :                         pOutl->SetKernAsianPunctuation( bAsianPunct );
     850                 :            :                     }
     851         [ +  - ]:         11 :                     pOutl = pDocument->GetInternalOutliner( sal_False );
     852         [ +  - ]:         11 :                     if( pOutl )
     853                 :            :                     {
     854         [ +  - ]:         11 :                         pOutl->SetKernAsianPunctuation( bAsianPunct );
     855                 :            :                     }
     856                 :            :                 }
     857                 :            :                 break;
     858                 :            : 
     859                 :            :             }
     860                 :            :             case HANDLE_UPDATEFROMTEMPLATE:
     861                 :            :             {
     862                 :         11 :                 sal_Bool value = sal_False;
     863         [ +  - ]:         11 :                 if( *pValues >>= value )
     864                 :            :                 {
     865         [ +  - ]:         11 :                     bChanged = ( value != pDocSh->IsQueryLoadTemplate() );
     866         [ +  - ]:         11 :                     pDocSh->SetQueryLoadTemplate( value );
     867                 :         11 :                     bOk = true;
     868                 :            :                 }
     869                 :            :             }
     870                 :         11 :             break;
     871                 :            : 
     872                 :            :             case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
     873                 :            :             {
     874                 :            :                 // Just propagate the new printer independent layout mode to
     875                 :            :                 // the document and determine it really differs from the old
     876                 :            :                 // one.
     877                 :            :                 sal_Int16 nOldValue =
     878         [ +  - ]:         11 :                     (sal_Int16)pDoc->GetPrinterIndependentLayout ();
     879                 :         11 :                 sal_Int16 nValue = 0;
     880         [ +  - ]:         11 :                 if (*pValues >>= nValue)
     881                 :            :                 {
     882         [ +  - ]:         11 :                     pDoc->SetPrinterIndependentLayout (nValue);
     883                 :         11 :                     bChanged = (nValue != nOldValue);
     884                 :         11 :                     bOk = true;
     885                 :            :                 }
     886                 :            :             }
     887                 :         11 :             break;
     888                 :            : 
     889                 :            :             // --> #i33095#
     890                 :            :             case HANDLE_LOAD_READONLY:
     891                 :            :             {
     892                 :         11 :                 sal_Bool bNewValue = sal_False;
     893         [ +  - ]:         11 :                 if ( *pValues >>= bNewValue )
     894                 :            :                 {
     895         [ +  - ]:         11 :                     bChanged = ( pDocSh->IsLoadReadonly() != bNewValue );
     896         [ +  - ]:         11 :                     pDocSh->SetLoadReadonly( bNewValue );
     897                 :         11 :                     bOk = true;
     898                 :            :                 }
     899                 :            :             }
     900                 :         11 :             break;
     901                 :            : 
     902                 :            :             case HANDLE_SAVE_VERSION:
     903                 :            :             {
     904                 :         11 :                 sal_Bool bNewValue = sal_False;
     905         [ +  - ]:         11 :                 if ( *pValues >>= bNewValue )
     906                 :            :                 {
     907         [ +  - ]:         11 :                     bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue );
     908         [ +  - ]:         11 :                     pDocSh->SetSaveVersionOnClose( bNewValue );
     909                 :         11 :                     bOk = true;
     910                 :            :                 }
     911                 :            :             }
     912                 :         11 :             break;
     913                 :            : 
     914                 :            :             default:
     915         [ #  # ]:          0 :                 throw UnknownPropertyException();
     916                 :            :         }
     917                 :            : 
     918         [ -  + ]:        303 :         if( !bOk )
     919         [ #  # ]:          0 :             throw IllegalArgumentException();
     920                 :            :     }
     921                 :            : 
     922         [ -  + ]:        303 :     if( bOptionsChanged )
     923                 :            :     {
     924         [ #  # ]:          0 :         if( !pPrinter )
     925         [ #  # ]:          0 :             pPrinter = pDocSh->GetPrinter( sal_True );
     926         [ #  # ]:          0 :         SfxItemSet aNewOptions( pPrinter->GetOptions() );
     927         [ #  # ]:          0 :         aNewOptions.Put( aOptionsPrintItem );
     928 [ #  # ][ #  # ]:          0 :         pPrinter->SetOptions( aNewOptions );
     929                 :            :     }
     930                 :            : 
     931 [ +  + ][ -  + ]:        303 :     if( bChanged || bOptionsChanged )
     932 [ +  - ][ +  - ]:        303 :         mpModel->SetModified( sal_True );
     933                 :        303 : }
     934                 :            : 
     935                 :         72 : void DocumentSettings::ExtractURL( XPropertyListType t, Any* pValue )
     936                 :            : {
     937         [ +  - ]:         72 :     XPropertyListRef pList = mpModel->GetDoc()->GetPropertyList( t );
     938         [ -  + ]:         72 :     if( !pList.is() )
     939                 :         72 :         return;
     940                 :            : 
     941 [ +  - ][ +  - ]:         72 :     INetURLObject aPathURL( pList->GetPath() );
     942 [ +  - ][ +  - ]:         72 :     aPathURL.insertName( pList->GetName() );
     943 [ +  - ][ +  - ]:         72 :     aPathURL.setExtension( pList->GetDefaultExt() );
     944         [ +  - ]:         72 :     OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
     945 [ +  - ][ +  - ]:         72 :     *pValue <<= aPath;
                 [ +  - ]
     946                 :            : }
     947                 :            : 
     948                 :        403 : void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException )
     949                 :            : {
     950         [ +  - ]:        403 :     ::SolarMutexGuard aGuard;
     951                 :            : 
     952                 :        403 :     SdDrawDocument* pDoc = mpModel->GetDoc();
     953                 :        403 :     ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
     954 [ -  + ][ +  - ]:        403 :     if( NULL == pDoc || NULL == pDocSh )
     955         [ #  # ]:          0 :         throw UnknownPropertyException();
     956                 :            : 
     957         [ +  - ]:        403 :     SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
     958                 :            : 
     959         [ +  - ]:        403 :     SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
     960         [ -  + ]:        403 :     if( pPrinter )
     961                 :            :     {
     962                 :          0 :         SdOptionsPrintItem* pPrinterOptions = NULL;
     963 [ #  # ][ #  # ]:          0 :         if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
     964         [ #  # ]:          0 :             aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
     965                 :            :     }
     966                 :            :     else
     967                 :            :     {
     968 [ +  - ][ +  - ]:        403 :         aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
                 [ +  - ]
     969                 :            :     }
     970                 :        403 :     SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
     971                 :            : 
     972         [ +  + ]:        806 :     for( ; *ppEntries; ppEntries++, pValue++ )
     973                 :            :     {
     974   [ +  +  +  +  :        403 :         switch( (*ppEntries)->mnHandle )
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
             +  +  +  +  
                      - ]
     975                 :            :         {
     976                 :            :             case HANDLE_COLORTABLEURL:
     977         [ +  - ]:         12 :                 ExtractURL( XCOLOR_LIST, pValue );
     978                 :         12 :                 break;
     979                 :            :             case HANDLE_DASHTABLEURL:
     980         [ +  - ]:         12 :                 ExtractURL( XDASH_LIST, pValue );
     981                 :         12 :                 break;
     982                 :            :             case HANDLE_LINEENDTABLEURL:
     983         [ +  - ]:         12 :                 ExtractURL( XLINE_END_LIST, pValue );
     984                 :         12 :                 break;
     985                 :            :             case HANDLE_HATCHTABLEURL:
     986         [ +  - ]:         12 :                 ExtractURL( XHATCH_LIST, pValue );
     987                 :         12 :                 break;
     988                 :            :             case HANDLE_GRADIENTTABLEURL:
     989         [ +  - ]:         12 :                 ExtractURL( XGRADIENT_LIST, pValue );
     990                 :         12 :                 break;
     991                 :            :             case HANDLE_BITMAPTABLEURL:
     992         [ +  - ]:         12 :                 ExtractURL( XBITMAP_LIST, pValue );
     993                 :         12 :                 break;
     994                 :            :             case HANDLE_FORBIDDENCHARS:
     995 [ +  - ][ +  - ]:         19 :                 *pValue <<= mpModel->getForbiddenCharsTable();
     996                 :         19 :                 break;
     997                 :            :             case HANDLE_APPLYUSERDATA:
     998 [ +  - ][ +  - ]:         12 :                 *pValue <<= pDocSh->IsUseUserData();
     999                 :         12 :                 break;
    1000                 :            :             case HANDLE_PRINTDRAWING:
    1001 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Bool)aPrintOpts.IsDraw();
    1002                 :          4 :                 break;
    1003                 :            :             case HANDLE_PRINTNOTES:
    1004 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Bool)aPrintOpts.IsNotes();
    1005                 :          4 :                 break;
    1006                 :            :             case HANDLE_PRINTHANDOUT:
    1007 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Bool)aPrintOpts.IsHandout();
    1008                 :          4 :                 break;
    1009                 :            :             case HANDLE_PRINTOUTLINE:
    1010 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Bool)aPrintOpts.IsOutline();
    1011                 :          4 :                 break;
    1012                 :            :             case HANDLE_SLIDESPERHANDOUT:
    1013 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Int16)aPrintOpts.GetHandoutPages();
    1014                 :          4 :                 break;
    1015                 :            :             case HANDLE_HANDOUTHORIZONTAL:
    1016 [ +  - ][ +  - ]:          4 :                 *pValue <<= (sal_Bool)aPrintOpts.IsHandoutHorizontal();
    1017                 :          4 :                 break;
    1018                 :            :             case HANDLE_PRINTPAGENAME:
    1019 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsPagename();
    1020                 :         12 :                 break;
    1021                 :            :             case HANDLE_PRINTDATE:
    1022 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsDate();
    1023                 :         12 :                 break;
    1024                 :            :             case HANDLE_PRINTTIME:
    1025 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsTime();
    1026                 :         12 :                 break;
    1027                 :            :             case HANDLE_PRINTHIDENPAGES:
    1028 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsHiddenPages();
    1029                 :         12 :                 break;
    1030                 :            :             case HANDLE_PRINTFITPAGE:
    1031 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsPagesize();
    1032                 :         12 :                 break;
    1033                 :            :             case HANDLE_PRINTTILEPAGE:
    1034 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsPagetile();
    1035                 :         12 :                 break;
    1036                 :            :             case HANDLE_PRINTBOOKLET:
    1037 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsBooklet();
    1038                 :         12 :                 break;
    1039                 :            :             case HANDLE_PRINTBOOKLETFRONT:
    1040 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsFrontPage();
    1041                 :         12 :                 break;
    1042                 :            :             case HANDLE_PRINTBOOKLETBACK:
    1043 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Bool)aPrintOpts.IsBackPage();
    1044                 :         12 :                 break;
    1045                 :            :             case HANDLE_PRINTQUALITY:
    1046 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Int32)aPrintOpts.GetOutputQuality();
    1047                 :         12 :                 break;
    1048                 :            :             case HANDLE_MEASUREUNIT:
    1049                 :            :                 {
    1050                 :            :                     short nMeasure;
    1051                 :          8 :                     SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
    1052         [ +  - ]:          8 :                     *pValue <<= (sal_Int16)nMeasure;
    1053                 :            :                 }
    1054                 :          8 :                 break;
    1055                 :            :             case HANDLE_SCALE_NUM:
    1056         [ +  - ]:          8 :                 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
    1057                 :          8 :                 break;
    1058                 :            :             case HANDLE_SCALE_DOM:
    1059         [ +  - ]:          8 :                 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
    1060                 :          8 :                 break;
    1061                 :            :             case HANDLE_TABSTOP:
    1062         [ +  - ]:         12 :                 *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
    1063                 :         12 :                 break;
    1064                 :            :             case HANDLE_PAGENUMFMT:
    1065 [ +  - ][ +  - ]:         12 :                 *pValue <<= (sal_Int32)pDoc->GetPageNumType();
    1066                 :         12 :                 break;
    1067                 :            :             case HANDLE_PRINTERNAME:
    1068                 :            :                 {
    1069         [ +  - ]:         12 :                     SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
    1070 [ -  + ][ +  - ]:         12 :                     *pValue <<= pTempPrinter ? OUString ( pTempPrinter->GetName()) : OUString();
    1071                 :            :                 }
    1072                 :         12 :                 break;
    1073                 :            :             case HANDLE_PRINTERJOB:
    1074                 :            :                 {
    1075         [ +  - ]:         12 :                     SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
    1076         [ -  + ]:         12 :                     if (pTempPrinter)
    1077                 :            :                     {
    1078         [ #  # ]:          0 :                         SvMemoryStream aStream;
    1079         [ #  # ]:          0 :                         pTempPrinter->Store( aStream );
    1080         [ #  # ]:          0 :                         aStream.Seek ( STREAM_SEEK_TO_END );
    1081                 :          0 :                         sal_uInt32 nSize = aStream.Tell();
    1082         [ #  # ]:          0 :                         aStream.Seek ( STREAM_SEEK_TO_BEGIN );
    1083         [ #  # ]:          0 :                         Sequence < sal_Int8 > aSequence ( nSize );
    1084 [ #  # ][ #  # ]:          0 :                         memcpy ( aSequence.getArray(), aStream.GetData(), nSize );
    1085 [ #  # ][ #  # ]:          0 :                         *pValue <<= aSequence;
                 [ #  # ]
    1086                 :            :                     }
    1087                 :            :                     else
    1088                 :            :                     {
    1089         [ +  - ]:         12 :                         Sequence < sal_Int8 > aSequence;
    1090 [ +  - ][ +  - ]:         12 :                         *pValue <<= aSequence;
    1091                 :            :                     }
    1092                 :            :                 }
    1093                 :         12 :                 break;
    1094                 :            : 
    1095                 :            :             case HANDLE_PARAGRAPHSUMMATION :
    1096                 :            :             {
    1097                 :         12 :                 sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
    1098         [ +  - ]:         12 :                 *pValue <<= bIsSummationOfParagraphs;
    1099                 :            :             }
    1100                 :         12 :             break;
    1101                 :            : 
    1102                 :            :             case HANDLE_CHARCOMPRESS:
    1103                 :            :             {
    1104         [ +  - ]:         12 :                 *pValue <<= (sal_Int16)pDoc->GetCharCompressType();
    1105                 :         12 :                 break;
    1106                 :            :             }
    1107                 :            : 
    1108                 :            :             case HANDLE_ASIANPUNCT:
    1109                 :            :             {
    1110         [ +  - ]:         12 :                 *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation();
    1111                 :         12 :                 break;
    1112                 :            :             }
    1113                 :            : 
    1114                 :            :             case HANDLE_UPDATEFROMTEMPLATE:
    1115                 :            :             {
    1116 [ +  - ][ +  - ]:         12 :                 *pValue <<= pDocSh->IsQueryLoadTemplate();
    1117                 :            :             }
    1118                 :         12 :             break;
    1119                 :            : 
    1120                 :            :             case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
    1121                 :            :             {
    1122                 :            :                 sal_Int16 nPrinterIndependentLayout =
    1123         [ +  - ]:         12 :                     (sal_Int16)pDoc->GetPrinterIndependentLayout();
    1124         [ +  - ]:         12 :                 *pValue <<= nPrinterIndependentLayout;
    1125                 :            :             }
    1126                 :         12 :             break;
    1127                 :            : 
    1128                 :            :             // --> #i33095#
    1129                 :            :             case HANDLE_LOAD_READONLY:
    1130                 :            :             {
    1131 [ +  - ][ +  - ]:         12 :                 *pValue <<= pDocSh->IsLoadReadonly();
    1132                 :            :             }
    1133                 :         12 :             break;
    1134                 :            : 
    1135                 :            :             case HANDLE_SAVE_VERSION:
    1136                 :            :             {
    1137 [ +  - ][ +  - ]:         12 :                 *pValue <<= pDocSh->IsSaveVersionOnClose();
    1138                 :            :             }
    1139                 :         12 :             break;
    1140                 :            : 
    1141                 :            :             default:
    1142         [ #  # ]:          0 :                 throw UnknownPropertyException();
    1143                 :            :         }
    1144 [ +  - ][ +  - ]:        403 :     }
    1145                 :        403 : }
    1146                 :            : 
    1147                 :            : // XInterface
    1148                 :         30 : Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException)
    1149                 :            : {
    1150                 :         30 :     return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
    1151                 :            : }
    1152                 :            : 
    1153                 :         60 : void SAL_CALL DocumentSettings::acquire(  ) throw ()
    1154                 :            : {
    1155                 :         60 :     WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
    1156                 :         60 : }
    1157                 :            : 
    1158                 :         60 : void SAL_CALL DocumentSettings::release(  ) throw ()
    1159                 :            : {
    1160                 :         60 :     WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
    1161                 :         60 : }
    1162                 :            : 
    1163                 :            : 
    1164                 :            : // XPropertySet
    1165                 :         30 : Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo(  ) throw(RuntimeException)
    1166                 :            : {
    1167                 :         30 :     return PropertySetHelper::getPropertySetInfo();
    1168                 :            : }
    1169                 :            : 
    1170                 :        303 : void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1171                 :            : {
    1172                 :        303 :     PropertySetHelper::setPropertyValue( aPropertyName, aValue );
    1173                 :        303 : }
    1174                 :            : 
    1175                 :        403 : Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1176                 :            : {
    1177                 :        403 :     return PropertySetHelper::getPropertyValue( PropertyName );
    1178                 :            : }
    1179                 :            : 
    1180                 :          0 : void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1181                 :            : {
    1182                 :          0 :     PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener );
    1183                 :          0 : }
    1184                 :            : 
    1185                 :          0 : void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1186                 :            : {
    1187                 :          0 :     PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener );
    1188                 :          0 : }
    1189                 :            : 
    1190                 :          0 : void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1191                 :            : {
    1192                 :          0 :     PropertySetHelper::addVetoableChangeListener( PropertyName, aListener );
    1193                 :          0 : }
    1194                 :            : 
    1195                 :          0 : void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1196                 :            : {
    1197                 :          0 :     PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener );
    1198                 :          0 : }
    1199                 :            : 
    1200                 :            : // XMultiPropertySet
    1201                 :          0 : void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1202                 :            : {
    1203                 :          0 :     PropertySetHelper::setPropertyValues( aPropertyNames, aValues );
    1204                 :          0 : }
    1205                 :            : 
    1206                 :          0 : Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException)
    1207                 :            : {
    1208                 :          0 :     return PropertySetHelper::getPropertyValues( aPropertyNames );
    1209                 :            : }
    1210                 :            : 
    1211                 :          0 : void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
    1212                 :            : {
    1213                 :          0 :     PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener );
    1214                 :          0 : }
    1215                 :            : 
    1216                 :          0 : void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
    1217                 :            : {
    1218                 :          0 :     PropertySetHelper::removePropertiesChangeListener( xListener );
    1219                 :          0 : }
    1220                 :            : 
    1221                 :          0 : void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
    1222                 :            : {
    1223                 :          0 :     PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener );
    1224                 :          0 : }
    1225                 :            : 
    1226                 :            : // XServiceInfo
    1227                 :          0 : OUString SAL_CALL DocumentSettings::getImplementationName(  )
    1228                 :            :     throw(RuntimeException)
    1229                 :            : {
    1230                 :          0 :     return OUString( "com.sun.star.comp.Draw.DocumentSettings" );
    1231                 :            : }
    1232                 :            : 
    1233                 :          0 : sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName )
    1234                 :            :     throw(RuntimeException)
    1235                 :            : {
    1236         [ #  # ]:          0 :     const Sequence< OUString > aSeq( getSupportedServiceNames() );
    1237                 :          0 :     sal_Int32 nCount = aSeq.getLength();
    1238                 :          0 :     const OUString* pServices = aSeq.getConstArray();
    1239         [ #  # ]:          0 :     while( nCount-- )
    1240                 :            :     {
    1241         [ #  # ]:          0 :         if( *pServices++ == ServiceName )
    1242                 :          0 :             return sal_True;
    1243                 :            :     }
    1244                 :            : 
    1245         [ #  # ]:          0 :     return sal_True;
    1246                 :            : }
    1247                 :            : 
    1248                 :          0 : Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames(  )
    1249                 :            :     throw(RuntimeException)
    1250                 :            : {
    1251                 :          0 :     Sequence< OUString > aSeq( 2 );
    1252         [ #  # ]:          0 :     aSeq[0] = "com.sun.star.document.Settings" ;
    1253         [ #  # ]:          0 :     if( mpModel->IsImpressDocument() )
    1254                 :            :     {
    1255         [ #  # ]:          0 :         aSeq[1] = "com.sun.star.presentation.DocumentSettings" ;
    1256                 :            :     }
    1257                 :            :     else
    1258                 :            :     {
    1259         [ #  # ]:          0 :         aSeq[1] = "com.sun.star.drawing.DocumentSettings" ;
    1260                 :            :     }
    1261                 :            : 
    1262                 :          0 :     return aSeq;
    1263                 :            : }
    1264                 :            : 
    1265                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10