1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 #include <vos/mutex.hxx> 32 #include <sfx2/sfxbasecontroller.hxx> 33 #include <SwXDocumentSettings.hxx> 34 #include <comphelper/MasterPropertySetInfo.hxx> 35 #include <com/sun/star/beans/PropertyAttribute.hpp> 36 #include <com/sun/star/i18n/XForbiddenCharacters.hpp> 37 #include <com/sun/star/document/PrinterIndependentLayout.hpp> 38 #include <doc.hxx> 39 #include <docsh.hxx> 40 #include <fldupde.hxx> 41 #include <linkenum.hxx> 42 #include <sfx2/printer.hxx> 43 #include <editsh.hxx> 44 #include <drawdoc.hxx> 45 #include <svl/zforlist.hxx> 46 #include <unotxdoc.hxx> 47 #include <cmdid.h> 48 #include <svx/zoomitem.hxx> 49 #include <unomod.hxx> 50 #include <vcl/svapp.hxx> 51 52 #include "swmodule.hxx" 53 #include "cfgitems.hxx" 54 #include "prtopt.hxx" 55 56 57 #include "swmodule.hxx" 58 #include "cfgitems.hxx" 59 #include "prtopt.hxx" 60 61 using rtl::OUString; 62 63 using namespace comphelper; 64 using namespace ::com::sun::star; 65 using namespace ::com::sun::star::uno; 66 using namespace ::com::sun::star::beans; 67 using namespace ::com::sun::star::lang; 68 using namespace ::com::sun::star::i18n; 69 70 enum SwDocumentSettingsPropertyHandles 71 { 72 HANDLE_FORBIDDEN_CHARS, 73 HANDLE_LINK_UPDATE_MODE, 74 HANDLE_FIELD_AUTO_UPDATE, 75 HANDLE_CHART_AUTO_UPDATE, 76 HANDLE_ADD_PARA_TABLE_SPACING, 77 HANDLE_ADD_PARA_TABLE_SPACING_AT_START, 78 HANDLE_ALIGN_TAB_STOP_POSITION, 79 HANDLE_PRINTER_NAME, 80 HANDLE_PRINTER_SETUP, 81 HANDLE_IS_KERN_ASIAN_PUNCTUATION, 82 HANDLE_CHARACTER_COMPRESSION_TYPE, 83 HANDLE_APPLY_USER_DATA, 84 HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, 85 HANDLE_CURRENT_DATABASE_DATA_SOURCE, 86 HANDLE_CURRENT_DATABASE_COMMAND, 87 HANDLE_CURRENT_DATABASE_COMMAND_TYPE, 88 HANDLE_SAVE_VERSION_ON_CLOSE, 89 HANDLE_IS_GRID_VISIBLE, 90 HANDLE_IS_SNAP_TO_GRID, 91 HANDLE_IS_SYNCHRONISE_AXES, 92 HANDLE_HORIZONTAL_GRID_RESOLUTION, 93 HANDLE_HORIZONTAL_GRID_SUBDIVISION, 94 HANDLE_VERTICAL_GRID_RESOLUTION, 95 HANDLE_VERTICAL_GRID_SUBDIVISION, 96 HANDLE_UPDATE_FROM_TEMPLATE, 97 HANDLE_PRINTER_INDEPENDENT_LAYOUT, 98 HANDLE_IS_LABEL_DOC, 99 HANDLE_IS_ADD_FLY_OFFSET, 100 HANDLE_IS_ADD_EXTERNAL_LEADING, 101 HANDLE_OLD_NUMBERING, // #111955# 102 HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, 103 /* Stampit It disable the print cancel button of the shown progress dialog. */ 104 HANDLE_ALLOW_PRINTJOB_CANCEL, 105 HANDLE_USE_FORMER_LINE_SPACING, 106 HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, 107 HANDLE_USE_FORMER_OBJECT_POSITIONING, 108 HANDLE_USE_FORMER_TEXT_WRAPPING, 109 HANDLE_CHANGES_PASSWORD, 110 HANDLE_CONSIDER_WRAP_ON_OBJPOS, 111 HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, 112 HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, 113 HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, 114 HANDLE_TABLE_ROW_KEEP, 115 HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, 116 HANDLE_LOAD_READONLY, 117 HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, 118 HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, 119 HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, 120 HANDLE_USE_OLD_PRINTER_METRICS, 121 HANDLE_PROTECT_FORM, 122 HANDLE_TABS_RELATIVE_TO_INDENT, 123 // --> OD 2008-06-05 #i89181# 124 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, 125 // <-- 126 HANDLE_MODIFYPASSWORDINFO, 127 HANDLE_MATH_BASELINE_ALIGNMENT 128 }; 129 130 MasterPropertySetInfo * lcl_createSettingsInfo() 131 { 132 static PropertyInfo aWriterSettingsInfoMap[] = 133 { 134 { RTL_CONSTASCII_STRINGPARAM("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, CPPUTYPE_REFFORBCHARS, 0, 0}, 135 { RTL_CONSTASCII_STRINGPARAM("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, CPPUTYPE_INT16, 0, 0}, 136 { RTL_CONSTASCII_STRINGPARAM("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0}, 137 { RTL_CONSTASCII_STRINGPARAM("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0}, 138 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, CPPUTYPE_BOOLEAN, 0, 0}, 139 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, CPPUTYPE_BOOLEAN, 0, 0}, 140 { RTL_CONSTASCII_STRINGPARAM("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, CPPUTYPE_BOOLEAN, 0, 0}, 141 { RTL_CONSTASCII_STRINGPARAM("PrinterName"), HANDLE_PRINTER_NAME, CPPUTYPE_OUSTRING, 0, 0}, 142 { RTL_CONSTASCII_STRINGPARAM("PrinterSetup"), HANDLE_PRINTER_SETUP, CPPUTYPE_SEQINT8, 0, 0}, 143 { RTL_CONSTASCII_STRINGPARAM("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, CPPUTYPE_BOOLEAN, 0, 0}, 144 { RTL_CONSTASCII_STRINGPARAM("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, CPPUTYPE_INT16, 0, 0}, 145 { RTL_CONSTASCII_STRINGPARAM("ApplyUserData"), HANDLE_APPLY_USER_DATA, CPPUTYPE_BOOLEAN, 0, 0}, 146 { RTL_CONSTASCII_STRINGPARAM("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, CPPUTYPE_BOOLEAN, 0, 0}, 147 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, CPPUTYPE_OUSTRING, 0, 0}, 148 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, CPPUTYPE_OUSTRING, 0, 0}, 149 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, CPPUTYPE_INT32, 0, 0}, 150 { RTL_CONSTASCII_STRINGPARAM("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, CPPUTYPE_BOOLEAN, 0, 0}, 151 { RTL_CONSTASCII_STRINGPARAM("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, CPPUTYPE_BOOLEAN, 0, 0}, 152 153 { RTL_CONSTASCII_STRINGPARAM("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, CPPUTYPE_INT16, 0, 0}, 154 { RTL_CONSTASCII_STRINGPARAM("IsLabelDocument"), HANDLE_IS_LABEL_DOC, CPPUTYPE_BOOLEAN, 0, 0}, 155 { RTL_CONSTASCII_STRINGPARAM("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, CPPUTYPE_BOOLEAN, 0, 0}, 156 { RTL_CONSTASCII_STRINGPARAM("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, CPPUTYPE_BOOLEAN, 0, 0}, 157 { RTL_CONSTASCII_STRINGPARAM("UseOldNumbering"), HANDLE_OLD_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0}, // #111955# 158 { RTL_CONSTASCII_STRINGPARAM("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0}, 159 /* Stampit It disable the print cancel button of the shown progress dialog. */ 160 { RTL_CONSTASCII_STRINGPARAM("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, CPPUTYPE_BOOLEAN, 0, 0}, 161 { RTL_CONSTASCII_STRINGPARAM("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, CPPUTYPE_BOOLEAN, 0, 0}, 162 { RTL_CONSTASCII_STRINGPARAM("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, CPPUTYPE_BOOLEAN, 0, 0}, 163 { RTL_CONSTASCII_STRINGPARAM("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, CPPUTYPE_BOOLEAN, 0, 0}, 164 { RTL_CONSTASCII_STRINGPARAM("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, CPPUTYPE_BOOLEAN, 0, 0}, 165 { RTL_CONSTASCII_STRINGPARAM("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, CPPUTYPE_SEQINT8, 0, 0}, 166 { RTL_CONSTASCII_STRINGPARAM("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, CPPUTYPE_BOOLEAN, 0, 0}, 167 { RTL_CONSTASCII_STRINGPARAM("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0}, 168 { RTL_CONSTASCII_STRINGPARAM("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, CPPUTYPE_BOOLEAN, 0, 0}, 169 { RTL_CONSTASCII_STRINGPARAM("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, CPPUTYPE_BOOLEAN, 0, 0}, 170 { RTL_CONSTASCII_STRINGPARAM("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, CPPUTYPE_BOOLEAN, 0, 0}, 171 { RTL_CONSTASCII_STRINGPARAM("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, CPPUTYPE_BOOLEAN, 0, 0}, 172 { RTL_CONSTASCII_STRINGPARAM("LoadReadonly"), HANDLE_LOAD_READONLY, CPPUTYPE_BOOLEAN, 0, 0}, 173 { RTL_CONSTASCII_STRINGPARAM("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, CPPUTYPE_BOOLEAN, 0, 0}, 174 { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, CPPUTYPE_BOOLEAN, 0, 0}, 175 { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, CPPUTYPE_BOOLEAN, 0, 0}, 176 { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, CPPUTYPE_BOOLEAN, 0, 0}, 177 { RTL_CONSTASCII_STRINGPARAM("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, CPPUTYPE_BOOLEAN, 0, 0}, 178 { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM, CPPUTYPE_BOOLEAN, 0, 0}, 179 // --> OD 2008-06-05 #i89181# 180 { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0}, 181 { RTL_CONSTASCII_STRINGPARAM("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, CPPUTYPE_PROPERTYVALUE, 0, 0}, 182 { RTL_CONSTASCII_STRINGPARAM("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, CPPUTYPE_BOOLEAN, 0, 0}, 183 184 /* 185 * As OS said, we don't have a view when we need to set this, so I have to 186 * find another solution before adding them to this property set - MTG 187 { RTL_CONSTASCII_STRINGPARAM("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, CPPUTYPE_BOOLEAN, 0, 0}, 188 { RTL_CONSTASCII_STRINGPARAM("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, CPPUTYPE_BOOLEAN, 0, 0}, 189 { RTL_CONSTASCII_STRINGPARAM("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, CPPUTYPE_BOOLEAN, 0, 0}, 190 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0}, 191 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0}, 192 { RTL_CONSTASCII_STRINGPARAM("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0}, 193 { RTL_CONSTASCII_STRINGPARAM("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0}, 194 195 { RTL_CONSTASCII_STRINGPARAM("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, CPPUTYPE_BOOLEAN, 0, 0}, 196 { RTL_CONSTASCII_STRINGPARAM("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, CPPUTYPE_BOOLEAN, 0, 0}, 197 { RTL_CONSTASCII_STRINGPARAM("ShowSpaces"), HANDLE_SHOW_SPACES, CPPUTYPE_BOOLEAN, 0, 0}, 198 { RTL_CONSTASCII_STRINGPARAM("ShowTabs"), HANDLE_SHOW_TABS, CPPUTYPE_BOOLEAN, 0, 0}, 199 { RTL_CONSTASCII_STRINGPARAM("ShowBreaks"), HANDLE_SHOW_BREAKS, CPPUTYPE_BOOLEAN, 0, 0}, 200 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, CPPUTYPE_BOOLEAN, 0, 0}, 201 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, CPPUTYPE_BOOLEAN, 0, 0}, 202 203 { RTL_CONSTASCII_STRINGPARAM("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0}, 204 { RTL_CONSTASCII_STRINGPARAM("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0}, 205 { RTL_CONSTASCII_STRINGPARAM("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0}, 206 { RTL_CONSTASCII_STRINGPARAM("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, CPPUTYPE_BOOLEAN, 0, 0}, 207 { RTL_CONSTASCII_STRINGPARAM("ShowSimpleHandles"), HANDLE_SHOW_SIMPLE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0}, 208 { RTL_CONSTASCII_STRINGPARAM("ShowLargeHandles"), HANDLE_SHOW_LARGE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0}, 209 */ 210 { NULL, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 } 211 }; 212 return new MasterPropertySetInfo ( aWriterSettingsInfoMap ); 213 } 214 215 SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel ) 216 : MasterPropertySet ( lcl_createSettingsInfo (), 217 &Application::GetSolarMutex () ) 218 , mxModel ( pModel ) 219 , mpModel ( pModel ) 220 , mpDocSh ( NULL ) 221 , mpDoc ( NULL ) 222 , mpPrinter( NULL ) 223 { 224 registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT, mpModel->GetDocShell()->GetDoc() ) ); 225 } 226 227 SwXDocumentSettings::~SwXDocumentSettings() 228 throw() 229 { 230 } 231 232 Any SAL_CALL SwXDocumentSettings::queryInterface( const Type& rType ) 233 throw(RuntimeException) 234 { 235 return ::cppu::queryInterface ( rType, 236 // OWeakObject interfaces 237 dynamic_cast< XInterface* > ( dynamic_cast< OWeakObject* >(this) ), 238 dynamic_cast< XWeak* > ( this ), 239 // my own interfaces 240 dynamic_cast< XPropertySet* > ( this ), 241 dynamic_cast< XPropertyState* > ( this ), 242 dynamic_cast< XMultiPropertySet* > ( this ), 243 dynamic_cast< XServiceInfo* > ( this ), 244 dynamic_cast< XTypeProvider* > ( this ) ); 245 } 246 void SwXDocumentSettings::acquire () 247 throw () 248 { 249 OWeakObject::acquire(); 250 } 251 void SwXDocumentSettings::release () 252 throw () 253 { 254 OWeakObject::release(); 255 } 256 257 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( ) 258 throw (RuntimeException) 259 { 260 vos::OGuard aGuard(Application::GetSolarMutex()); 261 262 uno::Sequence< uno::Type > aBaseTypes( 5 ); 263 uno::Type* pBaseTypes = aBaseTypes.getArray(); 264 265 // from MasterPropertySet 266 pBaseTypes[0] = ::getCppuType((Reference< XPropertySet >*)0); 267 pBaseTypes[1] = ::getCppuType((Reference< XPropertyState >*)0); 268 pBaseTypes[2] = ::getCppuType((Reference< XMultiPropertySet >*)0); 269 // 270 pBaseTypes[3] = ::getCppuType((Reference< XServiceInfo >*)0); 271 pBaseTypes[4] = ::getCppuType((Reference< XTypeProvider >*)0); 272 273 return aBaseTypes; 274 } 275 276 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( ) 277 throw (RuntimeException) 278 { 279 vos::OGuard aGuard(Application::GetSolarMutex()); 280 static Sequence< sal_Int8 > aId( 16 ); 281 static sal_Bool bInit = sal_False; 282 if(!bInit) 283 { 284 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True ); 285 bInit = sal_True; 286 } 287 return aId; 288 } 289 290 void SwXDocumentSettings::_preSetValues () 291 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 292 { 293 mpDocSh = mpModel->GetDocShell(); 294 mpDoc = mpDocSh->GetDoc(); 295 296 if( NULL == mpDoc || NULL == mpDocSh ) 297 throw UnknownPropertyException(); 298 } 299 300 301 void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue ) 302 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 303 { 304 if (rInfo.mnAttributes & PropertyAttribute::READONLY) 305 throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + C2U(rInfo.mpName), static_cast < cppu::OWeakObject * > ( 0 ) ); 306 307 switch( rInfo.mnHandle ) 308 { 309 case HANDLE_FORBIDDEN_CHARS: 310 break; 311 case HANDLE_LINK_UPDATE_MODE: 312 { 313 sal_Int16 nMode = 0; 314 rValue >>= nMode; 315 switch (nMode) 316 { 317 case NEVER: 318 case MANUAL: 319 case AUTOMATIC: 320 case GLOBALSETTING: 321 break; 322 default: 323 throw IllegalArgumentException(); 324 } 325 mpDoc->setLinkUpdateMode(nMode); 326 } 327 break; 328 case HANDLE_FIELD_AUTO_UPDATE: 329 { 330 sal_Bool bUpdateField = *(sal_Bool*)rValue.getValue(); 331 SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true); 332 mpDoc->setFieldUpdateFlags( bUpdateField ? 333 nFlag == AUTOUPD_FIELD_AND_CHARTS ? 334 AUTOUPD_FIELD_AND_CHARTS : 335 AUTOUPD_FIELD_ONLY : 336 AUTOUPD_OFF ); 337 } 338 break; 339 case HANDLE_CHART_AUTO_UPDATE: 340 { 341 sal_Bool bUpdateChart = *(sal_Bool*)rValue.getValue(); 342 SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true); 343 mpDoc->setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ? 344 bUpdateChart ? 345 AUTOUPD_FIELD_AND_CHARTS : 346 AUTOUPD_FIELD_ONLY : 347 AUTOUPD_OFF ); 348 } 349 break; 350 case HANDLE_ADD_PARA_TABLE_SPACING: 351 { 352 sal_Bool bParaSpace = sal_False; 353 rValue >>= bParaSpace; 354 mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX, bParaSpace ); 355 } 356 break; 357 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START: 358 { 359 sal_Bool bParaSpacePage = sal_False; 360 rValue >>= bParaSpacePage; 361 mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bParaSpacePage ); 362 } 363 break; 364 case HANDLE_ALIGN_TAB_STOP_POSITION: 365 { 366 sal_Bool bAlignTab = *(sal_Bool*)rValue.getValue(); 367 mpDoc->set(IDocumentSettingAccess::TAB_COMPAT, bAlignTab); 368 } 369 break; 370 case HANDLE_PRINTER_NAME: 371 { 372 //the printer must be created 373 OUString sPrinterName; 374 if( rValue >>= sPrinterName ) 375 { 376 if( !mpPrinter && sPrinterName.getLength() > 0 && mpDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) 377 { 378 SfxPrinter* pPrinter = mpDoc->getPrinter( true ); 379 if ( OUString ( pPrinter->GetName()) != sPrinterName ) 380 { 381 SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); 382 if( pNewPrinter->IsKnown() ) 383 { 384 // set printer only once; in _postSetValues 385 mpPrinter = pNewPrinter; 386 } 387 else 388 { 389 delete pNewPrinter; 390 } 391 } 392 } 393 } 394 else 395 throw IllegalArgumentException(); 396 } 397 break; 398 case HANDLE_PRINTER_SETUP: 399 { 400 Sequence < sal_Int8 > aSequence; 401 if ( rValue >>= aSequence ) 402 { 403 sal_uInt32 nSize = aSequence.getLength(); 404 if( nSize > 0 ) 405 { 406 SvMemoryStream aStream (aSequence.getArray(), nSize, 407 STREAM_READ ); 408 aStream.Seek ( STREAM_SEEK_TO_BEGIN ); 409 static sal_uInt16 __READONLY_DATA nRange[] = 410 { 411 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER, 412 SID_HTML_MODE, SID_HTML_MODE, 413 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, 414 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 415 0 416 }; 417 SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange ); 418 SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); 419 420 // set printer only once; in _postSetValues 421 delete mpPrinter; 422 mpPrinter = pPrinter; 423 } 424 } 425 else 426 throw IllegalArgumentException(); 427 } 428 break; 429 case HANDLE_IS_KERN_ASIAN_PUNCTUATION: 430 { 431 sal_Bool bIsKern = *(sal_Bool*)(rValue).getValue(); 432 mpDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION, bIsKern); 433 SwEditShell* pEditSh = mpDoc->GetEditShell(); 434 if(pEditSh) 435 pEditSh->ChgHyphenation(); 436 } 437 break; 438 case HANDLE_CHARACTER_COMPRESSION_TYPE: 439 { 440 sal_Int16 nMode = 0; 441 rValue >>= nMode; 442 switch (nMode) 443 { 444 case CHARCOMPRESS_NONE: 445 case CHARCOMPRESS_PUNCTUATION: 446 case CHARCOMPRESS_PUNCTUATION_KANA: 447 break; 448 default: 449 throw IllegalArgumentException(); 450 } 451 mpDoc->setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) ); 452 } 453 break; 454 case HANDLE_APPLY_USER_DATA: 455 { 456 mpDocSh->SetUseUserData( *(sal_Bool*)rValue.getValue() ); 457 } 458 break; 459 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS: 460 { 461 sal_Bool bSaveGlobal = *(sal_Bool*)rValue.getValue(); 462 mpDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal ); 463 } 464 break; 465 case HANDLE_CURRENT_DATABASE_DATA_SOURCE: 466 { 467 SwDBData aData = mpDoc->GetDBData(); 468 if ( rValue >>= aData.sDataSource ) 469 mpDoc->ChgDBData( aData ); 470 } 471 break; 472 case HANDLE_CURRENT_DATABASE_COMMAND: 473 { 474 SwDBData aData = mpDoc->GetDBData(); 475 if ( rValue >>= aData.sCommand ) 476 mpDoc->ChgDBData( aData ); 477 } 478 break; 479 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE: 480 { 481 SwDBData aData = mpDoc->GetDBData(); 482 if ( rValue >>= aData.nCommandType ) 483 mpDoc->ChgDBData( aData ); 484 } 485 break; 486 case HANDLE_SAVE_VERSION_ON_CLOSE: 487 { 488 mpDocSh->SetSaveVersionOnClose( *(sal_Bool*)rValue.getValue() ); 489 } 490 break; 491 case HANDLE_UPDATE_FROM_TEMPLATE: 492 { 493 mpDocSh->SetQueryLoadTemplate( *(sal_Bool*)rValue.getValue() ); 494 } 495 break; 496 case HANDLE_PRINTER_INDEPENDENT_LAYOUT: 497 { 498 sal_Int16 nTmp = 0; 499 rValue >>= nTmp; 500 501 bool bUseVirDev = true; 502 bool bHiResVirDev = true; 503 if( nTmp == document::PrinterIndependentLayout::DISABLED ) 504 bUseVirDev = false; 505 else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION ) 506 bHiResVirDev = false; 507 else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION ) 508 throw IllegalArgumentException(); 509 510 mpDoc->setReferenceDeviceType( bUseVirDev, bHiResVirDev ); 511 } 512 break; 513 case HANDLE_IS_LABEL_DOC : 514 { 515 sal_Bool bSet = sal_False; 516 if(!(rValue >>= bSet)) 517 throw IllegalArgumentException(); 518 mpDoc->set(IDocumentSettingAccess::LABEL_DOCUMENT, bSet); 519 } 520 break; 521 case HANDLE_IS_ADD_FLY_OFFSET: 522 { 523 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 524 mpDoc->set(IDocumentSettingAccess::ADD_FLY_OFFSETS, bTmp); 525 } 526 break; 527 case HANDLE_IS_ADD_EXTERNAL_LEADING: 528 { 529 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 530 mpDoc->set(IDocumentSettingAccess::ADD_EXT_LEADING, bTmp); 531 } 532 break; 533 case HANDLE_OLD_NUMBERING: // #111955# 534 { 535 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 536 mpDoc->set(IDocumentSettingAccess::OLD_NUMBERING, bTmp); 537 } 538 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING: 539 { 540 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 541 mpDoc->set(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE, bTmp); 542 } 543 break; 544 case HANDLE_ALLOW_PRINTJOB_CANCEL: 545 { 546 sal_Bool bState = sal_False; 547 if (!(rValue >>= bState)) 548 throw IllegalArgumentException(); 549 mpDocSh->Stamp_SetPrintCancelState(bState); 550 } 551 break; 552 case HANDLE_USE_FORMER_LINE_SPACING: 553 { 554 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 555 mpDoc->set(IDocumentSettingAccess::OLD_LINE_SPACING, bTmp); 556 } 557 break; 558 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS: 559 { 560 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 561 mpDoc->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp); 562 } 563 break; 564 case HANDLE_USE_FORMER_OBJECT_POSITIONING: 565 { 566 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 567 mpDoc->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, bTmp); 568 } 569 break; 570 case HANDLE_USE_FORMER_TEXT_WRAPPING: 571 { 572 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 573 mpDoc->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, bTmp); 574 } 575 break; 576 case HANDLE_CHANGES_PASSWORD: 577 { 578 Sequence <sal_Int8> aNew; 579 if(rValue >>= aNew) 580 { 581 mpDoc->SetRedlinePassword(aNew); 582 if(aNew.getLength()) 583 { 584 sal_uInt16 eMode = mpDoc->GetRedlineMode(); 585 eMode = eMode|nsRedlineMode_t::REDLINE_ON; 586 mpDoc->SetRedlineMode((RedlineMode_t)( eMode )); 587 } 588 } 589 } 590 break; 591 case HANDLE_CONSIDER_WRAP_ON_OBJPOS: 592 { 593 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 594 mpDoc->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp ); 595 } 596 break; 597 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: 598 { 599 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 600 mpDoc->set(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp); 601 } 602 break; 603 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: 604 { 605 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 606 mpDoc->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp); 607 } 608 break; 609 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: 610 { 611 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 612 mpDoc->set(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp); 613 } 614 break; 615 case HANDLE_TABLE_ROW_KEEP: 616 { 617 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 618 mpDoc->set(IDocumentSettingAccess::TABLE_ROW_KEEP, bTmp); 619 } 620 break; 621 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: 622 { 623 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 624 mpDoc->set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp); 625 } 626 break; 627 case HANDLE_LOAD_READONLY: 628 { 629 mpDocSh->SetLoadReadonly( *(sal_Bool*)rValue.getValue() ); 630 } 631 break; 632 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: 633 { 634 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 635 mpDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp); 636 } 637 break; 638 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES: 639 { 640 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 641 mpDoc->set(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp); 642 } 643 break; 644 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING: 645 { 646 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 647 mpDoc->set(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING, bTmp); 648 } 649 break; 650 case HANDLE_USE_OLD_PRINTER_METRICS: 651 { 652 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 653 mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp); 654 } 655 break; 656 case HANDLE_TABS_RELATIVE_TO_INDENT: 657 { 658 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 659 mpDoc->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, bTmp); 660 } 661 break; 662 case HANDLE_PROTECT_FORM: 663 { 664 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 665 mpDoc->set(IDocumentSettingAccess::PROTECT_FORM, bTmp); 666 } 667 break; 668 // --> OD 2008-06-05 #i89181# 669 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: 670 { 671 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 672 mpDoc->set(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp); 673 } 674 break; 675 // <-- 676 case HANDLE_MODIFYPASSWORDINFO: 677 { 678 uno::Sequence< beans::PropertyValue > aInfo; 679 if ( !( rValue >>= aInfo ) ) 680 throw lang::IllegalArgumentException( 681 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value of type Sequence<PropertyValue> expected!" ) ), 682 uno::Reference< uno::XInterface >(), 683 2 ); 684 685 if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) ) 686 throw beans::PropertyVetoException( 687 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The hash is not allowed to be changed now!" ) ), 688 uno::Reference< uno::XInterface >() ); 689 } 690 break; 691 case HANDLE_MATH_BASELINE_ALIGNMENT: 692 { 693 sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); 694 mpDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, bTmp ); 695 } 696 break; 697 default: 698 throw UnknownPropertyException(); 699 } 700 } 701 702 void SwXDocumentSettings::_postSetValues () 703 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 704 { 705 // set printer only once, namely here! 706 if( mpPrinter != NULL ) 707 { 708 // #i86352# the printer is also used as container for options by sfx 709 // when setting a printer it should have decent default options 710 SfxItemSet aOptions( mpPrinter->GetOptions() ); 711 SwPrintData aPrtData( mpDoc->getPrintData() ); 712 SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData); 713 aOptions.Put(aAddPrinterItem); 714 mpPrinter->SetOptions( aOptions ); 715 716 mpDoc->setPrinter( mpPrinter, true, true ); 717 } 718 719 mpPrinter = 0; 720 mpDocSh = 0; 721 mpDoc = 0; 722 } 723 724 void SwXDocumentSettings::_preGetValues () 725 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 726 { 727 mpDocSh = mpModel->GetDocShell(); 728 mpDoc = mpDocSh->GetDoc(); 729 if( NULL == mpDoc || NULL == mpDocSh ) 730 throw UnknownPropertyException(); 731 } 732 733 void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) 734 throw(beans::UnknownPropertyException, lang::WrappedTargetException ) 735 { 736 switch( rInfo.mnHandle ) 737 { 738 case HANDLE_FORBIDDEN_CHARS: 739 { 740 Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY); 741 rValue <<= xRet; 742 } 743 break; 744 case HANDLE_LINK_UPDATE_MODE: 745 { 746 rValue <<= static_cast < sal_Int16 > ( mpDoc->getLinkUpdateMode(true) ); 747 } 748 break; 749 case HANDLE_FIELD_AUTO_UPDATE: 750 { 751 SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true); 752 sal_Bool bFieldUpd = (nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS ); 753 rValue.setValue(&bFieldUpd, ::getBooleanCppuType()); 754 } 755 break; 756 case HANDLE_CHART_AUTO_UPDATE: 757 { 758 SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true); 759 sal_Bool bChartUpd = nFlags == AUTOUPD_FIELD_AND_CHARTS; 760 rValue.setValue(&bChartUpd, ::getBooleanCppuType()); 761 } 762 break; 763 case HANDLE_ADD_PARA_TABLE_SPACING: 764 { 765 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX); 766 rValue.setValue(&bParaSpace, ::getBooleanCppuType()); 767 } 768 break; 769 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START: 770 { 771 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES); 772 rValue.setValue(&bParaSpace, ::getBooleanCppuType()); 773 } 774 break; 775 case HANDLE_ALIGN_TAB_STOP_POSITION: 776 { 777 sal_Bool bAlignTab = mpDoc->get(IDocumentSettingAccess::TAB_COMPAT); 778 rValue.setValue(&bAlignTab, ::getBooleanCppuType()); 779 } 780 break; 781 case HANDLE_PRINTER_NAME: 782 { 783 SfxPrinter *pPrinter = mpDoc->getPrinter( sal_False ); 784 rValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); 785 } 786 break; 787 case HANDLE_PRINTER_SETUP: 788 { 789 SfxPrinter *pPrinter = mpDocSh->GetDoc()->getPrinter( sal_False ); 790 if (pPrinter) 791 { 792 SvMemoryStream aStream; 793 pPrinter->Store( aStream ); 794 aStream.Seek ( STREAM_SEEK_TO_END ); 795 sal_uInt32 nSize = aStream.Tell(); 796 aStream.Seek ( STREAM_SEEK_TO_BEGIN ); 797 Sequence < sal_Int8 > aSequence( nSize ); 798 aStream.Read ( aSequence.getArray(), nSize ); 799 rValue <<= aSequence; 800 } 801 else 802 { 803 Sequence < sal_Int8 > aSequence ( 0 ); 804 rValue <<= aSequence; 805 } 806 } 807 break; 808 case HANDLE_IS_KERN_ASIAN_PUNCTUATION: 809 { 810 //sal_Bool bParaSpace = mpDoc->IsKernAsianPunctuation(); 811 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION); 812 rValue.setValue(&bParaSpace, ::getBooleanCppuType()); 813 } 814 break; 815 case HANDLE_APPLY_USER_DATA: 816 { 817 rValue <<= mpDocSh->IsUseUserData(); 818 } 819 break; 820 case HANDLE_CHARACTER_COMPRESSION_TYPE: 821 { 822 rValue <<= static_cast < sal_Int16 > (mpDoc->getCharacterCompressionType()); 823 } 824 break; 825 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS: 826 { 827 sal_Bool bSaveGlobal = mpDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS); 828 rValue.setValue(&bSaveGlobal, ::getBooleanCppuType()); 829 } 830 break; 831 case HANDLE_CURRENT_DATABASE_DATA_SOURCE: 832 { 833 const SwDBData& rData = mpDoc->GetDBDesc(); 834 rValue <<= rData.sDataSource; 835 } 836 break; 837 case HANDLE_CURRENT_DATABASE_COMMAND: 838 { 839 const SwDBData& rData = mpDoc->GetDBDesc(); 840 rValue <<= rData.sCommand; 841 } 842 break; 843 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE: 844 { 845 const SwDBData& rData = mpDoc->GetDBDesc(); 846 rValue <<= rData.nCommandType; 847 } 848 break; 849 case HANDLE_SAVE_VERSION_ON_CLOSE: 850 { 851 rValue <<= mpDocSh->IsSaveVersionOnClose(); 852 } 853 break; 854 case HANDLE_UPDATE_FROM_TEMPLATE: 855 { 856 rValue <<= mpDocSh->IsQueryLoadTemplate(); 857 } 858 break; 859 case HANDLE_PRINTER_INDEPENDENT_LAYOUT: 860 { 861 // returns short (see css.document.PrinterIndependentLayout) 862 sal_Int16 nVirDevType = mpDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ? 863 ( mpDoc->get(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE) ? 864 document::PrinterIndependentLayout::HIGH_RESOLUTION : 865 document::PrinterIndependentLayout::LOW_RESOLUTION ) : 866 document::PrinterIndependentLayout::DISABLED; 867 rValue <<= nVirDevType; 868 } 869 break; 870 case HANDLE_IS_LABEL_DOC: 871 { 872 sal_Bool bLabel = mpDoc->get(IDocumentSettingAccess::LABEL_DOCUMENT); 873 rValue <<= bLabel; 874 } 875 break; 876 case HANDLE_IS_ADD_FLY_OFFSET: 877 { 878 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_FLY_OFFSETS); 879 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 880 } 881 break; 882 case HANDLE_IS_ADD_EXTERNAL_LEADING: 883 { 884 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_EXT_LEADING); 885 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 886 } 887 break; 888 case HANDLE_OLD_NUMBERING: // #111955# 889 { 890 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_NUMBERING); 891 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 892 } 893 break; 894 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING: // #111955# 895 { 896 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE); 897 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 898 } 899 break; 900 case HANDLE_ALLOW_PRINTJOB_CANCEL: 901 { 902 sal_Bool bPrintCancelState = mpDocSh->Stamp_GetPrintCancelState(); 903 rValue.setValue(&bPrintCancelState, ::getBooleanCppuType()); 904 } 905 break; 906 case HANDLE_USE_FORMER_LINE_SPACING: 907 { 908 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_LINE_SPACING); 909 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 910 } 911 break; 912 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS: 913 { 914 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS); 915 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 916 } 917 break; 918 case HANDLE_USE_FORMER_OBJECT_POSITIONING: 919 { 920 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS); 921 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 922 } 923 break; 924 case HANDLE_USE_FORMER_TEXT_WRAPPING: 925 { 926 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING); 927 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 928 } 929 break; 930 case HANDLE_CHANGES_PASSWORD: 931 { 932 rValue <<= mpDoc->GetRedlinePassword(); 933 } 934 break; 935 case HANDLE_CONSIDER_WRAP_ON_OBJPOS: 936 { 937 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION); 938 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 939 } 940 break; 941 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: 942 { 943 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING); 944 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 945 } 946 break; 947 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: 948 { 949 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); 950 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 951 } 952 break; 953 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: 954 { 955 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT); 956 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 957 } 958 break; 959 case HANDLE_TABLE_ROW_KEEP : 960 { 961 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABLE_ROW_KEEP); 962 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 963 } 964 break; 965 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: 966 { 967 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION); 968 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 969 } 970 break; 971 case HANDLE_LOAD_READONLY: 972 { 973 rValue <<= mpDocSh->IsLoadReadonly(); 974 } 975 break; 976 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: 977 { 978 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); 979 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 980 } 981 break; 982 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES: 983 { 984 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME); 985 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 986 } 987 break; 988 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING: 989 { 990 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING); 991 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 992 } 993 break; 994 case HANDLE_USE_OLD_PRINTER_METRICS: 995 { 996 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS); 997 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 998 } 999 break; 1000 case HANDLE_TABS_RELATIVE_TO_INDENT: 1001 { 1002 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT); 1003 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 1004 } 1005 break; 1006 case HANDLE_PROTECT_FORM: 1007 { 1008 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::PROTECT_FORM); 1009 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 1010 } 1011 break; 1012 // --> OD 2008-06-05 #i89181# 1013 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: 1014 { 1015 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST); 1016 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 1017 } 1018 break; 1019 // <-- 1020 case HANDLE_MODIFYPASSWORDINFO: 1021 { 1022 rValue <<= mpDocSh->GetModifyPasswordInfo(); 1023 } 1024 break; 1025 case HANDLE_MATH_BASELINE_ALIGNMENT: 1026 { 1027 sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); 1028 rValue.setValue( &bTmp, ::getBooleanCppuType() ); 1029 } 1030 break; 1031 1032 default: 1033 throw UnknownPropertyException(); 1034 } 1035 } 1036 1037 void SwXDocumentSettings::_postGetValues () 1038 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 1039 { 1040 mpDocSh = 0; 1041 mpDoc = 0; 1042 } 1043 1044 // XServiceInfo 1045 OUString SAL_CALL SwXDocumentSettings::getImplementationName( ) 1046 throw(RuntimeException) 1047 { 1048 return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.DocumentSettings")); 1049 } 1050 1051 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName ) 1052 throw(RuntimeException) 1053 { 1054 const Sequence< OUString > aSeq( getSupportedServiceNames() ); 1055 sal_Int32 nCount = aSeq.getLength(); 1056 const OUString* pServices = aSeq.getConstArray(); 1057 while( nCount-- ) 1058 { 1059 if( *pServices++ == ServiceName ) 1060 return sal_True; 1061 } 1062 return sal_True; 1063 } 1064 1065 Sequence< OUString > SAL_CALL SwXDocumentSettings::getSupportedServiceNames( ) 1066 throw(RuntimeException) 1067 { 1068 Sequence< OUString > aSeq( 4 ); 1069 aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") ); 1070 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DocumentSettings") ); 1071 aSeq[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintSettings") ); 1072 aSeq[3] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintPreviewSettings") ); 1073 return aSeq; 1074 } 1075 1076 1077