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_TAB_OVER_SPACING,
138  HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
139  HANDLE_SURROUND_TEXT_WRAP_SMALL,
140  HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
141  HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
142  HANDLE_SUBTRACT_FLYS,
143  HANDLE_DISABLE_OFF_PAGE_POSITIONING,
144  HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
145  HANDLE_CONTINUOUS_ENDNOTES,
146  HANDLE_PROTECT_BOOKMARKS,
147  HANDLE_PROTECT_FIELDS,
148  HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
149  HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
150  HANDLE_GUTTER_AT_TOP,
151 };
152 
153 }
154 
156 {
157  static PropertyInfo const aWriterSettingsInfoMap[] =
158  {
159  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
160  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
161  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
162  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
163  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
164  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
165  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
166  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
167  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
168  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
169  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
170  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
171  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
172  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
173  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
174  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
175  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
176  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
177  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
178  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
179  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
180 
181  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
182  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
183  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
184  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
185  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
186  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
187  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
188  /* Stampit It disable the print cancel button of the shown progress dialog. */
189  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
190  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
191  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
192  { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
193  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
194  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
195  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
196  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
197  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
198  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
199  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
200  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
201  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
202  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
203  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
204  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
205  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
206  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
207  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
208  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
209  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
210  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
211  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
212  { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
213  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
214  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
215  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
216  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
217  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
218  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
219  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
220  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
221  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
222  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
223  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
224  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
225  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
226  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
227  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
228  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
229  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
230  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
231  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
232  { OUString("TabOverSpacing"), HANDLE_TAB_OVER_SPACING, cppu::UnoType<bool>::get(), 0},
233  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
234  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
235  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
236  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
237  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
238  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
239  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
240  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
241  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
242  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
243  { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
244  { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
245  { OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
246 
247 /*
248  * As OS said, we don't have a view when we need to set this, so I have to
249  * find another solution before adding them to this property set - MTG
250  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
251  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
252  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
253  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
254  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
255  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
256  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
257 
258  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
259  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
260  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
261  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
262  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
263  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
264  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
265 
266  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
267  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
268  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
269  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
270 */
271  { OUString(), 0, css::uno::Type(), 0}
272  };
273  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
274 }
275 
278  &Application::GetSolarMutex () )
279 , mpModel ( pModel )
280 , mpDocSh ( nullptr )
281 , mpDoc ( nullptr )
282 , mpPrinter( nullptr )
283 , mbPreferPrinterPapersize( false )
284 {
286 }
287 
289  noexcept
290 {
291 }
292 
294 {
295  return ::cppu::queryInterface(rType,
296  // OWeakObject interfaces
297  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
298  &dynamic_cast<XWeak&>(*this),
299  // my own interfaces
300  &dynamic_cast<XPropertySet&>(*this),
301  &dynamic_cast<XPropertyState&>(*this),
302  &dynamic_cast<XMultiPropertySet&>(*this),
303  &dynamic_cast<XServiceInfo&>(*this),
304  &dynamic_cast<XTypeProvider&>(*this));
305 }
307  noexcept
308 {
309  OWeakObject::acquire();
310 }
312  noexcept
313 {
314  OWeakObject::release();
315 }
316 
317 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
318 {
319  static const uno::Sequence< uno::Type > aTypes {
320  // from MasterPropertySet
326  };
327  return aTypes;
328 }
329 
330 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
331 {
332  return css::uno::Sequence<sal_Int8>();
333 }
334 
336 {
338  if (nullptr == mpDocSh)
339  throw UnknownPropertyException();
340 
341  mpDoc = mpDocSh->GetDoc();
342  if (nullptr == mpDoc)
343  throw UnknownPropertyException();
344 }
345 
347 {
348  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
349  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
350 
351  switch( rInfo.mnHandle )
352  {
353  case HANDLE_FORBIDDEN_CHARS:
354  break;
355  case HANDLE_LINK_UPDATE_MODE:
356  {
357  sal_Int16 nMode = 0;
358  rValue >>= nMode;
359  switch (nMode)
360  {
361  case NEVER:
362  case MANUAL:
363  case AUTOMATIC:
364  case GLOBALSETTING:
365  break;
366  default:
367  throw IllegalArgumentException();
368  }
370  }
371  break;
372  case HANDLE_FIELD_AUTO_UPDATE:
373  {
374  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
377  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
380  AUTOUPD_OFF );
381  }
382  break;
383  case HANDLE_CHART_AUTO_UPDATE:
384  {
385  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
388  bUpdateChart ?
391  AUTOUPD_OFF );
392  }
393  break;
394  case HANDLE_ADD_PARA_TABLE_SPACING:
395  {
396  bool bParaSpace = false;
397  rValue >>= bParaSpace;
399  }
400  break;
401  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
402  {
403  bool bParaSpacePage = false;
404  rValue >>= bParaSpacePage;
406  }
407  break;
408  case HANDLE_ALIGN_TAB_STOP_POSITION:
409  {
410  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
412  }
413  break;
414  case HANDLE_PRINTER_NAME:
415  {
416  //the printer must be created
417  OUString sPrinterName;
418  if( !(rValue >>= sPrinterName) )
419  throw IllegalArgumentException();
420 
421  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
422  {
423  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
424  if ( pPrinter->GetName() != sPrinterName )
425  {
426  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
427  assert (! pNewPrinter->isDisposed() );
428  if( pNewPrinter->IsKnown() )
429  {
430  // set printer only once; in _postSetValues
431  mpPrinter = pNewPrinter;
432  }
433  else
434  {
435  pNewPrinter.disposeAndClear();
436  }
437  }
438  }
439 
440  }
441  break;
442  case HANDLE_PRINTER_SETUP:
443  {
444  Sequence < sal_Int8 > aSequence;
445  if ( !(rValue >>= aSequence) )
446  throw IllegalArgumentException();
447 
448  sal_uInt32 nSize = aSequence.getLength();
449  if( nSize > 0 )
450  {
451  SvMemoryStream aStream (aSequence.getArray(), nSize,
452  StreamMode::READ );
453  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
454  auto pItemSet = std::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), svl::Items<
455  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
456  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
457  SID_HTML_MODE, SID_HTML_MODE,
458  FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER> );
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_TAB_OVER_SPACING:
896  {
897  bool bTmp = *o3tl::doAccess<bool>(rValue);
899  }
900  break;
901  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
902  {
903  bool bTmp = *o3tl::doAccess<bool>(rValue);
905  }
906  break;
907  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
908  {
909  bool bTmp = *o3tl::doAccess<bool>(rValue);
911  }
912  break;
913  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
914  {
915  bool bTmp = *o3tl::doAccess<bool>(rValue);
917  }
918  break;
919  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
920  {
921  bool bTmp;
922  if (rValue >>= bTmp)
923  {
926  }
927  }
928  break;
929  case HANDLE_SUBTRACT_FLYS:
930  {
931  bool bTmp;
932  if (rValue >>= bTmp)
933  {
936  }
937  }
938  break;
939  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
940  {
941  bool bTmp;
942  if (rValue >>= bTmp)
943  {
946  }
947  }
948  break;
949  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
950  {
951  bool bTmp;
952  if (rValue >>= bTmp)
953  {
955  bTmp);
956  }
957  }
958  break;
959  case HANDLE_CONTINUOUS_ENDNOTES:
960  {
961  bool bTmp;
962  if (rValue >>= bTmp)
963  {
965  bTmp);
966  }
967  }
968  break;
969  case HANDLE_PROTECT_BOOKMARKS:
970  {
971  bool bTmp;
972  if (rValue >>= bTmp)
973  {
975  bTmp);
976  }
977  }
978  break;
979  case HANDLE_PROTECT_FIELDS:
980  {
981  bool bTmp;
982  if (rValue >>= bTmp)
983  {
985  bTmp);
986  }
987  }
988  break;
989  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
990  {
991  bool bTmp;
992  if (rValue >>= bTmp)
993  {
996  }
997  }
998  break;
999  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1000  {
1001  bool bTmp;
1002  if (rValue >>= bTmp)
1003  {
1006  }
1007  }
1008  break;
1009  case HANDLE_GUTTER_AT_TOP:
1010  {
1011  bool bTmp;
1012  if (rValue >>= bTmp)
1013  {
1015  }
1016  }
1017  break;
1018  default:
1019  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1020  }
1021 }
1022 
1024 {
1025  // set printer only once, namely here!
1026  if( mpPrinter != nullptr )
1027  {
1028  // #i86352# the printer is also used as container for options by sfx
1029  // when setting a printer it should have decent default options
1030  SfxItemSet aOptions( mpPrinter->GetOptions() );
1032  SwAddPrinterItem aAddPrinterItem (aPrtData);
1033  aOptions.Put(aAddPrinterItem);
1034  mpPrinter->SetOptions( aOptions );
1035  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1036 
1038  }
1039 
1040  mpPrinter = nullptr;
1041  mpDocSh = nullptr;
1042  mpDoc = nullptr;
1043 }
1044 
1046 {
1048  if (nullptr == mpDocSh)
1049  throw UnknownPropertyException();
1050  mpDoc = mpDocSh->GetDoc();
1051  if (nullptr == mpDoc)
1052  throw UnknownPropertyException();
1053 }
1054 
1056 {
1057  switch( rInfo.mnHandle )
1058  {
1059  case HANDLE_FORBIDDEN_CHARS:
1060  {
1061  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1062  rValue <<= xRet;
1063  }
1064  break;
1065  case HANDLE_LINK_UPDATE_MODE:
1066  {
1067  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1068  }
1069  break;
1070  case HANDLE_FIELD_AUTO_UPDATE:
1071  {
1073  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1074  }
1075  break;
1076  case HANDLE_CHART_AUTO_UPDATE:
1077  {
1079  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1080  }
1081  break;
1082  case HANDLE_ADD_PARA_TABLE_SPACING:
1083  {
1085  }
1086  break;
1087  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1088  {
1090  }
1091  break;
1092  case HANDLE_ALIGN_TAB_STOP_POSITION:
1093  {
1095  }
1096  break;
1097  case HANDLE_PRINTER_NAME:
1098  {
1099  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1100  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1101  }
1102  break;
1103  case HANDLE_PRINTER_SETUP:
1104  {
1105  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1106  if (pPrinter)
1107  {
1108  SvMemoryStream aStream;
1109  pPrinter->Store( aStream );
1110  sal_uInt32 nSize = aStream.TellEnd();
1111  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1112  Sequence < sal_Int8 > aSequence( nSize );
1113  aStream.ReadBytes(aSequence.getArray(), nSize);
1114  rValue <<= aSequence;
1115  }
1116  else
1117  {
1118  Sequence < sal_Int8 > aSequence ( 0 );
1119  rValue <<= aSequence;
1120  }
1121  }
1122  break;
1123  case HANDLE_PRINTER_PAPER:
1124  {
1125  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1126  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1127  }
1128  break;
1129  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1130  {
1132  }
1133  break;
1134  case HANDLE_APPLY_USER_DATA:
1135  {
1136  rValue <<= mpDocSh->IsUseUserData();
1137  }
1138  break;
1139  case HANDLE_SAVE_THUMBNAIL:
1140  {
1141  rValue <<= mpDocSh->IsUseThumbnailSave();
1142  }
1143  break;
1144  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1145  {
1146  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1147  }
1148  break;
1149  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1150  {
1152  }
1153  break;
1154  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1155  {
1156  const SwDBData& rData = mpDoc->GetDBData();
1157  rValue <<= rData.sDataSource;
1158  }
1159  break;
1160  case HANDLE_CURRENT_DATABASE_COMMAND:
1161  {
1162  const SwDBData& rData = mpDoc->GetDBData();
1163  rValue <<= rData.sCommand;
1164  }
1165  break;
1166  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1167  {
1168  const SwDBData& rData = mpDoc->GetDBData();
1169  rValue <<= rData.nCommandType;
1170  }
1171  break;
1172  case HANDLE_EMBEDDED_DATABASE_NAME:
1173  {
1174 #if HAVE_FEATURE_DBCONNECTIVITY
1175  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1176 #else
1177  rValue = uno::Any();
1178 #endif
1179  }
1180  break;
1181  case HANDLE_SAVE_VERSION_ON_CLOSE:
1182  {
1183  rValue <<= mpDocSh->IsSaveVersionOnClose();
1184  }
1185  break;
1186  case HANDLE_UPDATE_FROM_TEMPLATE:
1187  {
1188  rValue <<= mpDocSh->IsQueryLoadTemplate();
1189  }
1190  break;
1191  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1192  {
1193  // returns short (see css.document.PrinterIndependentLayout)
1196  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1197  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1198  document::PrinterIndependentLayout::DISABLED;
1199  rValue <<= nVirDevType;
1200  }
1201  break;
1202  case HANDLE_IS_LABEL_DOC:
1203  {
1205  rValue <<= bLabel;
1206  }
1207  break;
1208  case HANDLE_IS_ADD_FLY_OFFSET:
1209  {
1211  }
1212  break;
1213  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1214  {
1216  }
1217  break;
1218  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1219  {
1221  }
1222  break;
1223  case HANDLE_OLD_NUMBERING:
1224  {
1226  }
1227  break;
1228  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1229  {
1230  rValue <<= false;
1231  }
1232  break;
1233  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1234  {
1235  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1236  }
1237  break;
1238  case HANDLE_USE_FORMER_LINE_SPACING:
1239  {
1241  }
1242  break;
1243  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1244  {
1246  }
1247  break;
1248  case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
1249  {
1251  }
1252  break;
1253  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1254  {
1256  }
1257  break;
1258  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1259  {
1261  }
1262  break;
1263  case HANDLE_CHANGES_PASSWORD:
1264  {
1266  }
1267  break;
1268  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1269  {
1271  }
1272  break;
1273  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1274  {
1276  }
1277  break;
1278  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1279  {
1281  }
1282  break;
1283  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1284  {
1286  }
1287  break;
1288  case HANDLE_TABLE_ROW_KEEP :
1289  {
1291  }
1292  break;
1293  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1294  {
1296  }
1297  break;
1298  case HANDLE_LOAD_READONLY:
1299  {
1300  rValue <<= mpDocSh->IsLoadReadonly();
1301  }
1302  break;
1303  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1304  {
1306  }
1307  break;
1308  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1309  {
1311  }
1312  break;
1313  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1314  {
1316  }
1317  break;
1318  case HANDLE_USE_OLD_PRINTER_METRICS:
1319  {
1320  rValue <<= false;
1321  }
1322  break;
1323  case HANDLE_TABS_RELATIVE_TO_INDENT:
1324  {
1326  }
1327  break;
1328  case HANDLE_RSID:
1329  {
1330  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1331  }
1332  break;
1333  case HANDLE_RSID_ROOT:
1334  {
1335  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1336  }
1337  break;
1338  case HANDLE_PROTECT_FORM:
1339  {
1341  }
1342  break;
1343  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1344  {
1346  }
1347  break;
1348  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1349  {
1351  }
1352  break;
1353  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1354  {
1356  }
1357  break;
1358  case HANDLE_MODIFYPASSWORDINFO:
1359  {
1360  rValue <<= mpDocSh->GetModifyPasswordInfo();
1361  }
1362  break;
1363  case HANDLE_MATH_BASELINE_ALIGNMENT:
1364  {
1366  }
1367  break;
1368  case HANDLE_INVERT_BORDER_SPACING:
1369  {
1371  }
1372  break;
1373  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1374  {
1376  }
1377  break;
1378  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1379  {
1381  }
1382  break;
1383  case HANDLE_TAB_OVERFLOW:
1384  {
1386  }
1387  break;
1388  case HANDLE_UNBREAKABLE_NUMBERINGS:
1389  {
1391  }
1392  break;
1393  case HANDLE_STYLES_NODEFAULT:
1394  {
1396  }
1397  break;
1398  case HANDLE_FLOATTABLE_NOMARGINS:
1399  {
1401  }
1402  break;
1403  case HANDLE_CLIPPED_PICTURES:
1404  {
1406  }
1407  break;
1408  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1409  {
1411  }
1412  break;
1413  case HANDLE_EMBED_FONTS:
1414  {
1416  }
1417  break;
1418  case HANDLE_EMBED_USED_FONTS:
1419  {
1421  }
1422  break;
1423  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1424  {
1426  }
1427  break;
1428  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1429  {
1431  }
1432  break;
1433  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1434  {
1436  }
1437  break;
1438  case HANDLE_EMBED_SYSTEM_FONTS:
1439  {
1441  }
1442  break;
1443  case HANDLE_TAB_OVER_MARGIN:
1444  {
1446  }
1447  break;
1448  case HANDLE_TAB_OVER_SPACING:
1449  {
1451  }
1452  break;
1453  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1454  {
1456  }
1457  break;
1458  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1459  {
1461  }
1462  break;
1463  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1464  {
1466  }
1467  break;
1468  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1469  {
1471  }
1472  break;
1473  case HANDLE_SUBTRACT_FLYS:
1474  {
1476  }
1477  break;
1478  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1479  {
1481  }
1482  break;
1483  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1484  {
1485  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1487  }
1488  break;
1489  case HANDLE_CONTINUOUS_ENDNOTES:
1490  {
1491  rValue
1493  }
1494  break;
1495  case HANDLE_PROTECT_BOOKMARKS:
1496  {
1497  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1499  }
1500  break;
1501  case HANDLE_PROTECT_FIELDS:
1502  {
1503  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1505  }
1506  break;
1507  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1508  {
1509  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1511  }
1512  break;
1513  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1514  {
1515  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1517  }
1518  break;
1519  case HANDLE_GUTTER_AT_TOP:
1520  {
1522  }
1523  break;
1524  default:
1525  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1526  }
1527 }
1528 
1530 {
1531  mpDocSh = nullptr;
1532  mpDoc = nullptr;
1533 }
1534 
1535 // XServiceInfo
1537 {
1538  return "SwXDocumentSettings";
1539 }
1540 
1541 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1542 {
1543  return cppu::supportsService(this, ServiceName);
1544 }
1545 
1547 {
1548  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1549 }
1550 
1551 /* 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
static constexpr auto Items
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.
virtual void SAL_CALL release() noexcept override
const ContentProperties & rData
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:407
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:765
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 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:203
SwDBData const & GetDBData()
Definition: docfld.cxx:370
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
virtual void _preSetValues() override
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3159