LibreOffice Module sw (master)  1
SwXDocumentSettings.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <config_features.h>
21 
22 #include <sal/config.h>
23 #include <sal/log.hxx>
24 
25 #include <utility>
26 
27 #include <o3tl/any.hxx>
28 #include "SwXDocumentSettings.hxx"
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
33 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
34 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
35 #include <doc.hxx>
39 #include <docsh.hxx>
40 #include <fldupde.hxx>
41 #include <linkenum.hxx>
42 #include <sfx2/printer.hxx>
43 #include <editsh.hxx>
44 #include <unotxdoc.hxx>
45 #include <cmdid.h>
46 #include <unomod.hxx>
47 #include <vcl/svapp.hxx>
48 #include <svl/asiancfg.hxx>
49 #include <tools/stream.hxx>
50 
51 #include <cfgitems.hxx>
52 #include <dbmgr.hxx>
53 
54 using namespace comphelper;
55 using namespace ::com::sun::star;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::beans;
58 using namespace ::com::sun::star::lang;
59 using namespace ::com::sun::star::i18n;
60 
61 namespace {
62 
64 {
65  HANDLE_FORBIDDEN_CHARS,
66  HANDLE_LINK_UPDATE_MODE,
67  HANDLE_FIELD_AUTO_UPDATE,
68  HANDLE_CHART_AUTO_UPDATE,
69  HANDLE_ADD_PARA_TABLE_SPACING,
70  HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
71  HANDLE_ALIGN_TAB_STOP_POSITION,
72  HANDLE_PRINTER_NAME,
73  HANDLE_PRINTER_SETUP,
74  HANDLE_PRINTER_PAPER,
75  HANDLE_IS_KERN_ASIAN_PUNCTUATION,
76  HANDLE_CHARACTER_COMPRESSION_TYPE,
77  HANDLE_APPLY_USER_DATA,
78  HANDLE_SAVE_THUMBNAIL,
79  HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS,
80  HANDLE_CURRENT_DATABASE_DATA_SOURCE,
81  HANDLE_CURRENT_DATABASE_COMMAND,
82  HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
83  HANDLE_EMBEDDED_DATABASE_NAME,
84  HANDLE_SAVE_VERSION_ON_CLOSE,
85  HANDLE_UPDATE_FROM_TEMPLATE,
86  HANDLE_PRINTER_INDEPENDENT_LAYOUT,
87  HANDLE_IS_LABEL_DOC,
88  HANDLE_IS_ADD_FLY_OFFSET,
89  HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,
90  HANDLE_IS_ADD_EXTERNAL_LEADING,
91  HANDLE_OLD_NUMBERING,
92  HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
93  /* Stampit It disable the print cancel button of the shown progress dialog. */
94  HANDLE_ALLOW_PRINTJOB_CANCEL,
95  HANDLE_USE_FORMER_LINE_SPACING,
96  HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
97  HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
98  HANDLE_USE_FORMER_OBJECT_POSITIONING,
99  HANDLE_USE_FORMER_TEXT_WRAPPING,
100  HANDLE_CHANGES_PASSWORD,
101  HANDLE_CONSIDER_WRAP_ON_OBJPOS,
102  HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
103  HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
104  HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
105  HANDLE_TABLE_ROW_KEEP,
106  HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
107  HANDLE_LOAD_READONLY,
108  HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
109  HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
110  HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
111  HANDLE_USE_OLD_PRINTER_METRICS,
112  HANDLE_PROTECT_FORM,
113  HANDLE_MS_WORD_COMP_TRAILING_BLANKS,
114  HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
115  HANDLE_TABS_RELATIVE_TO_INDENT,
116  HANDLE_RSID,
117  HANDLE_RSID_ROOT,
118  HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
119  HANDLE_MODIFYPASSWORDINFO,
120  HANDLE_MATH_BASELINE_ALIGNMENT,
121  HANDLE_INVERT_BORDER_SPACING,
122  HANDLE_COLLAPSE_EMPTY_CELL_PARA,
123  HANDLE_SMALL_CAPS_PERCENTAGE_66,
124  HANDLE_TAB_OVERFLOW,
125  HANDLE_UNBREAKABLE_NUMBERINGS,
126  HANDLE_STYLES_NODEFAULT,
127  HANDLE_FLOATTABLE_NOMARGINS,
128  HANDLE_CLIPPED_PICTURES,
129  HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
130  HANDLE_EMBED_FONTS,
131  HANDLE_EMBED_USED_FONTS,
132  HANDLE_EMBED_LATIN_SCRIPT_FONTS,
133  HANDLE_EMBED_ASIAN_SCRIPT_FONTS,
134  HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
135  HANDLE_EMBED_SYSTEM_FONTS,
136  HANDLE_TAB_OVER_MARGIN,
137  HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
138  HANDLE_SURROUND_TEXT_WRAP_SMALL,
139  HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
140  HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
141  HANDLE_SUBTRACT_FLYS,
142  HANDLE_DISABLE_OFF_PAGE_POSITIONING,
143  HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
144  HANDLE_CONTINUOUS_ENDNOTES,
145  HANDLE_PROTECT_BOOKMARKS,
146  HANDLE_PROTECT_FIELDS,
147  HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
148  HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
149 };
150 
151 }
152 
154 {
155  static PropertyInfo const aWriterSettingsInfoMap[] =
156  {
157  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
158  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
159  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
160  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
161  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
162  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
163  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
164  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
165  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
166  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
167  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
168  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
169  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
170  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
171  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
172  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
173  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
174  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
175  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
176  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
177  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
178 
179  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
180  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
181  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
182  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
183  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
184  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
185  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
186  /* Stampit It disable the print cancel button of the shown progress dialog. */
187  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
188  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
189  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
190  { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
191  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
192  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
193  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
194  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
195  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
196  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
197  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
198  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
199  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
200  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
201  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
202  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
203  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
204  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
205  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
206  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
207  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
208  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
209  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
210  { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
211  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
212  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
213  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
214  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
215  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
216  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
217  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
218  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
219  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
220  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
221  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
222  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
223  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
224  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
225  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
226  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
227  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
228  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
229  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
230  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
231  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
232  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
233  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
234  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
235  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
236  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
237  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
238  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
239  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
240  { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
241  { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
242 
243 /*
244  * As OS said, we don't have a view when we need to set this, so I have to
245  * find another solution before adding them to this property set - MTG
246  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
247  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
248  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
249  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
250  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
251  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
252  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
253 
254  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
255  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
256  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
257  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
258  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
259  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
260  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
261 
262  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
263  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
264  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
265  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
266 */
267  { OUString(), 0, css::uno::Type(), 0}
268  };
269  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
270 }
271 
274  &Application::GetSolarMutex () )
275 , mpModel ( pModel )
276 , mpDocSh ( nullptr )
277 , mpDoc ( nullptr )
278 , mpPrinter( nullptr )
279 , mbPreferPrinterPapersize( false )
280 {
282 }
283 
285  throw()
286 {
287 }
288 
290 {
291  return ::cppu::queryInterface(rType,
292  // OWeakObject interfaces
293  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
294  &dynamic_cast<XWeak&>(*this),
295  // my own interfaces
296  &dynamic_cast<XPropertySet&>(*this),
297  &dynamic_cast<XPropertyState&>(*this),
298  &dynamic_cast<XMultiPropertySet&>(*this),
299  &dynamic_cast<XServiceInfo&>(*this),
300  &dynamic_cast<XTypeProvider&>(*this));
301 }
303  throw ()
304 {
305  OWeakObject::acquire();
306 }
308  throw ()
309 {
310  OWeakObject::release();
311 }
312 
313 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
314 {
315  static const uno::Sequence< uno::Type > aTypes {
316  // from MasterPropertySet
322  };
323  return aTypes;
324 }
325 
326 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
327 {
328  return css::uno::Sequence<sal_Int8>();
329 }
330 
332 {
334  if (nullptr == mpDocSh)
335  throw UnknownPropertyException();
336 
337  mpDoc = mpDocSh->GetDoc();
338  if (nullptr == mpDoc)
339  throw UnknownPropertyException();
340 }
341 
343 {
344  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
345  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
346 
347  switch( rInfo.mnHandle )
348  {
349  case HANDLE_FORBIDDEN_CHARS:
350  break;
351  case HANDLE_LINK_UPDATE_MODE:
352  {
353  sal_Int16 nMode = 0;
354  rValue >>= nMode;
355  switch (nMode)
356  {
357  case NEVER:
358  case MANUAL:
359  case AUTOMATIC:
360  case GLOBALSETTING:
361  break;
362  default:
363  throw IllegalArgumentException();
364  }
366  }
367  break;
368  case HANDLE_FIELD_AUTO_UPDATE:
369  {
370  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
373  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
376  AUTOUPD_OFF );
377  }
378  break;
379  case HANDLE_CHART_AUTO_UPDATE:
380  {
381  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
384  bUpdateChart ?
387  AUTOUPD_OFF );
388  }
389  break;
390  case HANDLE_ADD_PARA_TABLE_SPACING:
391  {
392  bool bParaSpace = false;
393  rValue >>= bParaSpace;
395  }
396  break;
397  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
398  {
399  bool bParaSpacePage = false;
400  rValue >>= bParaSpacePage;
402  }
403  break;
404  case HANDLE_ALIGN_TAB_STOP_POSITION:
405  {
406  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
408  }
409  break;
410  case HANDLE_PRINTER_NAME:
411  {
412  //the printer must be created
413  OUString sPrinterName;
414  if( !(rValue >>= sPrinterName) )
415  throw IllegalArgumentException();
416 
417  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
418  {
419  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
420  if ( pPrinter->GetName() != sPrinterName )
421  {
422  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
423  assert (! pNewPrinter->isDisposed() );
424  if( pNewPrinter->IsKnown() )
425  {
426  // set printer only once; in _postSetValues
427  mpPrinter = pNewPrinter;
428  }
429  else
430  {
431  pNewPrinter.disposeAndClear();
432  }
433  }
434  }
435 
436  }
437  break;
438  case HANDLE_PRINTER_SETUP:
439  {
440  Sequence < sal_Int8 > aSequence;
441  if ( !(rValue >>= aSequence) )
442  throw IllegalArgumentException();
443 
444  sal_uInt32 nSize = aSequence.getLength();
445  if( nSize > 0 )
446  {
447  SvMemoryStream aStream (aSequence.getArray(), nSize,
448  StreamMode::READ );
449  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
450  static sal_uInt16 const nRange[] =
451  {
453  SID_HTML_MODE, SID_HTML_MODE,
454  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
455  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
456  0
457  };
458  auto pItemSet = std::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), nRange );
459  VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
460  assert (! pPrinter->isDisposed() );
461  // set printer only once; in _postSetValues
463  mpPrinter = pPrinter;
464  }
465 
466  }
467  break;
468  case HANDLE_PRINTER_PAPER:
469  {
470  bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
471  if(!(rValue >>= bPreferPrinterPapersize))
472  throw IllegalArgumentException();
473  mbPreferPrinterPapersize = bPreferPrinterPapersize;
474  }
475  break;
476  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
477  {
478  bool bIsKern = *o3tl::doAccess<bool>(rValue);
480  SwEditShell* pEditSh = mpDoc->GetEditShell();
481  if(pEditSh)
482  pEditSh->ChgHyphenation();
483  }
484  break;
485  case HANDLE_CHARACTER_COMPRESSION_TYPE:
486  {
487  sal_Int16 nMode = 0;
488  rValue >>= nMode;
489  switch (static_cast<CharCompressType>(nMode))
490  {
491  case CharCompressType::NONE:
492  case CharCompressType::PunctuationOnly:
493  case CharCompressType::PunctuationAndKana:
494  break;
495  default:
496  throw IllegalArgumentException();
497  }
498  mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
499  }
500  break;
501  case HANDLE_APPLY_USER_DATA:
502  {
503  mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
504  }
505  break;
506  case HANDLE_SAVE_THUMBNAIL:
507  {
508  mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
509  }
510  break;
511  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
512  {
513  bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
515  }
516  break;
517  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
518  {
520  if ( rValue >>= aData.sDataSource )
521  mpDoc->ChgDBData( aData );
522  }
523  break;
524  case HANDLE_CURRENT_DATABASE_COMMAND:
525  {
527 
528  if ( rValue >>= aData.sCommand )
529  mpDoc->ChgDBData( aData );
530 
531  SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
532  "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
533  }
534  break;
535  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
536  {
538  if ( rValue >>= aData.nCommandType )
539  mpDoc->ChgDBData( aData );
540  SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
541  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
542  SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
543  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
544  }
545  break;
546  case HANDLE_EMBEDDED_DATABASE_NAME:
547  {
548 #if HAVE_FEATURE_DBCONNECTIVITY
549  OUString sEmbeddedName;
550  if (rValue >>= sEmbeddedName)
551  mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
552 #endif
553  }
554  break;
555  case HANDLE_SAVE_VERSION_ON_CLOSE:
556  {
557  mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
558  }
559  break;
560  case HANDLE_UPDATE_FROM_TEMPLATE:
561  {
562  mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
563  }
564  break;
565  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
566  {
567  sal_Int16 nTmp = 0;
568  rValue >>= nTmp;
569 
570  bool bUseVirDev = true;
571  bool bHiResVirDev = true;
572  if( nTmp == document::PrinterIndependentLayout::DISABLED )
573  bUseVirDev = false;
574  else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
575  bHiResVirDev = false;
576  else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
577  throw IllegalArgumentException();
578 
579  mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
580  }
581  break;
582  case HANDLE_IS_LABEL_DOC :
583  {
584  bool bSet = false;
585  if(!(rValue >>= bSet))
586  throw IllegalArgumentException();
588  }
589  break;
590  case HANDLE_IS_ADD_FLY_OFFSET:
591  {
592  bool bTmp = *o3tl::doAccess<bool>(rValue);
594  }
595  break;
596  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
597  {
598  bool bTmp = *o3tl::doAccess<bool>(rValue);
600  }
601  break;
602  case HANDLE_IS_ADD_EXTERNAL_LEADING:
603  {
604  bool bTmp = *o3tl::doAccess<bool>(rValue);
606  }
607  break;
608  case HANDLE_OLD_NUMBERING:
609  {
610  bool bTmp = *o3tl::doAccess<bool>(rValue);
612  }
613  break;
614  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
615  {
616  // ignore - this is a dead property
617  }
618  break;
619  case HANDLE_ALLOW_PRINTJOB_CANCEL:
620  {
621  bool bState = false;
622  if (!(rValue >>= bState))
623  throw IllegalArgumentException();
625  }
626  break;
627  case HANDLE_USE_FORMER_LINE_SPACING:
628  {
629  bool bTmp = *o3tl::doAccess<bool>(rValue);
631  }
632  break;
633  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
634  {
635  bool bTmp = *o3tl::doAccess<bool>(rValue);
637  }
638  break;
639  case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
640  {
641  bool bTmp = *o3tl::doAccess<bool>(rValue);
643  }
644  break;
645  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
646  {
647  bool bTmp = *o3tl::doAccess<bool>(rValue);
649  }
650  break;
651  case HANDLE_USE_FORMER_TEXT_WRAPPING:
652  {
653  bool bTmp = *o3tl::doAccess<bool>(rValue);
655  }
656  break;
657  case HANDLE_CHANGES_PASSWORD:
658  {
659  Sequence <sal_Int8> aNew;
660  if(rValue >>= aNew)
661  {
663  if(aNew.hasElements())
664  {
666  eMode |= RedlineFlags::On;
668  }
669  }
670  }
671  break;
672  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
673  {
674  bool bTmp = *o3tl::doAccess<bool>(rValue);
676  }
677  break;
678  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
679  {
680  bool bTmp = *o3tl::doAccess<bool>(rValue);
682  }
683  break;
684  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
685  {
686  bool bTmp = *o3tl::doAccess<bool>(rValue);
688  }
689  break;
690  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
691  {
692  bool bTmp = *o3tl::doAccess<bool>(rValue);
694  }
695  break;
696  case HANDLE_TABLE_ROW_KEEP:
697  {
698  bool bTmp = *o3tl::doAccess<bool>(rValue);
700  }
701  break;
702  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
703  {
704  bool bTmp = *o3tl::doAccess<bool>(rValue);
706  }
707  break;
708  case HANDLE_LOAD_READONLY:
709  {
710  mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
711  }
712  break;
713  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
714  {
715  bool bTmp = *o3tl::doAccess<bool>(rValue);
717  }
718  break;
719  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
720  {
721  bool bTmp = *o3tl::doAccess<bool>(rValue);
723  }
724  break;
725  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
726  {
727  bool bTmp = *o3tl::doAccess<bool>(rValue);
729  }
730  break;
731  case HANDLE_USE_OLD_PRINTER_METRICS:
732  // ignore - this is a dead property
733  break;
734  case HANDLE_TABS_RELATIVE_TO_INDENT:
735  {
736  bool bTmp = *o3tl::doAccess<bool>(rValue);
738  }
739  break;
740  case HANDLE_RSID:
741  {
742  sal_uInt32 nTmp = 0;
743  rValue >>= nTmp;
744  mpDoc->setRsid( nTmp );
745  }
746  break;
747  case HANDLE_RSID_ROOT:
748  {
749  sal_uInt32 nTmp = 0;
750  rValue >>= nTmp;
751  mpDoc->setRsidRoot( nTmp );
752  }
753  break;
754  case HANDLE_PROTECT_FORM:
755  {
756  bool bTmp = *o3tl::doAccess<bool>(rValue);
758  }
759  break;
760  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
761  {
762  bool bTmp = *o3tl::doAccess<bool>(rValue);
764  }
765  break;
766  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
767  {
768  bool bTmp = *o3tl::doAccess<bool>(rValue);
770  }
771  break;
772  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
773  {
774  bool bTmp = *o3tl::doAccess<bool>(rValue);
776  }
777  break;
778  case HANDLE_MODIFYPASSWORDINFO:
779  {
780  uno::Sequence< beans::PropertyValue > aInfo;
781  if ( !( rValue >>= aInfo ) )
782  throw lang::IllegalArgumentException(
783  "Value of type Sequence<PropertyValue> expected!",
784  uno::Reference< uno::XInterface >(),
785  2 );
786 
787  if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
788  throw beans::PropertyVetoException(
789  "The hash is not allowed to be changed now!",
790  uno::Reference< uno::XInterface >() );
791  }
792  break;
793  case HANDLE_MATH_BASELINE_ALIGNMENT:
794  {
795  bool bTmp = *o3tl::doAccess<bool>(rValue);
797  }
798  break;
799  case HANDLE_INVERT_BORDER_SPACING:
800  {
801  bool bTmp = *o3tl::doAccess<bool>(rValue);
803  }
804  break;
805  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
806  {
807  bool bTmp = *o3tl::doAccess<bool>(rValue);
809  }
810  break;
811  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
812  {
813  bool bTmp = *o3tl::doAccess<bool>(rValue);
815  }
816  break;
817  case HANDLE_TAB_OVERFLOW:
818  {
819  bool bTmp = *o3tl::doAccess<bool>(rValue);
821  }
822  break;
823  case HANDLE_UNBREAKABLE_NUMBERINGS:
824  {
825  bool bTmp = *o3tl::doAccess<bool>(rValue);
827  }
828  break;
829  case HANDLE_STYLES_NODEFAULT:
830  {
831  bool bTmp = *o3tl::doAccess<bool>(rValue);
833  }
834  break;
835  case HANDLE_FLOATTABLE_NOMARGINS:
836  {
837  bool bTmp = *o3tl::doAccess<bool>(rValue);
839  }
840  break;
841  case HANDLE_CLIPPED_PICTURES:
842  {
843  bool bTmp = *o3tl::doAccess<bool>(rValue);
845  }
846  break;
847  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
848  {
849  bool bTmp = *o3tl::doAccess<bool>(rValue);
851  }
852  break;
853  case HANDLE_EMBED_FONTS:
854  {
855  bool bTmp = *o3tl::doAccess<bool>(rValue);
857  }
858  break;
859  case HANDLE_EMBED_USED_FONTS:
860  {
861  bool bTmp = *o3tl::doAccess<bool>(rValue);
863  }
864  break;
865  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
866  {
867  bool bTmp = *o3tl::doAccess<bool>(rValue);
869  }
870  break;
871  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
872  {
873  bool bTmp = *o3tl::doAccess<bool>(rValue);
875  }
876  break;
877  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
878  {
879  bool bTmp = *o3tl::doAccess<bool>(rValue);
881  }
882  break;
883  case HANDLE_EMBED_SYSTEM_FONTS:
884  {
885  bool bTmp = *o3tl::doAccess<bool>(rValue);
887  }
888  break;
889  case HANDLE_TAB_OVER_MARGIN:
890  {
891  bool bTmp = *o3tl::doAccess<bool>(rValue);
893  }
894  break;
895  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
896  {
897  bool bTmp = *o3tl::doAccess<bool>(rValue);
899  }
900  break;
901  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
902  {
903  bool bTmp = *o3tl::doAccess<bool>(rValue);
905  }
906  break;
907  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
908  {
909  bool bTmp = *o3tl::doAccess<bool>(rValue);
911  }
912  break;
913  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
914  {
915  bool bTmp;
916  if (rValue >>= bTmp)
917  {
920  }
921  }
922  break;
923  case HANDLE_SUBTRACT_FLYS:
924  {
925  bool bTmp;
926  if (rValue >>= bTmp)
927  {
930  }
931  }
932  break;
933  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
934  {
935  bool bTmp;
936  if (rValue >>= bTmp)
937  {
940  }
941  }
942  break;
943  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
944  {
945  bool bTmp;
946  if (rValue >>= bTmp)
947  {
949  bTmp);
950  }
951  }
952  break;
953  case HANDLE_CONTINUOUS_ENDNOTES:
954  {
955  bool bTmp;
956  if (rValue >>= bTmp)
957  {
959  bTmp);
960  }
961  }
962  break;
963  case HANDLE_PROTECT_BOOKMARKS:
964  {
965  bool bTmp;
966  if (rValue >>= bTmp)
967  {
969  bTmp);
970  }
971  }
972  break;
973  case HANDLE_PROTECT_FIELDS:
974  {
975  bool bTmp;
976  if (rValue >>= bTmp)
977  {
979  bTmp);
980  }
981  }
982  break;
983  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
984  {
985  bool bTmp;
986  if (rValue >>= bTmp)
987  {
990  }
991  }
992  break;
993  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
994  {
995  bool bTmp;
996  if (rValue >>= bTmp)
997  {
1000  }
1001  }
1002  break;
1003  default:
1004  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1005  }
1006 }
1007 
1009 {
1010  // set printer only once, namely here!
1011  if( mpPrinter != nullptr )
1012  {
1013  // #i86352# the printer is also used as container for options by sfx
1014  // when setting a printer it should have decent default options
1015  SfxItemSet aOptions( mpPrinter->GetOptions() );
1017  SwAddPrinterItem aAddPrinterItem (aPrtData);
1018  aOptions.Put(aAddPrinterItem);
1019  mpPrinter->SetOptions( aOptions );
1020  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1021 
1023  }
1024 
1025  mpPrinter = nullptr;
1026  mpDocSh = nullptr;
1027  mpDoc = nullptr;
1028 }
1029 
1031 {
1033  if (nullptr == mpDocSh)
1034  throw UnknownPropertyException();
1035  mpDoc = mpDocSh->GetDoc();
1036  if (nullptr == mpDoc)
1037  throw UnknownPropertyException();
1038 }
1039 
1041 {
1042  switch( rInfo.mnHandle )
1043  {
1044  case HANDLE_FORBIDDEN_CHARS:
1045  {
1046  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1047  rValue <<= xRet;
1048  }
1049  break;
1050  case HANDLE_LINK_UPDATE_MODE:
1051  {
1052  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1053  }
1054  break;
1055  case HANDLE_FIELD_AUTO_UPDATE:
1056  {
1058  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1059  }
1060  break;
1061  case HANDLE_CHART_AUTO_UPDATE:
1062  {
1064  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1065  }
1066  break;
1067  case HANDLE_ADD_PARA_TABLE_SPACING:
1068  {
1070  }
1071  break;
1072  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1073  {
1075  }
1076  break;
1077  case HANDLE_ALIGN_TAB_STOP_POSITION:
1078  {
1080  }
1081  break;
1082  case HANDLE_PRINTER_NAME:
1083  {
1084  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1085  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1086  }
1087  break;
1088  case HANDLE_PRINTER_SETUP:
1089  {
1090  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1091  if (pPrinter)
1092  {
1093  SvMemoryStream aStream;
1094  pPrinter->Store( aStream );
1095  sal_uInt32 nSize = aStream.TellEnd();
1096  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1097  Sequence < sal_Int8 > aSequence( nSize );
1098  aStream.ReadBytes(aSequence.getArray(), nSize);
1099  rValue <<= aSequence;
1100  }
1101  else
1102  {
1103  Sequence < sal_Int8 > aSequence ( 0 );
1104  rValue <<= aSequence;
1105  }
1106  }
1107  break;
1108  case HANDLE_PRINTER_PAPER:
1109  {
1110  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1111  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1112  }
1113  break;
1114  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1115  {
1117  }
1118  break;
1119  case HANDLE_APPLY_USER_DATA:
1120  {
1121  rValue <<= mpDocSh->IsUseUserData();
1122  }
1123  break;
1124  case HANDLE_SAVE_THUMBNAIL:
1125  {
1126  rValue <<= mpDocSh->IsUseThumbnailSave();
1127  }
1128  break;
1129  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1130  {
1131  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1132  }
1133  break;
1134  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1135  {
1137  }
1138  break;
1139  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1140  {
1141  const SwDBData& rData = mpDoc->GetDBDesc();
1142  rValue <<= rData.sDataSource;
1143  }
1144  break;
1145  case HANDLE_CURRENT_DATABASE_COMMAND:
1146  {
1147  const SwDBData& rData = mpDoc->GetDBDesc();
1148  rValue <<= rData.sCommand;
1149  }
1150  break;
1151  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1152  {
1153  const SwDBData& rData = mpDoc->GetDBDesc();
1154  rValue <<= rData.nCommandType;
1155  }
1156  break;
1157  case HANDLE_EMBEDDED_DATABASE_NAME:
1158  {
1159 #if HAVE_FEATURE_DBCONNECTIVITY
1160  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1161 #else
1162  rValue = uno::Any();
1163 #endif
1164  }
1165  break;
1166  case HANDLE_SAVE_VERSION_ON_CLOSE:
1167  {
1168  rValue <<= mpDocSh->IsSaveVersionOnClose();
1169  }
1170  break;
1171  case HANDLE_UPDATE_FROM_TEMPLATE:
1172  {
1173  rValue <<= mpDocSh->IsQueryLoadTemplate();
1174  }
1175  break;
1176  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1177  {
1178  // returns short (see css.document.PrinterIndependentLayout)
1181  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1182  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1183  document::PrinterIndependentLayout::DISABLED;
1184  rValue <<= nVirDevType;
1185  }
1186  break;
1187  case HANDLE_IS_LABEL_DOC:
1188  {
1190  rValue <<= bLabel;
1191  }
1192  break;
1193  case HANDLE_IS_ADD_FLY_OFFSET:
1194  {
1196  }
1197  break;
1198  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1199  {
1201  }
1202  break;
1203  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1204  {
1206  }
1207  break;
1208  case HANDLE_OLD_NUMBERING:
1209  {
1211  }
1212  break;
1213  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1214  {
1215  rValue <<= false;
1216  }
1217  break;
1218  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1219  {
1220  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1221  }
1222  break;
1223  case HANDLE_USE_FORMER_LINE_SPACING:
1224  {
1226  }
1227  break;
1228  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1229  {
1231  }
1232  break;
1233  case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
1234  {
1236  }
1237  break;
1238  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1239  {
1241  }
1242  break;
1243  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1244  {
1246  }
1247  break;
1248  case HANDLE_CHANGES_PASSWORD:
1249  {
1251  }
1252  break;
1253  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1254  {
1256  }
1257  break;
1258  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1259  {
1261  }
1262  break;
1263  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1264  {
1266  }
1267  break;
1268  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1269  {
1271  }
1272  break;
1273  case HANDLE_TABLE_ROW_KEEP :
1274  {
1276  }
1277  break;
1278  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1279  {
1281  }
1282  break;
1283  case HANDLE_LOAD_READONLY:
1284  {
1285  rValue <<= mpDocSh->IsLoadReadonly();
1286  }
1287  break;
1288  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1289  {
1291  }
1292  break;
1293  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1294  {
1296  }
1297  break;
1298  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1299  {
1301  }
1302  break;
1303  case HANDLE_USE_OLD_PRINTER_METRICS:
1304  {
1305  rValue <<= false;
1306  }
1307  break;
1308  case HANDLE_TABS_RELATIVE_TO_INDENT:
1309  {
1311  }
1312  break;
1313  case HANDLE_RSID:
1314  {
1315  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1316  }
1317  break;
1318  case HANDLE_RSID_ROOT:
1319  {
1320  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1321  }
1322  break;
1323  case HANDLE_PROTECT_FORM:
1324  {
1326  }
1327  break;
1328  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1329  {
1331  }
1332  break;
1333  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1334  {
1336  }
1337  break;
1338  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1339  {
1341  }
1342  break;
1343  case HANDLE_MODIFYPASSWORDINFO:
1344  {
1345  rValue <<= mpDocSh->GetModifyPasswordInfo();
1346  }
1347  break;
1348  case HANDLE_MATH_BASELINE_ALIGNMENT:
1349  {
1351  }
1352  break;
1353  case HANDLE_INVERT_BORDER_SPACING:
1354  {
1356  }
1357  break;
1358  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1359  {
1361  }
1362  break;
1363  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1364  {
1366  }
1367  break;
1368  case HANDLE_TAB_OVERFLOW:
1369  {
1371  }
1372  break;
1373  case HANDLE_UNBREAKABLE_NUMBERINGS:
1374  {
1376  }
1377  break;
1378  case HANDLE_STYLES_NODEFAULT:
1379  {
1381  }
1382  break;
1383  case HANDLE_FLOATTABLE_NOMARGINS:
1384  {
1386  }
1387  break;
1388  case HANDLE_CLIPPED_PICTURES:
1389  {
1391  }
1392  break;
1393  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1394  {
1396  }
1397  break;
1398  case HANDLE_EMBED_FONTS:
1399  {
1401  }
1402  break;
1403  case HANDLE_EMBED_USED_FONTS:
1404  {
1406  }
1407  break;
1408  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1409  {
1411  }
1412  break;
1413  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1414  {
1416  }
1417  break;
1418  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1419  {
1421  }
1422  break;
1423  case HANDLE_EMBED_SYSTEM_FONTS:
1424  {
1426  }
1427  break;
1428  case HANDLE_TAB_OVER_MARGIN:
1429  {
1431  }
1432  break;
1433  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1434  {
1436  }
1437  break;
1438  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1439  {
1441  }
1442  break;
1443  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1444  {
1446  }
1447  break;
1448  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1449  {
1451  }
1452  break;
1453  case HANDLE_SUBTRACT_FLYS:
1454  {
1456  }
1457  break;
1458  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1459  {
1461  }
1462  break;
1463  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1464  {
1465  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1467  }
1468  break;
1469  case HANDLE_CONTINUOUS_ENDNOTES:
1470  {
1471  rValue
1473  }
1474  break;
1475  case HANDLE_PROTECT_BOOKMARKS:
1476  {
1477  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1479  }
1480  break;
1481  case HANDLE_PROTECT_FIELDS:
1482  {
1483  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1485  }
1486  break;
1487  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1488  {
1489  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1491  }
1492  break;
1493  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1494  {
1495  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1497  }
1498  break;
1499  default:
1500  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1501  }
1502 }
1503 
1505 {
1506  mpDocSh = nullptr;
1507  mpDoc = nullptr;
1508 }
1509 
1510 // XServiceInfo
1512 {
1513  return "SwXDocumentSettings";
1514 }
1515 
1516 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1517 {
1518  return cppu::supportsService(this, ServiceName);
1519 }
1520 
1522 {
1523  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1524 }
1525 
1526 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Type
virtual void _postSetValues() override
virtual void SAL_CALL release() override
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
void ChgDBData(const SwDBData &rNewData)
Definition: doc.cxx:453
bool IsUseUserData() const
SwFieldUpdateFlags
Definition: fldupde.hxx:22
virtual OUString SAL_CALL getImplementationName() override
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
const char aData[]
Definition: ww8scan.hxx:47
static MasterPropertySetInfo * lcl_createSettingsInfo()
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
sal_uInt32 getRsidRoot() const
Definition: doc.cxx:216
OUString sDataSource
Definition: swdbdata.hxx:30
void disposeAndClear()
virtual void setReferenceDeviceType(bool bNewVirtual, bool bNewHiRes)=0
Sets the type of the reference device used for formatting the document.
const ContentProperties & rData
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:441
virtual void setFieldUpdateFlags(SwFieldUpdateFlags nMode)=0
Set the current field update mode.
sal_uInt64 Seek(sal_uInt64 nPos)
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:763
virtual sal_uInt64 TellEnd() override
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual void SAL_CALL acquire() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void setCharacterCompressionType(CharCompressType nType)=0
Set the character compression type for Asian characters.
virtual void _preGetValues() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
void setEmbeddedName(const OUString &rEmbeddedName, SwDocShell &rDocShell)
Definition: dbmgr.cxx:3140
sal_uInt32 getRsid() const
Definition: doc.cxx:196
Mode eMode
virtual SwFieldUpdateFlags getFieldUpdateFlags(bool bGlobalSettings) const =0
Get the current field update mode.
SwXDocumentSettings(SwXTextDocument *pModel)
RedlineFlags on.
SfxObjectCreateMode GetCreateMode() const
const SwDBData & GetDBDesc()
Definition: docfld.cxx:348
SwDocumentSettingsPropertyHandles
void registerSlave(ChainablePropertySet *pNewSet)
virtual CharCompressType getCharacterCompressionType() const =0
Get the character compression type for Asian characters.
const SfxItemSet & GetOptions() const
void ChgHyphenation()
Definition: viewsh.hxx:208
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
SwDBData const & GetDBData()
Definition: docfld.cxx:343
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
#define STREAM_SEEK_TO_BEGIN
virtual ~SwXDocumentSettings() override
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:327
bool Stamp_GetPrintCancelState() const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const =0
Get the current link update mode.
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
static VclPtr< SfxPrinter > Create(SvStream &rStream, std::unique_ptr< SfxItemSet > &&pOptions)
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
void SetSaveVersionOnClose(bool bSet)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
unsigned char sal_Bool
void setRsidRoot(sal_uInt32 nVal)
Definition: doc.cxx:221
SwDocShell * GetDocShell()
Definition: unotxdoc.hxx:466
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
css::uno::Type const & get()
void SetUseThumbnailSave(bool _bNew)
SwXTextDocument * mpModel
void SetUseUserData(bool bNew)
void Store(SvStream &rStream) const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
const SvXMLTokenMapEntry aTypes[]
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
std::size_t ReadBytes(void *pData, std::size_t nSize)
void setRsid(sal_uInt32 nVal)
Definition: doc.cxx:201
virtual void _postGetValues() override
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
AUTOMATIC
bool IsUseThumbnailSave() const
#define SAL_WARN_IF(condition, area, stream)
bool IsQueryLoadTemplate() const
bool IsSaveVersionOnClose() const
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
bool SetModifyPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
virtual void setLinkUpdateMode(sal_uInt16 nMode)=0
Set the current link update mode.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
void SetLoadReadonly(bool _bReadonly)
void SetQueryLoadTemplate(bool b)
bool IsLoadReadonly() const
void Stamp_SetPrintCancelState(bool bState)
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
VclPtr< SfxPrinter > mpPrinter
the printer should be set only once; since there are several printer-related properties, remember the last printer and set it in _postSetValues
OUString sCommand
Definition: swdbdata.hxx:31
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
SwDBManager * GetDBManager() const
Definition: doc.hxx:666
void SetOptions(const SfxItemSet &rNewOptions)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1317
virtual void _preSetValues() override
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3161