1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <osl/mutex.hxx>
22 #include <sfx2/sfxbasecontroller.hxx>
23 #include <SwXDocumentSettings.hxx>
24 #include <comphelper/MasterPropertySetInfo.hxx>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
27 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
30 #include <fldupde.hxx>
31 #include <linkenum.hxx>
32 #include <sfx2/printer.hxx>
34 #include <drawdoc.hxx>
35 #include <svl/zforlist.hxx>
36 #include <unotxdoc.hxx>
38 #include <sfx2/zoomitem.hxx>
40 #include <vcl/svapp.hxx>
41 #include <comphelper/servicehelper.hxx>
43 #include "swmodule.hxx"
44 #include "cfgitems.hxx"
48 using namespace comphelper
;
49 using namespace ::com::sun::star
;
50 using namespace ::com::sun::star::uno
;
51 using namespace ::com::sun::star::beans
;
52 using namespace ::com::sun::star::lang
;
53 using namespace ::com::sun::star::i18n
;
55 enum SwDocumentSettingsPropertyHandles
57 HANDLE_FORBIDDEN_CHARS
,
58 HANDLE_LINK_UPDATE_MODE
,
59 HANDLE_FIELD_AUTO_UPDATE
,
60 HANDLE_CHART_AUTO_UPDATE
,
61 HANDLE_ADD_PARA_TABLE_SPACING
,
62 HANDLE_ADD_PARA_TABLE_SPACING_AT_START
,
63 HANDLE_ALIGN_TAB_STOP_POSITION
,
66 HANDLE_IS_KERN_ASIAN_PUNCTUATION
,
67 HANDLE_CHARACTER_COMPRESSION_TYPE
,
68 HANDLE_APPLY_USER_DATA
,
69 HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS
,
70 HANDLE_CURRENT_DATABASE_DATA_SOURCE
,
71 HANDLE_CURRENT_DATABASE_COMMAND
,
72 HANDLE_CURRENT_DATABASE_COMMAND_TYPE
,
73 HANDLE_SAVE_VERSION_ON_CLOSE
,
74 HANDLE_IS_GRID_VISIBLE
,
75 HANDLE_IS_SNAP_TO_GRID
,
76 HANDLE_IS_SYNCHRONISE_AXES
,
77 HANDLE_HORIZONTAL_GRID_RESOLUTION
,
78 HANDLE_HORIZONTAL_GRID_SUBDIVISION
,
79 HANDLE_VERTICAL_GRID_RESOLUTION
,
80 HANDLE_VERTICAL_GRID_SUBDIVISION
,
81 HANDLE_UPDATE_FROM_TEMPLATE
,
82 HANDLE_PRINTER_INDEPENDENT_LAYOUT
,
84 HANDLE_IS_ADD_FLY_OFFSET
,
85 HANDLE_IS_ADD_EXTERNAL_LEADING
,
86 HANDLE_OLD_NUMBERING
, // #111955#
87 HANDLE_OUTLINELEVEL_YIELDS_NUMBERING
,
88 /* Stampit It disable the print cancel button of the shown progress dialog. */
89 HANDLE_ALLOW_PRINTJOB_CANCEL
,
90 HANDLE_USE_FORMER_LINE_SPACING
,
91 HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS
,
92 HANDLE_USE_FORMER_OBJECT_POSITIONING
,
93 HANDLE_USE_FORMER_TEXT_WRAPPING
,
94 HANDLE_CHANGES_PASSWORD
,
95 HANDLE_CONSIDER_WRAP_ON_OBJPOS
,
96 HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
,
97 HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
,
98 HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
,
99 HANDLE_TABLE_ROW_KEEP
,
100 HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
,
101 HANDLE_LOAD_READONLY
,
102 HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
,
103 HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES
,
104 HANDLE_UNIX_FORCE_ZERO_EXT_LEADING
,
105 HANDLE_USE_OLD_PRINTER_METRICS
,
107 HANDLE_TABS_RELATIVE_TO_INDENT
,
111 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
,
112 HANDLE_MODIFYPASSWORDINFO
,
113 HANDLE_MATH_BASELINE_ALIGNMENT
,
114 HANDLE_INVERT_BORDER_SPACING
,
115 HANDLE_COLLAPSE_EMPTY_CELL_PARA
,
116 HANDLE_SMALL_CAPS_PERCENTAGE_66
,
118 HANDLE_UNBREAKABLE_NUMBERINGS
,
119 HANDLE_STYLES_NODEFAULT
,
120 HANDLE_FLOATTABLE_NOMARGINS
,
121 HANDLE_CLIPPED_PICTURES
,
122 HANDLE_BACKGROUND_PARA_OVER_DRAWINGS
,
124 HANDLE_EMBED_SYSTEM_FONTS
,
125 HANDLE_TAB_OVER_MARGIN
,
128 static MasterPropertySetInfo
* lcl_createSettingsInfo()
130 static PropertyInfo aWriterSettingsInfoMap
[] =
132 { RTL_CONSTASCII_STRINGPARAM("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS
, CPPUTYPE_REFFORBCHARS
, 0, 0},
133 { RTL_CONSTASCII_STRINGPARAM("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE
, CPPUTYPE_INT16
, 0, 0},
134 { RTL_CONSTASCII_STRINGPARAM("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE
, CPPUTYPE_BOOLEAN
, 0, 0},
135 { RTL_CONSTASCII_STRINGPARAM("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE
, CPPUTYPE_BOOLEAN
, 0, 0},
136 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING
, CPPUTYPE_BOOLEAN
, 0, 0},
137 { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START
, CPPUTYPE_BOOLEAN
, 0, 0},
138 { RTL_CONSTASCII_STRINGPARAM("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION
, CPPUTYPE_BOOLEAN
, 0, 0},
139 { RTL_CONSTASCII_STRINGPARAM("PrinterName"), HANDLE_PRINTER_NAME
, CPPUTYPE_OUSTRING
, 0, 0},
140 { RTL_CONSTASCII_STRINGPARAM("PrinterSetup"), HANDLE_PRINTER_SETUP
, CPPUTYPE_SEQINT8
, 0, 0},
141 { RTL_CONSTASCII_STRINGPARAM("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION
, CPPUTYPE_BOOLEAN
, 0, 0},
142 { RTL_CONSTASCII_STRINGPARAM("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE
, CPPUTYPE_INT16
, 0, 0},
143 { RTL_CONSTASCII_STRINGPARAM("ApplyUserData"), HANDLE_APPLY_USER_DATA
, CPPUTYPE_BOOLEAN
, 0, 0},
144 { RTL_CONSTASCII_STRINGPARAM("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS
, CPPUTYPE_BOOLEAN
, 0, 0},
145 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE
, CPPUTYPE_OUSTRING
, 0, 0},
146 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND
, CPPUTYPE_OUSTRING
, 0, 0},
147 { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE
, CPPUTYPE_INT32
, 0, 0},
148 { RTL_CONSTASCII_STRINGPARAM("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE
, CPPUTYPE_BOOLEAN
, 0, 0},
149 { RTL_CONSTASCII_STRINGPARAM("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE
, CPPUTYPE_BOOLEAN
, 0, 0},
151 { RTL_CONSTASCII_STRINGPARAM("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT
, CPPUTYPE_INT16
, 0, 0},
152 { RTL_CONSTASCII_STRINGPARAM("IsLabelDocument"), HANDLE_IS_LABEL_DOC
, CPPUTYPE_BOOLEAN
, 0, 0},
153 { RTL_CONSTASCII_STRINGPARAM("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET
, CPPUTYPE_BOOLEAN
, 0, 0},
154 { RTL_CONSTASCII_STRINGPARAM("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING
, CPPUTYPE_BOOLEAN
, 0, 0},
155 { RTL_CONSTASCII_STRINGPARAM("UseOldNumbering"), HANDLE_OLD_NUMBERING
, CPPUTYPE_BOOLEAN
, 0, 0}, // #111955#
156 { RTL_CONSTASCII_STRINGPARAM("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING
, CPPUTYPE_BOOLEAN
, 0, 0},
157 /* Stampit It disable the print cancel button of the shown progress dialog. */
158 { RTL_CONSTASCII_STRINGPARAM("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL
, CPPUTYPE_BOOLEAN
, 0, 0},
159 { RTL_CONSTASCII_STRINGPARAM("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING
, CPPUTYPE_BOOLEAN
, 0, 0},
160 { RTL_CONSTASCII_STRINGPARAM("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS
, CPPUTYPE_BOOLEAN
, 0, 0},
161 { RTL_CONSTASCII_STRINGPARAM("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING
, CPPUTYPE_BOOLEAN
, 0, 0},
162 { RTL_CONSTASCII_STRINGPARAM("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING
, CPPUTYPE_BOOLEAN
, 0, 0},
163 { RTL_CONSTASCII_STRINGPARAM("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD
, CPPUTYPE_SEQINT8
, 0, 0},
164 { RTL_CONSTASCII_STRINGPARAM("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS
, CPPUTYPE_BOOLEAN
, 0, 0},
165 { RTL_CONSTASCII_STRINGPARAM("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
, CPPUTYPE_BOOLEAN
, 0, 0},
166 { RTL_CONSTASCII_STRINGPARAM("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
, CPPUTYPE_BOOLEAN
, 0, 0},
167 { RTL_CONSTASCII_STRINGPARAM("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
, CPPUTYPE_BOOLEAN
, 0, 0},
168 { RTL_CONSTASCII_STRINGPARAM("TableRowKeep"), HANDLE_TABLE_ROW_KEEP
, CPPUTYPE_BOOLEAN
, 0, 0},
169 { RTL_CONSTASCII_STRINGPARAM("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
, CPPUTYPE_BOOLEAN
, 0, 0},
170 { RTL_CONSTASCII_STRINGPARAM("LoadReadonly"), HANDLE_LOAD_READONLY
, CPPUTYPE_BOOLEAN
, 0, 0},
171 { RTL_CONSTASCII_STRINGPARAM("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
, CPPUTYPE_BOOLEAN
, 0, 0},
172 { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES
, CPPUTYPE_BOOLEAN
, 0, 0},
173 { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING
, CPPUTYPE_BOOLEAN
, 0, 0},
174 { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS
, CPPUTYPE_BOOLEAN
, 0, 0},
175 { RTL_CONSTASCII_STRINGPARAM("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT
, CPPUTYPE_BOOLEAN
, 0, 0},
176 { RTL_CONSTASCII_STRINGPARAM("Rsid"), HANDLE_RSID
, CPPUTYPE_INT32
, 0, 0},
177 { RTL_CONSTASCII_STRINGPARAM("RsidRoot"), HANDLE_RSID_ROOT
, CPPUTYPE_INT32
, 0, 0},
178 { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM
, CPPUTYPE_BOOLEAN
, 0, 0},
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 { RTL_CONSTASCII_STRINGPARAM("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING
, CPPUTYPE_BOOLEAN
, 0, 0},
184 { RTL_CONSTASCII_STRINGPARAM("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA
, CPPUTYPE_BOOLEAN
, 0, 0},
185 { RTL_CONSTASCII_STRINGPARAM("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66
, CPPUTYPE_BOOLEAN
, 0, 0},
186 { RTL_CONSTASCII_STRINGPARAM("TabOverflow"), HANDLE_TAB_OVERFLOW
, CPPUTYPE_BOOLEAN
, 0, 0},
187 { RTL_CONSTASCII_STRINGPARAM("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS
, CPPUTYPE_BOOLEAN
, 0, 0},
188 { RTL_CONSTASCII_STRINGPARAM("StylesNoDefault"), HANDLE_STYLES_NODEFAULT
, CPPUTYPE_BOOLEAN
, 0, 0},
189 { RTL_CONSTASCII_STRINGPARAM("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS
, CPPUTYPE_BOOLEAN
, 0, 0},
190 { RTL_CONSTASCII_STRINGPARAM("ClippedPictures"), HANDLE_CLIPPED_PICTURES
, CPPUTYPE_BOOLEAN
, 0, 0},
191 { RTL_CONSTASCII_STRINGPARAM("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS
, CPPUTYPE_BOOLEAN
, 0, 0},
192 { RTL_CONSTASCII_STRINGPARAM("EmbedFonts"), HANDLE_EMBED_FONTS
, CPPUTYPE_BOOLEAN
, 0, 0},
193 { RTL_CONSTASCII_STRINGPARAM("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS
, CPPUTYPE_BOOLEAN
, 0, 0},
194 { RTL_CONSTASCII_STRINGPARAM("TabOverMargin"), HANDLE_TAB_OVER_MARGIN
, CPPUTYPE_BOOLEAN
, 0, 0},
196 * As OS said, we don't have a view when we need to set this, so I have to
197 * find another solution before adding them to this property set - MTG
198 { RTL_CONSTASCII_STRINGPARAM("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, CPPUTYPE_BOOLEAN, 0, 0},
199 { RTL_CONSTASCII_STRINGPARAM("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, CPPUTYPE_BOOLEAN, 0, 0},
200 { RTL_CONSTASCII_STRINGPARAM("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, CPPUTYPE_BOOLEAN, 0, 0},
201 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
202 { RTL_CONSTASCII_STRINGPARAM("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
203 { RTL_CONSTASCII_STRINGPARAM("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
204 { RTL_CONSTASCII_STRINGPARAM("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
206 { RTL_CONSTASCII_STRINGPARAM("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, CPPUTYPE_BOOLEAN, 0, 0},
207 { RTL_CONSTASCII_STRINGPARAM("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, CPPUTYPE_BOOLEAN, 0, 0},
208 { RTL_CONSTASCII_STRINGPARAM("ShowSpaces"), HANDLE_SHOW_SPACES, CPPUTYPE_BOOLEAN, 0, 0},
209 { RTL_CONSTASCII_STRINGPARAM("ShowTabs"), HANDLE_SHOW_TABS, CPPUTYPE_BOOLEAN, 0, 0},
210 { RTL_CONSTASCII_STRINGPARAM("ShowBreaks"), HANDLE_SHOW_BREAKS, CPPUTYPE_BOOLEAN, 0, 0},
211 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, CPPUTYPE_BOOLEAN, 0, 0},
212 { RTL_CONSTASCII_STRINGPARAM("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, CPPUTYPE_BOOLEAN, 0, 0},
214 { RTL_CONSTASCII_STRINGPARAM("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
215 { RTL_CONSTASCII_STRINGPARAM("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
216 { RTL_CONSTASCII_STRINGPARAM("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
217 { RTL_CONSTASCII_STRINGPARAM("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, CPPUTYPE_BOOLEAN, 0, 0},
219 { NULL
, 0, 0, CPPUTYPE_UNKNOWN
, 0, 0 }
221 return new MasterPropertySetInfo ( aWriterSettingsInfoMap
);
224 SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument
* pModel
)
225 : MasterPropertySet ( lcl_createSettingsInfo (),
226 &Application::GetSolarMutex () )
233 registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT
, mpModel
->GetDocShell()->GetDoc() ) );
236 SwXDocumentSettings::~SwXDocumentSettings()
241 Any SAL_CALL
SwXDocumentSettings::queryInterface( const Type
& rType
)
242 throw(RuntimeException
)
244 return ::cppu::queryInterface ( rType
,
245 // OWeakObject interfaces
246 dynamic_cast< XInterface
* > ( dynamic_cast< OWeakObject
* >(this) ),
247 dynamic_cast< XWeak
* > ( this ),
249 dynamic_cast< XPropertySet
* > ( this ),
250 dynamic_cast< XPropertyState
* > ( this ),
251 dynamic_cast< XMultiPropertySet
* > ( this ),
252 dynamic_cast< XServiceInfo
* > ( this ),
253 dynamic_cast< XTypeProvider
* > ( this ) );
255 void SwXDocumentSettings::acquire ()
258 OWeakObject::acquire();
260 void SwXDocumentSettings::release ()
263 OWeakObject::release();
266 uno::Sequence
< uno::Type
> SAL_CALL
SwXDocumentSettings::getTypes( )
267 throw (RuntimeException
)
269 SolarMutexGuard aGuard
;
271 uno::Sequence
< uno::Type
> aBaseTypes( 5 );
272 uno::Type
* pBaseTypes
= aBaseTypes
.getArray();
274 // from MasterPropertySet
275 pBaseTypes
[0] = ::getCppuType((Reference
< XPropertySet
>*)0);
276 pBaseTypes
[1] = ::getCppuType((Reference
< XPropertyState
>*)0);
277 pBaseTypes
[2] = ::getCppuType((Reference
< XMultiPropertySet
>*)0);
279 pBaseTypes
[3] = ::getCppuType((Reference
< XServiceInfo
>*)0);
280 pBaseTypes
[4] = ::getCppuType((Reference
< XTypeProvider
>*)0);
287 class theSwXDocumentSettingsImplementationId
: public rtl::Static
< UnoTunnelIdInit
, theSwXDocumentSettingsImplementationId
> {};
290 uno::Sequence
< sal_Int8
> SAL_CALL
SwXDocumentSettings::getImplementationId( )
291 throw (RuntimeException
)
293 return theSwXDocumentSettingsImplementationId::get().getSeq();
296 void SwXDocumentSettings::_preSetValues ()
297 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
299 mpDocSh
= mpModel
->GetDocShell();
300 mpDoc
= mpDocSh
->GetDoc();
302 if( NULL
== mpDoc
|| NULL
== mpDocSh
)
303 throw UnknownPropertyException();
307 void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo
& rInfo
, const uno::Any
&rValue
)
308 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
310 if (rInfo
.mnAttributes
& PropertyAttribute::READONLY
)
311 throw PropertyVetoException ( OUString( "Property is read-only: " ) + OUString::createFromAscii(rInfo
.mpName
), static_cast < cppu::OWeakObject
* > ( 0 ) );
313 switch( rInfo
.mnHandle
)
315 case HANDLE_FORBIDDEN_CHARS
:
317 case HANDLE_LINK_UPDATE_MODE
:
329 throw IllegalArgumentException();
331 mpDoc
->setLinkUpdateMode(nMode
);
334 case HANDLE_FIELD_AUTO_UPDATE
:
336 sal_Bool bUpdateField
= *(sal_Bool
*)rValue
.getValue();
337 SwFldUpdateFlags nFlag
= mpDoc
->getFieldUpdateFlags(true);
338 mpDoc
->setFieldUpdateFlags( bUpdateField
?
339 nFlag
== AUTOUPD_FIELD_AND_CHARTS
?
340 AUTOUPD_FIELD_AND_CHARTS
:
345 case HANDLE_CHART_AUTO_UPDATE
:
347 sal_Bool bUpdateChart
= *(sal_Bool
*)rValue
.getValue();
348 SwFldUpdateFlags nFlag
= mpDoc
->getFieldUpdateFlags(true);
349 mpDoc
->setFieldUpdateFlags( (nFlag
== AUTOUPD_FIELD_ONLY
|| nFlag
== AUTOUPD_FIELD_AND_CHARTS
) ?
351 AUTOUPD_FIELD_AND_CHARTS
:
356 case HANDLE_ADD_PARA_TABLE_SPACING
:
358 sal_Bool bParaSpace
= sal_False
;
359 rValue
>>= bParaSpace
;
360 mpDoc
->set(IDocumentSettingAccess::PARA_SPACE_MAX
, bParaSpace
);
363 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START
:
365 sal_Bool bParaSpacePage
= sal_False
;
366 rValue
>>= bParaSpacePage
;
367 mpDoc
->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES
, bParaSpacePage
);
370 case HANDLE_ALIGN_TAB_STOP_POSITION
:
372 sal_Bool bAlignTab
= *(sal_Bool
*)rValue
.getValue();
373 mpDoc
->set(IDocumentSettingAccess::TAB_COMPAT
, bAlignTab
);
376 case HANDLE_PRINTER_NAME
:
378 //the printer must be created
379 OUString sPrinterName
;
380 if( rValue
>>= sPrinterName
)
382 if( !mpPrinter
&& !sPrinterName
.isEmpty() && mpDocSh
->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED
)
384 SfxPrinter
* pPrinter
= mpDoc
->getPrinter( true );
385 if ( OUString ( pPrinter
->GetName()) != sPrinterName
)
387 SfxPrinter
*pNewPrinter
= new SfxPrinter ( pPrinter
->GetOptions().Clone(), sPrinterName
);
388 if( pNewPrinter
->IsKnown() )
390 // set printer only once; in _postSetValues
391 mpPrinter
= pNewPrinter
;
401 throw IllegalArgumentException();
404 case HANDLE_PRINTER_SETUP
:
406 Sequence
< sal_Int8
> aSequence
;
407 if ( rValue
>>= aSequence
)
409 sal_uInt32 nSize
= aSequence
.getLength();
412 SvMemoryStream
aStream (aSequence
.getArray(), nSize
,
414 aStream
.Seek ( STREAM_SEEK_TO_BEGIN
);
415 static sal_uInt16
const nRange
[] =
417 FN_PARAM_ADDPRINTER
, FN_PARAM_ADDPRINTER
,
418 SID_HTML_MODE
, SID_HTML_MODE
,
419 SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
420 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
423 SfxItemSet
*pItemSet
= new SfxItemSet( mpDoc
->GetAttrPool(), nRange
);
424 SfxPrinter
*pPrinter
= SfxPrinter::Create ( aStream
, pItemSet
);
426 // set printer only once; in _postSetValues
428 mpPrinter
= pPrinter
;
432 throw IllegalArgumentException();
435 case HANDLE_IS_KERN_ASIAN_PUNCTUATION
:
437 sal_Bool bIsKern
= *(sal_Bool
*)(rValue
).getValue();
438 mpDoc
->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION
, bIsKern
);
439 SwEditShell
* pEditSh
= mpDoc
->GetEditShell();
441 pEditSh
->ChgHyphenation();
444 case HANDLE_CHARACTER_COMPRESSION_TYPE
:
450 case CHARCOMPRESS_NONE
:
451 case CHARCOMPRESS_PUNCTUATION
:
452 case CHARCOMPRESS_PUNCTUATION_KANA
:
455 throw IllegalArgumentException();
457 mpDoc
->setCharacterCompressionType(static_cast < SwCharCompressType
> (nMode
) );
460 case HANDLE_APPLY_USER_DATA
:
462 mpDocSh
->SetUseUserData( *(sal_Bool
*)rValue
.getValue() );
465 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS
:
467 sal_Bool bSaveGlobal
= *(sal_Bool
*)rValue
.getValue();
468 mpDoc
->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS
, bSaveGlobal
);
471 case HANDLE_CURRENT_DATABASE_DATA_SOURCE
:
473 SwDBData aData
= mpDoc
->GetDBData();
474 if ( rValue
>>= aData
.sDataSource
)
475 mpDoc
->ChgDBData( aData
);
478 case HANDLE_CURRENT_DATABASE_COMMAND
:
480 SwDBData aData
= mpDoc
->GetDBData();
482 if ( rValue
>>= aData
.sCommand
)
483 mpDoc
->ChgDBData( aData
);
485 SAL_WARN_IF( aData
.sDataSource
.isEmpty() && !aData
.sCommand
.isEmpty(), "sw.uno",
486 "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
489 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE
:
491 SwDBData aData
= mpDoc
->GetDBData();
492 if ( rValue
>>= aData
.nCommandType
)
493 mpDoc
->ChgDBData( aData
);
494 SAL_WARN_IF( aData
.nCommandType
&& aData
.sDataSource
.isEmpty(), "sw.uno",
495 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
496 SAL_WARN_IF( aData
.nCommandType
&& aData
.sCommand
.isEmpty(), "sw.uno",
497 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
500 case HANDLE_SAVE_VERSION_ON_CLOSE
:
502 mpDocSh
->SetSaveVersionOnClose( *(sal_Bool
*)rValue
.getValue() );
505 case HANDLE_UPDATE_FROM_TEMPLATE
:
507 mpDocSh
->SetQueryLoadTemplate( *(sal_Bool
*)rValue
.getValue() );
510 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
515 bool bUseVirDev
= true;
516 bool bHiResVirDev
= true;
517 if( nTmp
== document::PrinterIndependentLayout::DISABLED
)
519 else if ( nTmp
== document::PrinterIndependentLayout::LOW_RESOLUTION
)
520 bHiResVirDev
= false;
521 else if ( nTmp
!= document::PrinterIndependentLayout::HIGH_RESOLUTION
)
522 throw IllegalArgumentException();
524 mpDoc
->setReferenceDeviceType( bUseVirDev
, bHiResVirDev
);
527 case HANDLE_IS_LABEL_DOC
:
529 sal_Bool bSet
= sal_False
;
530 if(!(rValue
>>= bSet
))
531 throw IllegalArgumentException();
532 mpDoc
->set(IDocumentSettingAccess::LABEL_DOCUMENT
, bSet
);
535 case HANDLE_IS_ADD_FLY_OFFSET
:
537 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
538 mpDoc
->set(IDocumentSettingAccess::ADD_FLY_OFFSETS
, bTmp
);
541 case HANDLE_IS_ADD_EXTERNAL_LEADING
:
543 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
544 mpDoc
->set(IDocumentSettingAccess::ADD_EXT_LEADING
, bTmp
);
547 case HANDLE_OLD_NUMBERING
: // #111955#
549 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
550 mpDoc
->set(IDocumentSettingAccess::OLD_NUMBERING
, bTmp
);
552 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING
:
554 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
555 mpDoc
->set(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE
, bTmp
);
558 case HANDLE_ALLOW_PRINTJOB_CANCEL
:
560 sal_Bool bState
= sal_False
;
561 if (!(rValue
>>= bState
))
562 throw IllegalArgumentException();
563 mpDocSh
->Stamp_SetPrintCancelState(bState
);
566 case HANDLE_USE_FORMER_LINE_SPACING
:
568 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
569 mpDoc
->set(IDocumentSettingAccess::OLD_LINE_SPACING
, bTmp
);
572 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS
:
574 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
575 mpDoc
->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS
, bTmp
);
578 case HANDLE_USE_FORMER_OBJECT_POSITIONING
:
580 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
581 mpDoc
->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS
, bTmp
);
584 case HANDLE_USE_FORMER_TEXT_WRAPPING
:
586 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
587 mpDoc
->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING
, bTmp
);
590 case HANDLE_CHANGES_PASSWORD
:
592 Sequence
<sal_Int8
> aNew
;
595 mpDoc
->SetRedlinePassword(aNew
);
598 sal_uInt16 eMode
= mpDoc
->GetRedlineMode();
599 eMode
= eMode
|nsRedlineMode_t::REDLINE_ON
;
600 mpDoc
->SetRedlineMode((RedlineMode_t
)( eMode
));
605 case HANDLE_CONSIDER_WRAP_ON_OBJPOS
:
607 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
608 mpDoc
->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION
, bTmp
);
611 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
:
613 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
614 mpDoc
->set(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
, bTmp
);
617 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
:
619 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
620 mpDoc
->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
, bTmp
);
623 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
:
625 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
626 mpDoc
->set(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
, bTmp
);
629 case HANDLE_TABLE_ROW_KEEP
:
631 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
632 mpDoc
->set(IDocumentSettingAccess::TABLE_ROW_KEEP
, bTmp
);
635 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
:
637 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
638 mpDoc
->set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
, bTmp
);
641 case HANDLE_LOAD_READONLY
:
643 mpDocSh
->SetLoadReadonly( *(sal_Bool
*)rValue
.getValue() );
646 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
:
648 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
649 mpDoc
->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
, bTmp
);
652 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES
:
654 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
655 mpDoc
->set(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME
, bTmp
);
658 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING
:
660 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
661 mpDoc
->set(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING
, bTmp
);
664 case HANDLE_USE_OLD_PRINTER_METRICS
:
665 // ignore - this is a dead property
667 case HANDLE_TABS_RELATIVE_TO_INDENT
:
669 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
670 mpDoc
->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT
, bTmp
);
677 mpDoc
->setRsid( nTmp
);
680 case HANDLE_RSID_ROOT
:
684 mpDoc
->setRsidRoot( nTmp
);
687 case HANDLE_PROTECT_FORM
:
689 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
690 mpDoc
->set(IDocumentSettingAccess::PROTECT_FORM
, bTmp
);
694 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
:
696 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
697 mpDoc
->set(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
, bTmp
);
700 case HANDLE_MODIFYPASSWORDINFO
:
702 uno::Sequence
< beans::PropertyValue
> aInfo
;
703 if ( !( rValue
>>= aInfo
) )
704 throw lang::IllegalArgumentException(
705 OUString( "Value of type Sequence<PropertyValue> expected!" ),
706 uno::Reference
< uno::XInterface
>(),
709 if ( !mpDocSh
->SetModifyPasswordInfo( aInfo
) )
710 throw beans::PropertyVetoException(
711 OUString( "The hash is not allowed to be changed now!" ),
712 uno::Reference
< uno::XInterface
>() );
715 case HANDLE_MATH_BASELINE_ALIGNMENT
:
717 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
718 mpDoc
->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT
, bTmp
);
721 case HANDLE_INVERT_BORDER_SPACING
:
723 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
724 mpDoc
->set(IDocumentSettingAccess::INVERT_BORDER_SPACING
, bTmp
);
727 case HANDLE_COLLAPSE_EMPTY_CELL_PARA
:
729 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
730 mpDoc
->set(IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA
, bTmp
);
733 case HANDLE_SMALL_CAPS_PERCENTAGE_66
:
735 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
736 mpDoc
->set(IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66
, bTmp
);
739 case HANDLE_TAB_OVERFLOW
:
741 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
742 mpDoc
->set(IDocumentSettingAccess::TAB_OVERFLOW
, bTmp
);
745 case HANDLE_UNBREAKABLE_NUMBERINGS
:
747 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
748 mpDoc
->set(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS
, bTmp
);
751 case HANDLE_STYLES_NODEFAULT
:
753 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
754 mpDoc
->set(IDocumentSettingAccess::STYLES_NODEFAULT
, bTmp
);
757 case HANDLE_FLOATTABLE_NOMARGINS
:
759 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
760 mpDoc
->set(IDocumentSettingAccess::FLOATTABLE_NOMARGINS
, bTmp
);
763 case HANDLE_CLIPPED_PICTURES
:
765 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
766 mpDoc
->set(IDocumentSettingAccess::CLIPPED_PICTURES
, bTmp
);
769 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS
:
771 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
772 mpDoc
->set(IDocumentSettingAccess::BACKGROUND_PARA_OVER_DRAWINGS
, bTmp
);
775 case HANDLE_EMBED_FONTS
:
777 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
778 mpDoc
->set(IDocumentSettingAccess::EMBED_FONTS
, bTmp
);
780 case HANDLE_EMBED_SYSTEM_FONTS
:
782 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
783 mpDoc
->set(IDocumentSettingAccess::EMBED_SYSTEM_FONTS
, bTmp
);
786 case HANDLE_TAB_OVER_MARGIN
:
788 sal_Bool bTmp
= *(sal_Bool
*)rValue
.getValue();
789 mpDoc
->set(IDocumentSettingAccess::TAB_OVER_MARGIN
, bTmp
);
793 throw UnknownPropertyException();
797 void SwXDocumentSettings::_postSetValues ()
798 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
800 // set printer only once, namely here!
801 if( mpPrinter
!= NULL
)
803 // #i86352# the printer is also used as container for options by sfx
804 // when setting a printer it should have decent default options
805 SfxItemSet
aOptions( mpPrinter
->GetOptions() );
806 SwPrintData
aPrtData( mpDoc
->getPrintData() );
807 SwAddPrinterItem
aAddPrinterItem (FN_PARAM_ADDPRINTER
, aPrtData
);
808 aOptions
.Put(aAddPrinterItem
);
809 mpPrinter
->SetOptions( aOptions
);
811 mpDoc
->setPrinter( mpPrinter
, true, true );
819 void SwXDocumentSettings::_preGetValues ()
820 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
822 mpDocSh
= mpModel
->GetDocShell();
823 mpDoc
= mpDocSh
->GetDoc();
824 if( NULL
== mpDoc
|| NULL
== mpDocSh
)
825 throw UnknownPropertyException();
828 void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo
& rInfo
, uno::Any
& rValue
)
829 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
)
831 switch( rInfo
.mnHandle
)
833 case HANDLE_FORBIDDEN_CHARS
:
835 Reference
<XForbiddenCharacters
> xRet(*mpModel
->GetPropertyHelper(), UNO_QUERY
);
839 case HANDLE_LINK_UPDATE_MODE
:
841 rValue
<<= static_cast < sal_Int16
> ( mpDoc
->getLinkUpdateMode(true) );
844 case HANDLE_FIELD_AUTO_UPDATE
:
846 SwFldUpdateFlags nFlags
= mpDoc
->getFieldUpdateFlags(true);
847 sal_Bool bFieldUpd
= (nFlags
== AUTOUPD_FIELD_ONLY
|| nFlags
== AUTOUPD_FIELD_AND_CHARTS
);
848 rValue
.setValue(&bFieldUpd
, ::getBooleanCppuType());
851 case HANDLE_CHART_AUTO_UPDATE
:
853 SwFldUpdateFlags nFlags
= mpDoc
->getFieldUpdateFlags(true);
854 sal_Bool bChartUpd
= nFlags
== AUTOUPD_FIELD_AND_CHARTS
;
855 rValue
.setValue(&bChartUpd
, ::getBooleanCppuType());
858 case HANDLE_ADD_PARA_TABLE_SPACING
:
860 sal_Bool bParaSpace
= mpDoc
->get(IDocumentSettingAccess::PARA_SPACE_MAX
);
861 rValue
.setValue(&bParaSpace
, ::getBooleanCppuType());
864 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START
:
866 sal_Bool bParaSpace
= mpDoc
->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES
);
867 rValue
.setValue(&bParaSpace
, ::getBooleanCppuType());
870 case HANDLE_ALIGN_TAB_STOP_POSITION
:
872 sal_Bool bAlignTab
= mpDoc
->get(IDocumentSettingAccess::TAB_COMPAT
);
873 rValue
.setValue(&bAlignTab
, ::getBooleanCppuType());
876 case HANDLE_PRINTER_NAME
:
878 SfxPrinter
*pPrinter
= mpDoc
->getPrinter( sal_False
);
879 rValue
<<= pPrinter
? OUString ( pPrinter
->GetName()) : OUString();
882 case HANDLE_PRINTER_SETUP
:
884 SfxPrinter
*pPrinter
= mpDoc
->getPrinter( sal_False
);
887 SvMemoryStream aStream
;
888 pPrinter
->Store( aStream
);
889 aStream
.Seek ( STREAM_SEEK_TO_END
);
890 sal_uInt32 nSize
= aStream
.Tell();
891 aStream
.Seek ( STREAM_SEEK_TO_BEGIN
);
892 Sequence
< sal_Int8
> aSequence( nSize
);
893 aStream
.Read ( aSequence
.getArray(), nSize
);
894 rValue
<<= aSequence
;
898 Sequence
< sal_Int8
> aSequence ( 0 );
899 rValue
<<= aSequence
;
903 case HANDLE_IS_KERN_ASIAN_PUNCTUATION
:
905 sal_Bool bParaSpace
= mpDoc
->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION
);
906 rValue
.setValue(&bParaSpace
, ::getBooleanCppuType());
909 case HANDLE_APPLY_USER_DATA
:
911 rValue
<<= mpDocSh
->IsUseUserData();
914 case HANDLE_CHARACTER_COMPRESSION_TYPE
:
916 rValue
<<= static_cast < sal_Int16
> (mpDoc
->getCharacterCompressionType());
919 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS
:
921 sal_Bool bSaveGlobal
= mpDoc
->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS
);
922 rValue
.setValue(&bSaveGlobal
, ::getBooleanCppuType());
925 case HANDLE_CURRENT_DATABASE_DATA_SOURCE
:
927 const SwDBData
& rData
= mpDoc
->GetDBDesc();
928 rValue
<<= rData
.sDataSource
;
931 case HANDLE_CURRENT_DATABASE_COMMAND
:
933 const SwDBData
& rData
= mpDoc
->GetDBDesc();
934 rValue
<<= rData
.sCommand
;
937 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE
:
939 const SwDBData
& rData
= mpDoc
->GetDBDesc();
940 rValue
<<= rData
.nCommandType
;
943 case HANDLE_SAVE_VERSION_ON_CLOSE
:
945 rValue
<<= mpDocSh
->IsSaveVersionOnClose();
948 case HANDLE_UPDATE_FROM_TEMPLATE
:
950 rValue
<<= mpDocSh
->IsQueryLoadTemplate();
953 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
955 // returns short (see css.document.PrinterIndependentLayout)
956 sal_Int16 nVirDevType
= mpDoc
->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE
) ?
957 ( mpDoc
->get(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE
) ?
958 document::PrinterIndependentLayout::HIGH_RESOLUTION
:
959 document::PrinterIndependentLayout::LOW_RESOLUTION
) :
960 document::PrinterIndependentLayout::DISABLED
;
961 rValue
<<= nVirDevType
;
964 case HANDLE_IS_LABEL_DOC
:
966 sal_Bool bLabel
= mpDoc
->get(IDocumentSettingAccess::LABEL_DOCUMENT
);
970 case HANDLE_IS_ADD_FLY_OFFSET
:
972 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::ADD_FLY_OFFSETS
);
973 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
976 case HANDLE_IS_ADD_EXTERNAL_LEADING
:
978 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::ADD_EXT_LEADING
);
979 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
982 case HANDLE_OLD_NUMBERING
: // #111955#
984 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::OLD_NUMBERING
);
985 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
988 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING
: // #111955#
990 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE
);
991 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
994 case HANDLE_ALLOW_PRINTJOB_CANCEL
:
996 sal_Bool bPrintCancelState
= mpDocSh
->Stamp_GetPrintCancelState();
997 rValue
.setValue(&bPrintCancelState
, ::getBooleanCppuType());
1000 case HANDLE_USE_FORMER_LINE_SPACING
:
1002 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::OLD_LINE_SPACING
);
1003 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1006 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS
:
1008 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS
);
1009 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1012 case HANDLE_USE_FORMER_OBJECT_POSITIONING
:
1014 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS
);
1015 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1018 case HANDLE_USE_FORMER_TEXT_WRAPPING
:
1020 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING
);
1021 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1024 case HANDLE_CHANGES_PASSWORD
:
1026 rValue
<<= mpDoc
->GetRedlinePassword();
1029 case HANDLE_CONSIDER_WRAP_ON_OBJPOS
:
1031 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION
);
1032 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1035 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
:
1037 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
);
1038 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1041 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
:
1043 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
);
1044 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1047 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
:
1049 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
);
1050 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1053 case HANDLE_TABLE_ROW_KEEP
:
1055 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::TABLE_ROW_KEEP
);
1056 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1059 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
:
1061 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
);
1062 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1065 case HANDLE_LOAD_READONLY
:
1067 rValue
<<= mpDocSh
->IsLoadReadonly();
1070 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
:
1072 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
);
1073 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1076 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES
:
1078 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME
);
1079 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1082 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING
:
1084 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING
);
1085 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1088 case HANDLE_USE_OLD_PRINTER_METRICS
:
1090 sal_Bool bTmp
= sal_False
;
1091 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1094 case HANDLE_TABS_RELATIVE_TO_INDENT
:
1096 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT
);
1097 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1102 rValue
<<= static_cast < sal_Int32
> ( mpDoc
->getRsid() );
1105 case HANDLE_RSID_ROOT
:
1107 rValue
<<= static_cast < sal_Int32
> ( mpDoc
->getRsidRoot() );
1110 case HANDLE_PROTECT_FORM
:
1112 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::PROTECT_FORM
);
1113 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1117 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
:
1119 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
);
1120 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1123 case HANDLE_MODIFYPASSWORDINFO
:
1125 rValue
<<= mpDocSh
->GetModifyPasswordInfo();
1128 case HANDLE_MATH_BASELINE_ALIGNMENT
:
1130 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT
);
1131 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1134 case HANDLE_INVERT_BORDER_SPACING
:
1136 sal_Bool bTmp
= mpDoc
->get(IDocumentSettingAccess::INVERT_BORDER_SPACING
);
1137 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1140 case HANDLE_COLLAPSE_EMPTY_CELL_PARA
:
1142 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::COLLAPSE_EMPTY_CELL_PARA
);
1143 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1146 case HANDLE_SMALL_CAPS_PERCENTAGE_66
:
1148 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66
);
1149 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1152 case HANDLE_TAB_OVERFLOW
:
1154 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::TAB_OVERFLOW
);
1155 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1158 case HANDLE_UNBREAKABLE_NUMBERINGS
:
1160 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS
);
1161 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1164 case HANDLE_STYLES_NODEFAULT
:
1166 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::STYLES_NODEFAULT
);
1167 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1170 case HANDLE_FLOATTABLE_NOMARGINS
:
1172 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::FLOATTABLE_NOMARGINS
);
1173 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1176 case HANDLE_CLIPPED_PICTURES
:
1178 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::CLIPPED_PICTURES
);
1179 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1182 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS
:
1184 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::BACKGROUND_PARA_OVER_DRAWINGS
);
1185 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1188 case HANDLE_EMBED_FONTS
:
1190 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::EMBED_FONTS
);
1191 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1194 case HANDLE_EMBED_SYSTEM_FONTS
:
1196 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::EMBED_SYSTEM_FONTS
);
1197 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1200 case HANDLE_TAB_OVER_MARGIN
:
1202 sal_Bool bTmp
= mpDoc
->get( IDocumentSettingAccess::TAB_OVER_MARGIN
);
1203 rValue
.setValue( &bTmp
, ::getBooleanCppuType() );
1207 throw UnknownPropertyException();
1211 void SwXDocumentSettings::_postGetValues ()
1212 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
1219 OUString SAL_CALL
SwXDocumentSettings::getImplementationName( )
1220 throw(RuntimeException
)
1222 return OUString("com.sun.star.comp.Writer.DocumentSettings");
1225 sal_Bool SAL_CALL
SwXDocumentSettings::supportsService( const OUString
& ServiceName
)
1226 throw(RuntimeException
)
1228 const Sequence
< OUString
> aSeq( getSupportedServiceNames() );
1229 sal_Int32 nCount
= aSeq
.getLength();
1230 const OUString
* pServices
= aSeq
.getConstArray();
1233 if( *pServices
++ == ServiceName
)
1239 Sequence
< OUString
> SAL_CALL
SwXDocumentSettings::getSupportedServiceNames( )
1240 throw(RuntimeException
)
1242 Sequence
< OUString
> aSeq( 3 );
1243 aSeq
[0] = OUString("com.sun.star.document.Settings");
1244 aSeq
[1] = OUString("com.sun.star.text.DocumentSettings");
1245 aSeq
[2] = OUString("com.sun.star.text.PrintSettings");
1250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */