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