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