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