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 #include <config_fuzzers.h>
22 
23 #include <sal/config.h>
24 #include <sal/log.hxx>
25 
26 #include <utility>
27 
28 #include <o3tl/any.hxx>
29 #include "SwXDocumentSettings.hxx"
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
35 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
36 #include <doc.hxx>
40 #include <docsh.hxx>
41 #include <fldupde.hxx>
42 #include <linkenum.hxx>
43 #include <sfx2/printer.hxx>
44 #include <editsh.hxx>
45 #include <unotxdoc.hxx>
46 #include <cmdid.h>
47 #include <unomod.hxx>
48 #include <vcl/svapp.hxx>
49 #include <svl/asiancfg.hxx>
50 #include <tools/stream.hxx>
51 
52 #include <cfgitems.hxx>
53 #include <dbmgr.hxx>
54 
55 using namespace comphelper;
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::i18n;
61 
62 namespace {
63 
65 {
66  HANDLE_FORBIDDEN_CHARS,
67  HANDLE_LINK_UPDATE_MODE,
68  HANDLE_FIELD_AUTO_UPDATE,
69  HANDLE_CHART_AUTO_UPDATE,
70  HANDLE_ADD_PARA_TABLE_SPACING,
71  HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
72  HANDLE_ALIGN_TAB_STOP_POSITION,
73  HANDLE_PRINTER_NAME,
74  HANDLE_PRINTER_SETUP,
75  HANDLE_PRINTER_PAPER,
76  HANDLE_IS_KERN_ASIAN_PUNCTUATION,
77  HANDLE_CHARACTER_COMPRESSION_TYPE,
78  HANDLE_APPLY_USER_DATA,
79  HANDLE_SAVE_THUMBNAIL,
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_EMBEDDED_DATABASE_NAME,
85  HANDLE_SAVE_VERSION_ON_CLOSE,
86  HANDLE_UPDATE_FROM_TEMPLATE,
87  HANDLE_PRINTER_INDEPENDENT_LAYOUT,
88  HANDLE_IS_LABEL_DOC,
89  HANDLE_IS_ADD_FLY_OFFSET,
90  HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,
91  HANDLE_IS_ADD_EXTERNAL_LEADING,
92  HANDLE_OLD_NUMBERING,
93  HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
94  /* Stampit It disable the print cancel button of the shown progress dialog. */
95  HANDLE_ALLOW_PRINTJOB_CANCEL,
96  HANDLE_USE_FORMER_LINE_SPACING,
97  HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
98  HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
99  HANDLE_USE_FORMER_OBJECT_POSITIONING,
100  HANDLE_USE_FORMER_TEXT_WRAPPING,
101  HANDLE_CHANGES_PASSWORD,
102  HANDLE_CONSIDER_WRAP_ON_OBJPOS,
103  HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
104  HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
105  HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
106  HANDLE_TABLE_ROW_KEEP,
107  HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
108  HANDLE_LOAD_READONLY,
109  HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
110  HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
111  HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
112  HANDLE_USE_OLD_PRINTER_METRICS,
113  HANDLE_PROTECT_FORM,
114  HANDLE_MS_WORD_COMP_TRAILING_BLANKS,
115  HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
116  HANDLE_TABS_RELATIVE_TO_INDENT,
117  HANDLE_RSID,
118  HANDLE_RSID_ROOT,
119  HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
120  HANDLE_MODIFYPASSWORDINFO,
121  HANDLE_MATH_BASELINE_ALIGNMENT,
122  HANDLE_INVERT_BORDER_SPACING,
123  HANDLE_COLLAPSE_EMPTY_CELL_PARA,
124  HANDLE_SMALL_CAPS_PERCENTAGE_66,
125  HANDLE_TAB_OVERFLOW,
126  HANDLE_UNBREAKABLE_NUMBERINGS,
127  HANDLE_STYLES_NODEFAULT,
128  HANDLE_FLOATTABLE_NOMARGINS,
129  HANDLE_CLIPPED_PICTURES,
130  HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
131  HANDLE_EMBED_FONTS,
132  HANDLE_EMBED_USED_FONTS,
133  HANDLE_EMBED_LATIN_SCRIPT_FONTS,
134  HANDLE_EMBED_ASIAN_SCRIPT_FONTS,
135  HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
136  HANDLE_EMBED_SYSTEM_FONTS,
137  HANDLE_TAB_OVER_MARGIN,
138  HANDLE_TAB_OVER_SPACING,
139  HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
140  HANDLE_SURROUND_TEXT_WRAP_SMALL,
141  HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
142  HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
143  HANDLE_SUBTRACT_FLYS,
144  HANDLE_DISABLE_OFF_PAGE_POSITIONING,
145  HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
146  HANDLE_CONTINUOUS_ENDNOTES,
147  HANDLE_PROTECT_BOOKMARKS,
148  HANDLE_PROTECT_FIELDS,
149  HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
150  HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
151  HANDLE_GUTTER_AT_TOP,
152  HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND,
153  HANDLE_IMAGE_PREFERRED_DPI,
154  HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
155 };
156 
157 }
158 
160 {
161  static PropertyInfo const aWriterSettingsInfoMap[] =
162  {
163  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
164  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
165  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
166  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
167  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
168  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
169  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
170  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
171  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
172  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
173  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
174  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
175  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
176  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
177  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
178  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
179  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
180  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
181  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
182  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
183  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
184 
185  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
186  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
187  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
188  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
189  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
190  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
191  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
192  /* Stampit It disable the print cancel button of the shown progress dialog. */
193  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
194  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
195  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
196  { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
197  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
198  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
199  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
200  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
201  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
202  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
203  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
204  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
205  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
206  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
207  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
208  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
209  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
210  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
211  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
212  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
213  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
214  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
215  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
216  { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
217  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
218  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
219  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
220  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
221  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
222  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
223  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
224  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
225  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
226  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
227  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
228  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
229  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
230  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
231  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
232  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
233  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
234  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
235  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
236  { OUString("TabOverSpacing"), HANDLE_TAB_OVER_SPACING, cppu::UnoType<bool>::get(), 0},
237  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
238  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
239  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
240  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
241  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
242  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
243  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
244  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
245  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
246  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
247  { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
248  { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
249  { OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
250  { OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType<bool>::get(), 0 },
251  { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0 },
252  { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 },
253 
254 /*
255  * As OS said, we don't have a view when we need to set this, so I have to
256  * find another solution before adding them to this property set - MTG
257  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
258  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
259  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
260  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
261  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
262  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
263  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
264 
265  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
266  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
267  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
268  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
269  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
270  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
271  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
272 
273  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
274  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
275  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
276  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
277 */
278  { OUString(), 0, css::uno::Type(), 0}
279  };
280  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
281 }
282 
285  &Application::GetSolarMutex () )
286 , mpModel ( pModel )
287 , mpDocSh ( nullptr )
288 , mpDoc ( nullptr )
289 , mpPrinter( nullptr )
290 , mbPreferPrinterPapersize( false )
291 {
293 }
294 
296  noexcept
297 {
298 }
299 
301 {
302  return ::cppu::queryInterface(rType,
303  // OWeakObject interfaces
304  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
305  &dynamic_cast<XWeak&>(*this),
306  // my own interfaces
307  &dynamic_cast<XPropertySet&>(*this),
308  &dynamic_cast<XPropertyState&>(*this),
309  &dynamic_cast<XMultiPropertySet&>(*this),
310  &dynamic_cast<XServiceInfo&>(*this),
311  &dynamic_cast<XTypeProvider&>(*this));
312 }
314  noexcept
315 {
316  OWeakObject::acquire();
317 }
319  noexcept
320 {
321  OWeakObject::release();
322 }
323 
324 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
325 {
326  static const uno::Sequence< uno::Type > aTypes {
327  // from MasterPropertySet
333  };
334  return aTypes;
335 }
336 
337 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
338 {
339  return css::uno::Sequence<sal_Int8>();
340 }
341 
343 {
345  if (nullptr == mpDocSh)
346  throw UnknownPropertyException();
347 
348  mpDoc = mpDocSh->GetDoc();
349  if (nullptr == mpDoc)
350  throw UnknownPropertyException();
351 }
352 
354 {
355  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
356  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
357 
358  switch( rInfo.mnHandle )
359  {
360  case HANDLE_FORBIDDEN_CHARS:
361  break;
362  case HANDLE_LINK_UPDATE_MODE:
363  {
364  sal_Int16 nMode = 0;
365  rValue >>= nMode;
366  switch (nMode)
367  {
368  case NEVER:
369  case MANUAL:
370  case AUTOMATIC:
371  case GLOBALSETTING:
372  break;
373  default:
374  throw IllegalArgumentException();
375  }
377  }
378  break;
379  case HANDLE_FIELD_AUTO_UPDATE:
380  {
381  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
384  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
387  AUTOUPD_OFF );
388  }
389  break;
390  case HANDLE_CHART_AUTO_UPDATE:
391  {
392  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
395  bUpdateChart ?
398  AUTOUPD_OFF );
399  }
400  break;
401  case HANDLE_ADD_PARA_TABLE_SPACING:
402  {
403  bool bParaSpace = false;
404  rValue >>= bParaSpace;
406  }
407  break;
408  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
409  {
410  bool bParaSpacePage = false;
411  rValue >>= bParaSpacePage;
413  }
414  break;
415  case HANDLE_ALIGN_TAB_STOP_POSITION:
416  {
417  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
419  }
420  break;
421  case HANDLE_PRINTER_NAME:
422  {
423  //the printer must be created
424  OUString sPrinterName;
425  if( !(rValue >>= sPrinterName) )
426  throw IllegalArgumentException();
427 
428  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
429  {
430  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
431  if ( pPrinter->GetName() != sPrinterName )
432  {
433  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
434  assert (! pNewPrinter->isDisposed() );
435  if( pNewPrinter->IsKnown() )
436  {
437  // set printer only once; in _postSetValues
438  mpPrinter = pNewPrinter;
439  }
440  else
441  {
442  pNewPrinter.disposeAndClear();
443  }
444  }
445  }
446 
447  }
448  break;
449  case HANDLE_PRINTER_SETUP:
450  {
451  Sequence < sal_Int8 > aSequence;
452  if ( !(rValue >>= aSequence) )
453  throw IllegalArgumentException();
454 
455  sal_uInt32 nSize = aSequence.getLength();
456  if( nSize > 0 )
457  {
458  SvMemoryStream aStream (aSequence.getArray(), nSize,
459  StreamMode::READ );
460  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
461  auto pItemSet = std::make_unique<SfxItemSetFixed<
462  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
463  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
464  SID_HTML_MODE, SID_HTML_MODE,
465  FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER>>( mpDoc->GetAttrPool() );
466  VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
467  assert (! pPrinter->isDisposed() );
468  // set printer only once; in _postSetValues
470  mpPrinter = pPrinter;
471  }
472 
473  }
474  break;
475  case HANDLE_PRINTER_PAPER:
476  {
477  bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
478  if(!(rValue >>= bPreferPrinterPapersize))
479  throw IllegalArgumentException();
480  mbPreferPrinterPapersize = bPreferPrinterPapersize;
481  }
482  break;
483  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
484  {
485  bool bIsKern = *o3tl::doAccess<bool>(rValue);
487  SwEditShell* pEditSh = mpDoc->GetEditShell();
488  if(pEditSh)
489  pEditSh->ChgHyphenation();
490  }
491  break;
492  case HANDLE_CHARACTER_COMPRESSION_TYPE:
493  {
494  sal_Int16 nMode = 0;
495  rValue >>= nMode;
496  switch (static_cast<CharCompressType>(nMode))
497  {
498  case CharCompressType::NONE:
499  case CharCompressType::PunctuationOnly:
500  case CharCompressType::PunctuationAndKana:
501  break;
502  default:
503  throw IllegalArgumentException();
504  }
505  mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
506  }
507  break;
508  case HANDLE_APPLY_USER_DATA:
509  {
510  mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
511  }
512  break;
513  case HANDLE_SAVE_THUMBNAIL:
514  {
515  mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
516  }
517  break;
518  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
519  {
520  bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
522  }
523  break;
524  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
525  {
527  if ( rValue >>= aData.sDataSource )
528  mpDoc->ChgDBData( aData );
529  }
530  break;
531  case HANDLE_CURRENT_DATABASE_COMMAND:
532  {
534 
535  if ( rValue >>= aData.sCommand )
536  mpDoc->ChgDBData( aData );
537 
538  SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
539  "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
540  }
541  break;
542  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
543  {
545  if ( rValue >>= aData.nCommandType )
546  mpDoc->ChgDBData( aData );
547  SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
548  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
549  SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
550  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
551  }
552  break;
553  case HANDLE_EMBEDDED_DATABASE_NAME:
554  {
555 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
556  OUString sEmbeddedName;
557  if (rValue >>= sEmbeddedName)
558  mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
559 #endif
560  }
561  break;
562  case HANDLE_SAVE_VERSION_ON_CLOSE:
563  {
564  mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
565  }
566  break;
567  case HANDLE_UPDATE_FROM_TEMPLATE:
568  {
569  mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
570  }
571  break;
572  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
573  {
574  sal_Int16 nTmp = 0;
575  rValue >>= nTmp;
576 
577  bool bUseVirDev = true;
578  bool bHiResVirDev = true;
579  if( nTmp == document::PrinterIndependentLayout::DISABLED )
580  bUseVirDev = false;
581  else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
582  bHiResVirDev = false;
583  else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
584  throw IllegalArgumentException();
585 
586  mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
587  }
588  break;
589  case HANDLE_IS_LABEL_DOC :
590  {
591  bool bSet = false;
592  if(!(rValue >>= bSet))
593  throw IllegalArgumentException();
595  }
596  break;
597  case HANDLE_IS_ADD_FLY_OFFSET:
598  {
599  bool bTmp = *o3tl::doAccess<bool>(rValue);
601  }
602  break;
603  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
604  {
605  bool bTmp = *o3tl::doAccess<bool>(rValue);
607  }
608  break;
609  case HANDLE_IS_ADD_EXTERNAL_LEADING:
610  {
611  bool bTmp = *o3tl::doAccess<bool>(rValue);
613  }
614  break;
615  case HANDLE_OLD_NUMBERING:
616  {
617  bool bTmp = *o3tl::doAccess<bool>(rValue);
619  }
620  break;
621  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
622  {
623  // ignore - this is a dead property
624  }
625  break;
626  case HANDLE_ALLOW_PRINTJOB_CANCEL:
627  {
628  bool bState = false;
629  if (!(rValue >>= bState))
630  throw IllegalArgumentException();
632  }
633  break;
634  case HANDLE_USE_FORMER_LINE_SPACING:
635  {
636  bool bTmp = *o3tl::doAccess<bool>(rValue);
638  }
639  break;
640  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
641  {
642  bool bTmp = *o3tl::doAccess<bool>(rValue);
644  }
645  break;
646  case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
647  {
648  bool bTmp = *o3tl::doAccess<bool>(rValue);
650  }
651  break;
652  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
653  {
654  bool bTmp = *o3tl::doAccess<bool>(rValue);
656  }
657  break;
658  case HANDLE_USE_FORMER_TEXT_WRAPPING:
659  {
660  bool bTmp = *o3tl::doAccess<bool>(rValue);
662  }
663  break;
664  case HANDLE_CHANGES_PASSWORD:
665  {
666  Sequence <sal_Int8> aNew;
667  if(rValue >>= aNew)
668  {
670  if(aNew.hasElements())
671  {
673  eMode |= RedlineFlags::On;
675  }
676  }
677  }
678  break;
679  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
680  {
681  bool bTmp = *o3tl::doAccess<bool>(rValue);
683  }
684  break;
685  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
686  {
687  bool bTmp = *o3tl::doAccess<bool>(rValue);
689  }
690  break;
691  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
692  {
693  bool bTmp = *o3tl::doAccess<bool>(rValue);
695  }
696  break;
697  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
698  {
699  bool bTmp = *o3tl::doAccess<bool>(rValue);
701  }
702  break;
703  case HANDLE_TABLE_ROW_KEEP:
704  {
705  bool bTmp = *o3tl::doAccess<bool>(rValue);
707  }
708  break;
709  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
710  {
711  bool bTmp = *o3tl::doAccess<bool>(rValue);
713  }
714  break;
715  case HANDLE_LOAD_READONLY:
716  {
717  mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
718  }
719  break;
720  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
721  {
722  bool bTmp = *o3tl::doAccess<bool>(rValue);
724  }
725  break;
726  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
727  {
728  bool bTmp = *o3tl::doAccess<bool>(rValue);
730  }
731  break;
732  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
733  {
734  bool bTmp = *o3tl::doAccess<bool>(rValue);
736  }
737  break;
738  case HANDLE_USE_OLD_PRINTER_METRICS:
739  // ignore - this is a dead property
740  break;
741  case HANDLE_TABS_RELATIVE_TO_INDENT:
742  {
743  bool bTmp = *o3tl::doAccess<bool>(rValue);
745  }
746  break;
747  case HANDLE_RSID:
748  {
749  sal_uInt32 nTmp = 0;
750  rValue >>= nTmp;
751  mpDoc->setRsid( nTmp );
752  }
753  break;
754  case HANDLE_RSID_ROOT:
755  {
756  sal_uInt32 nTmp = 0;
757  rValue >>= nTmp;
758  mpDoc->setRsidRoot( nTmp );
759  }
760  break;
761  case HANDLE_PROTECT_FORM:
762  {
763  bool bTmp = *o3tl::doAccess<bool>(rValue);
765  }
766  break;
767  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
768  {
769  bool bTmp = *o3tl::doAccess<bool>(rValue);
771  }
772  break;
773  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
774  {
775  bool bTmp = *o3tl::doAccess<bool>(rValue);
777  }
778  break;
779  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
780  {
781  bool bTmp = *o3tl::doAccess<bool>(rValue);
783  }
784  break;
785  case HANDLE_MODIFYPASSWORDINFO:
786  {
787  uno::Sequence< beans::PropertyValue > aInfo;
788  if ( !( rValue >>= aInfo ) )
789  throw lang::IllegalArgumentException(
790  "Value of type Sequence<PropertyValue> expected!",
791  uno::Reference< uno::XInterface >(),
792  2 );
793 
794  if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
795  throw beans::PropertyVetoException(
796  "The hash is not allowed to be changed now!",
797  uno::Reference< uno::XInterface >() );
798  }
799  break;
800  case HANDLE_MATH_BASELINE_ALIGNMENT:
801  {
802  bool bTmp = *o3tl::doAccess<bool>(rValue);
804  }
805  break;
806  case HANDLE_INVERT_BORDER_SPACING:
807  {
808  bool bTmp = *o3tl::doAccess<bool>(rValue);
810  }
811  break;
812  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
813  {
814  bool bTmp = *o3tl::doAccess<bool>(rValue);
816  }
817  break;
818  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
819  {
820  bool bTmp = *o3tl::doAccess<bool>(rValue);
822  }
823  break;
824  case HANDLE_TAB_OVERFLOW:
825  {
826  bool bTmp = *o3tl::doAccess<bool>(rValue);
828  }
829  break;
830  case HANDLE_UNBREAKABLE_NUMBERINGS:
831  {
832  bool bTmp = *o3tl::doAccess<bool>(rValue);
834  }
835  break;
836  case HANDLE_STYLES_NODEFAULT:
837  {
838  bool bTmp = *o3tl::doAccess<bool>(rValue);
840  }
841  break;
842  case HANDLE_FLOATTABLE_NOMARGINS:
843  {
844  bool bTmp = *o3tl::doAccess<bool>(rValue);
846  }
847  break;
848  case HANDLE_CLIPPED_PICTURES:
849  {
850  bool bTmp = *o3tl::doAccess<bool>(rValue);
852  }
853  break;
854  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
855  {
856  bool bTmp = *o3tl::doAccess<bool>(rValue);
858  }
859  break;
860  case HANDLE_EMBED_FONTS:
861  {
862  bool bTmp = *o3tl::doAccess<bool>(rValue);
864  }
865  break;
866  case HANDLE_EMBED_USED_FONTS:
867  {
868  bool bTmp = *o3tl::doAccess<bool>(rValue);
870  }
871  break;
872  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
873  {
874  bool bTmp = *o3tl::doAccess<bool>(rValue);
876  }
877  break;
878  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
879  {
880  bool bTmp = *o3tl::doAccess<bool>(rValue);
882  }
883  break;
884  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
885  {
886  bool bTmp = *o3tl::doAccess<bool>(rValue);
888  }
889  break;
890  case HANDLE_EMBED_SYSTEM_FONTS:
891  {
892  bool bTmp = *o3tl::doAccess<bool>(rValue);
894  }
895  break;
896  case HANDLE_TAB_OVER_MARGIN:
897  {
898  bool bTmp = *o3tl::doAccess<bool>(rValue);
900  }
901  break;
902  case HANDLE_TAB_OVER_SPACING:
903  {
904  bool bTmp = *o3tl::doAccess<bool>(rValue);
906  }
907  break;
908  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
909  {
910  bool bTmp = *o3tl::doAccess<bool>(rValue);
912  }
913  break;
914  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
915  {
916  bool bTmp = *o3tl::doAccess<bool>(rValue);
918  }
919  break;
920  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
921  {
922  bool bTmp = *o3tl::doAccess<bool>(rValue);
924  }
925  break;
926  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
927  {
928  bool bTmp;
929  if (rValue >>= bTmp)
930  {
933  }
934  }
935  break;
936  case HANDLE_SUBTRACT_FLYS:
937  {
938  bool bTmp;
939  if (rValue >>= bTmp)
940  {
943  }
944  }
945  break;
946  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
947  {
948  bool bTmp;
949  if (rValue >>= bTmp)
950  {
953  }
954  }
955  break;
956  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
957  {
958  bool bTmp;
959  if (rValue >>= bTmp)
960  {
962  bTmp);
963  }
964  }
965  break;
966  case HANDLE_CONTINUOUS_ENDNOTES:
967  {
968  bool bTmp;
969  if (rValue >>= bTmp)
970  {
972  bTmp);
973  }
974  }
975  break;
976  case HANDLE_PROTECT_BOOKMARKS:
977  {
978  bool bTmp;
979  if (rValue >>= bTmp)
980  {
982  bTmp);
983  }
984  }
985  break;
986  case HANDLE_PROTECT_FIELDS:
987  {
988  bool bTmp;
989  if (rValue >>= bTmp)
990  {
992  bTmp);
993  }
994  }
995  break;
996  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
997  {
998  bool bTmp;
999  if (rValue >>= bTmp)
1000  {
1003  }
1004  }
1005  break;
1006  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1007  {
1008  bool bTmp;
1009  if (rValue >>= bTmp)
1010  {
1013  }
1014  }
1015  break;
1016  case HANDLE_GUTTER_AT_TOP:
1017  {
1018  bool bTmp;
1019  if (rValue >>= bTmp)
1020  {
1022  }
1023  }
1024  break;
1025  case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1026  {
1027  bool bTmp;
1028  if (rValue >>= bTmp)
1029  {
1032  }
1033  }
1034  break;
1035  case HANDLE_IMAGE_PREFERRED_DPI:
1036  {
1037  sal_uInt32 nValue = 0;
1038  if (rValue >>= nValue)
1039  {
1041  }
1042  }
1043  break;
1044  case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1045  {
1046  bool bTmp;
1047  if (rValue >>= bTmp)
1048  {
1051  }
1052  }
1053  break;
1054  default:
1055  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1056  }
1057 }
1058 
1060 {
1061  // set printer only once, namely here!
1062  if( mpPrinter != nullptr )
1063  {
1064  // #i86352# the printer is also used as container for options by sfx
1065  // when setting a printer it should have decent default options
1066  SfxItemSet aOptions( mpPrinter->GetOptions() );
1068  SwAddPrinterItem aAddPrinterItem (aPrtData);
1069  aOptions.Put(aAddPrinterItem);
1070  mpPrinter->SetOptions( aOptions );
1071  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1072 
1074  }
1075 
1076  mpPrinter = nullptr;
1077  mpDocSh = nullptr;
1078  mpDoc = nullptr;
1079 }
1080 
1082 {
1084  if (nullptr == mpDocSh)
1085  throw UnknownPropertyException();
1086  mpDoc = mpDocSh->GetDoc();
1087  if (nullptr == mpDoc)
1088  throw UnknownPropertyException();
1089 }
1090 
1092 {
1093  switch( rInfo.mnHandle )
1094  {
1095  case HANDLE_FORBIDDEN_CHARS:
1096  {
1097  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1098  rValue <<= xRet;
1099  }
1100  break;
1101  case HANDLE_LINK_UPDATE_MODE:
1102  {
1103  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1104  }
1105  break;
1106  case HANDLE_FIELD_AUTO_UPDATE:
1107  {
1109  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1110  }
1111  break;
1112  case HANDLE_CHART_AUTO_UPDATE:
1113  {
1115  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1116  }
1117  break;
1118  case HANDLE_ADD_PARA_TABLE_SPACING:
1119  {
1121  }
1122  break;
1123  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1124  {
1126  }
1127  break;
1128  case HANDLE_ALIGN_TAB_STOP_POSITION:
1129  {
1131  }
1132  break;
1133  case HANDLE_PRINTER_NAME:
1134  {
1135  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1136  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1137  }
1138  break;
1139  case HANDLE_PRINTER_SETUP:
1140  {
1141  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1142  if (pPrinter)
1143  {
1144  SvMemoryStream aStream;
1145  pPrinter->Store( aStream );
1146  sal_uInt32 nSize = aStream.TellEnd();
1147  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1148  Sequence < sal_Int8 > aSequence( nSize );
1149  aStream.ReadBytes(aSequence.getArray(), nSize);
1150  rValue <<= aSequence;
1151  }
1152  else
1153  {
1154  Sequence < sal_Int8 > aSequence ( 0 );
1155  rValue <<= aSequence;
1156  }
1157  }
1158  break;
1159  case HANDLE_PRINTER_PAPER:
1160  {
1161  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1162  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1163  }
1164  break;
1165  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1166  {
1168  }
1169  break;
1170  case HANDLE_APPLY_USER_DATA:
1171  {
1172  rValue <<= mpDocSh->IsUseUserData();
1173  }
1174  break;
1175  case HANDLE_SAVE_THUMBNAIL:
1176  {
1177  rValue <<= mpDocSh->IsUseThumbnailSave();
1178  }
1179  break;
1180  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1181  {
1182  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1183  }
1184  break;
1185  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1186  {
1188  }
1189  break;
1190  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1191  {
1192  const SwDBData& rData = mpDoc->GetDBData();
1193  rValue <<= rData.sDataSource;
1194  }
1195  break;
1196  case HANDLE_CURRENT_DATABASE_COMMAND:
1197  {
1198  const SwDBData& rData = mpDoc->GetDBData();
1199  rValue <<= rData.sCommand;
1200  }
1201  break;
1202  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1203  {
1204  const SwDBData& rData = mpDoc->GetDBData();
1205  rValue <<= rData.nCommandType;
1206  }
1207  break;
1208  case HANDLE_EMBEDDED_DATABASE_NAME:
1209  {
1210 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1211  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1212 #else
1213  rValue = uno::Any();
1214 #endif
1215  }
1216  break;
1217  case HANDLE_SAVE_VERSION_ON_CLOSE:
1218  {
1219  rValue <<= mpDocSh->IsSaveVersionOnClose();
1220  }
1221  break;
1222  case HANDLE_UPDATE_FROM_TEMPLATE:
1223  {
1224  rValue <<= mpDocSh->IsQueryLoadTemplate();
1225  }
1226  break;
1227  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1228  {
1229  // returns short (see css.document.PrinterIndependentLayout)
1232  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1233  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1234  document::PrinterIndependentLayout::DISABLED;
1235  rValue <<= nVirDevType;
1236  }
1237  break;
1238  case HANDLE_IS_LABEL_DOC:
1239  {
1241  rValue <<= bLabel;
1242  }
1243  break;
1244  case HANDLE_IS_ADD_FLY_OFFSET:
1245  {
1247  }
1248  break;
1249  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1250  {
1252  }
1253  break;
1254  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1255  {
1257  }
1258  break;
1259  case HANDLE_OLD_NUMBERING:
1260  {
1262  }
1263  break;
1264  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1265  {
1266  rValue <<= false;
1267  }
1268  break;
1269  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1270  {
1271  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1272  }
1273  break;
1274  case HANDLE_USE_FORMER_LINE_SPACING:
1275  {
1277  }
1278  break;
1279  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1280  {
1282  }
1283  break;
1284  case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
1285  {
1287  }
1288  break;
1289  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1290  {
1292  }
1293  break;
1294  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1295  {
1297  }
1298  break;
1299  case HANDLE_CHANGES_PASSWORD:
1300  {
1302  }
1303  break;
1304  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1305  {
1307  }
1308  break;
1309  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1310  {
1312  }
1313  break;
1314  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1315  {
1317  }
1318  break;
1319  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1320  {
1322  }
1323  break;
1324  case HANDLE_TABLE_ROW_KEEP :
1325  {
1327  }
1328  break;
1329  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1330  {
1332  }
1333  break;
1334  case HANDLE_LOAD_READONLY:
1335  {
1336  rValue <<= mpDocSh->IsLoadReadonly();
1337  }
1338  break;
1339  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1340  {
1342  }
1343  break;
1344  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1345  {
1347  }
1348  break;
1349  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1350  {
1352  }
1353  break;
1354  case HANDLE_USE_OLD_PRINTER_METRICS:
1355  {
1356  rValue <<= false;
1357  }
1358  break;
1359  case HANDLE_TABS_RELATIVE_TO_INDENT:
1360  {
1362  }
1363  break;
1364  case HANDLE_RSID:
1365  {
1366  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1367  }
1368  break;
1369  case HANDLE_RSID_ROOT:
1370  {
1371  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1372  }
1373  break;
1374  case HANDLE_PROTECT_FORM:
1375  {
1377  }
1378  break;
1379  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1380  {
1382  }
1383  break;
1384  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1385  {
1387  }
1388  break;
1389  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1390  {
1392  }
1393  break;
1394  case HANDLE_MODIFYPASSWORDINFO:
1395  {
1396  rValue <<= mpDocSh->GetModifyPasswordInfo();
1397  }
1398  break;
1399  case HANDLE_MATH_BASELINE_ALIGNMENT:
1400  {
1402  }
1403  break;
1404  case HANDLE_INVERT_BORDER_SPACING:
1405  {
1407  }
1408  break;
1409  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1410  {
1412  }
1413  break;
1414  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1415  {
1417  }
1418  break;
1419  case HANDLE_TAB_OVERFLOW:
1420  {
1422  }
1423  break;
1424  case HANDLE_UNBREAKABLE_NUMBERINGS:
1425  {
1427  }
1428  break;
1429  case HANDLE_STYLES_NODEFAULT:
1430  {
1432  }
1433  break;
1434  case HANDLE_FLOATTABLE_NOMARGINS:
1435  {
1437  }
1438  break;
1439  case HANDLE_CLIPPED_PICTURES:
1440  {
1442  }
1443  break;
1444  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1445  {
1447  }
1448  break;
1449  case HANDLE_EMBED_FONTS:
1450  {
1452  }
1453  break;
1454  case HANDLE_EMBED_USED_FONTS:
1455  {
1457  }
1458  break;
1459  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1460  {
1462  }
1463  break;
1464  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1465  {
1467  }
1468  break;
1469  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1470  {
1472  }
1473  break;
1474  case HANDLE_EMBED_SYSTEM_FONTS:
1475  {
1477  }
1478  break;
1479  case HANDLE_TAB_OVER_MARGIN:
1480  {
1482  }
1483  break;
1484  case HANDLE_TAB_OVER_SPACING:
1485  {
1487  }
1488  break;
1489  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1490  {
1492  }
1493  break;
1494  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1495  {
1497  }
1498  break;
1499  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1500  {
1502  }
1503  break;
1504  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1505  {
1507  }
1508  break;
1509  case HANDLE_SUBTRACT_FLYS:
1510  {
1512  }
1513  break;
1514  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1515  {
1517  }
1518  break;
1519  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1520  {
1521  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1523  }
1524  break;
1525  case HANDLE_CONTINUOUS_ENDNOTES:
1526  {
1527  rValue
1529  }
1530  break;
1531  case HANDLE_PROTECT_BOOKMARKS:
1532  {
1533  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1535  }
1536  break;
1537  case HANDLE_PROTECT_FIELDS:
1538  {
1539  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1541  }
1542  break;
1543  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1544  {
1545  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1547  }
1548  break;
1549  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1550  {
1551  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1553  }
1554  break;
1555  case HANDLE_GUTTER_AT_TOP:
1556  {
1558  }
1559  break;
1560  case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1561  {
1562  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1564  }
1565  break;
1566  case HANDLE_IMAGE_PREFERRED_DPI:
1567  {
1569  }
1570  break;
1571  case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1572  {
1573  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1575  }
1576  break;
1577  default:
1578  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1579  }
1580 }
1581 
1583 {
1584  mpDocSh = nullptr;
1585  mpDoc = nullptr;
1586 }
1587 
1588 // XServiceInfo
1590 {
1591  return "SwXDocumentSettings";
1592 }
1593 
1594 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1595 {
1596  return cppu::supportsService(this, ServiceName);
1597 }
1598 
1600 {
1601  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1602 }
1603 
1604 /* 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
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
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
sal_uInt32 getRsidRoot() const
Definition: doc.cxx:216
virtual void setImagePreferredDPI(sal_Int32 nValue)=0
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.
virtual void SAL_CALL release() noexcept override
const ContentProperties & rData
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:402
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:766
virtual sal_uInt64 TellEnd() override
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
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:3138
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
SwDocumentSettingsPropertyHandles
virtual sal_Int32 getImagePreferredDPI()=0
virtual CharCompressType getCharacterCompressionType() const =0
Get the character compression type for Asian characters.
const SfxItemSet & GetOptions() const
void ChgHyphenation()
Definition: viewsh.hxx:208
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
SwDBData const & GetDBData()
Definition: docfld.cxx:371
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
#define STREAM_SEEK_TO_BEGIN
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
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:465
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
static rtl::Reference< MasterPropertySetInfo > lcl_createSettingsInfo()
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.
void registerSlave(ChainablePropertySet *pNewSet) noexcept
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void SAL_CALL acquire() noexcept override
virtual ~SwXDocumentSettings() noexcept override
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:670
void SetOptions(const SfxItemSet &rNewOptions)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
sal_Int16 nValue
virtual void _preSetValues() override
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3159