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