update dev300-m58
[ooovba.git] / sw / source / ui / uno / SwXDocumentSettings.cxx
blob039cfb4c1115d22a50071b8d2b8189be6310fb44
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwXDocumentSettings.cxx,v $
10 * $Revision: 1.66 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <vos/mutex.hxx>
34 #include <sfx2/sfxbasecontroller.hxx>
35 #include <SwXDocumentSettings.hxx>
36 #include <SwXPrintPreviewSettings.hxx>
37 #ifndef _COMPHELPER_MASTERPROPERTSETINFO_HXX_
38 #include <comphelper/MasterPropertySetInfo.hxx>
39 #endif
40 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
41 #include <com/sun/star/beans/PropertyAttribute.hpp>
42 #endif
43 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
44 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
45 #include <doc.hxx>
46 #include <docsh.hxx>
47 #include <fldupde.hxx>
48 #include <linkenum.hxx>
49 #include <sfx2/printer.hxx>
50 #include <editsh.hxx>
51 #include <drawdoc.hxx>
52 #include <svtools/zforlist.hxx>
53 #include <unoobj.hxx>
54 #include <unotxdoc.hxx>
55 #include <cmdid.h>
56 #include <svx/zoomitem.hxx>
57 #include <unomod.hxx>
58 #include <vcl/svapp.hxx>
60 #include "swmodule.hxx"
61 #include "cfgitems.hxx"
62 #include "prtopt.hxx"
65 #include "swmodule.hxx"
66 #include "cfgitems.hxx"
67 #include "prtopt.hxx"
69 using rtl::OUString;
71 using namespace comphelper;
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::uno;
74 using namespace ::com::sun::star::beans;
75 using namespace ::com::sun::star::lang;
76 using namespace ::com::sun::star::i18n;
78 enum SwDocumentSettingsPropertyHandles
80 HANDLE_FORBIDDEN_CHARS,
81 HANDLE_LINK_UPDATE_MODE,
82 HANDLE_FIELD_AUTO_UPDATE,
83 HANDLE_CHART_AUTO_UPDATE,
84 HANDLE_ADD_PARA_TABLE_SPACING,
85 HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
86 HANDLE_ALIGN_TAB_STOP_POSITION,
87 HANDLE_PRINTER_NAME,
88 HANDLE_PRINTER_SETUP,
89 HANDLE_IS_KERN_ASIAN_PUNCTUATION,
90 HANDLE_CHARACTER_COMPRESSION_TYPE,
91 HANDLE_APPLY_USER_DATA,
92 HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS,
93 HANDLE_CURRENT_DATABASE_DATA_SOURCE,
94 HANDLE_CURRENT_DATABASE_COMMAND,
95 HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
96 HANDLE_SAVE_VERSION_ON_CLOSE,
97 HANDLE_IS_GRID_VISIBLE,
98 HANDLE_IS_SNAP_TO_GRID,
99 HANDLE_IS_SYNCHRONISE_AXES,
100 HANDLE_HORIZONTAL_GRID_RESOLUTION,
101 HANDLE_HORIZONTAL_GRID_SUBDIVISION,
102 HANDLE_VERTICAL_GRID_RESOLUTION,
103 HANDLE_VERTICAL_GRID_SUBDIVISION,
104 HANDLE_UPDATE_FROM_TEMPLATE,
105 HANDLE_PRINTER_INDEPENDENT_LAYOUT,
106 HANDLE_IS_LABEL_DOC,
107 HANDLE_IS_ADD_FLY_OFFSET,
108 HANDLE_IS_ADD_EXTERNAL_LEADING,
109 HANDLE_OLD_NUMBERING, // #111955#
110 HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
111 /* Stampit It disable the print cancel button of the shown progress dialog. */
112 HANDLE_ALLOW_PRINTJOB_CANCEL,
113 HANDLE_USE_FORMER_LINE_SPACING,
114 HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
115 HANDLE_USE_FORMER_OBJECT_POSITIONING,
116 HANDLE_USE_FORMER_TEXT_WRAPPING,
117 HANDLE_CHANGES_PASSWORD,
118 HANDLE_CONSIDER_WRAP_ON_OBJPOS,
119 HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
120 HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
121 HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
122 HANDLE_TABLE_ROW_KEEP,
123 HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
124 HANDLE_LOAD_READONLY,
125 HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
126 HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
127 HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
128 HANDLE_USE_OLD_PRINTER_METRICS,
129 HANDLE_PROTECT_FORM,
130 HANDLE_TABS_RELATIVE_TO_INDENT,
131 // --> OD 2008-06-05 #i89181#
132 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
133 // <--
134 ,HANDLE_INVERT_BORDER_SPACING
135 ,HANDLE_COLLAPSE_EMPTY_CELL_PARA
138 MasterPropertySetInfo * lcl_createSettingsInfo()
140 static PropertyInfo aWriterSettingsInfoMap[] =
142 { RTL_CONSTASCII_STRINGPARAM("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, CPPUTYPE_REFFORBCHARS, 0, 0},
143 { RTL_CONSTASCII_STRINGPARAM("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, CPPUTYPE_INT16, 0, 0},
144 { RTL_CONSTASCII_STRINGPARAM("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0},
145 { RTL_CONSTASCII_STRINGPARAM("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0},
146 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
147 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, CPPUTYPE_BOOLEAN, 0, 0},
148 { RTL_CONSTASCII_STRINGPARAM("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, CPPUTYPE_BOOLEAN, 0, 0},
149 { RTL_CONSTASCII_STRINGPARAM("PrinterName"), HANDLE_PRINTER_NAME, CPPUTYPE_OUSTRING, 0, 0},
150 { RTL_CONSTASCII_STRINGPARAM("PrinterSetup"), HANDLE_PRINTER_SETUP, CPPUTYPE_SEQINT8, 0, 0},
151 { RTL_CONSTASCII_STRINGPARAM("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, CPPUTYPE_BOOLEAN, 0, 0},
152 { RTL_CONSTASCII_STRINGPARAM("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, CPPUTYPE_INT16, 0, 0},
153 { RTL_CONSTASCII_STRINGPARAM("ApplyUserData"), HANDLE_APPLY_USER_DATA, CPPUTYPE_BOOLEAN, 0, 0},
154 { RTL_CONSTASCII_STRINGPARAM("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, CPPUTYPE_BOOLEAN, 0, 0},
155 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, CPPUTYPE_OUSTRING, 0, 0},
156 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, CPPUTYPE_OUSTRING, 0, 0},
157 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, CPPUTYPE_INT32, 0, 0},
158 { RTL_CONSTASCII_STRINGPARAM("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, CPPUTYPE_BOOLEAN, 0, 0},
159 { RTL_CONSTASCII_STRINGPARAM("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, CPPUTYPE_BOOLEAN, 0, 0},
161 { RTL_CONSTASCII_STRINGPARAM("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, CPPUTYPE_INT16, 0, 0},
162 { RTL_CONSTASCII_STRINGPARAM("IsLabelDocument"), HANDLE_IS_LABEL_DOC, CPPUTYPE_BOOLEAN, 0, 0},
163 { RTL_CONSTASCII_STRINGPARAM("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, CPPUTYPE_BOOLEAN, 0, 0},
164 { RTL_CONSTASCII_STRINGPARAM("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
165 { RTL_CONSTASCII_STRINGPARAM("UseOldNumbering"), HANDLE_OLD_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0}, // #111955#
166 { RTL_CONSTASCII_STRINGPARAM("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0},
167 /* Stampit It disable the print cancel button of the shown progress dialog. */
168 { RTL_CONSTASCII_STRINGPARAM("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, CPPUTYPE_BOOLEAN, 0, 0},
169 { RTL_CONSTASCII_STRINGPARAM("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
170 { RTL_CONSTASCII_STRINGPARAM("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, CPPUTYPE_BOOLEAN, 0, 0},
171 { RTL_CONSTASCII_STRINGPARAM("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, CPPUTYPE_BOOLEAN, 0, 0},
172 { RTL_CONSTASCII_STRINGPARAM("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, CPPUTYPE_BOOLEAN, 0, 0},
173 { RTL_CONSTASCII_STRINGPARAM("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, CPPUTYPE_SEQINT8, 0, 0},
174 { RTL_CONSTASCII_STRINGPARAM("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, CPPUTYPE_BOOLEAN, 0, 0},
175 { RTL_CONSTASCII_STRINGPARAM("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0},
176 { RTL_CONSTASCII_STRINGPARAM("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, CPPUTYPE_BOOLEAN, 0, 0},
177 { RTL_CONSTASCII_STRINGPARAM("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, CPPUTYPE_BOOLEAN, 0, 0},
178 { RTL_CONSTASCII_STRINGPARAM("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, CPPUTYPE_BOOLEAN, 0, 0},
179 { RTL_CONSTASCII_STRINGPARAM("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, CPPUTYPE_BOOLEAN, 0, 0},
180 { RTL_CONSTASCII_STRINGPARAM("LoadReadonly"), HANDLE_LOAD_READONLY, CPPUTYPE_BOOLEAN, 0, 0},
181 { RTL_CONSTASCII_STRINGPARAM("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, CPPUTYPE_BOOLEAN, 0, 0},
182 { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, CPPUTYPE_BOOLEAN, 0, 0},
183 { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
184 { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, CPPUTYPE_BOOLEAN, 0, 0},
185 { RTL_CONSTASCII_STRINGPARAM("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, CPPUTYPE_BOOLEAN, 0, 0},
186 { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM, CPPUTYPE_BOOLEAN, 0, 0},
187 // --> OD 2008-06-05 #i89181#
188 { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0},
189 { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
190 { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, CPPUTYPE_BOOLEAN, 0, 0},
192 * As OS said, we don't have a view when we need to set this, so I have to
193 * find another solution before adding them to this property set - MTG
194 { RTL_CONSTASCII_STRINGPARAM("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, CPPUTYPE_BOOLEAN, 0, 0},
195 { RTL_CONSTASCII_STRINGPARAM("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, CPPUTYPE_BOOLEAN, 0, 0},
196 { RTL_CONSTASCII_STRINGPARAM("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, CPPUTYPE_BOOLEAN, 0, 0},
197 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
198 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
199 { RTL_CONSTASCII_STRINGPARAM("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
200 { RTL_CONSTASCII_STRINGPARAM("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
202 { RTL_CONSTASCII_STRINGPARAM("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, CPPUTYPE_BOOLEAN, 0, 0},
203 { RTL_CONSTASCII_STRINGPARAM("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, CPPUTYPE_BOOLEAN, 0, 0},
204 { RTL_CONSTASCII_STRINGPARAM("ShowSpaces"), HANDLE_SHOW_SPACES, CPPUTYPE_BOOLEAN, 0, 0},
205 { RTL_CONSTASCII_STRINGPARAM("ShowTabs"), HANDLE_SHOW_TABS, CPPUTYPE_BOOLEAN, 0, 0},
206 { RTL_CONSTASCII_STRINGPARAM("ShowBreaks"), HANDLE_SHOW_BREAKS, CPPUTYPE_BOOLEAN, 0, 0},
207 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, CPPUTYPE_BOOLEAN, 0, 0},
208 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, CPPUTYPE_BOOLEAN, 0, 0},
210 { RTL_CONSTASCII_STRINGPARAM("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
211 { RTL_CONSTASCII_STRINGPARAM("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
212 { RTL_CONSTASCII_STRINGPARAM("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
213 { RTL_CONSTASCII_STRINGPARAM("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, CPPUTYPE_BOOLEAN, 0, 0},
214 { RTL_CONSTASCII_STRINGPARAM("ShowSimpleHandles"), HANDLE_SHOW_SIMPLE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0},
215 { RTL_CONSTASCII_STRINGPARAM("ShowLargeHandles"), HANDLE_SHOW_LARGE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0},
217 { NULL, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
219 return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
222 SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
223 : MasterPropertySet ( lcl_createSettingsInfo (),
224 &Application::GetSolarMutex () )
225 , mxModel ( pModel )
226 , mpModel ( pModel )
227 , mpDocSh ( NULL )
228 , mpDoc ( NULL )
229 , mpPrinter( NULL )
231 registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT, mpModel->GetDocShell()->GetDoc() ) );
232 registerSlave ( new SwXPrintPreviewSettings ( mpModel->GetDocShell()->GetDoc() ) );
235 SwXDocumentSettings::~SwXDocumentSettings()
236 throw()
240 Any SAL_CALL SwXDocumentSettings::queryInterface( const Type& rType )
241 throw(RuntimeException)
243 return ::cppu::queryInterface ( rType,
244 // OWeakObject interfaces
245 dynamic_cast< XInterface* > ( dynamic_cast< OWeakObject* >(this) ),
246 dynamic_cast< XWeak* > ( this ),
247 // my own interfaces
248 dynamic_cast< XPropertySet* > ( this ),
249 dynamic_cast< XPropertyState* > ( this ),
250 dynamic_cast< XMultiPropertySet* > ( this ),
251 dynamic_cast< XServiceInfo* > ( this ),
252 dynamic_cast< XTypeProvider* > ( this ) );
254 void SwXDocumentSettings::acquire ()
255 throw ()
257 OWeakObject::acquire();
259 void SwXDocumentSettings::release ()
260 throw ()
262 OWeakObject::release();
265 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
266 throw (RuntimeException)
268 vos::OGuard aGuard(Application::GetSolarMutex());
270 uno::Sequence< uno::Type > aBaseTypes( 5 );
271 uno::Type* pBaseTypes = aBaseTypes.getArray();
273 // from MasterPropertySet
274 pBaseTypes[0] = ::getCppuType((Reference< XPropertySet >*)0);
275 pBaseTypes[1] = ::getCppuType((Reference< XPropertyState >*)0);
276 pBaseTypes[2] = ::getCppuType((Reference< XMultiPropertySet >*)0);
278 pBaseTypes[3] = ::getCppuType((Reference< XServiceInfo >*)0);
279 pBaseTypes[4] = ::getCppuType((Reference< XTypeProvider >*)0);
281 return aBaseTypes;
284 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
285 throw (RuntimeException)
287 vos::OGuard aGuard(Application::GetSolarMutex());
288 static Sequence< sal_Int8 > aId( 16 );
289 static sal_Bool bInit = sal_False;
290 if(!bInit)
292 rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
293 bInit = sal_True;
295 return aId;
298 void SwXDocumentSettings::_preSetValues ()
299 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
301 mpDocSh = mpModel->GetDocShell();
302 mpDoc = mpDocSh->GetDoc();
304 if( NULL == mpDoc || NULL == mpDocSh )
305 throw UnknownPropertyException();
309 void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
310 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
312 if (rInfo.mnAttributes & PropertyAttribute::READONLY)
313 throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + C2U(rInfo.mpName), static_cast < cppu::OWeakObject * > ( 0 ) );
315 switch( rInfo.mnHandle )
317 case HANDLE_FORBIDDEN_CHARS:
318 break;
319 case HANDLE_LINK_UPDATE_MODE:
321 sal_Int16 nMode = 0;
322 rValue >>= nMode;
323 switch (nMode)
325 case NEVER:
326 case MANUAL:
327 case AUTOMATIC:
328 case GLOBALSETTING:
329 break;
330 default:
331 throw IllegalArgumentException();
333 mpDoc->setLinkUpdateMode(nMode);
335 break;
336 case HANDLE_FIELD_AUTO_UPDATE:
338 sal_Bool bUpdateField = *(sal_Bool*)rValue.getValue();
339 SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true);
340 mpDoc->setFieldUpdateFlags( bUpdateField ?
341 nFlag == AUTOUPD_FIELD_AND_CHARTS ?
342 AUTOUPD_FIELD_AND_CHARTS :
343 AUTOUPD_FIELD_ONLY :
344 AUTOUPD_OFF );
346 break;
347 case HANDLE_CHART_AUTO_UPDATE:
349 sal_Bool bUpdateChart = *(sal_Bool*)rValue.getValue();
350 SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true);
351 mpDoc->setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ?
352 bUpdateChart ?
353 AUTOUPD_FIELD_AND_CHARTS :
354 AUTOUPD_FIELD_ONLY :
355 AUTOUPD_OFF );
357 break;
358 case HANDLE_ADD_PARA_TABLE_SPACING:
360 sal_Bool bParaSpace = sal_False;
361 rValue >>= bParaSpace;
362 mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX, bParaSpace );
364 break;
365 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
367 sal_Bool bParaSpacePage = sal_False;
368 rValue >>= bParaSpacePage;
369 mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bParaSpacePage );
371 break;
372 case HANDLE_ALIGN_TAB_STOP_POSITION:
374 sal_Bool bAlignTab = *(sal_Bool*)rValue.getValue();
375 mpDoc->set(IDocumentSettingAccess::TAB_COMPAT, bAlignTab);
377 break;
378 case HANDLE_PRINTER_NAME:
380 //the printer must be created
381 OUString sPrinterName;
382 if( rValue >>= sPrinterName )
384 if( !mpPrinter && sPrinterName.getLength() > 0 && mpDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
386 SfxPrinter* pPrinter = mpDoc->getPrinter( true );
387 if ( OUString ( pPrinter->GetName()) != sPrinterName )
389 SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
390 if( pNewPrinter->IsKnown() )
392 // set printer only once; in _postSetValues
393 mpPrinter = pNewPrinter;
395 else
397 delete pNewPrinter;
402 else
403 throw IllegalArgumentException();
405 break;
406 case HANDLE_PRINTER_SETUP:
408 Sequence < sal_Int8 > aSequence;
409 if ( rValue >>= aSequence )
411 sal_uInt32 nSize = aSequence.getLength();
412 if( nSize > 0 )
414 SvMemoryStream aStream (aSequence.getArray(), nSize,
415 STREAM_READ );
416 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
417 static sal_uInt16 __READONLY_DATA nRange[] =
419 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
420 SID_HTML_MODE, SID_HTML_MODE,
421 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
422 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
425 SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange );
426 SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
428 // set printer only once; in _postSetValues
429 delete mpPrinter;
430 mpPrinter = pPrinter;
433 else
434 throw IllegalArgumentException();
436 break;
437 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
439 sal_Bool bIsKern = *(sal_Bool*)(rValue).getValue();
440 mpDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION, bIsKern);
441 SwEditShell* pEditSh = mpDoc->GetEditShell();
442 if(pEditSh)
443 pEditSh->ChgHyphenation();
445 break;
446 case HANDLE_CHARACTER_COMPRESSION_TYPE:
448 sal_Int16 nMode = 0;
449 rValue >>= nMode;
450 switch (nMode)
452 case CHARCOMPRESS_NONE:
453 case CHARCOMPRESS_PUNCTUATION:
454 case CHARCOMPRESS_PUNCTUATION_KANA:
455 break;
456 default:
457 throw IllegalArgumentException();
459 mpDoc->setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) );
461 break;
462 case HANDLE_APPLY_USER_DATA:
464 mpDocSh->SetUseUserData( *(sal_Bool*)rValue.getValue() );
466 break;
467 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
469 sal_Bool bSaveGlobal = *(sal_Bool*)rValue.getValue();
470 mpDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal );
472 break;
473 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
475 SwDBData aData = mpDoc->GetDBData();
476 if ( rValue >>= aData.sDataSource )
477 mpDoc->ChgDBData( aData );
479 break;
480 case HANDLE_CURRENT_DATABASE_COMMAND:
482 SwDBData aData = mpDoc->GetDBData();
483 if ( rValue >>= aData.sCommand )
484 mpDoc->ChgDBData( aData );
486 break;
487 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
489 SwDBData aData = mpDoc->GetDBData();
490 if ( rValue >>= aData.nCommandType )
491 mpDoc->ChgDBData( aData );
493 break;
494 case HANDLE_SAVE_VERSION_ON_CLOSE:
496 mpDocSh->SetSaveVersionOnClose( *(sal_Bool*)rValue.getValue() );
498 break;
499 case HANDLE_UPDATE_FROM_TEMPLATE:
501 mpDocSh->SetQueryLoadTemplate( *(sal_Bool*)rValue.getValue() );
503 break;
504 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
506 sal_Int16 nTmp = 0;
507 rValue >>= nTmp;
509 bool bUseVirDev = true;
510 bool bHiResVirDev = true;
511 if( nTmp == document::PrinterIndependentLayout::DISABLED )
512 bUseVirDev = false;
513 else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
514 bHiResVirDev = false;
515 else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
516 throw IllegalArgumentException();
518 mpDoc->setReferenceDeviceType( bUseVirDev, bHiResVirDev );
520 break;
521 case HANDLE_IS_LABEL_DOC :
523 sal_Bool bSet = sal_False;
524 if(!(rValue >>= bSet))
525 throw IllegalArgumentException();
526 mpDoc->set(IDocumentSettingAccess::LABEL_DOCUMENT, bSet);
528 break;
529 case HANDLE_IS_ADD_FLY_OFFSET:
531 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
532 mpDoc->set(IDocumentSettingAccess::ADD_FLY_OFFSETS, bTmp);
534 break;
535 case HANDLE_IS_ADD_EXTERNAL_LEADING:
537 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
538 mpDoc->set(IDocumentSettingAccess::ADD_EXT_LEADING, bTmp);
540 break;
541 case HANDLE_OLD_NUMBERING: // #111955#
543 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
544 mpDoc->set(IDocumentSettingAccess::OLD_NUMBERING, bTmp);
546 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
548 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
549 mpDoc->set(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE, bTmp);
551 break;
552 case HANDLE_ALLOW_PRINTJOB_CANCEL:
554 sal_Bool bState = sal_False;
555 if (!(rValue >>= bState))
556 throw IllegalArgumentException();
557 mpDocSh->Stamp_SetPrintCancelState(bState);
559 break;
560 case HANDLE_USE_FORMER_LINE_SPACING:
562 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
563 mpDoc->set(IDocumentSettingAccess::OLD_LINE_SPACING, bTmp);
565 break;
566 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
568 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
569 mpDoc->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
571 break;
572 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
574 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
575 mpDoc->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, bTmp);
577 break;
578 case HANDLE_USE_FORMER_TEXT_WRAPPING:
580 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
581 mpDoc->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, bTmp);
583 break;
584 case HANDLE_CHANGES_PASSWORD:
586 Sequence <sal_Int8> aNew;
587 if(rValue >>= aNew)
589 mpDoc->SetRedlinePassword(aNew);
590 if(aNew.getLength())
592 sal_uInt16 eMode = mpDoc->GetRedlineMode();
593 eMode = eMode|nsRedlineMode_t::REDLINE_ON;
594 mpDoc->SetRedlineMode((RedlineMode_t)( eMode ));
598 break;
599 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
601 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
602 mpDoc->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp );
604 break;
605 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
607 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
608 mpDoc->set(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp);
610 break;
611 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
613 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
614 mpDoc->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp);
616 break;
617 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
619 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
620 mpDoc->set(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp);
622 break;
623 case HANDLE_TABLE_ROW_KEEP:
625 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
626 mpDoc->set(IDocumentSettingAccess::TABLE_ROW_KEEP, bTmp);
628 break;
629 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
631 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
632 mpDoc->set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp);
634 break;
635 case HANDLE_LOAD_READONLY:
637 mpDocSh->SetLoadReadonly( *(sal_Bool*)rValue.getValue() );
639 break;
640 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
642 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
643 mpDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp);
645 break;
646 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
648 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
649 mpDoc->set(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp);
651 break;
652 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
654 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
655 mpDoc->set(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING, bTmp);
657 break;
658 case HANDLE_USE_OLD_PRINTER_METRICS:
660 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
661 mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp);
663 break;
664 case HANDLE_TABS_RELATIVE_TO_INDENT:
666 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
667 mpDoc->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, bTmp);
669 break;
670 case HANDLE_PROTECT_FORM:
672 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
673 mpDoc->set(IDocumentSettingAccess::PROTECT_FORM, bTmp);
675 break;
676 // --> OD 2008-06-05 #i89181#
677 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
679 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
680 mpDoc->set(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp);
682 break;
683 // <--
684 case HANDLE_INVERT_BORDER_SPACING:
686 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
687 mpDoc->set(IDocumentSettingAccess::INVERT_BORDER_SPACING, bTmp);
689 break;
690 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
692 sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
693 mpDoc->set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA, bTmp);
695 break;
696 default:
697 throw UnknownPropertyException();
701 void SwXDocumentSettings::_postSetValues ()
702 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
704 // set printer only once, namely here!
705 if( mpPrinter != NULL )
707 // #i86352# the printer is also used as container for options by sfx
708 // when setting a printer it should have decent default options
709 SfxItemSet aOptions( mpPrinter->GetOptions() );
710 SwPrintData aPrtData;
711 if( mpDoc->getPrintData() )
712 aPrtData = *mpDoc->getPrintData();
713 else
714 aPrtData = *SW_MOD()->GetPrtOptions(false);
715 SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
716 aOptions.Put(aAddPrinterItem);
717 mpPrinter->SetOptions( aOptions );
719 mpDoc->setPrinter( mpPrinter, true, true );
722 mpPrinter = 0;
723 mpDocSh = 0;
724 mpDoc = 0;
727 void SwXDocumentSettings::_preGetValues ()
728 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
730 mpDocSh = mpModel->GetDocShell();
731 mpDoc = mpDocSh->GetDoc();
732 if( NULL == mpDoc || NULL == mpDocSh )
733 throw UnknownPropertyException();
736 void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
737 throw(beans::UnknownPropertyException, lang::WrappedTargetException )
739 switch( rInfo.mnHandle )
741 case HANDLE_FORBIDDEN_CHARS:
743 Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
744 rValue <<= xRet;
746 break;
747 case HANDLE_LINK_UPDATE_MODE:
749 rValue <<= static_cast < sal_Int16 > ( mpDoc->getLinkUpdateMode(true) );
751 break;
752 case HANDLE_FIELD_AUTO_UPDATE:
754 SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true);
755 BOOL bFieldUpd = (nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS );
756 rValue.setValue(&bFieldUpd, ::getBooleanCppuType());
758 break;
759 case HANDLE_CHART_AUTO_UPDATE:
761 SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true);
762 BOOL bChartUpd = nFlags == AUTOUPD_FIELD_AND_CHARTS;
763 rValue.setValue(&bChartUpd, ::getBooleanCppuType());
765 break;
766 case HANDLE_ADD_PARA_TABLE_SPACING:
768 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX);
769 rValue.setValue(&bParaSpace, ::getBooleanCppuType());
771 break;
772 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
774 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES);
775 rValue.setValue(&bParaSpace, ::getBooleanCppuType());
777 break;
778 case HANDLE_ALIGN_TAB_STOP_POSITION:
780 sal_Bool bAlignTab = mpDoc->get(IDocumentSettingAccess::TAB_COMPAT);
781 rValue.setValue(&bAlignTab, ::getBooleanCppuType());
783 break;
784 case HANDLE_PRINTER_NAME:
786 SfxPrinter *pPrinter = mpDoc->getPrinter( sal_False );
787 rValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString();
789 break;
790 case HANDLE_PRINTER_SETUP:
792 SfxPrinter *pPrinter = mpDocSh->GetDoc()->getPrinter( sal_False );
793 if (pPrinter)
795 SvMemoryStream aStream;
796 pPrinter->Store( aStream );
797 aStream.Seek ( STREAM_SEEK_TO_END );
798 sal_uInt32 nSize = aStream.Tell();
799 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
800 Sequence < sal_Int8 > aSequence( nSize );
801 aStream.Read ( aSequence.getArray(), nSize );
802 rValue <<= aSequence;
804 else
806 Sequence < sal_Int8 > aSequence ( 0 );
807 rValue <<= aSequence;
810 break;
811 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
813 //sal_Bool bParaSpace = mpDoc->IsKernAsianPunctuation();
814 sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION);
815 rValue.setValue(&bParaSpace, ::getBooleanCppuType());
817 break;
818 case HANDLE_APPLY_USER_DATA:
820 rValue <<= mpDocSh->IsUseUserData();
822 break;
823 case HANDLE_CHARACTER_COMPRESSION_TYPE:
825 rValue <<= static_cast < sal_Int16 > (mpDoc->getCharacterCompressionType());
827 break;
828 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
830 sal_Bool bSaveGlobal = mpDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
831 rValue.setValue(&bSaveGlobal, ::getBooleanCppuType());
833 break;
834 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
836 const SwDBData& rData = mpDoc->GetDBDesc();
837 rValue <<= rData.sDataSource;
839 break;
840 case HANDLE_CURRENT_DATABASE_COMMAND:
842 const SwDBData& rData = mpDoc->GetDBDesc();
843 rValue <<= rData.sCommand;
845 break;
846 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
848 const SwDBData& rData = mpDoc->GetDBDesc();
849 rValue <<= rData.nCommandType;
851 break;
852 case HANDLE_SAVE_VERSION_ON_CLOSE:
854 rValue <<= mpDocSh->IsSaveVersionOnClose();
856 break;
857 case HANDLE_UPDATE_FROM_TEMPLATE:
859 rValue <<= mpDocSh->IsQueryLoadTemplate();
861 break;
862 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
864 // returns short (see css.document.PrinterIndependentLayout)
865 sal_Int16 nVirDevType = mpDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ?
866 ( mpDoc->get(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE) ?
867 document::PrinterIndependentLayout::HIGH_RESOLUTION :
868 document::PrinterIndependentLayout::LOW_RESOLUTION ) :
869 document::PrinterIndependentLayout::DISABLED;
870 rValue <<= nVirDevType;
872 break;
873 case HANDLE_IS_LABEL_DOC:
875 sal_Bool bLabel = mpDoc->get(IDocumentSettingAccess::LABEL_DOCUMENT);
876 rValue <<= bLabel;
878 break;
879 case HANDLE_IS_ADD_FLY_OFFSET:
881 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_FLY_OFFSETS);
882 rValue.setValue( &bTmp, ::getBooleanCppuType() );
884 break;
885 case HANDLE_IS_ADD_EXTERNAL_LEADING:
887 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_EXT_LEADING);
888 rValue.setValue( &bTmp, ::getBooleanCppuType() );
890 break;
891 case HANDLE_OLD_NUMBERING: // #111955#
893 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_NUMBERING);
894 rValue.setValue( &bTmp, ::getBooleanCppuType() );
896 break;
897 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING: // #111955#
899 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE);
900 rValue.setValue( &bTmp, ::getBooleanCppuType() );
902 break;
903 case HANDLE_ALLOW_PRINTJOB_CANCEL:
905 sal_Bool bPrintCancelState = mpDocSh->Stamp_GetPrintCancelState();
906 rValue.setValue(&bPrintCancelState, ::getBooleanCppuType());
908 break;
909 case HANDLE_USE_FORMER_LINE_SPACING:
911 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_LINE_SPACING);
912 rValue.setValue( &bTmp, ::getBooleanCppuType() );
914 break;
915 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
917 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS);
918 rValue.setValue( &bTmp, ::getBooleanCppuType() );
920 break;
921 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
923 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS);
924 rValue.setValue( &bTmp, ::getBooleanCppuType() );
926 break;
927 case HANDLE_USE_FORMER_TEXT_WRAPPING:
929 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING);
930 rValue.setValue( &bTmp, ::getBooleanCppuType() );
932 break;
933 case HANDLE_CHANGES_PASSWORD:
935 rValue <<= mpDoc->GetRedlinePassword();
937 break;
938 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
940 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION);
941 rValue.setValue( &bTmp, ::getBooleanCppuType() );
943 break;
944 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
946 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING);
947 rValue.setValue( &bTmp, ::getBooleanCppuType() );
949 break;
950 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
952 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK);
953 rValue.setValue( &bTmp, ::getBooleanCppuType() );
955 break;
956 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
958 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT);
959 rValue.setValue( &bTmp, ::getBooleanCppuType() );
961 break;
962 case HANDLE_TABLE_ROW_KEEP :
964 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABLE_ROW_KEEP);
965 rValue.setValue( &bTmp, ::getBooleanCppuType() );
967 break;
968 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
970 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION);
971 rValue.setValue( &bTmp, ::getBooleanCppuType() );
973 break;
974 case HANDLE_LOAD_READONLY:
976 rValue <<= mpDocSh->IsLoadReadonly();
978 break;
979 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
981 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
982 rValue.setValue( &bTmp, ::getBooleanCppuType() );
984 break;
985 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
987 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME);
988 rValue.setValue( &bTmp, ::getBooleanCppuType() );
990 break;
991 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
993 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING);
994 rValue.setValue( &bTmp, ::getBooleanCppuType() );
996 break;
997 case HANDLE_USE_OLD_PRINTER_METRICS:
999 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS);
1000 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1002 break;
1003 case HANDLE_TABS_RELATIVE_TO_INDENT:
1005 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
1006 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1008 break;
1009 case HANDLE_PROTECT_FORM:
1011 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::PROTECT_FORM);
1012 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1014 break;
1015 // --> OD 2008-06-05 #i89181#
1016 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1018 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
1019 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1021 break;
1022 // <--
1023 case HANDLE_INVERT_BORDER_SPACING:
1025 sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::INVERT_BORDER_SPACING);
1026 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1028 break;
1029 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1031 sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA );
1032 rValue.setValue( &bTmp, ::getBooleanCppuType() );
1034 break;
1035 default:
1036 throw UnknownPropertyException();
1040 void SwXDocumentSettings::_postGetValues ()
1041 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
1043 mpDocSh = 0;
1044 mpDoc = 0;
1047 // XServiceInfo
1048 OUString SAL_CALL SwXDocumentSettings::getImplementationName( )
1049 throw(RuntimeException)
1051 return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.DocumentSettings"));
1054 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1055 throw(RuntimeException)
1057 const Sequence< OUString > aSeq( getSupportedServiceNames() );
1058 sal_Int32 nCount = aSeq.getLength();
1059 const OUString* pServices = aSeq.getConstArray();
1060 while( nCount-- )
1062 if( *pServices++ == ServiceName )
1063 return sal_True;
1065 return sal_True;
1068 Sequence< OUString > SAL_CALL SwXDocumentSettings::getSupportedServiceNames( )
1069 throw(RuntimeException)
1071 Sequence< OUString > aSeq( 4 );
1072 aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
1073 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DocumentSettings") );
1074 aSeq[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintSettings") );
1075 aSeq[3] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintPreviewSettings") );
1076 return aSeq;