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_TABS_RELATIVE_TO_INDENT,
114  HANDLE_RSID,
115  HANDLE_RSID_ROOT,
116  HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
117  HANDLE_MODIFYPASSWORDINFO,
118  HANDLE_MATH_BASELINE_ALIGNMENT,
119  HANDLE_INVERT_BORDER_SPACING,
120  HANDLE_COLLAPSE_EMPTY_CELL_PARA,
121  HANDLE_SMALL_CAPS_PERCENTAGE_66,
122  HANDLE_TAB_OVERFLOW,
123  HANDLE_UNBREAKABLE_NUMBERINGS,
124  HANDLE_STYLES_NODEFAULT,
125  HANDLE_FLOATTABLE_NOMARGINS,
126  HANDLE_CLIPPED_PICTURES,
127  HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
128  HANDLE_EMBED_FONTS,
129  HANDLE_EMBED_USED_FONTS,
130  HANDLE_EMBED_LATIN_SCRIPT_FONTS,
131  HANDLE_EMBED_ASIAN_SCRIPT_FONTS,
132  HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
133  HANDLE_EMBED_SYSTEM_FONTS,
134  HANDLE_TAB_OVER_MARGIN,
135  HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
136  HANDLE_SURROUND_TEXT_WRAP_SMALL,
137  HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
138  HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
139  HANDLE_SUBTRACT_FLYS,
140  HANDLE_DISABLE_OFF_PAGE_POSITIONING,
141  HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
142  HANDLE_CONTINUOUS_ENDNOTES,
143  HANDLE_PROTECT_BOOKMARKS,
144  HANDLE_PROTECT_FIELDS,
145 };
146 
147 }
148 
150 {
151  static PropertyInfo const aWriterSettingsInfoMap[] =
152  {
153  { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
154  { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
155  { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
156  { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
157  { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
158  { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
159  { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
160  { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
161  { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
162  { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
163  { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
164  { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
165  { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
166  { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
167  { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
168  { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
169  { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
170  { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
171  { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
172  { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
173  { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
174 
175  { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
176  { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
177  { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
178  { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
179  { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
180  { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
181  { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
182  /* Stampit It disable the print cancel button of the shown progress dialog. */
183  { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
184  { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
185  { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
186  { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
187  { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
188  { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
189  { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
190  { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
191  { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
192  { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
193  { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
194  { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
195  { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
196  { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
197  { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
198  { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
199  { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
200  { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
201  { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
202  { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
203  { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
204  { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
205  { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
206  { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
207  { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
208  { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
209  { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
210  { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
211  { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
212  { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
213  { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
214  { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
215  { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
216  { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
217  { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
218  { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
219  { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
220  { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
221  { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
222  { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
223  { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
224  { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
225  { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
226  { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
227  { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
228  { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
229  { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
230  { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
231  { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
232  { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
233  { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
234 /*
235  * As OS said, we don't have a view when we need to set this, so I have to
236  * find another solution before adding them to this property set - MTG
237  { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
238  { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
239  { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
240  { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
241  { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
242  { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
243  { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
244 
245  { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
246  { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
247  { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
248  { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
249  { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
250  { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
251  { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
252 
253  { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
254  { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
255  { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
256  { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
257 */
258  { OUString(), 0, css::uno::Type(), 0}
259  };
260  return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
261 }
262 
265  &Application::GetSolarMutex () )
266 , mpModel ( pModel )
267 , mpDocSh ( nullptr )
268 , mpDoc ( nullptr )
269 , mpPrinter( nullptr )
270 , mbPreferPrinterPapersize( false )
271 {
273 }
274 
276  throw()
277 {
278 }
279 
281 {
282  return ::cppu::queryInterface(rType,
283  // OWeakObject interfaces
284  &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
285  &dynamic_cast<XWeak&>(*this),
286  // my own interfaces
287  &dynamic_cast<XPropertySet&>(*this),
288  &dynamic_cast<XPropertyState&>(*this),
289  &dynamic_cast<XMultiPropertySet&>(*this),
290  &dynamic_cast<XServiceInfo&>(*this),
291  &dynamic_cast<XTypeProvider&>(*this));
292 }
294  throw ()
295 {
296  OWeakObject::acquire();
297 }
299  throw ()
300 {
301  OWeakObject::release();
302 }
303 
304 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
305 {
306  static const uno::Sequence< uno::Type > aTypes {
307  // from MasterPropertySet
313  };
314  return aTypes;
315 }
316 
317 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
318 {
319  return css::uno::Sequence<sal_Int8>();
320 }
321 
323 {
325  if (nullptr == mpDocSh)
326  throw UnknownPropertyException();
327 
328  mpDoc = mpDocSh->GetDoc();
329  if (nullptr == mpDoc)
330  throw UnknownPropertyException();
331 }
332 
334 {
335  if (rInfo.mnAttributes & PropertyAttribute::READONLY)
336  throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
337 
338  switch( rInfo.mnHandle )
339  {
340  case HANDLE_FORBIDDEN_CHARS:
341  break;
342  case HANDLE_LINK_UPDATE_MODE:
343  {
344  sal_Int16 nMode = 0;
345  rValue >>= nMode;
346  switch (nMode)
347  {
348  case NEVER:
349  case MANUAL:
350  case AUTOMATIC:
351  case GLOBALSETTING:
352  break;
353  default:
354  throw IllegalArgumentException();
355  }
357  }
358  break;
359  case HANDLE_FIELD_AUTO_UPDATE:
360  {
361  bool bUpdateField = *o3tl::doAccess<bool>(rValue);
364  nFlag == AUTOUPD_FIELD_AND_CHARTS ?
367  AUTOUPD_OFF );
368  }
369  break;
370  case HANDLE_CHART_AUTO_UPDATE:
371  {
372  bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
375  bUpdateChart ?
378  AUTOUPD_OFF );
379  }
380  break;
381  case HANDLE_ADD_PARA_TABLE_SPACING:
382  {
383  bool bParaSpace = false;
384  rValue >>= bParaSpace;
386  }
387  break;
388  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
389  {
390  bool bParaSpacePage = false;
391  rValue >>= bParaSpacePage;
393  }
394  break;
395  case HANDLE_ALIGN_TAB_STOP_POSITION:
396  {
397  bool bAlignTab = *o3tl::doAccess<bool>(rValue);
399  }
400  break;
401  case HANDLE_PRINTER_NAME:
402  {
403  //the printer must be created
404  OUString sPrinterName;
405  if( !(rValue >>= sPrinterName) )
406  throw IllegalArgumentException();
407 
408  if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
409  {
410  SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
411  if ( pPrinter->GetName() != sPrinterName )
412  {
413  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
414  assert (! pNewPrinter->isDisposed() );
415  if( pNewPrinter->IsKnown() )
416  {
417  // set printer only once; in _postSetValues
418  mpPrinter = pNewPrinter;
419  }
420  else
421  {
422  pNewPrinter.disposeAndClear();
423  }
424  }
425  }
426 
427  }
428  break;
429  case HANDLE_PRINTER_SETUP:
430  {
431  Sequence < sal_Int8 > aSequence;
432  if ( !(rValue >>= aSequence) )
433  throw IllegalArgumentException();
434 
435  sal_uInt32 nSize = aSequence.getLength();
436  if( nSize > 0 )
437  {
438  SvMemoryStream aStream (aSequence.getArray(), nSize,
439  StreamMode::READ );
440  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
441  static sal_uInt16 const nRange[] =
442  {
444  SID_HTML_MODE, SID_HTML_MODE,
445  SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
446  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
447  0
448  };
449  auto pItemSet = std::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), nRange );
450  VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
451  assert (! pPrinter->isDisposed() );
452  // set printer only once; in _postSetValues
454  mpPrinter = pPrinter;
455  }
456 
457  }
458  break;
459  case HANDLE_PRINTER_PAPER:
460  {
461  bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
462  if(!(rValue >>= bPreferPrinterPapersize))
463  throw IllegalArgumentException();
464  mbPreferPrinterPapersize = bPreferPrinterPapersize;
465  }
466  break;
467  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
468  {
469  bool bIsKern = *o3tl::doAccess<bool>(rValue);
471  SwEditShell* pEditSh = mpDoc->GetEditShell();
472  if(pEditSh)
473  pEditSh->ChgHyphenation();
474  }
475  break;
476  case HANDLE_CHARACTER_COMPRESSION_TYPE:
477  {
478  sal_Int16 nMode = 0;
479  rValue >>= nMode;
480  switch (static_cast<CharCompressType>(nMode))
481  {
482  case CharCompressType::NONE:
483  case CharCompressType::PunctuationOnly:
484  case CharCompressType::PunctuationAndKana:
485  break;
486  default:
487  throw IllegalArgumentException();
488  }
489  mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
490  }
491  break;
492  case HANDLE_APPLY_USER_DATA:
493  {
494  mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
495  }
496  break;
497  case HANDLE_SAVE_THUMBNAIL:
498  {
499  mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
500  }
501  break;
502  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
503  {
504  bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
506  }
507  break;
508  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
509  {
511  if ( rValue >>= aData.sDataSource )
512  mpDoc->ChgDBData( aData );
513  }
514  break;
515  case HANDLE_CURRENT_DATABASE_COMMAND:
516  {
518 
519  if ( rValue >>= aData.sCommand )
520  mpDoc->ChgDBData( aData );
521 
522  SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
523  "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
524  }
525  break;
526  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
527  {
529  if ( rValue >>= aData.nCommandType )
530  mpDoc->ChgDBData( aData );
531  SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
532  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
533  SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
534  "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
535  }
536  break;
537  case HANDLE_EMBEDDED_DATABASE_NAME:
538  {
539 #if HAVE_FEATURE_DBCONNECTIVITY
540  OUString sEmbeddedName;
541  if (rValue >>= sEmbeddedName)
542  mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
543 #endif
544  }
545  break;
546  case HANDLE_SAVE_VERSION_ON_CLOSE:
547  {
548  mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
549  }
550  break;
551  case HANDLE_UPDATE_FROM_TEMPLATE:
552  {
553  mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
554  }
555  break;
556  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
557  {
558  sal_Int16 nTmp = 0;
559  rValue >>= nTmp;
560 
561  bool bUseVirDev = true;
562  bool bHiResVirDev = true;
563  if( nTmp == document::PrinterIndependentLayout::DISABLED )
564  bUseVirDev = false;
565  else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
566  bHiResVirDev = false;
567  else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
568  throw IllegalArgumentException();
569 
570  mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
571  }
572  break;
573  case HANDLE_IS_LABEL_DOC :
574  {
575  bool bSet = false;
576  if(!(rValue >>= bSet))
577  throw IllegalArgumentException();
579  }
580  break;
581  case HANDLE_IS_ADD_FLY_OFFSET:
582  {
583  bool bTmp = *o3tl::doAccess<bool>(rValue);
585  }
586  break;
587  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
588  {
589  bool bTmp = *o3tl::doAccess<bool>(rValue);
591  }
592  break;
593  case HANDLE_IS_ADD_EXTERNAL_LEADING:
594  {
595  bool bTmp = *o3tl::doAccess<bool>(rValue);
597  }
598  break;
599  case HANDLE_OLD_NUMBERING:
600  {
601  bool bTmp = *o3tl::doAccess<bool>(rValue);
603  }
604  break;
605  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
606  {
607  // ignore - this is a dead property
608  }
609  break;
610  case HANDLE_ALLOW_PRINTJOB_CANCEL:
611  {
612  bool bState = false;
613  if (!(rValue >>= bState))
614  throw IllegalArgumentException();
616  }
617  break;
618  case HANDLE_USE_FORMER_LINE_SPACING:
619  {
620  bool bTmp = *o3tl::doAccess<bool>(rValue);
622  }
623  break;
624  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
625  {
626  bool bTmp = *o3tl::doAccess<bool>(rValue);
628  }
629  break;
630  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
631  {
632  bool bTmp = *o3tl::doAccess<bool>(rValue);
634  }
635  break;
636  case HANDLE_USE_FORMER_TEXT_WRAPPING:
637  {
638  bool bTmp = *o3tl::doAccess<bool>(rValue);
640  }
641  break;
642  case HANDLE_CHANGES_PASSWORD:
643  {
644  Sequence <sal_Int8> aNew;
645  if(rValue >>= aNew)
646  {
648  if(aNew.hasElements())
649  {
651  eMode |= RedlineFlags::On;
653  }
654  }
655  }
656  break;
657  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
658  {
659  bool bTmp = *o3tl::doAccess<bool>(rValue);
661  }
662  break;
663  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
664  {
665  bool bTmp = *o3tl::doAccess<bool>(rValue);
667  }
668  break;
669  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
670  {
671  bool bTmp = *o3tl::doAccess<bool>(rValue);
673  }
674  break;
675  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
676  {
677  bool bTmp = *o3tl::doAccess<bool>(rValue);
679  }
680  break;
681  case HANDLE_TABLE_ROW_KEEP:
682  {
683  bool bTmp = *o3tl::doAccess<bool>(rValue);
685  }
686  break;
687  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
688  {
689  bool bTmp = *o3tl::doAccess<bool>(rValue);
691  }
692  break;
693  case HANDLE_LOAD_READONLY:
694  {
695  mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
696  }
697  break;
698  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
699  {
700  bool bTmp = *o3tl::doAccess<bool>(rValue);
702  }
703  break;
704  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
705  {
706  bool bTmp = *o3tl::doAccess<bool>(rValue);
708  }
709  break;
710  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
711  {
712  bool bTmp = *o3tl::doAccess<bool>(rValue);
714  }
715  break;
716  case HANDLE_USE_OLD_PRINTER_METRICS:
717  // ignore - this is a dead property
718  break;
719  case HANDLE_TABS_RELATIVE_TO_INDENT:
720  {
721  bool bTmp = *o3tl::doAccess<bool>(rValue);
723  }
724  break;
725  case HANDLE_RSID:
726  {
727  sal_uInt32 nTmp = 0;
728  rValue >>= nTmp;
729  mpDoc->setRsid( nTmp );
730  }
731  break;
732  case HANDLE_RSID_ROOT:
733  {
734  sal_uInt32 nTmp = 0;
735  rValue >>= nTmp;
736  mpDoc->setRsidRoot( nTmp );
737  }
738  break;
739  case HANDLE_PROTECT_FORM:
740  {
741  bool bTmp = *o3tl::doAccess<bool>(rValue);
743  }
744  break;
745  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
746  {
747  bool bTmp = *o3tl::doAccess<bool>(rValue);
749  }
750  break;
751  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
752  {
753  bool bTmp = *o3tl::doAccess<bool>(rValue);
755  }
756  break;
757  case HANDLE_MODIFYPASSWORDINFO:
758  {
759  uno::Sequence< beans::PropertyValue > aInfo;
760  if ( !( rValue >>= aInfo ) )
761  throw lang::IllegalArgumentException(
762  "Value of type Sequence<PropertyValue> expected!",
763  uno::Reference< uno::XInterface >(),
764  2 );
765 
766  if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
767  throw beans::PropertyVetoException(
768  "The hash is not allowed to be changed now!",
769  uno::Reference< uno::XInterface >() );
770  }
771  break;
772  case HANDLE_MATH_BASELINE_ALIGNMENT:
773  {
774  bool bTmp = *o3tl::doAccess<bool>(rValue);
776  }
777  break;
778  case HANDLE_INVERT_BORDER_SPACING:
779  {
780  bool bTmp = *o3tl::doAccess<bool>(rValue);
782  }
783  break;
784  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
785  {
786  bool bTmp = *o3tl::doAccess<bool>(rValue);
788  }
789  break;
790  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
791  {
792  bool bTmp = *o3tl::doAccess<bool>(rValue);
794  }
795  break;
796  case HANDLE_TAB_OVERFLOW:
797  {
798  bool bTmp = *o3tl::doAccess<bool>(rValue);
800  }
801  break;
802  case HANDLE_UNBREAKABLE_NUMBERINGS:
803  {
804  bool bTmp = *o3tl::doAccess<bool>(rValue);
806  }
807  break;
808  case HANDLE_STYLES_NODEFAULT:
809  {
810  bool bTmp = *o3tl::doAccess<bool>(rValue);
812  }
813  break;
814  case HANDLE_FLOATTABLE_NOMARGINS:
815  {
816  bool bTmp = *o3tl::doAccess<bool>(rValue);
818  }
819  break;
820  case HANDLE_CLIPPED_PICTURES:
821  {
822  bool bTmp = *o3tl::doAccess<bool>(rValue);
824  }
825  break;
826  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
827  {
828  bool bTmp = *o3tl::doAccess<bool>(rValue);
830  }
831  break;
832  case HANDLE_EMBED_FONTS:
833  {
834  bool bTmp = *o3tl::doAccess<bool>(rValue);
836  }
837  break;
838  case HANDLE_EMBED_USED_FONTS:
839  {
840  bool bTmp = *o3tl::doAccess<bool>(rValue);
842  }
843  break;
844  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
845  {
846  bool bTmp = *o3tl::doAccess<bool>(rValue);
848  }
849  break;
850  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
851  {
852  bool bTmp = *o3tl::doAccess<bool>(rValue);
854  }
855  break;
856  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
857  {
858  bool bTmp = *o3tl::doAccess<bool>(rValue);
860  }
861  break;
862  case HANDLE_EMBED_SYSTEM_FONTS:
863  {
864  bool bTmp = *o3tl::doAccess<bool>(rValue);
866  }
867  break;
868  case HANDLE_TAB_OVER_MARGIN:
869  {
870  bool bTmp = *o3tl::doAccess<bool>(rValue);
872  }
873  break;
874  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
875  {
876  bool bTmp = *o3tl::doAccess<bool>(rValue);
878  }
879  break;
880  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
881  {
882  bool bTmp = *o3tl::doAccess<bool>(rValue);
884  }
885  break;
886  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
887  {
888  bool bTmp = *o3tl::doAccess<bool>(rValue);
890  }
891  break;
892  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
893  {
894  bool bTmp;
895  if (rValue >>= bTmp)
896  {
899  }
900  }
901  break;
902  case HANDLE_SUBTRACT_FLYS:
903  {
904  bool bTmp;
905  if (rValue >>= bTmp)
906  {
909  }
910  }
911  break;
912  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
913  {
914  bool bTmp;
915  if (rValue >>= bTmp)
916  {
919  }
920  }
921  break;
922  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
923  {
924  bool bTmp;
925  if (rValue >>= bTmp)
926  {
928  bTmp);
929  }
930  }
931  break;
932  case HANDLE_CONTINUOUS_ENDNOTES:
933  {
934  bool bTmp;
935  if (rValue >>= bTmp)
936  {
938  bTmp);
939  }
940  }
941  break;
942  case HANDLE_PROTECT_BOOKMARKS:
943  {
944  bool bTmp;
945  if (rValue >>= bTmp)
946  {
948  bTmp);
949  }
950  }
951  break;
952  case HANDLE_PROTECT_FIELDS:
953  {
954  bool bTmp;
955  if (rValue >>= bTmp)
956  {
958  bTmp);
959  }
960  }
961  break;
962  default:
963  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
964  }
965 }
966 
968 {
969  // set printer only once, namely here!
970  if( mpPrinter != nullptr )
971  {
972  // #i86352# the printer is also used as container for options by sfx
973  // when setting a printer it should have decent default options
974  SfxItemSet aOptions( mpPrinter->GetOptions() );
976  SwAddPrinterItem aAddPrinterItem (aPrtData);
977  aOptions.Put(aAddPrinterItem);
978  mpPrinter->SetOptions( aOptions );
979  mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
980 
982  }
983 
984  mpPrinter = nullptr;
985  mpDocSh = nullptr;
986  mpDoc = nullptr;
987 }
988 
990 {
992  if (nullptr == mpDocSh)
993  throw UnknownPropertyException();
994  mpDoc = mpDocSh->GetDoc();
995  if (nullptr == mpDoc)
996  throw UnknownPropertyException();
997 }
998 
1000 {
1001  switch( rInfo.mnHandle )
1002  {
1003  case HANDLE_FORBIDDEN_CHARS:
1004  {
1005  Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1006  rValue <<= xRet;
1007  }
1008  break;
1009  case HANDLE_LINK_UPDATE_MODE:
1010  {
1011  rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1012  }
1013  break;
1014  case HANDLE_FIELD_AUTO_UPDATE:
1015  {
1017  rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1018  }
1019  break;
1020  case HANDLE_CHART_AUTO_UPDATE:
1021  {
1023  rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1024  }
1025  break;
1026  case HANDLE_ADD_PARA_TABLE_SPACING:
1027  {
1029  }
1030  break;
1031  case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1032  {
1034  }
1035  break;
1036  case HANDLE_ALIGN_TAB_STOP_POSITION:
1037  {
1039  }
1040  break;
1041  case HANDLE_PRINTER_NAME:
1042  {
1043  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1044  rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1045  }
1046  break;
1047  case HANDLE_PRINTER_SETUP:
1048  {
1049  SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1050  if (pPrinter)
1051  {
1052  SvMemoryStream aStream;
1053  pPrinter->Store( aStream );
1054  sal_uInt32 nSize = aStream.TellEnd();
1055  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1056  Sequence < sal_Int8 > aSequence( nSize );
1057  aStream.ReadBytes(aSequence.getArray(), nSize);
1058  rValue <<= aSequence;
1059  }
1060  else
1061  {
1062  Sequence < sal_Int8 > aSequence ( 0 );
1063  rValue <<= aSequence;
1064  }
1065  }
1066  break;
1067  case HANDLE_PRINTER_PAPER:
1068  {
1069  SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1070  rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1071  }
1072  break;
1073  case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1074  {
1076  }
1077  break;
1078  case HANDLE_APPLY_USER_DATA:
1079  {
1080  rValue <<= mpDocSh->IsUseUserData();
1081  }
1082  break;
1083  case HANDLE_SAVE_THUMBNAIL:
1084  {
1085  rValue <<= mpDocSh->IsUseThumbnailSave();
1086  }
1087  break;
1088  case HANDLE_CHARACTER_COMPRESSION_TYPE:
1089  {
1090  rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1091  }
1092  break;
1093  case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1094  {
1096  }
1097  break;
1098  case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1099  {
1100  const SwDBData& rData = mpDoc->GetDBDesc();
1101  rValue <<= rData.sDataSource;
1102  }
1103  break;
1104  case HANDLE_CURRENT_DATABASE_COMMAND:
1105  {
1106  const SwDBData& rData = mpDoc->GetDBDesc();
1107  rValue <<= rData.sCommand;
1108  }
1109  break;
1110  case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1111  {
1112  const SwDBData& rData = mpDoc->GetDBDesc();
1113  rValue <<= rData.nCommandType;
1114  }
1115  break;
1116  case HANDLE_EMBEDDED_DATABASE_NAME:
1117  {
1118 #if HAVE_FEATURE_DBCONNECTIVITY
1119  rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1120 #else
1121  rValue = uno::Any();
1122 #endif
1123  }
1124  break;
1125  case HANDLE_SAVE_VERSION_ON_CLOSE:
1126  {
1127  rValue <<= mpDocSh->IsSaveVersionOnClose();
1128  }
1129  break;
1130  case HANDLE_UPDATE_FROM_TEMPLATE:
1131  {
1132  rValue <<= mpDocSh->IsQueryLoadTemplate();
1133  }
1134  break;
1135  case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1136  {
1137  // returns short (see css.document.PrinterIndependentLayout)
1140  document::PrinterIndependentLayout::HIGH_RESOLUTION :
1141  document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1142  document::PrinterIndependentLayout::DISABLED;
1143  rValue <<= nVirDevType;
1144  }
1145  break;
1146  case HANDLE_IS_LABEL_DOC:
1147  {
1149  rValue <<= bLabel;
1150  }
1151  break;
1152  case HANDLE_IS_ADD_FLY_OFFSET:
1153  {
1155  }
1156  break;
1157  case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1158  {
1160  }
1161  break;
1162  case HANDLE_IS_ADD_EXTERNAL_LEADING:
1163  {
1165  }
1166  break;
1167  case HANDLE_OLD_NUMBERING:
1168  {
1170  }
1171  break;
1172  case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1173  {
1174  rValue <<= false;
1175  }
1176  break;
1177  case HANDLE_ALLOW_PRINTJOB_CANCEL:
1178  {
1179  rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1180  }
1181  break;
1182  case HANDLE_USE_FORMER_LINE_SPACING:
1183  {
1185  }
1186  break;
1187  case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1188  {
1190  }
1191  break;
1192  case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1193  {
1195  }
1196  break;
1197  case HANDLE_USE_FORMER_TEXT_WRAPPING:
1198  {
1200  }
1201  break;
1202  case HANDLE_CHANGES_PASSWORD:
1203  {
1205  }
1206  break;
1207  case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1208  {
1210  }
1211  break;
1212  case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1213  {
1215  }
1216  break;
1217  case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1218  {
1220  }
1221  break;
1222  case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1223  {
1225  }
1226  break;
1227  case HANDLE_TABLE_ROW_KEEP :
1228  {
1230  }
1231  break;
1232  case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1233  {
1235  }
1236  break;
1237  case HANDLE_LOAD_READONLY:
1238  {
1239  rValue <<= mpDocSh->IsLoadReadonly();
1240  }
1241  break;
1242  case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1243  {
1245  }
1246  break;
1247  case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1248  {
1250  }
1251  break;
1252  case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1253  {
1255  }
1256  break;
1257  case HANDLE_USE_OLD_PRINTER_METRICS:
1258  {
1259  rValue <<= false;
1260  }
1261  break;
1262  case HANDLE_TABS_RELATIVE_TO_INDENT:
1263  {
1265  }
1266  break;
1267  case HANDLE_RSID:
1268  {
1269  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1270  }
1271  break;
1272  case HANDLE_RSID_ROOT:
1273  {
1274  rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1275  }
1276  break;
1277  case HANDLE_PROTECT_FORM:
1278  {
1280  }
1281  break;
1282  case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1283  {
1285  }
1286  break;
1287  case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1288  {
1290  }
1291  break;
1292  case HANDLE_MODIFYPASSWORDINFO:
1293  {
1294  rValue <<= mpDocSh->GetModifyPasswordInfo();
1295  }
1296  break;
1297  case HANDLE_MATH_BASELINE_ALIGNMENT:
1298  {
1300  }
1301  break;
1302  case HANDLE_INVERT_BORDER_SPACING:
1303  {
1305  }
1306  break;
1307  case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1308  {
1310  }
1311  break;
1312  case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1313  {
1315  }
1316  break;
1317  case HANDLE_TAB_OVERFLOW:
1318  {
1320  }
1321  break;
1322  case HANDLE_UNBREAKABLE_NUMBERINGS:
1323  {
1325  }
1326  break;
1327  case HANDLE_STYLES_NODEFAULT:
1328  {
1330  }
1331  break;
1332  case HANDLE_FLOATTABLE_NOMARGINS:
1333  {
1335  }
1336  break;
1337  case HANDLE_CLIPPED_PICTURES:
1338  {
1340  }
1341  break;
1342  case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1343  {
1345  }
1346  break;
1347  case HANDLE_EMBED_FONTS:
1348  {
1350  }
1351  break;
1352  case HANDLE_EMBED_USED_FONTS:
1353  {
1355  }
1356  break;
1357  case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1358  {
1360  }
1361  break;
1362  case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1363  {
1365  }
1366  break;
1367  case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1368  {
1370  }
1371  break;
1372  case HANDLE_EMBED_SYSTEM_FONTS:
1373  {
1375  }
1376  break;
1377  case HANDLE_TAB_OVER_MARGIN:
1378  {
1380  }
1381  break;
1382  case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1383  {
1385  }
1386  break;
1387  case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1388  {
1390  }
1391  break;
1392  case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1393  {
1395  }
1396  break;
1397  case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1398  {
1400  }
1401  break;
1402  case HANDLE_SUBTRACT_FLYS:
1403  {
1405  }
1406  break;
1407  case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1408  {
1410  }
1411  break;
1412  case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1413  {
1414  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1416  }
1417  break;
1418  case HANDLE_CONTINUOUS_ENDNOTES:
1419  {
1420  rValue
1422  }
1423  break;
1424  case HANDLE_PROTECT_BOOKMARKS:
1425  {
1426  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1428  }
1429  break;
1430  case HANDLE_PROTECT_FIELDS:
1431  {
1432  rValue <<= mpDoc->getIDocumentSettingAccess().get(
1434  }
1435  break;
1436  default:
1437  throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1438  }
1439 }
1440 
1442 {
1443  mpDocSh = nullptr;
1444  mpDoc = nullptr;
1445 }
1446 
1447 // XServiceInfo
1449 {
1450  return "SwXDocumentSettings";
1451 }
1452 
1453 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1454 {
1455  return cppu::supportsService(this, ServiceName);
1456 }
1457 
1459 {
1460  return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1461 }
1462 
1463 /* 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:440
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:753
virtual sal_uInt64 TellEnd() override
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual void SAL_CALL acquire() override
sal_Int16 const mnAttributes
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:3172
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:347
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:211
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
SwDBData const & GetDBData()
Definition: docfld.cxx:342
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
#define STREAM_SEEK_TO_BEGIN
virtual ~SwXDocumentSettings() override
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:317
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:463
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.
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
sal_Int32 const mnHandle
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
SwDBManager * GetDBManager() const
Definition: doc.hxx:666
void SetOptions(const SfxItemSet &rNewOptions)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1317
virtual void _preSetValues() override
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3193