Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / uno / SwXDocumentSettings.cxx
blobbbf96ab967b5384d223ac70136b6c002118ead43
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <config_features.h>
21 #include <config_fuzzers.h>
23 #include <sal/config.h>
24 #include <sal/log.hxx>
26 #include <utility>
28 #include <o3tl/any.hxx>
29 #include "SwXDocumentSettings.hxx"
30 #include <comphelper/MasterPropertySetInfo.hxx>
31 #include <cppuhelper/queryinterface.hxx>
32 #include <cppuhelper/supportsservice.hxx>
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
35 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
36 #include <doc.hxx>
37 #include <IDocumentSettingAccess.hxx>
38 #include <IDocumentDeviceAccess.hxx>
39 #include <IDocumentRedlineAccess.hxx>
40 #include <docsh.hxx>
41 #include <fldupde.hxx>
42 #include <linkenum.hxx>
43 #include <sfx2/printer.hxx>
44 #include <editsh.hxx>
45 #include <unotxdoc.hxx>
46 #include <cmdid.h>
47 #include <unomod.hxx>
48 #include <vcl/svapp.hxx>
49 #include <svl/asiancfg.hxx>
50 #include <tools/stream.hxx>
52 #include <cfgitems.hxx>
53 #include <dbmgr.hxx>
55 using namespace comphelper;
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::i18n;
62 namespace {
64 enum SwDocumentSettingsPropertyHandles
66 HANDLE_FORBIDDEN_CHARS,
67 HANDLE_LINK_UPDATE_MODE,
68 HANDLE_FIELD_AUTO_UPDATE,
69 HANDLE_CHART_AUTO_UPDATE,
70 HANDLE_ADD_PARA_TABLE_SPACING,
71 HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
72 HANDLE_ALIGN_TAB_STOP_POSITION,
73 HANDLE_PRINTER_NAME,
74 HANDLE_PRINTER_SETUP,
75 HANDLE_PRINTER_PAPER,
76 HANDLE_IS_KERN_ASIAN_PUNCTUATION,
77 HANDLE_CHARACTER_COMPRESSION_TYPE,
78 HANDLE_APPLY_USER_DATA,
79 HANDLE_SAVE_THUMBNAIL,
80 HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS,
81 HANDLE_CURRENT_DATABASE_DATA_SOURCE,
82 HANDLE_CURRENT_DATABASE_COMMAND,
83 HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
84 HANDLE_EMBEDDED_DATABASE_NAME,
85 HANDLE_SAVE_VERSION_ON_CLOSE,
86 HANDLE_UPDATE_FROM_TEMPLATE,
87 HANDLE_PRINTER_INDEPENDENT_LAYOUT,
88 HANDLE_IS_LABEL_DOC,
89 HANDLE_IS_ADD_FLY_OFFSET,
90 HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,
91 HANDLE_IS_ADD_EXTERNAL_LEADING,
92 HANDLE_OLD_NUMBERING,
93 HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
94 /* Stampit It disable the print cancel button of the shown progress dialog. */
95 HANDLE_ALLOW_PRINTJOB_CANCEL,
96 HANDLE_USE_FORMER_LINE_SPACING,
97 HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
98 HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS,
99 HANDLE_USE_FORMER_OBJECT_POSITIONING,
100 HANDLE_USE_FORMER_TEXT_WRAPPING,
101 HANDLE_CHANGES_PASSWORD,
102 HANDLE_CONSIDER_WRAP_ON_OBJPOS,
103 HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
104 HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
105 HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
106 HANDLE_TABLE_ROW_KEEP,
107 HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
108 HANDLE_LOAD_READONLY,
109 HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
110 HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
111 HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
112 HANDLE_USE_OLD_PRINTER_METRICS,
113 HANDLE_PROTECT_FORM,
114 HANDLE_MS_WORD_COMP_TRAILING_BLANKS,
115 HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
116 HANDLE_TABS_RELATIVE_TO_INDENT,
117 HANDLE_RSID,
118 HANDLE_RSID_ROOT,
119 HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
120 HANDLE_MODIFYPASSWORDINFO,
121 HANDLE_MATH_BASELINE_ALIGNMENT,
122 HANDLE_INVERT_BORDER_SPACING,
123 HANDLE_COLLAPSE_EMPTY_CELL_PARA,
124 HANDLE_SMALL_CAPS_PERCENTAGE_66,
125 HANDLE_TAB_OVERFLOW,
126 HANDLE_UNBREAKABLE_NUMBERINGS,
127 HANDLE_STYLES_NODEFAULT,
128 HANDLE_FLOATTABLE_NOMARGINS,
129 HANDLE_CLIPPED_PICTURES,
130 HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
131 HANDLE_EMBED_FONTS,
132 HANDLE_EMBED_USED_FONTS,
133 HANDLE_EMBED_LATIN_SCRIPT_FONTS,
134 HANDLE_EMBED_ASIAN_SCRIPT_FONTS,
135 HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
136 HANDLE_EMBED_SYSTEM_FONTS,
137 HANDLE_TAB_OVER_MARGIN,
138 HANDLE_TAB_OVER_SPACING,
139 HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK,
140 HANDLE_SURROUND_TEXT_WRAP_SMALL,
141 HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
142 HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
143 HANDLE_SUBTRACT_FLYS,
144 HANDLE_DISABLE_OFF_PAGE_POSITIONING,
145 HANDLE_EMPTY_DB_FIELD_HIDES_PARA,
146 HANDLE_CONTINUOUS_ENDNOTES,
147 HANDLE_PROTECT_BOOKMARKS,
148 HANDLE_PROTECT_FIELDS,
149 HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
150 HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
151 HANDLE_GUTTER_AT_TOP,
152 HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND,
153 HANDLE_IMAGE_PREFERRED_DPI,
154 HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
155 HANDLE_HYPHENATE_URLS,
156 HANDLE_DO_NOT_BREAK_WRAPPED_TABLES,
157 HANDLE_ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
158 HANDLE_NO_NUMBERING_SHOW_FOLLOWBY,
159 HANDLE_DROP_CAP_PUNCTUATION,
164 static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo()
166 static PropertyInfo const aWriterSettingsInfoMap[] =
168 { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
169 { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
170 { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
171 { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
172 { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
173 { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
174 { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
175 { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
176 { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
177 { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
178 { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
179 { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
180 { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
181 { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
182 { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
183 { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
184 { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
185 { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
186 { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
187 { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
188 { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
190 { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
191 { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
192 { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
193 { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
194 { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
195 { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
196 { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
197 /* Stampit It disable the print cancel button of the shown progress dialog. */
198 { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
199 { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
200 { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
201 { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
202 { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
203 { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
204 { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
205 { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
206 { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
207 { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
208 { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
209 { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
210 { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
211 { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
212 { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
213 { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
214 { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
215 { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
216 { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
217 { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
218 { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
219 { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
220 { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
221 { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
222 { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
223 { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
224 { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
225 { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
226 { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
227 { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
228 { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
229 { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
230 { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
231 { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
232 { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
233 { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
234 { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
235 { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
236 { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
237 { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
238 { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
239 { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
240 { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
241 { OUString("TabOverSpacing"), HANDLE_TAB_OVER_SPACING, cppu::UnoType<bool>::get(), 0},
242 { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
243 { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
244 { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
245 { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
246 { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
247 { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
248 { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
249 { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
250 { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
251 { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
252 { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
253 { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
254 { OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
255 { OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType<bool>::get(), 0 },
256 { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0 },
257 { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 },
258 { OUString("HyphenateURLs"), HANDLE_HYPHENATE_URLS, cppu::UnoType<bool>::get(), 0 },
259 { OUString("DoNotBreakWrappedTables"), HANDLE_DO_NOT_BREAK_WRAPPED_TABLES, cppu::UnoType<bool>::get(), 0 },
260 { OUString("AllowTextAfterFloatingTableBreak"), HANDLE_ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK, cppu::UnoType<bool>::get(), 0 },
261 { OUString("NoNumberingShowFollowBy"), HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType<bool>::get(), 0 },
262 { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, cppu::UnoType<bool>::get(), 0 },
265 * As OS said, we don't have a view when we need to set this, so I have to
266 * find another solution before adding them to this property set - MTG
267 { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
268 { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
269 { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
270 { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
271 { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
272 { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
273 { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
275 { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
276 { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
277 { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
278 { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
279 { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
280 { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
281 { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
283 { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
284 { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
285 { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
286 { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
288 { OUString(), 0, css::uno::Type(), 0}
290 return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
293 SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
294 : MasterPropertySet ( lcl_createSettingsInfo().get(),
295 &Application::GetSolarMutex () )
296 , mpModel ( pModel )
297 , mpDocSh ( nullptr )
298 , mpDoc ( nullptr )
299 , mpPrinter( nullptr )
300 , mbPreferPrinterPapersize( false )
302 registerSlave ( new SwXPrintSettings ( SwXPrintSettingsType::Document, mpModel->GetDocShell()->GetDoc() ) );
305 SwXDocumentSettings::~SwXDocumentSettings()
306 noexcept
310 Any SAL_CALL SwXDocumentSettings::queryInterface( const Type& rType )
312 return ::cppu::queryInterface(rType,
313 // OWeakObject interfaces
314 static_cast<XInterface*>(static_cast<OWeakObject*>(this)),
315 static_cast<XWeak*>(this),
316 // my own interfaces
317 static_cast<XPropertySet*>(this),
318 static_cast<XPropertyState*>(this),
319 static_cast<XMultiPropertySet*>(this),
320 static_cast<XServiceInfo*>(this),
321 static_cast<XTypeProvider*>(this));
323 void SwXDocumentSettings::acquire ()
324 noexcept
326 OWeakObject::acquire();
328 void SwXDocumentSettings::release ()
329 noexcept
331 OWeakObject::release();
334 uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
336 static const uno::Sequence< uno::Type > aTypes {
337 // from MasterPropertySet
338 cppu::UnoType<XPropertySet>::get(),
339 cppu::UnoType<XPropertyState>::get(),
340 cppu::UnoType<XMultiPropertySet>::get(),
341 cppu::UnoType<XServiceInfo>::get(),
342 cppu::UnoType<XTypeProvider>::get(),
344 return aTypes;
347 uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
349 return css::uno::Sequence<sal_Int8>();
352 void SwXDocumentSettings::_preSetValues ()
354 mpDocSh = mpModel->GetDocShell();
355 if (nullptr == mpDocSh)
356 throw UnknownPropertyException();
358 mpDoc = mpDocSh->GetDoc();
359 if (nullptr == mpDoc)
360 throw UnknownPropertyException();
363 void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
365 if (rInfo.mnAttributes & PropertyAttribute::READONLY)
366 throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
368 switch( rInfo.mnHandle )
370 case HANDLE_FORBIDDEN_CHARS:
371 break;
372 case HANDLE_LINK_UPDATE_MODE:
374 sal_Int16 nMode = 0;
375 rValue >>= nMode;
376 switch (nMode)
378 case NEVER:
379 case MANUAL:
380 case AUTOMATIC:
381 case GLOBALSETTING:
382 break;
383 default:
384 throw IllegalArgumentException();
386 mpDoc->getIDocumentSettingAccess().setLinkUpdateMode(nMode);
388 break;
389 case HANDLE_FIELD_AUTO_UPDATE:
391 bool bUpdateField = *o3tl::doAccess<bool>(rValue);
392 SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
393 mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( bUpdateField ?
394 nFlag == AUTOUPD_FIELD_AND_CHARTS ?
395 AUTOUPD_FIELD_AND_CHARTS :
396 AUTOUPD_FIELD_ONLY :
397 AUTOUPD_OFF );
399 break;
400 case HANDLE_CHART_AUTO_UPDATE:
402 bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
403 SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
404 mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ?
405 bUpdateChart ?
406 AUTOUPD_FIELD_AND_CHARTS :
407 AUTOUPD_FIELD_ONLY :
408 AUTOUPD_OFF );
410 break;
411 case HANDLE_ADD_PARA_TABLE_SPACING:
413 bool bParaSpace = false;
414 rValue >>= bParaSpace;
415 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX, bParaSpace );
417 break;
418 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
420 bool bParaSpacePage = false;
421 rValue >>= bParaSpacePage;
422 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bParaSpacePage );
424 break;
425 case HANDLE_ALIGN_TAB_STOP_POSITION:
427 bool bAlignTab = *o3tl::doAccess<bool>(rValue);
428 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, bAlignTab);
430 break;
431 case HANDLE_PRINTER_NAME:
433 //the printer must be created
434 OUString sPrinterName;
435 if( !(rValue >>= sPrinterName) )
436 throw IllegalArgumentException();
438 if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
440 SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
441 if ( pPrinter->GetName() != sPrinterName )
443 VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
444 assert (! pNewPrinter->isDisposed() );
445 if( pNewPrinter->IsKnown() )
447 // set printer only once; in _postSetValues
448 mpPrinter = pNewPrinter;
450 else
452 pNewPrinter.disposeAndClear();
458 break;
459 case HANDLE_PRINTER_SETUP:
461 Sequence < sal_Int8 > aSequence;
462 if ( !(rValue >>= aSequence) )
463 throw IllegalArgumentException();
465 sal_uInt32 nSize = aSequence.getLength();
466 if( nSize > 0 )
468 SvMemoryStream aStream (aSequence.getArray(), nSize,
469 StreamMode::READ );
470 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
471 auto pItemSet = std::make_unique<SfxItemSetFixed<
472 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
473 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
474 SID_HTML_MODE, SID_HTML_MODE,
475 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER>>( mpDoc->GetAttrPool() );
476 VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
477 assert (! pPrinter->isDisposed() );
478 // set printer only once; in _postSetValues
479 mpPrinter.disposeAndClear();
480 mpPrinter = pPrinter;
484 break;
485 case HANDLE_PRINTER_PAPER:
487 bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
488 if(!(rValue >>= bPreferPrinterPapersize))
489 throw IllegalArgumentException();
490 mbPreferPrinterPapersize = bPreferPrinterPapersize;
492 break;
493 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
495 bool bIsKern = *o3tl::doAccess<bool>(rValue);
496 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, bIsKern);
497 if (SwEditShell* pEditSh = mpDoc->GetEditShell())
498 pEditSh->ChgHyphenation();
500 break;
501 case HANDLE_CHARACTER_COMPRESSION_TYPE:
503 sal_Int16 nMode = 0;
504 rValue >>= nMode;
505 switch (static_cast<CharCompressType>(nMode))
507 case CharCompressType::NONE:
508 case CharCompressType::PunctuationOnly:
509 case CharCompressType::PunctuationAndKana:
510 break;
511 default:
512 throw IllegalArgumentException();
514 mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode));
516 break;
517 case HANDLE_APPLY_USER_DATA:
519 mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
521 break;
522 case HANDLE_SAVE_THUMBNAIL:
524 mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
526 break;
527 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
529 bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
530 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal );
532 break;
533 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
535 SwDBData aData = mpDoc->GetDBData();
536 if ( rValue >>= aData.sDataSource )
537 mpDoc->ChgDBData( aData );
539 break;
540 case HANDLE_CURRENT_DATABASE_COMMAND:
542 SwDBData aData = mpDoc->GetDBData();
544 if ( rValue >>= aData.sCommand )
545 mpDoc->ChgDBData( aData );
547 SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
548 "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
550 break;
551 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
553 SwDBData aData = mpDoc->GetDBData();
554 if ( rValue >>= aData.nCommandType )
555 mpDoc->ChgDBData( aData );
556 SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
557 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
558 SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
559 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
561 break;
562 case HANDLE_EMBEDDED_DATABASE_NAME:
564 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
565 OUString sEmbeddedName;
566 if (rValue >>= sEmbeddedName)
567 mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
568 #endif
570 break;
571 case HANDLE_SAVE_VERSION_ON_CLOSE:
573 mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
575 break;
576 case HANDLE_UPDATE_FROM_TEMPLATE:
578 mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
580 break;
581 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
583 sal_Int16 nTmp = 0;
584 rValue >>= nTmp;
586 bool bUseVirDev = true;
587 bool bHiResVirDev = true;
588 if( nTmp == document::PrinterIndependentLayout::DISABLED )
589 bUseVirDev = false;
590 else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
591 bHiResVirDev = false;
592 else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
593 throw IllegalArgumentException();
595 mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
597 break;
598 case HANDLE_IS_LABEL_DOC :
600 bool bSet = false;
601 if(!(rValue >>= bSet))
602 throw IllegalArgumentException();
603 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::LABEL_DOCUMENT, bSet);
605 break;
606 case HANDLE_IS_ADD_FLY_OFFSET:
608 bool bTmp = *o3tl::doAccess<bool>(rValue);
609 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp);
611 break;
612 case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
614 bool bTmp = *o3tl::doAccess<bool>(rValue);
615 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp);
617 break;
618 case HANDLE_IS_ADD_EXTERNAL_LEADING:
620 bool bTmp = *o3tl::doAccess<bool>(rValue);
621 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, bTmp);
623 break;
624 case HANDLE_OLD_NUMBERING:
626 bool bTmp = *o3tl::doAccess<bool>(rValue);
627 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_NUMBERING, bTmp);
629 break;
630 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
632 // ignore - this is a dead property
634 break;
635 case HANDLE_ALLOW_PRINTJOB_CANCEL:
637 bool bState = false;
638 if (!(rValue >>= bState))
639 throw IllegalArgumentException();
640 mpDocSh->Stamp_SetPrintCancelState(bState);
642 break;
643 case HANDLE_USE_FORMER_LINE_SPACING:
645 bool bTmp = *o3tl::doAccess<bool>(rValue);
646 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_LINE_SPACING, bTmp);
648 break;
649 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
651 bool bTmp = *o3tl::doAccess<bool>(rValue);
652 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
654 break;
655 case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
657 bool bTmp = *o3tl::doAccess<bool>(rValue);
658 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, bTmp);
660 break;
661 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
663 bool bTmp = *o3tl::doAccess<bool>(rValue);
664 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_OBJECT_POS, bTmp);
666 break;
667 case HANDLE_USE_FORMER_TEXT_WRAPPING:
669 bool bTmp = *o3tl::doAccess<bool>(rValue);
670 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, bTmp);
672 break;
673 case HANDLE_CHANGES_PASSWORD:
675 Sequence <sal_Int8> aNew;
676 if(rValue >>= aNew)
678 mpDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew);
679 if(aNew.hasElements())
681 RedlineFlags eMode = mpDoc->getIDocumentRedlineAccess().GetRedlineFlags();
682 eMode |= RedlineFlags::On;
683 mpDoc->getIDocumentRedlineAccess().SetRedlineFlags( eMode );
687 break;
688 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
690 bool bTmp = *o3tl::doAccess<bool>(rValue);
691 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp );
693 break;
694 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
696 bool bTmp = *o3tl::doAccess<bool>(rValue);
697 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp);
699 break;
700 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
702 bool bTmp = *o3tl::doAccess<bool>(rValue);
703 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp);
705 break;
706 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
708 bool bTmp = *o3tl::doAccess<bool>(rValue);
709 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp);
711 break;
712 case HANDLE_TABLE_ROW_KEEP:
714 bool bTmp = *o3tl::doAccess<bool>(rValue);
715 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABLE_ROW_KEEP, bTmp);
717 break;
718 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
720 bool bTmp = *o3tl::doAccess<bool>(rValue);
721 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp);
723 break;
724 case HANDLE_LOAD_READONLY:
726 mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
728 break;
729 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
731 bool bTmp = *o3tl::doAccess<bool>(rValue);
732 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp);
734 break;
735 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
737 bool bTmp = *o3tl::doAccess<bool>(rValue);
738 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp);
740 break;
741 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
743 bool bTmp = *o3tl::doAccess<bool>(rValue);
744 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING, bTmp);
746 break;
747 case HANDLE_USE_OLD_PRINTER_METRICS:
748 // ignore - this is a dead property
749 break;
750 case HANDLE_TABS_RELATIVE_TO_INDENT:
752 bool bTmp = *o3tl::doAccess<bool>(rValue);
753 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT, bTmp);
755 break;
756 case HANDLE_RSID:
758 sal_uInt32 nTmp = 0;
759 rValue >>= nTmp;
760 mpDoc->setRsid( nTmp );
762 break;
763 case HANDLE_RSID_ROOT:
765 sal_uInt32 nTmp = 0;
766 rValue >>= nTmp;
767 mpDoc->setRsidRoot( nTmp );
769 break;
770 case HANDLE_PROTECT_FORM:
772 bool bTmp = *o3tl::doAccess<bool>(rValue);
773 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, bTmp);
775 break;
776 case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
778 bool bTmp = *o3tl::doAccess<bool>(rValue);
779 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS, bTmp);
781 break;
782 case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
784 bool bTmp = *o3tl::doAccess<bool>(rValue);
785 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, bTmp);
787 break;
788 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
790 bool bTmp = *o3tl::doAccess<bool>(rValue);
791 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp);
793 break;
794 case HANDLE_MODIFYPASSWORDINFO:
796 uno::Sequence< beans::PropertyValue > aInfo;
797 if ( !( rValue >>= aInfo ) )
798 throw lang::IllegalArgumentException(
799 "Value of type Sequence<PropertyValue> expected!",
800 uno::Reference< uno::XInterface >(),
801 2 );
803 if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
804 throw beans::PropertyVetoException(
805 "The hash is not allowed to be changed now!",
806 uno::Reference< uno::XInterface >() );
808 break;
809 case HANDLE_MATH_BASELINE_ALIGNMENT:
811 bool bTmp = *o3tl::doAccess<bool>(rValue);
812 mpDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT, bTmp );
814 break;
815 case HANDLE_INVERT_BORDER_SPACING:
817 bool bTmp = *o3tl::doAccess<bool>(rValue);
818 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::INVERT_BORDER_SPACING, bTmp);
820 break;
821 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
823 bool bTmp = *o3tl::doAccess<bool>(rValue);
824 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA, bTmp);
826 break;
827 case HANDLE_SMALL_CAPS_PERCENTAGE_66:
829 bool bTmp = *o3tl::doAccess<bool>(rValue);
830 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SMALL_CAPS_PERCENTAGE_66, bTmp);
832 break;
833 case HANDLE_TAB_OVERFLOW:
835 bool bTmp = *o3tl::doAccess<bool>(rValue);
836 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVERFLOW, bTmp);
838 break;
839 case HANDLE_UNBREAKABLE_NUMBERINGS:
841 bool bTmp = *o3tl::doAccess<bool>(rValue);
842 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNBREAKABLE_NUMBERINGS, bTmp);
844 break;
845 case HANDLE_STYLES_NODEFAULT:
847 bool bTmp = *o3tl::doAccess<bool>(rValue);
848 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::STYLES_NODEFAULT, bTmp);
850 break;
851 case HANDLE_FLOATTABLE_NOMARGINS:
853 bool bTmp = *o3tl::doAccess<bool>(rValue);
854 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::FLOATTABLE_NOMARGINS, bTmp);
856 break;
857 case HANDLE_CLIPPED_PICTURES:
859 bool bTmp = *o3tl::doAccess<bool>(rValue);
860 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIPPED_PICTURES, bTmp);
862 break;
863 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
865 bool bTmp = *o3tl::doAccess<bool>(rValue);
866 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS, bTmp);
868 break;
869 case HANDLE_EMBED_FONTS:
871 bool bTmp = *o3tl::doAccess<bool>(rValue);
872 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_FONTS, bTmp);
874 break;
875 case HANDLE_EMBED_USED_FONTS:
877 bool bTmp = *o3tl::doAccess<bool>(rValue);
878 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_USED_FONTS, bTmp);
880 break;
881 case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
883 bool bTmp = *o3tl::doAccess<bool>(rValue);
884 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS, bTmp);
886 break;
887 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
889 bool bTmp = *o3tl::doAccess<bool>(rValue);
890 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS, bTmp);
892 break;
893 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
895 bool bTmp = *o3tl::doAccess<bool>(rValue);
896 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS, bTmp);
898 break;
899 case HANDLE_EMBED_SYSTEM_FONTS:
901 bool bTmp = *o3tl::doAccess<bool>(rValue);
902 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_SYSTEM_FONTS, bTmp);
904 break;
905 case HANDLE_TAB_OVER_MARGIN:
907 bool bTmp = *o3tl::doAccess<bool>(rValue);
908 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, bTmp);
910 break;
911 case HANDLE_TAB_OVER_SPACING:
913 bool bTmp = *o3tl::doAccess<bool>(rValue);
914 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_SPACING, bTmp);
916 break;
917 case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
919 bool bTmp = *o3tl::doAccess<bool>(rValue);
920 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, bTmp);
922 break;
923 case HANDLE_SURROUND_TEXT_WRAP_SMALL:
925 bool bTmp = *o3tl::doAccess<bool>(rValue);
926 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, bTmp);
928 break;
929 case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
931 bool bTmp = *o3tl::doAccess<bool>(rValue);
932 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp);
934 break;
935 case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
937 bool bTmp;
938 if (rValue >>= bTmp)
940 mpDoc->getIDocumentSettingAccess().set(
941 DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, bTmp);
944 break;
945 case HANDLE_SUBTRACT_FLYS:
947 bool bTmp;
948 if (rValue >>= bTmp)
950 mpDoc->getIDocumentSettingAccess().set(
951 DocumentSettingId::SUBTRACT_FLYS, bTmp);
954 break;
955 case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
957 bool bTmp;
958 if (rValue >>= bTmp)
960 mpDoc->getIDocumentSettingAccess().set(
961 DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING, bTmp);
964 break;
965 case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
967 bool bTmp;
968 if (rValue >>= bTmp)
970 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA,
971 bTmp);
974 break;
975 case HANDLE_CONTINUOUS_ENDNOTES:
977 bool bTmp;
978 if (rValue >>= bTmp)
980 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES,
981 bTmp);
984 break;
985 case HANDLE_PROTECT_BOOKMARKS:
987 bool bTmp;
988 if (rValue >>= bTmp)
990 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_BOOKMARKS,
991 bTmp);
994 break;
995 case HANDLE_PROTECT_FIELDS:
997 bool bTmp;
998 if (rValue >>= bTmp)
1000 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FIELDS,
1001 bTmp);
1004 break;
1005 case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1007 bool bTmp;
1008 if (rValue >>= bTmp)
1010 mpDoc->getIDocumentSettingAccess().set(
1011 DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA, bTmp);
1014 break;
1015 case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1017 bool bTmp;
1018 if (rValue >>= bTmp)
1020 mpDoc->getIDocumentSettingAccess().set(
1021 DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA, bTmp);
1024 break;
1025 case HANDLE_GUTTER_AT_TOP:
1027 bool bTmp;
1028 if (rValue >>= bTmp)
1030 mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GUTTER_AT_TOP, bTmp);
1033 break;
1034 case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1036 bool bTmp;
1037 if (rValue >>= bTmp)
1039 mpDoc->getIDocumentSettingAccess().set(
1040 DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, bTmp);
1043 break;
1044 case HANDLE_IMAGE_PREFERRED_DPI:
1046 sal_uInt32 nValue = 0;
1047 if (rValue >>= nValue)
1049 mpDoc->getIDocumentSettingAccess().setImagePreferredDPI(nValue);
1052 break;
1053 case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1055 bool bTmp;
1056 if (rValue >>= bTmp)
1058 mpDoc->getIDocumentSettingAccess().set(
1059 DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, bTmp);
1062 break;
1063 case HANDLE_HYPHENATE_URLS:
1065 bool bTmp;
1066 if (rValue >>= bTmp)
1068 mpDoc->getIDocumentSettingAccess().set(
1069 DocumentSettingId::HYPHENATE_URLS, bTmp);
1072 break;
1073 case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES:
1075 bool bTmp;
1076 if (rValue >>= bTmp)
1078 mpDoc->getIDocumentSettingAccess().set(
1079 DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES, bTmp);
1082 break;
1083 case HANDLE_ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
1085 bool bTmp;
1086 if (rValue >>= bTmp)
1088 mpDoc->getIDocumentSettingAccess().set(
1089 DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK, bTmp);
1092 break;
1093 case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY:
1095 bool bTmp;
1096 if (rValue >>= bTmp)
1097 mpDoc->getIDocumentSettingAccess().set(
1098 DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY, bTmp);
1100 break;
1101 case HANDLE_DROP_CAP_PUNCTUATION:
1103 bool bTmp;
1104 if (rValue >>= bTmp)
1105 mpDoc->getIDocumentSettingAccess().set(
1106 DocumentSettingId::DROP_CAP_PUNCTUATION, bTmp);
1108 break;
1109 default:
1110 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1114 void SwXDocumentSettings::_postSetValues ()
1116 // set printer only once, namely here!
1117 if( mpPrinter != nullptr )
1119 // #i86352# the printer is also used as container for options by sfx
1120 // when setting a printer it should have decent default options
1121 SfxItemSet aOptions( mpPrinter->GetOptions() );
1122 SwPrintData aPrtData( mpDoc->getIDocumentDeviceAccess().getPrintData() );
1123 SwAddPrinterItem aAddPrinterItem (aPrtData);
1124 aOptions.Put(aAddPrinterItem);
1125 mpPrinter->SetOptions( aOptions );
1126 mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1128 mpDoc->getIDocumentDeviceAccess().setPrinter( mpPrinter, true, true );
1131 mpPrinter = nullptr;
1132 mpDocSh = nullptr;
1133 mpDoc = nullptr;
1136 void SwXDocumentSettings::_preGetValues ()
1138 mpDocSh = mpModel->GetDocShell();
1139 if (nullptr == mpDocSh)
1140 throw UnknownPropertyException();
1141 mpDoc = mpDocSh->GetDoc();
1142 if (nullptr == mpDoc)
1143 throw UnknownPropertyException();
1146 void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
1148 switch( rInfo.mnHandle )
1150 case HANDLE_FORBIDDEN_CHARS:
1152 rValue <<= Reference<XForbiddenCharacters>(mpModel->GetPropertyHelper());
1154 break;
1155 case HANDLE_LINK_UPDATE_MODE:
1157 rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1159 break;
1160 case HANDLE_FIELD_AUTO_UPDATE:
1162 SwFieldUpdateFlags nFlags = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
1163 rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1165 break;
1166 case HANDLE_CHART_AUTO_UPDATE:
1168 SwFieldUpdateFlags nFlags = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
1169 rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1171 break;
1172 case HANDLE_ADD_PARA_TABLE_SPACING:
1174 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX);
1176 break;
1177 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1179 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES);
1181 break;
1182 case HANDLE_ALIGN_TAB_STOP_POSITION:
1184 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
1186 break;
1187 case HANDLE_PRINTER_NAME:
1189 SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1190 rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1192 break;
1193 case HANDLE_PRINTER_SETUP:
1195 SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1196 if (pPrinter)
1198 SvMemoryStream aStream;
1199 pPrinter->Store( aStream );
1200 sal_uInt32 nSize = aStream.TellEnd();
1201 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1202 Sequence < sal_Int8 > aSequence( nSize );
1203 aStream.ReadBytes(aSequence.getArray(), nSize);
1204 rValue <<= aSequence;
1206 else
1208 Sequence < sal_Int8 > aSequence ( 0 );
1209 rValue <<= aSequence;
1212 break;
1213 case HANDLE_PRINTER_PAPER:
1215 SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1216 rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1218 break;
1219 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1221 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::KERN_ASIAN_PUNCTUATION);
1223 break;
1224 case HANDLE_APPLY_USER_DATA:
1226 rValue <<= mpDocSh->IsUseUserData();
1228 break;
1229 case HANDLE_SAVE_THUMBNAIL:
1231 rValue <<= mpDocSh->IsUseThumbnailSave();
1233 break;
1234 case HANDLE_CHARACTER_COMPRESSION_TYPE:
1236 rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1238 break;
1239 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1241 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS);
1243 break;
1244 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1246 const SwDBData& rData = mpDoc->GetDBData();
1247 rValue <<= rData.sDataSource;
1249 break;
1250 case HANDLE_CURRENT_DATABASE_COMMAND:
1252 const SwDBData& rData = mpDoc->GetDBData();
1253 rValue <<= rData.sCommand;
1255 break;
1256 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1258 const SwDBData& rData = mpDoc->GetDBData();
1259 rValue <<= rData.nCommandType;
1261 break;
1262 case HANDLE_EMBEDDED_DATABASE_NAME:
1264 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1265 rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1266 #else
1267 rValue = uno::Any();
1268 #endif
1270 break;
1271 case HANDLE_SAVE_VERSION_ON_CLOSE:
1273 rValue <<= mpDocSh->IsSaveVersionOnClose();
1275 break;
1276 case HANDLE_UPDATE_FROM_TEMPLATE:
1278 rValue <<= mpDocSh->IsQueryLoadTemplate();
1280 break;
1281 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1283 // returns short (see css.document.PrinterIndependentLayout)
1284 sal_Int16 nVirDevType = mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE) ?
1285 ( mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) ?
1286 document::PrinterIndependentLayout::HIGH_RESOLUTION :
1287 document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1288 document::PrinterIndependentLayout::DISABLED;
1289 rValue <<= nVirDevType;
1291 break;
1292 case HANDLE_IS_LABEL_DOC:
1294 bool bLabel = mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::LABEL_DOCUMENT);
1295 rValue <<= bLabel;
1297 break;
1298 case HANDLE_IS_ADD_FLY_OFFSET:
1300 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS);
1302 break;
1303 case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1305 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
1307 break;
1308 case HANDLE_IS_ADD_EXTERNAL_LEADING:
1310 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING);
1312 break;
1313 case HANDLE_OLD_NUMBERING:
1315 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::OLD_NUMBERING);
1317 break;
1318 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1320 rValue <<= false;
1322 break;
1323 case HANDLE_ALLOW_PRINTJOB_CANCEL:
1325 rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1327 break;
1328 case HANDLE_USE_FORMER_LINE_SPACING:
1330 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::OLD_LINE_SPACING);
1332 break;
1333 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1335 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS);
1337 break;
1338 case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
1340 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS);
1342 break;
1343 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1345 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS);
1347 break;
1348 case HANDLE_USE_FORMER_TEXT_WRAPPING:
1350 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING);
1352 break;
1353 case HANDLE_CHANGES_PASSWORD:
1355 rValue <<= mpDoc->getIDocumentRedlineAccess().GetRedlinePassword();
1357 break;
1358 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1360 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION);
1362 break;
1363 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1365 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING);
1367 break;
1368 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1370 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK);
1372 break;
1373 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1375 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT);
1377 break;
1378 case HANDLE_TABLE_ROW_KEEP :
1380 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABLE_ROW_KEEP);
1382 break;
1383 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1385 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION);
1387 break;
1388 case HANDLE_LOAD_READONLY:
1390 rValue <<= mpDocSh->IsLoadReadonly();
1392 break;
1393 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1395 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
1397 break;
1398 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1400 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME);
1402 break;
1403 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1405 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING);
1407 break;
1408 case HANDLE_USE_OLD_PRINTER_METRICS:
1410 rValue <<= false;
1412 break;
1413 case HANDLE_TABS_RELATIVE_TO_INDENT:
1415 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
1417 break;
1418 case HANDLE_RSID:
1420 rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1422 break;
1423 case HANDLE_RSID_ROOT:
1425 rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1427 break;
1428 case HANDLE_PROTECT_FORM:
1430 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM);
1432 break;
1433 case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1435 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS);
1437 break;
1438 case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1440 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY);
1442 break;
1443 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1445 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
1447 break;
1448 case HANDLE_MODIFYPASSWORDINFO:
1450 rValue <<= mpDocSh->GetModifyPasswordInfo();
1452 break;
1453 case HANDLE_MATH_BASELINE_ALIGNMENT:
1455 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
1457 break;
1458 case HANDLE_INVERT_BORDER_SPACING:
1460 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::INVERT_BORDER_SPACING);
1462 break;
1463 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1465 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA );
1467 break;
1468 case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1470 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 );
1472 break;
1473 case HANDLE_TAB_OVERFLOW:
1475 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TAB_OVERFLOW );
1477 break;
1478 case HANDLE_UNBREAKABLE_NUMBERINGS:
1480 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::UNBREAKABLE_NUMBERINGS );
1482 break;
1483 case HANDLE_STYLES_NODEFAULT:
1485 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::STYLES_NODEFAULT );
1487 break;
1488 case HANDLE_FLOATTABLE_NOMARGINS:
1490 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::FLOATTABLE_NOMARGINS );
1492 break;
1493 case HANDLE_CLIPPED_PICTURES:
1495 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::CLIPPED_PICTURES );
1497 break;
1498 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1500 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS );
1502 break;
1503 case HANDLE_EMBED_FONTS:
1505 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS );
1507 break;
1508 case HANDLE_EMBED_USED_FONTS:
1510 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_USED_FONTS );
1512 break;
1513 case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1515 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS );
1517 break;
1518 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1520 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS );
1522 break;
1523 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1525 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS );
1527 break;
1528 case HANDLE_EMBED_SYSTEM_FONTS:
1530 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS );
1532 break;
1533 case HANDLE_TAB_OVER_MARGIN:
1535 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TAB_OVER_MARGIN );
1537 break;
1538 case HANDLE_TAB_OVER_SPACING:
1540 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_SPACING);
1542 break;
1543 case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1545 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK );
1547 break;
1548 case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1550 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::SURROUND_TEXT_WRAP_SMALL );
1552 break;
1553 case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1555 rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING );
1557 break;
1558 case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1560 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE);
1562 break;
1563 case HANDLE_SUBTRACT_FLYS:
1565 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS);
1567 break;
1568 case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1570 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING);
1572 break;
1573 case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1575 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1576 DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA);
1578 break;
1579 case HANDLE_CONTINUOUS_ENDNOTES:
1581 rValue
1582 <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CONTINUOUS_ENDNOTES);
1584 break;
1585 case HANDLE_PROTECT_BOOKMARKS:
1587 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1588 DocumentSettingId::PROTECT_BOOKMARKS);
1590 break;
1591 case HANDLE_PROTECT_FIELDS:
1593 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1594 DocumentSettingId::PROTECT_FIELDS);
1596 break;
1597 case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1599 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1600 DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA);
1602 break;
1603 case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1605 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1606 DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA);
1608 break;
1609 case HANDLE_GUTTER_AT_TOP:
1611 rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP);
1613 break;
1614 case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1616 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1617 DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND);
1619 break;
1620 case HANDLE_IMAGE_PREFERRED_DPI:
1622 rValue <<= mpDoc->getIDocumentSettingAccess().getImagePreferredDPI();
1624 break;
1625 case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1627 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1628 DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE);
1630 break;
1631 case HANDLE_HYPHENATE_URLS:
1633 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1634 DocumentSettingId::HYPHENATE_URLS);
1636 break;
1637 case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES:
1639 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1640 DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES);
1642 break;
1643 case HANDLE_ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK:
1645 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1646 DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK);
1648 break;
1649 case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY:
1651 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1652 DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY);
1654 break;
1655 case HANDLE_DROP_CAP_PUNCTUATION:
1657 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1658 DocumentSettingId::DROP_CAP_PUNCTUATION);
1660 break;
1661 default:
1662 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1666 void SwXDocumentSettings::_postGetValues ()
1668 mpDocSh = nullptr;
1669 mpDoc = nullptr;
1672 // XServiceInfo
1673 OUString SAL_CALL SwXDocumentSettings::getImplementationName( )
1675 return "SwXDocumentSettings";
1678 sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1680 return cppu::supportsService(this, ServiceName);
1683 Sequence< OUString > SAL_CALL SwXDocumentSettings::getSupportedServiceNames( )
1685 return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1688 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */