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 };
148 
149 }
150 
152 {
153  static PropertyInfo const aWriterSettingsInfoMap[] =
154  {
155  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
156  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
157  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
158  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
159  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
160  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
161  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
162  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
163  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
164  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
165  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
166  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
167  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
168  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
169  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
170  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
171  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
172  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
173  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
174  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
175  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
176 
177  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
178  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
179  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
180  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
181  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
182  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
183  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
184  /* Stampit It disable the print cancel button of the shown progress dialog. */
185  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
186  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
187  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
188  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
189  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
190  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
191  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
192  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
193  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
194  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
195  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
196  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
197  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
198  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
199  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
200  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
201  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
202  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
203  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
204  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
205  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
206  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
207  { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
208  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
209  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
210  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
211  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
212  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
213  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
214  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
215  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
216  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
217  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
218  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
219  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
220  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
221  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
222  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
223  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
224  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
225  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
226  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
227  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
228  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
229  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
230  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
231  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
232  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
233  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
234  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
235  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
236  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
237  { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
238 
239 /*
240  * As OS said, we don't have a view when we need to set this, so I have to
241  * find another solution before adding them to this property set - MTG
242  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
243  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
244  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
245  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
246  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
247  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
248  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
249 
250  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
251  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
252  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
253  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
254  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
255  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
256  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
257 
258  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
259  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
260  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
261  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
262 */
263  { OUString(), 0, css::uno::Type(), 0}
264  };
265  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
266 }
267 
270  &Application::GetSolarMutex () )
271 , mpModel ( pModel )
272 , mpDocSh ( nullptr )
273 , mpDoc ( nullptr )
274 , mpPrinter( nullptr )
275 , mbPreferPrinterPapersize( false )
276 {
278 }
279 
281  throw()
282 {
283 }
284 
286 {
287  return ::cppu::queryInterface(rType,
288  // OWeakObject interfaces
289  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
290  &dynamic_cast<XWeak&>(*this),
291  // my own interfaces
292  &dynamic_cast<XPropertySet&>(*this),
293  &dynamic_cast<XPropertyState&>(*this),
294  &dynamic_cast<XMultiPropertySet&>(*this),
295  &dynamic_cast<XServiceInfo&>(*this),
296  &dynamic_cast<XTypeProvider&>(*this));
297 }
299  throw ()
300 {
301  OWeakObject::acquire();
302 }
304  throw ()
305 {
306  OWeakObject::release();
307 }
308 
309 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
310 {
311  static const uno::Sequence< uno::Type > aTypes {
312  // from MasterPropertySet
318  };
319  return aTypes;
320 }
321 
322 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
323 {
324  return css::uno::Sequence<sal_Int8>();
325 }
326 
328 {
330  if (nullptr == mpDocSh)
331  throw UnknownPropertyException();
332 
333  mpDoc = mpDocSh->GetDoc();
334  if (nullptr == mpDoc)
335  throw UnknownPropertyException();
336 }
337 
339 {
340  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
341  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
342 
343  switch( rInfo.mnHandle )
344  {
345  case HANDLE_FORBIDDEN_CHARS:
346  break;
347  case HANDLE_LINK_UPDATE_MODE:
348  {
349  sal_Int16 nMode = 0;
350  rValue >>= nMode;
351  switch (nMode)
352  {
353  case NEVER:
354  case MANUAL:
355  case AUTOMATIC:
356  case GLOBALSETTING:
357  break;
358  default:
359  throw IllegalArgumentException();
360  }
362  }
363  break;
364  case HANDLE_FIELD_AUTO_UPDATE:
365  {
366  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
369  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
372  AUTOUPD_OFF );
373  }
374  break;
375  case HANDLE_CHART_AUTO_UPDATE:
376  {
377  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
380  bUpdateChart ?
383  AUTOUPD_OFF );
384  }
385  break;
386  case HANDLE_ADD_PARA_TABLE_SPACING:
387  {
388  bool bParaSpace = false;
389  rValue >>= bParaSpace;
391  }
392  break;
393  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
394  {
395  bool bParaSpacePage = false;
396  rValue >>= bParaSpacePage;
398  }
399  break;
400  case HANDLE_ALIGN_TAB_STOP_POSITION:
401  {
402  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
404  }
405  break;
406  case HANDLE_PRINTER_NAME:
407  {
408  //the printer must be created
409  OUString sPrinterName;
410  if( !(rValue >>= sPrinterName) )
411  throw IllegalArgumentException();
412 
413  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
414  {
415  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
416  if ( pPrinter->GetName() != sPrinterName )
417  {
418  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
419  assert (! pNewPrinter->isDisposed() );
420  if( pNewPrinter->IsKnown() )
421  {
422  // set printer only once; in _postSetValues
423  mpPrinter = pNewPrinter;
424  }
425  else
426  {
427  pNewPrinter.disposeAndClear();
428  }
429  }
430  }
431 
432  }
433  break;
434  case HANDLE_PRINTER_SETUP:
435  {
436  Sequence < sal_Int8 > aSequence;
437  if ( !(rValue >>= aSequence) )
438  throw IllegalArgumentException();
439 
440  sal_uInt32 nSize = aSequence.getLength();
441  if( nSize > 0 )
442  {
443  SvMemoryStream aStream (aSequence.getArray(), nSize,
444  StreamMode::READ );
445  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
446  static sal_uInt16 const nRange[] =
447  {
449  SID_HTML_MODE, SID_HTML_MODE,
450  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
451  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
452  0
453  };
454  auto pItemSet = std::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), nRange );
455  VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
456  assert (! pPrinter->isDisposed() );
457  // set printer only once; in _postSetValues
459  mpPrinter = pPrinter;
460  }
461 
462  }
463  break;
464  case HANDLE_PRINTER_PAPER:
465  {
466  bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
467  if(!(rValue >>= bPreferPrinterPapersize))
468  throw IllegalArgumentException();
469  mbPreferPrinterPapersize = bPreferPrinterPapersize;
470  }
471  break;
472  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
473  {
474  bool bIsKern = *o3tl::doAccess<bool>(rValue);
476  SwEditShell* pEditSh = mpDoc->GetEditShell();
477  if(pEditSh)
478  pEditSh->ChgHyphenation();
479  }
480  break;
481  case HANDLE_CHARACTER_COMPRESSION_TYPE:
482  {
483  sal_Int16 nMode = 0;
484  rValue >>= nMode;
485  switch (static_cast<CharCompressType>(nMode))
486  {
487  case CharCompressType::NONE:
488  case CharCompressType::PunctuationOnly:
489  case CharCompressType::PunctuationAndKana:
490  break;
491  default:
492  throw IllegalArgumentException();
493  }
494  mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
495  }
496  break;
497  case HANDLE_APPLY_USER_DATA:
498  {
499  mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
500  }
501  break;
502  case HANDLE_SAVE_THUMBNAIL:
503  {
504  mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
505  }
506  break;
507  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
508  {
509  bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
511  }
512  break;
513  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
514  {
516  if ( rValue >>= aData.sDataSource )
517  mpDoc->ChgDBData( aData );
518  }
519  break;
520  case HANDLE_CURRENT_DATABASE_COMMAND:
521  {
523 
524  if ( rValue >>= aData.sCommand )
525  mpDoc->ChgDBData( aData );
526 
527  SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
528  "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
529  }
530  break;
531  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
532  {
534  if ( rValue >>= aData.nCommandType )
535  mpDoc->ChgDBData( aData );
536  SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
537  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
538  SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
539  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
540  }
541  break;
542  case HANDLE_EMBEDDED_DATABASE_NAME:
543  {
544 #if HAVE_FEATURE_DBCONNECTIVITY
545  OUString sEmbeddedName;
546  if (rValue >>= sEmbeddedName)
547  mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
548 #endif
549  }
550  break;
551  case HANDLE_SAVE_VERSION_ON_CLOSE:
552  {
553  mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
554  }
555  break;
556  case HANDLE_UPDATE_FROM_TEMPLATE:
557  {
558  mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
559  }
560  break;
561  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
562  {
563  sal_Int16 nTmp = 0;
564  rValue >>= nTmp;
565 
566  bool bUseVirDev = true;
567  bool bHiResVirDev = true;
568  if( nTmp == document::PrinterIndependentLayout::DISABLED )
569  bUseVirDev = false;
570  else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
571  bHiResVirDev = false;
572  else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
573  throw IllegalArgumentException();
574 
575  mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
576  }
577  break;
578  case HANDLE_IS_LABEL_DOC :
579  {
580  bool bSet = false;
581  if(!(rValue >>= bSet))
582  throw IllegalArgumentException();
584  }
585  break;
586  case HANDLE_IS_ADD_FLY_OFFSET:
587  {
588  bool bTmp = *o3tl::doAccess<bool>(rValue);
590  }
591  break;
592  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
593  {
594  bool bTmp = *o3tl::doAccess<bool>(rValue);
596  }
597  break;
598  case HANDLE_IS_ADD_EXTERNAL_LEADING:
599  {
600  bool bTmp = *o3tl::doAccess<bool>(rValue);
602  }
603  break;
604  case HANDLE_OLD_NUMBERING:
605  {
606  bool bTmp = *o3tl::doAccess<bool>(rValue);
608  }
609  break;
610  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
611  {
612  // ignore - this is a dead property
613  }
614  break;
615  case HANDLE_ALLOW_PRINTJOB_CANCEL:
616  {
617  bool bState = false;
618  if (!(rValue >>= bState))
619  throw IllegalArgumentException();
621  }
622  break;
623  case HANDLE_USE_FORMER_LINE_SPACING:
624  {
625  bool bTmp = *o3tl::doAccess<bool>(rValue);
627  }
628  break;
629  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
630  {
631  bool bTmp = *o3tl::doAccess<bool>(rValue);
633  }
634  break;
635  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
636  {
637  bool bTmp = *o3tl::doAccess<bool>(rValue);
639  }
640  break;
641  case HANDLE_USE_FORMER_TEXT_WRAPPING:
642  {
643  bool bTmp = *o3tl::doAccess<bool>(rValue);
645  }
646  break;
647  case HANDLE_CHANGES_PASSWORD:
648  {
649  Sequence <sal_Int8> aNew;
650  if(rValue >>= aNew)
651  {
653  if(aNew.hasElements())
654  {
656  eMode |= RedlineFlags::On;
658  }
659  }
660  }
661  break;
662  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
663  {
664  bool bTmp = *o3tl::doAccess<bool>(rValue);
666  }
667  break;
668  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
669  {
670  bool bTmp = *o3tl::doAccess<bool>(rValue);
672  }
673  break;
674  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
675  {
676  bool bTmp = *o3tl::doAccess<bool>(rValue);
678  }
679  break;
680  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
681  {
682  bool bTmp = *o3tl::doAccess<bool>(rValue);
684  }
685  break;
686  case HANDLE_TABLE_ROW_KEEP:
687  {
688  bool bTmp = *o3tl::doAccess<bool>(rValue);
690  }
691  break;
692  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
693  {
694  bool bTmp = *o3tl::doAccess<bool>(rValue);
696  }
697  break;
698  case HANDLE_LOAD_READONLY:
699  {
700  mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
701  }
702  break;
703  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
704  {
705  bool bTmp = *o3tl::doAccess<bool>(rValue);
707  }
708  break;
709  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
710  {
711  bool bTmp = *o3tl::doAccess<bool>(rValue);
713  }
714  break;
715  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
716  {
717  bool bTmp = *o3tl::doAccess<bool>(rValue);
719  }
720  break;
721  case HANDLE_USE_OLD_PRINTER_METRICS:
722  // ignore - this is a dead property
723  break;
724  case HANDLE_TABS_RELATIVE_TO_INDENT:
725  {
726  bool bTmp = *o3tl::doAccess<bool>(rValue);
728  }
729  break;
730  case HANDLE_RSID:
731  {
732  sal_uInt32 nTmp = 0;
733  rValue >>= nTmp;
734  mpDoc->setRsid( nTmp );
735  }
736  break;
737  case HANDLE_RSID_ROOT:
738  {
739  sal_uInt32 nTmp = 0;
740  rValue >>= nTmp;
741  mpDoc->setRsidRoot( nTmp );
742  }
743  break;
744  case HANDLE_PROTECT_FORM:
745  {
746  bool bTmp = *o3tl::doAccess<bool>(rValue);
748  }
749  break;
750  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
751  {
752  bool bTmp = *o3tl::doAccess<bool>(rValue);
754  }
755  break;
756  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
757  {
758  bool bTmp = *o3tl::doAccess<bool>(rValue);
760  }
761  break;
762  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
763  {
764  bool bTmp = *o3tl::doAccess<bool>(rValue);
766  }
767  break;
768  case HANDLE_MODIFYPASSWORDINFO:
769  {
770  uno::Sequence< beans::PropertyValue > aInfo;
771  if ( !( rValue >>= aInfo ) )
772  throw lang::IllegalArgumentException(
773  "Value of type Sequence<PropertyValue> expected!",
774  uno::Reference< uno::XInterface >(),
775  2 );
776 
777  if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
778  throw beans::PropertyVetoException(
779  "The hash is not allowed to be changed now!",
780  uno::Reference< uno::XInterface >() );
781  }
782  break;
783  case HANDLE_MATH_BASELINE_ALIGNMENT:
784  {
785  bool bTmp = *o3tl::doAccess<bool>(rValue);
787  }
788  break;
789  case HANDLE_INVERT_BORDER_SPACING:
790  {
791  bool bTmp = *o3tl::doAccess<bool>(rValue);
793  }
794  break;
795  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
796  {
797  bool bTmp = *o3tl::doAccess<bool>(rValue);
799  }
800  break;
801  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
802  {
803  bool bTmp = *o3tl::doAccess<bool>(rValue);
805  }
806  break;
807  case HANDLE_TAB_OVERFLOW:
808  {
809  bool bTmp = *o3tl::doAccess<bool>(rValue);
811  }
812  break;
813  case HANDLE_UNBREAKABLE_NUMBERINGS:
814  {
815  bool bTmp = *o3tl::doAccess<bool>(rValue);
817  }
818  break;
819  case HANDLE_STYLES_NODEFAULT:
820  {
821  bool bTmp = *o3tl::doAccess<bool>(rValue);
823  }
824  break;
825  case HANDLE_FLOATTABLE_NOMARGINS:
826  {
827  bool bTmp = *o3tl::doAccess<bool>(rValue);
829  }
830  break;
831  case HANDLE_CLIPPED_PICTURES:
832  {
833  bool bTmp = *o3tl::doAccess<bool>(rValue);
835  }
836  break;
837  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
838  {
839  bool bTmp = *o3tl::doAccess<bool>(rValue);
841  }
842  break;
843  case HANDLE_EMBED_FONTS:
844  {
845  bool bTmp = *o3tl::doAccess<bool>(rValue);
847  }
848  break;
849  case HANDLE_EMBED_USED_FONTS:
850  {
851  bool bTmp = *o3tl::doAccess<bool>(rValue);
853  }
854  break;
855  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
856  {
857  bool bTmp = *o3tl::doAccess<bool>(rValue);
859  }
860  break;
861  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
862  {
863  bool bTmp = *o3tl::doAccess<bool>(rValue);
865  }
866  break;
867  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
868  {
869  bool bTmp = *o3tl::doAccess<bool>(rValue);
871  }
872  break;
873  case HANDLE_EMBED_SYSTEM_FONTS:
874  {
875  bool bTmp = *o3tl::doAccess<bool>(rValue);
877  }
878  break;
879  case HANDLE_TAB_OVER_MARGIN:
880  {
881  bool bTmp = *o3tl::doAccess<bool>(rValue);
883  }
884  break;
885  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
886  {
887  bool bTmp = *o3tl::doAccess<bool>(rValue);
889  }
890  break;
891  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
892  {
893  bool bTmp = *o3tl::doAccess<bool>(rValue);
895  }
896  break;
897  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
898  {
899  bool bTmp = *o3tl::doAccess<bool>(rValue);
901  }
902  break;
903  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
904  {
905  bool bTmp;
906  if (rValue >>= bTmp)
907  {
910  }
911  }
912  break;
913  case HANDLE_SUBTRACT_FLYS:
914  {
915  bool bTmp;
916  if (rValue >>= bTmp)
917  {
920  }
921  }
922  break;
923  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
924  {
925  bool bTmp;
926  if (rValue >>= bTmp)
927  {
930  }
931  }
932  break;
933  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
934  {
935  bool bTmp;
936  if (rValue >>= bTmp)
937  {
939  bTmp);
940  }
941  }
942  break;
943  case HANDLE_CONTINUOUS_ENDNOTES:
944  {
945  bool bTmp;
946  if (rValue >>= bTmp)
947  {
949  bTmp);
950  }
951  }
952  break;
953  case HANDLE_PROTECT_BOOKMARKS:
954  {
955  bool bTmp;
956  if (rValue >>= bTmp)
957  {
959  bTmp);
960  }
961  }
962  break;
963  case HANDLE_PROTECT_FIELDS:
964  {
965  bool bTmp;
966  if (rValue >>= bTmp)
967  {
969  bTmp);
970  }
971  }
972  break;
973  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
974  {
975  bool bTmp;
976  if (rValue >>= bTmp)
977  {
980  }
981  }
982  break;
983  default:
984  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
985  }
986 }
987 
989 {
990  // set printer only once, namely here!
991  if( mpPrinter != nullptr )
992  {
993  // #i86352# the printer is also used as container for options by sfx
994  // when setting a printer it should have decent default options
995  SfxItemSet aOptions( mpPrinter->GetOptions() );
997  SwAddPrinterItem aAddPrinterItem (aPrtData);
998  aOptions.Put(aAddPrinterItem);
999  mpPrinter->SetOptions( aOptions );
1000  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1001 
1003  }
1004 
1005  mpPrinter = nullptr;
1006  mpDocSh = nullptr;
1007  mpDoc = nullptr;
1008 }
1009 
1011 {
1013  if (nullptr == mpDocSh)
1014  throw UnknownPropertyException();
1015  mpDoc = mpDocSh->GetDoc();
1016  if (nullptr == mpDoc)
1017  throw UnknownPropertyException();
1018 }
1019 
1021 {
1022  switch( rInfo.mnHandle )
1023  {
1024  case HANDLE_FORBIDDEN_CHARS:
1025  {
1026  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1027  rValue <<= xRet;
1028  }
1029  break;
1030  case HANDLE_LINK_UPDATE_MODE:
1031  {
1032  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1033  }
1034  break;
1035  case HANDLE_FIELD_AUTO_UPDATE:
1036  {
1038  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1039  }
1040  break;
1041  case HANDLE_CHART_AUTO_UPDATE:
1042  {
1044  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1045  }
1046  break;
1047  case HANDLE_ADD_PARA_TABLE_SPACING:
1048  {
1050  }
1051  break;
1052  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1053  {
1055  }
1056  break;
1057  case HANDLE_ALIGN_TAB_STOP_POSITION:
1058  {
1060  }
1061  break;
1062  case HANDLE_PRINTER_NAME:
1063  {
1064  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1065  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1066  }
1067  break;
1068  case HANDLE_PRINTER_SETUP:
1069  {
1070  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1071  if (pPrinter)
1072  {
1073  SvMemoryStream aStream;
1074  pPrinter->Store( aStream );
1075  sal_uInt32 nSize = aStream.TellEnd();
1076  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1077  Sequence < sal_Int8 > aSequence( nSize );
1078  aStream.ReadBytes(aSequence.getArray(), nSize);
1079  rValue <<= aSequence;
1080  }
1081  else
1082  {
1083  Sequence < sal_Int8 > aSequence ( 0 );
1084  rValue <<= aSequence;
1085  }
1086  }
1087  break;
1088  case HANDLE_PRINTER_PAPER:
1089  {
1090  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1091  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1092  }
1093  break;
1094  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1095  {
1097  }
1098  break;
1099  case HANDLE_APPLY_USER_DATA:
1100  {
1101  rValue <<= mpDocSh->IsUseUserData();
1102  }
1103  break;
1104  case HANDLE_SAVE_THUMBNAIL:
1105  {
1106  rValue <<= mpDocSh->IsUseThumbnailSave();
1107  }
1108  break;
1109  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1110  {
1111  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1112  }
1113  break;
1114  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1115  {
1117  }
1118  break;
1119  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1120  {
1121  const SwDBData& rData = mpDoc->GetDBDesc();
1122  rValue <<= rData.sDataSource;
1123  }
1124  break;
1125  case HANDLE_CURRENT_DATABASE_COMMAND:
1126  {
1127  const SwDBData& rData = mpDoc->GetDBDesc();
1128  rValue <<= rData.sCommand;
1129  }
1130  break;
1131  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1132  {
1133  const SwDBData& rData = mpDoc->GetDBDesc();
1134  rValue <<= rData.nCommandType;
1135  }
1136  break;
1137  case HANDLE_EMBEDDED_DATABASE_NAME:
1138  {
1139 #if HAVE_FEATURE_DBCONNECTIVITY
1140  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1141 #else
1142  rValue = uno::Any();
1143 #endif
1144  }
1145  break;
1146  case HANDLE_SAVE_VERSION_ON_CLOSE:
1147  {
1148  rValue <<= mpDocSh->IsSaveVersionOnClose();
1149  }
1150  break;
1151  case HANDLE_UPDATE_FROM_TEMPLATE:
1152  {
1153  rValue <<= mpDocSh->IsQueryLoadTemplate();
1154  }
1155  break;
1156  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1157  {
1158  // returns short (see css.document.PrinterIndependentLayout)
1161  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1162  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1163  document::PrinterIndependentLayout::DISABLED;
1164  rValue <<= nVirDevType;
1165  }
1166  break;
1167  case HANDLE_IS_LABEL_DOC:
1168  {
1170  rValue <<= bLabel;
1171  }
1172  break;
1173  case HANDLE_IS_ADD_FLY_OFFSET:
1174  {
1176  }
1177  break;
1178  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1179  {
1181  }
1182  break;
1183  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1184  {
1186  }
1187  break;
1188  case HANDLE_OLD_NUMBERING:
1189  {
1191  }
1192  break;
1193  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1194  {
1195  rValue <<= false;
1196  }
1197  break;
1198  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1199  {
1200  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1201  }
1202  break;
1203  case HANDLE_USE_FORMER_LINE_SPACING:
1204  {
1206  }
1207  break;
1208  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1209  {
1211  }
1212  break;
1213  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1214  {
1216  }
1217  break;
1218  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1219  {
1221  }
1222  break;
1223  case HANDLE_CHANGES_PASSWORD:
1224  {
1226  }
1227  break;
1228  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1229  {
1231  }
1232  break;
1233  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1234  {
1236  }
1237  break;
1238  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1239  {
1241  }
1242  break;
1243  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1244  {
1246  }
1247  break;
1248  case HANDLE_TABLE_ROW_KEEP :
1249  {
1251  }
1252  break;
1253  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1254  {
1256  }
1257  break;
1258  case HANDLE_LOAD_READONLY:
1259  {
1260  rValue <<= mpDocSh->IsLoadReadonly();
1261  }
1262  break;
1263  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1264  {
1266  }
1267  break;
1268  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1269  {
1271  }
1272  break;
1273  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1274  {
1276  }
1277  break;
1278  case HANDLE_USE_OLD_PRINTER_METRICS:
1279  {
1280  rValue <<= false;
1281  }
1282  break;
1283  case HANDLE_TABS_RELATIVE_TO_INDENT:
1284  {
1286  }
1287  break;
1288  case HANDLE_RSID:
1289  {
1290  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1291  }
1292  break;
1293  case HANDLE_RSID_ROOT:
1294  {
1295  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1296  }
1297  break;
1298  case HANDLE_PROTECT_FORM:
1299  {
1301  }
1302  break;
1303  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1304  {
1306  }
1307  break;
1308  case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1309  {
1311  }
1312  break;
1313  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1314  {
1316  }
1317  break;
1318  case HANDLE_MODIFYPASSWORDINFO:
1319  {
1320  rValue <<= mpDocSh->GetModifyPasswordInfo();
1321  }
1322  break;
1323  case HANDLE_MATH_BASELINE_ALIGNMENT:
1324  {
1326  }
1327  break;
1328  case HANDLE_INVERT_BORDER_SPACING:
1329  {
1331  }
1332  break;
1333  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1334  {
1336  }
1337  break;
1338  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1339  {
1341  }
1342  break;
1343  case HANDLE_TAB_OVERFLOW:
1344  {
1346  }
1347  break;
1348  case HANDLE_UNBREAKABLE_NUMBERINGS:
1349  {
1351  }
1352  break;
1353  case HANDLE_STYLES_NODEFAULT:
1354  {
1356  }
1357  break;
1358  case HANDLE_FLOATTABLE_NOMARGINS:
1359  {
1361  }
1362  break;
1363  case HANDLE_CLIPPED_PICTURES:
1364  {
1366  }
1367  break;
1368  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1369  {
1371  }
1372  break;
1373  case HANDLE_EMBED_FONTS:
1374  {
1376  }
1377  break;
1378  case HANDLE_EMBED_USED_FONTS:
1379  {
1381  }
1382  break;
1383  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1384  {
1386  }
1387  break;
1388  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1389  {
1391  }
1392  break;
1393  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1394  {
1396  }
1397  break;
1398  case HANDLE_EMBED_SYSTEM_FONTS:
1399  {
1401  }
1402  break;
1403  case HANDLE_TAB_OVER_MARGIN:
1404  {
1406  }
1407  break;
1408  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1409  {
1411  }
1412  break;
1413  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1414  {
1416  }
1417  break;
1418  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1419  {
1421  }
1422  break;
1423  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1424  {
1426  }
1427  break;
1428  case HANDLE_SUBTRACT_FLYS:
1429  {
1431  }
1432  break;
1433  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1434  {
1436  }
1437  break;
1438  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1439  {
1440  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1442  }
1443  break;
1444  case HANDLE_CONTINUOUS_ENDNOTES:
1445  {
1446  rValue
1448  }
1449  break;
1450  case HANDLE_PROTECT_BOOKMARKS:
1451  {
1452  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1454  }
1455  break;
1456  case HANDLE_PROTECT_FIELDS:
1457  {
1458  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1460  }
1461  break;
1462  case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1463  {
1464  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1466  }
1467  break;
1468  default:
1469  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1470  }
1471 }
1472 
1474 {
1475  mpDocSh = nullptr;
1476  mpDoc = nullptr;
1477 }
1478 
1479 // XServiceInfo
1481 {
1482  return "SwXDocumentSettings";
1483 }
1484 
1485 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1486 {
1487  return cppu::supportsService(this, ServiceName);
1488 }
1489 
1491 {
1492  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1493 }
1494 
1495 /* 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:452
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:237
sal_uInt32 getRsidRoot() const
Definition: doc.cxx:215
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:442
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:758
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:3220
sal_uInt32 getRsid() const
Definition: doc.cxx:195
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:209
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:220
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:200
virtual void _postGetValues() override
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
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:175
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:3241