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_USE_FORMER_OBJECT_POSITIONING,
98  HANDLE_USE_FORMER_TEXT_WRAPPING,
99  HANDLE_CHANGES_PASSWORD,
100  HANDLE_CONSIDER_WRAP_ON_OBJPOS,
101  HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
102  HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
103  HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
104  HANDLE_TABLE_ROW_KEEP,
105  HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
106  HANDLE_LOAD_READONLY,
107  HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
108  HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
109  HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
110  HANDLE_USE_OLD_PRINTER_METRICS,
111  HANDLE_PROTECT_FORM,
112  HANDLE_MS_WORD_COMP_TRAILING_BLANKS,
113  HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
114  HANDLE_TABS_RELATIVE_TO_INDENT,
115  HANDLE_RSID,
116  HANDLE_RSID_ROOT,
117  HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
118  HANDLE_MODIFYPASSWORDINFO,
119  HANDLE_MATH_BASELINE_ALIGNMENT,
120  HANDLE_INVERT_BORDER_SPACING,
121  HANDLE_COLLAPSE_EMPTY_CELL_PARA,
122  HANDLE_SMALL_CAPS_PERCENTAGE_66,
123  HANDLE_TAB_OVERFLOW,
124  HANDLE_UNBREAKABLE_NUMBERINGS,
125  HANDLE_STYLES_NODEFAULT,
126  HANDLE_FLOATTABLE_NOMARGINS,
127  HANDLE_CLIPPED_PICTURES,
128  HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
129  HANDLE_EMBED_FONTS,
130  HANDLE_EMBED_USED_FONTS,
131  HANDLE_EMBED_LATIN_SCRIPT_FONTS,
132  HANDLE_EMBED_ASIAN_SCRIPT_FONTS,
133  HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
134  HANDLE_EMBED_SYSTEM_FONTS,
135  HANDLE_TAB_OVER_MARGIN,
136  HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
137  HANDLE_SURROUND_TEXT_WRAP_SMALL,
138  HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
139  HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
140  HANDLE_SUBTRACT_FLYS,
141  HANDLE_DISABLE_OFF_PAGE_POSITIONING,
142  HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
143  HANDLE_CONTINUOUS_ENDNOTES,
144  HANDLE_PROTECT_BOOKMARKS,
145  HANDLE_PROTECT_FIELDS,
146  HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
147  HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
148 };
149 
150 }
151 
153 {
154  static PropertyInfo const aWriterSettingsInfoMap[] =
155  {
156  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
157  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
158  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
159  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
160  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
161  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
162  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
163  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
164  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
165  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
166  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
167  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
168  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
169  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
170  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
171  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
172  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
173  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
174  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
175  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
176  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
177 
178  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
179  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
180  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
181  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
182  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
183  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
184  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
185  /* Stampit It disable the print cancel button of the shown progress dialog. */
186  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
187  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
188  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
189  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
190  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
191  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
192  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
193  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
194  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
195  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
196  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
197  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
198  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
199  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
200  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
201  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
202  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
203  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
204  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
205  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
206  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
207  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
208  { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
209  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
210  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
211  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
212  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
213  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
214  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
215  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
216  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
217  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
218  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
219  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
220  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
221  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
222  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
223  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
224  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
225  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
226  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
227  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
228  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
229  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
230  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
231  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
232  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
233  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
234  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
235  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
236  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
237  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
238  { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
239  { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
240 
241 /*
242  * As OS said, we don't have a view when we need to set this, so I have to
243  * find another solution before adding them to this property set - MTG
244  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
245  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
246  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
247  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
248  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
249  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
250  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
251 
252  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
253  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
254  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
255  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
256  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
257  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
258  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
259 
260  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
261  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
262  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
263  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
264 */
265  { OUString(), 0, css::uno::Type(), 0}
266  };
267  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
268 }
269 
272  &Application::GetSolarMutex () )
273 , mpModel ( pModel )
274 , mpDocSh ( nullptr )
275 , mpDoc ( nullptr )
276 , mpPrinter( nullptr )
277 , mbPreferPrinterPapersize( false )
278 {
280 }
281 
283  throw()
284 {
285 }
286 
288 {
289  return ::cppu::queryInterface(rType,
290  // OWeakObject interfaces
291  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
292  &dynamic_cast<XWeak&>(*this),
293  // my own interfaces
294  &dynamic_cast<XPropertySet&>(*this),
295  &dynamic_cast<XPropertyState&>(*this),
296  &dynamic_cast<XMultiPropertySet&>(*this),
297  &dynamic_cast<XServiceInfo&>(*this),
298  &dynamic_cast<XTypeProvider&>(*this));
299 }
301  throw ()
302 {
303  OWeakObject::acquire();
304 }
306  throw ()
307 {
308  OWeakObject::release();
309 }
310 
311 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
312 {
313  static const uno::Sequence< uno::Type > aTypes {
314  // from MasterPropertySet
320  };
321  return aTypes;
322 }
323 
324 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
325 {
326  return css::uno::Sequence<sal_Int8>();
327 }
328 
330 {
332  if (nullptr == mpDocSh)
333  throw UnknownPropertyException();
334 
335  mpDoc = mpDocSh->GetDoc();
336  if (nullptr == mpDoc)
337  throw UnknownPropertyException();
338 }
339 
341 {
342  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
343  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
344 
345  switch( rInfo.mnHandle )
346  {
347  case HANDLE_FORBIDDEN_CHARS:
348  break;
349  case HANDLE_LINK_UPDATE_MODE:
350  {
351  sal_Int16 nMode = 0;
352  rValue >>= nMode;
353  switch (nMode)
354  {
355  case NEVER:
356  case MANUAL:
357  case AUTOMATIC:
358  case GLOBALSETTING:
359  break;
360  default:
361  throw IllegalArgumentException();
362  }
364  }
365  break;
366  case HANDLE_FIELD_AUTO_UPDATE:
367  {
368  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
371  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
374  AUTOUPD_OFF );
375  }
376  break;
377  case HANDLE_CHART_AUTO_UPDATE:
378  {
379  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
382  bUpdateChart ?
385  AUTOUPD_OFF );
386  }
387  break;
388  case HANDLE_ADD_PARA_TABLE_SPACING:
389  {
390  bool bParaSpace = false;
391  rValue >>= bParaSpace;
393  }
394  break;
395  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
396  {
397  bool bParaSpacePage = false;
398  rValue >>= bParaSpacePage;
400  }
401  break;
402  case HANDLE_ALIGN_TAB_STOP_POSITION:
403  {
404  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
406  }
407  break;
408  case HANDLE_PRINTER_NAME:
409  {
410  //the printer must be created
411  OUString sPrinterName;
412  if( !(rValue >>= sPrinterName) )
413  throw IllegalArgumentException();
414 
415  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
416  {
417  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
418  if ( pPrinter->GetName() != sPrinterName )
419  {
420  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
421  assert (! pNewPrinter->isDisposed() );
422  if( pNewPrinter->IsKnown() )
423  {
424  // set printer only once; in _postSetValues
425  mpPrinter = pNewPrinter;
426  }
427  else
428  {
429  pNewPrinter.disposeAndClear();
430  }
431  }
432  }
433 
434  }
435  break;
436  case HANDLE_PRINTER_SETUP:
437  {
438  Sequence < sal_Int8 > aSequence;
439  if ( !(rValue >>= aSequence) )
440  throw IllegalArgumentException();
441 
442  sal_uInt32 nSize = aSequence.getLength();
443  if( nSize > 0 )
444  {
445  SvMemoryStream aStream (aSequence.getArray(), nSize,
446  StreamMode::READ );
447  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
448  static sal_uInt16 const nRange[] =
449  {
451  SID_HTML_MODE, SID_HTML_MODE,
452  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
453  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
454  0
455  };
456  auto pItemSet = std::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), nRange );
457  VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
458  assert (! pPrinter->isDisposed() );
459  // set printer only once; in _postSetValues
461  mpPrinter = pPrinter;
462  }
463 
464  }
465  break;
466  case HANDLE_PRINTER_PAPER:
467  {
468  bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
469  if(!(rValue >>= bPreferPrinterPapersize))
470  throw IllegalArgumentException();
471  mbPreferPrinterPapersize = bPreferPrinterPapersize;
472  }
473  break;
474  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
475  {
476  bool bIsKern = *o3tl::doAccess<bool>(rValue);
478  SwEditShell* pEditSh = mpDoc->GetEditShell();
479  if(pEditSh)
480  pEditSh->ChgHyphenation();
481  }
482  break;
483  case HANDLE_CHARACTER_COMPRESSION_TYPE:
484  {
485  sal_Int16 nMode = 0;
486  rValue >>= nMode;
487  switch (static_cast<CharCompressType>(nMode))
488  {
489  case CharCompressType::NONE:
490  case CharCompressType::PunctuationOnly:
491  case CharCompressType::PunctuationAndKana:
492  break;
493  default:
494  throw IllegalArgumentException();
495  }
496  mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
497  }
498  break;
499  case HANDLE_APPLY_USER_DATA:
500  {
501  mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
502  }
503  break;
504  case HANDLE_SAVE_THUMBNAIL:
505  {
506  mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
507  }
508  break;
509  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
510  {
511  bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
513  }
514  break;
515  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
516  {
518  if ( rValue >>= aData.sDataSource )
519  mpDoc->ChgDBData( aData );
520  }
521  break;
522  case HANDLE_CURRENT_DATABASE_COMMAND:
523  {
525 
526  if ( rValue >>= aData.sCommand )
527  mpDoc->ChgDBData( aData );
528 
529  SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
530  "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
531  }
532  break;
533  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
534  {
536  if ( rValue >>= aData.nCommandType )
537  mpDoc->ChgDBData( aData );
538  SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
539  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
540  SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
541  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
542  }
543  break;
544  case HANDLE_EMBEDDED_DATABASE_NAME:
545  {
546 #if HAVE_FEATURE_DBCONNECTIVITY
547  OUString sEmbeddedName;
548  if (rValue >>= sEmbeddedName)
549  mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
550 #endif
551  }
552  break;
553  case HANDLE_SAVE_VERSION_ON_CLOSE:
554  {
555  mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
556  }
557  break;
558  case HANDLE_UPDATE_FROM_TEMPLATE:
559  {
560  mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
561  }
562  break;
563  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
564  {
565  sal_Int16 nTmp = 0;
566  rValue >>= nTmp;
567 
568  bool bUseVirDev = true;
569  bool bHiResVirDev = true;
570  if( nTmp == document::PrinterIndependentLayout::DISABLED )
571  bUseVirDev = false;
572  else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
573  bHiResVirDev = false;
574  else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
575  throw IllegalArgumentException();
576 
577  mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
578  }
579  break;
580  case HANDLE_IS_LABEL_DOC :
581  {
582  bool bSet = false;
583  if(!(rValue >>= bSet))
584  throw IllegalArgumentException();
586  }
587  break;
588  case HANDLE_IS_ADD_FLY_OFFSET:
589  {
590  bool bTmp = *o3tl::doAccess<bool>(rValue);
592  }
593  break;
594  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
595  {
596  bool bTmp = *o3tl::doAccess<bool>(rValue);
598  }
599  break;
600  case HANDLE_IS_ADD_EXTERNAL_LEADING:
601  {
602  bool bTmp = *o3tl::doAccess<bool>(rValue);
604  }
605  break;
606  case HANDLE_OLD_NUMBERING:
607  {
608  bool bTmp = *o3tl::doAccess<bool>(rValue);
610  }
611  break;
612  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
613  {
614  // ignore - this is a dead property
615  }
616  break;
617  case HANDLE_ALLOW_PRINTJOB_CANCEL:
618  {
619  bool bState = false;
620  if (!(rValue >>= bState))
621  throw IllegalArgumentException();
623  }
624  break;
625  case HANDLE_USE_FORMER_LINE_SPACING:
626  {
627  bool bTmp = *o3tl::doAccess<bool>(rValue);
629  }
630  break;
631  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
632  {
633  bool bTmp = *o3tl::doAccess<bool>(rValue);
635  }
636  break;
637  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
638  {
639  bool bTmp = *o3tl::doAccess<bool>(rValue);
641  }
642  break;
643  case HANDLE_USE_FORMER_TEXT_WRAPPING:
644  {
645  bool bTmp = *o3tl::doAccess<bool>(rValue);
647  }
648  break;
649  case HANDLE_CHANGES_PASSWORD:
650  {
651  Sequence <sal_Int8> aNew;
652  if(rValue >>= aNew)
653  {
655  if(aNew.hasElements())
656  {
658  eMode |= RedlineFlags::On;
660  }
661  }
662  }
663  break;
664  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
665  {
666  bool bTmp = *o3tl::doAccess<bool>(rValue);
668  }
669  break;
670  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
671  {
672  bool bTmp = *o3tl::doAccess<bool>(rValue);
674  }
675  break;
676  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
677  {
678  bool bTmp = *o3tl::doAccess<bool>(rValue);
680  }
681  break;
682  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
683  {
684  bool bTmp = *o3tl::doAccess<bool>(rValue);
686  }
687  break;
688  case HANDLE_TABLE_ROW_KEEP:
689  {
690  bool bTmp = *o3tl::doAccess<bool>(rValue);
692  }
693  break;
694  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
695  {
696  bool bTmp = *o3tl::doAccess<bool>(rValue);
698  }
699  break;
700  case HANDLE_LOAD_READONLY:
701  {
702  mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
703  }
704  break;
705  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
706  {
707  bool bTmp = *o3tl::doAccess<bool>(rValue);
709  }
710  break;
711  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
712  {
713  bool bTmp = *o3tl::doAccess<bool>(rValue);
715  }
716  break;
717  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
718  {
719  bool bTmp = *o3tl::doAccess<bool>(rValue);
721  }
722  break;
723  case HANDLE_USE_OLD_PRINTER_METRICS:
724  // ignore - this is a dead property
725  break;
726  case HANDLE_TABS_RELATIVE_TO_INDENT:
727  {
728  bool bTmp = *o3tl::doAccess<bool>(rValue);
730  }
731  break;
732  case HANDLE_RSID:
733  {
734  sal_uInt32 nTmp = 0;
735  rValue >>= nTmp;
736  mpDoc->setRsid( nTmp );
737  }
738  break;
739  case HANDLE_RSID_ROOT:
740  {
741  sal_uInt32 nTmp = 0;
742  rValue >>= nTmp;
743  mpDoc->setRsidRoot( nTmp );
744  }
745  break;
746  case HANDLE_PROTECT_FORM:
747  {
748  bool bTmp = *o3tl::doAccess<bool>(rValue);
750  }
751  break;
752  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
753  {
754  bool bTmp = *o3tl::doAccess<bool>(rValue);
756  }
757  break;
758  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
759  {
760  bool bTmp = *o3tl::doAccess<bool>(rValue);
762  }
763  break;
764  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
765  {
766  bool bTmp = *o3tl::doAccess<bool>(rValue);
768  }
769  break;
770  case HANDLE_MODIFYPASSWORDINFO:
771  {
772  uno::Sequence< beans::PropertyValue > aInfo;
773  if ( !( rValue >>= aInfo ) )
774  throw lang::IllegalArgumentException(
775  "Value of type Sequence<PropertyValue> expected!",
776  uno::Reference< uno::XInterface >(),
777  2 );
778 
779  if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
780  throw beans::PropertyVetoException(
781  "The hash is not allowed to be changed now!",
782  uno::Reference< uno::XInterface >() );
783  }
784  break;
785  case HANDLE_MATH_BASELINE_ALIGNMENT:
786  {
787  bool bTmp = *o3tl::doAccess<bool>(rValue);
789  }
790  break;
791  case HANDLE_INVERT_BORDER_SPACING:
792  {
793  bool bTmp = *o3tl::doAccess<bool>(rValue);
795  }
796  break;
797  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
798  {
799  bool bTmp = *o3tl::doAccess<bool>(rValue);
801  }
802  break;
803  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
804  {
805  bool bTmp = *o3tl::doAccess<bool>(rValue);
807  }
808  break;
809  case HANDLE_TAB_OVERFLOW:
810  {
811  bool bTmp = *o3tl::doAccess<bool>(rValue);
813  }
814  break;
815  case HANDLE_UNBREAKABLE_NUMBERINGS:
816  {
817  bool bTmp = *o3tl::doAccess<bool>(rValue);
819  }
820  break;
821  case HANDLE_STYLES_NODEFAULT:
822  {
823  bool bTmp = *o3tl::doAccess<bool>(rValue);
825  }
826  break;
827  case HANDLE_FLOATTABLE_NOMARGINS:
828  {
829  bool bTmp = *o3tl::doAccess<bool>(rValue);
831  }
832  break;
833  case HANDLE_CLIPPED_PICTURES:
834  {
835  bool bTmp = *o3tl::doAccess<bool>(rValue);
837  }
838  break;
839  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
840  {
841  bool bTmp = *o3tl::doAccess<bool>(rValue);
843  }
844  break;
845  case HANDLE_EMBED_FONTS:
846  {
847  bool bTmp = *o3tl::doAccess<bool>(rValue);
849  }
850  break;
851  case HANDLE_EMBED_USED_FONTS:
852  {
853  bool bTmp = *o3tl::doAccess<bool>(rValue);
855  }
856  break;
857  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
858  {
859  bool bTmp = *o3tl::doAccess<bool>(rValue);
861  }
862  break;
863  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
864  {
865  bool bTmp = *o3tl::doAccess<bool>(rValue);
867  }
868  break;
869  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
870  {
871  bool bTmp = *o3tl::doAccess<bool>(rValue);
873  }
874  break;
875  case HANDLE_EMBED_SYSTEM_FONTS:
876  {
877  bool bTmp = *o3tl::doAccess<bool>(rValue);
879  }
880  break;
881  case HANDLE_TAB_OVER_MARGIN:
882  {
883  bool bTmp = *o3tl::doAccess<bool>(rValue);
885  }
886  break;
887  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
888  {
889  bool bTmp = *o3tl::doAccess<bool>(rValue);
891  }
892  break;
893  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
894  {
895  bool bTmp = *o3tl::doAccess<bool>(rValue);
897  }
898  break;
899  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
900  {
901  bool bTmp = *o3tl::doAccess<bool>(rValue);
903  }
904  break;
905  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
906  {
907  bool bTmp;
908  if (rValue >>= bTmp)
909  {
912  }
913  }
914  break;
915  case HANDLE_SUBTRACT_FLYS:
916  {
917  bool bTmp;
918  if (rValue >>= bTmp)
919  {
922  }
923  }
924  break;
925  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
926  {
927  bool bTmp;
928  if (rValue >>= bTmp)
929  {
932  }
933  }
934  break;
935  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
936  {
937  bool bTmp;
938  if (rValue >>= bTmp)
939  {
941  bTmp);
942  }
943  }
944  break;
945  case HANDLE_CONTINUOUS_ENDNOTES:
946  {
947  bool bTmp;
948  if (rValue >>= bTmp)
949  {
951  bTmp);
952  }
953  }
954  break;
955  case HANDLE_PROTECT_BOOKMARKS:
956  {
957  bool bTmp;
958  if (rValue >>= bTmp)
959  {
961  bTmp);
962  }
963  }
964  break;
965  case HANDLE_PROTECT_FIELDS:
966  {
967  bool bTmp;
968  if (rValue >>= bTmp)
969  {
971  bTmp);
972  }
973  }
974  break;
975  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
976  {
977  bool bTmp;
978  if (rValue >>= bTmp)
979  {
982  }
983  }
984  break;
985  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
986  {
987  bool bTmp;
988  if (rValue >>= bTmp)
989  {
992  }
993  }
994  break;
995  default:
996  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
997  }
998 }
999 
1001 {
1002  // set printer only once, namely here!
1003  if( mpPrinter != nullptr )
1004  {
1005  // #i86352# the printer is also used as container for options by sfx
1006  // when setting a printer it should have decent default options
1007  SfxItemSet aOptions( mpPrinter->GetOptions() );
1009  SwAddPrinterItem aAddPrinterItem (aPrtData);
1010  aOptions.Put(aAddPrinterItem);
1011  mpPrinter->SetOptions( aOptions );
1012  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1013 
1015  }
1016 
1017  mpPrinter = nullptr;
1018  mpDocSh = nullptr;
1019  mpDoc = nullptr;
1020 }
1021 
1023 {
1025  if (nullptr == mpDocSh)
1026  throw UnknownPropertyException();
1027  mpDoc = mpDocSh->GetDoc();
1028  if (nullptr == mpDoc)
1029  throw UnknownPropertyException();
1030 }
1031 
1033 {
1034  switch( rInfo.mnHandle )
1035  {
1036  case HANDLE_FORBIDDEN_CHARS:
1037  {
1038  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1039  rValue <<= xRet;
1040  }
1041  break;
1042  case HANDLE_LINK_UPDATE_MODE:
1043  {
1044  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1045  }
1046  break;
1047  case HANDLE_FIELD_AUTO_UPDATE:
1048  {
1050  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1051  }
1052  break;
1053  case HANDLE_CHART_AUTO_UPDATE:
1054  {
1056  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1057  }
1058  break;
1059  case HANDLE_ADD_PARA_TABLE_SPACING:
1060  {
1062  }
1063  break;
1064  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1065  {
1067  }
1068  break;
1069  case HANDLE_ALIGN_TAB_STOP_POSITION:
1070  {
1072  }
1073  break;
1074  case HANDLE_PRINTER_NAME:
1075  {
1076  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1077  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1078  }
1079  break;
1080  case HANDLE_PRINTER_SETUP:
1081  {
1082  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1083  if (pPrinter)
1084  {
1085  SvMemoryStream aStream;
1086  pPrinter->Store( aStream );
1087  sal_uInt32 nSize = aStream.TellEnd();
1088  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1089  Sequence < sal_Int8 > aSequence( nSize );
1090  aStream.ReadBytes(aSequence.getArray(), nSize);
1091  rValue <<= aSequence;
1092  }
1093  else
1094  {
1095  Sequence < sal_Int8 > aSequence ( 0 );
1096  rValue <<= aSequence;
1097  }
1098  }
1099  break;
1100  case HANDLE_PRINTER_PAPER:
1101  {
1102  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1103  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1104  }
1105  break;
1106  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1107  {
1109  }
1110  break;
1111  case HANDLE_APPLY_USER_DATA:
1112  {
1113  rValue <<= mpDocSh->IsUseUserData();
1114  }
1115  break;
1116  case HANDLE_SAVE_THUMBNAIL:
1117  {
1118  rValue <<= mpDocSh->IsUseThumbnailSave();
1119  }
1120  break;
1121  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1122  {
1123  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1124  }
1125  break;
1126  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1127  {
1129  }
1130  break;
1131  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1132  {
1133  const SwDBData& rData = mpDoc->GetDBDesc();
1134  rValue <<= rData.sDataSource;
1135  }
1136  break;
1137  case HANDLE_CURRENT_DATABASE_COMMAND:
1138  {
1139  const SwDBData& rData = mpDoc->GetDBDesc();
1140  rValue <<= rData.sCommand;
1141  }
1142  break;
1143  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1144  {
1145  const SwDBData& rData = mpDoc->GetDBDesc();
1146  rValue <<= rData.nCommandType;
1147  }
1148  break;
1149  case HANDLE_EMBEDDED_DATABASE_NAME:
1150  {
1151 #if HAVE_FEATURE_DBCONNECTIVITY
1152  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1153 #else
1154  rValue = uno::Any();
1155 #endif
1156  }
1157  break;
1158  case HANDLE_SAVE_VERSION_ON_CLOSE:
1159  {
1160  rValue <<= mpDocSh->IsSaveVersionOnClose();
1161  }
1162  break;
1163  case HANDLE_UPDATE_FROM_TEMPLATE:
1164  {
1165  rValue <<= mpDocSh->IsQueryLoadTemplate();
1166  }
1167  break;
1168  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1169  {
1170  // returns short (see css.document.PrinterIndependentLayout)
1173  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1174  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1175  document::PrinterIndependentLayout::DISABLED;
1176  rValue <<= nVirDevType;
1177  }
1178  break;
1179  case HANDLE_IS_LABEL_DOC:
1180  {
1182  rValue <<= bLabel;
1183  }
1184  break;
1185  case HANDLE_IS_ADD_FLY_OFFSET:
1186  {
1188  }
1189  break;
1190  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1191  {
1193  }
1194  break;
1195  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1196  {
1198  }
1199  break;
1200  case HANDLE_OLD_NUMBERING:
1201  {
1203  }
1204  break;
1205  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1206  {
1207  rValue <<= false;
1208  }
1209  break;
1210  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1211  {
1212  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1213  }
1214  break;
1215  case HANDLE_USE_FORMER_LINE_SPACING:
1216  {
1218  }
1219  break;
1220  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1221  {
1223  }
1224  break;
1225  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1226  {
1228  }
1229  break;
1230  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1231  {
1233  }
1234  break;
1235  case HANDLE_CHANGES_PASSWORD:
1236  {
1238  }
1239  break;
1240  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1241  {
1243  }
1244  break;
1245  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1246  {
1248  }
1249  break;
1250  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1251  {
1253  }
1254  break;
1255  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1256  {
1258  }
1259  break;
1260  case HANDLE_TABLE_ROW_KEEP :
1261  {
1263  }
1264  break;
1265  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1266  {
1268  }
1269  break;
1270  case HANDLE_LOAD_READONLY:
1271  {
1272  rValue <<= mpDocSh->IsLoadReadonly();
1273  }
1274  break;
1275  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1276  {
1278  }
1279  break;
1280  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1281  {
1283  }
1284  break;
1285  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1286  {
1288  }
1289  break;
1290  case HANDLE_USE_OLD_PRINTER_METRICS:
1291  {
1292  rValue <<= false;
1293  }
1294  break;
1295  case HANDLE_TABS_RELATIVE_TO_INDENT:
1296  {
1298  }
1299  break;
1300  case HANDLE_RSID:
1301  {
1302  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1303  }
1304  break;
1305  case HANDLE_RSID_ROOT:
1306  {
1307  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1308  }
1309  break;
1310  case HANDLE_PROTECT_FORM:
1311  {
1313  }
1314  break;
1315  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1316  {
1318  }
1319  break;
1320  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1321  {
1323  }
1324  break;
1325  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1326  {
1328  }
1329  break;
1330  case HANDLE_MODIFYPASSWORDINFO:
1331  {
1332  rValue <<= mpDocSh->GetModifyPasswordInfo();
1333  }
1334  break;
1335  case HANDLE_MATH_BASELINE_ALIGNMENT:
1336  {
1338  }
1339  break;
1340  case HANDLE_INVERT_BORDER_SPACING:
1341  {
1343  }
1344  break;
1345  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1346  {
1348  }
1349  break;
1350  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1351  {
1353  }
1354  break;
1355  case HANDLE_TAB_OVERFLOW:
1356  {
1358  }
1359  break;
1360  case HANDLE_UNBREAKABLE_NUMBERINGS:
1361  {
1363  }
1364  break;
1365  case HANDLE_STYLES_NODEFAULT:
1366  {
1368  }
1369  break;
1370  case HANDLE_FLOATTABLE_NOMARGINS:
1371  {
1373  }
1374  break;
1375  case HANDLE_CLIPPED_PICTURES:
1376  {
1378  }
1379  break;
1380  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1381  {
1383  }
1384  break;
1385  case HANDLE_EMBED_FONTS:
1386  {
1388  }
1389  break;
1390  case HANDLE_EMBED_USED_FONTS:
1391  {
1393  }
1394  break;
1395  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1396  {
1398  }
1399  break;
1400  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1401  {
1403  }
1404  break;
1405  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1406  {
1408  }
1409  break;
1410  case HANDLE_EMBED_SYSTEM_FONTS:
1411  {
1413  }
1414  break;
1415  case HANDLE_TAB_OVER_MARGIN:
1416  {
1418  }
1419  break;
1420  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1421  {
1423  }
1424  break;
1425  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1426  {
1428  }
1429  break;
1430  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1431  {
1433  }
1434  break;
1435  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1436  {
1438  }
1439  break;
1440  case HANDLE_SUBTRACT_FLYS:
1441  {
1443  }
1444  break;
1445  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1446  {
1448  }
1449  break;
1450  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1451  {
1452  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1454  }
1455  break;
1456  case HANDLE_CONTINUOUS_ENDNOTES:
1457  {
1458  rValue
1460  }
1461  break;
1462  case HANDLE_PROTECT_BOOKMARKS:
1463  {
1464  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1466  }
1467  break;
1468  case HANDLE_PROTECT_FIELDS:
1469  {
1470  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1472  }
1473  break;
1474  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1475  {
1476  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1478  }
1479  break;
1480  case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1481  {
1482  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1484  }
1485  break;
1486  default:
1487  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1488  }
1489 }
1490 
1492 {
1493  mpDocSh = nullptr;
1494  mpDoc = nullptr;
1495 }
1496 
1497 // XServiceInfo
1499 {
1500  return "SwXDocumentSettings";
1501 }
1502 
1503 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1504 {
1505  return cppu::supportsService(this, ServiceName);
1506 }
1507 
1509 {
1510  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1511 }
1512 
1513 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Type
virtual void _postSetValues() override
virtual void SAL_CALL release() override
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
void ChgDBData(const SwDBData &rNewData)
Definition: doc.cxx:453
bool IsUseUserData() const
SwFieldUpdateFlags
Definition: fldupde.hxx:22
virtual OUString SAL_CALL getImplementationName() override
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
const char aData[]
Definition: ww8scan.hxx:47
static MasterPropertySetInfo * lcl_createSettingsInfo()
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
sal_uInt32 getRsidRoot() const
Definition: doc.cxx:216
OUString sDataSource
Definition: swdbdata.hxx:30
void disposeAndClear()
virtual void setReferenceDeviceType(bool bNewVirtual, bool bNewHiRes)=0
Sets the type of the reference device used for formatting the document.
const ContentProperties & rData
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:441
virtual void setFieldUpdateFlags(SwFieldUpdateFlags nMode)=0
Set the current field update mode.
sal_uInt64 Seek(sal_uInt64 nPos)
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:760
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:3141
sal_uInt32 getRsid() const
Definition: doc.cxx:196
Mode eMode
virtual SwFieldUpdateFlags getFieldUpdateFlags(bool bGlobalSettings) const =0
Get the current field update mode.
SwXDocumentSettings(SwXTextDocument *pModel)
RedlineFlags on.
SfxObjectCreateMode GetCreateMode() const
const SwDBData & GetDBDesc()
Definition: docfld.cxx:348
SwDocumentSettingsPropertyHandles
void registerSlave(ChainablePropertySet *pNewSet)
virtual CharCompressType getCharacterCompressionType() const =0
Get the character compression type for Asian characters.
const SfxItemSet & GetOptions() const
void ChgHyphenation()
Definition: viewsh.hxx:208
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
SwDBData const & GetDBData()
Definition: docfld.cxx:343
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
#define STREAM_SEEK_TO_BEGIN
virtual ~SwXDocumentSettings() override
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:327
bool Stamp_GetPrintCancelState() const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const =0
Get the current link update mode.
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
static VclPtr< SfxPrinter > Create(SvStream &rStream, std::unique_ptr< SfxItemSet > &&pOptions)
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
void SetSaveVersionOnClose(bool bSet)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
unsigned char sal_Bool
void setRsidRoot(sal_uInt32 nVal)
Definition: doc.cxx:221
SwDocShell * GetDocShell()
Definition: unotxdoc.hxx:466
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
css::uno::Type const & get()
void SetUseThumbnailSave(bool _bNew)
SwXTextDocument * mpModel
void SetUseUserData(bool bNew)
void Store(SvStream &rStream) const
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
const SvXMLTokenMapEntry aTypes[]
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
std::size_t ReadBytes(void *pData, std::size_t nSize)
void setRsid(sal_uInt32 nVal)
Definition: doc.cxx:201
virtual void _postGetValues() override
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
AUTOMATIC
bool IsUseThumbnailSave() const
#define SAL_WARN_IF(condition, area, stream)
bool IsQueryLoadTemplate() const
bool IsSaveVersionOnClose() const
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
bool SetModifyPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
virtual void setLinkUpdateMode(sal_uInt16 nMode)=0
Set the current link update mode.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
void SetLoadReadonly(bool _bReadonly)
void SetQueryLoadTemplate(bool b)
bool IsLoadReadonly() const
void Stamp_SetPrintCancelState(bool bState)
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
VclPtr< SfxPrinter > mpPrinter
the printer should be set only once; since there are several printer-related properties, remember the last printer and set it in _postSetValues
OUString sCommand
Definition: swdbdata.hxx:31
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
SwDBManager * GetDBManager() const
Definition: doc.hxx:664
void SetOptions(const SfxItemSet &rNewOptions)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
virtual void _preSetValues() override
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3162