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#include <config_fuzzers.h>
22
23#include <sal/config.h>
24#include <sal/log.hxx>
25
26#include <utility>
27
28#include <o3tl/any.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>
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>
51
52#include <cfgitems.hxx>
53#include <dbmgr.hxx>
54
55using namespace comphelper;
56using namespace ::com::sun::star;
57using namespace ::com::sun::star::uno;
58using namespace ::com::sun::star::beans;
59using namespace ::com::sun::star::lang;
60using namespace ::com::sun::star::i18n;
61
62namespace {
63
64enum SwDocumentSettingsPropertyHandles
65{
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_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS
156};
157
158}
159
161{
162 static PropertyInfo const aWriterSettingsInfoMap[] =
163 {
164 { OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0},
165 { OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0},
166 { OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
167 { OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0},
168 { OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0},
169 { OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0},
170 { OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0},
171 { OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0},
172 { OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
173 { OUString("PrinterPaperFromSetup"), HANDLE_PRINTER_PAPER, cppu::UnoType<bool>::get(), 0},
174 { OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0},
175 { OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0},
176 { OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0 },
177 { OUString("SaveThumbnail"), HANDLE_SAVE_THUMBNAIL, cppu::UnoType<bool>::get(), 0 },
178 { OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0},
179 { OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0},
180 { OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0},
181 { OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0},
182 { OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0},
183 { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0},
184 { OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0},
185
186 { OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0},
187 { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0},
188 { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
189 { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType<bool>::get(), 0},
190 { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0},
191 { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0},
192 { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0},
193 /* Stampit It disable the print cancel button of the shown progress dialog. */
194 { OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0},
195 { OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0},
196 { OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
197 { OUString("AddParaLineSpacingToTableCells"), HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0},
198 { OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0},
199 { OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0},
200 { OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0},
201 { OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0},
202 { OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0},
203 { OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0},
204 { OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0},
205 { OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0},
206 { OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0},
207 { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0},
208 { OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0},
209 { OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0},
210 { OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0},
211 { OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0},
212 { OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0},
213 { OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0},
214 { OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0},
215 { OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0},
216 { OUString("MsWordCompTrailingBlanks"), HANDLE_MS_WORD_COMP_TRAILING_BLANKS, cppu::UnoType<bool>::get(), 0 },
217 { OUString("MsWordCompMinLineHeightByFly"), HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, cppu::UnoType<bool>::get(), 0 },
218 { OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0},
219 { OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0},
220 { OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0},
221 { OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0},
222 { OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0},
223 { OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0},
224 { OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0},
225 { OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0},
226 { OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0},
227 { OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0},
228 { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0},
229 { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0},
230 { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0},
231 { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0},
232 { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
233 { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
234 { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0},
235 { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0},
236 { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0},
237 { OUString("TabOverSpacing"), HANDLE_TAB_OVER_SPACING, cppu::UnoType<bool>::get(), 0},
238 { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0},
239 { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0},
240 { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
241 { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0},
242 { OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0},
243 { OUString("DisableOffPagePositioning"), HANDLE_DISABLE_OFF_PAGE_POSITIONING, cppu::UnoType<bool>::get(), 0},
244 { OUString("EmptyDbFieldHidesPara"), HANDLE_EMPTY_DB_FIELD_HIDES_PARA, cppu::UnoType<bool>::get(), 0 },
245 { OUString("ContinuousEndnotes"), HANDLE_CONTINUOUS_ENDNOTES, cppu::UnoType<bool>::get(), 0 },
246 { OUString("ProtectBookmarks"), HANDLE_PROTECT_BOOKMARKS, cppu::UnoType<bool>::get(), 0 },
247 { OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
248 { OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
249 { OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
250 { OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
251 { OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType<bool>::get(), 0 },
252 { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0 },
253 { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 },
254 { OUString("WordLikeWrapForAsCharFlys"), HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, cppu::UnoType<bool>::get(), 0 },
255
256/*
257 * As OS said, we don't have a view when we need to set this, so I have to
258 * find another solution before adding them to this property set - MTG
259 { OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
260 { OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
261 { OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
262 { OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
263 { OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
264 { OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
265 { OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
266
267 { OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
268 { OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
269 { OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
270 { OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
271 { OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
272 { OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
273 { OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
274
275 { OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
276 { OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
277 { OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
278 { OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
279*/
280 { OUString(), 0, css::uno::Type(), 0}
281 };
282 return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
283}
284
287 &Application::GetSolarMutex () )
288, mpModel ( pModel )
289, mpDocSh ( nullptr )
290, mpDoc ( nullptr )
291, mpPrinter( nullptr )
292, mbPreferPrinterPapersize( false )
293{
295}
296
298 noexcept
299{
300}
301
303{
304 return ::cppu::queryInterface(rType,
305 // OWeakObject interfaces
306 &dynamic_cast<XInterface&>(dynamic_cast<OWeakObject&>(*this)),
307 &dynamic_cast<XWeak&>(*this),
308 // my own interfaces
309 &dynamic_cast<XPropertySet&>(*this),
310 &dynamic_cast<XPropertyState&>(*this),
311 &dynamic_cast<XMultiPropertySet&>(*this),
312 &dynamic_cast<XServiceInfo&>(*this),
313 &dynamic_cast<XTypeProvider&>(*this));
314}
316 noexcept
317{
318 OWeakObject::acquire();
319}
321 noexcept
322{
323 OWeakObject::release();
324}
325
326uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
327{
328 static const uno::Sequence< uno::Type > aTypes {
329 // from MasterPropertySet
335 };
336 return aTypes;
337}
338
339uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
340{
341 return css::uno::Sequence<sal_Int8>();
342}
343
345{
347 if (nullptr == mpDocSh)
348 throw UnknownPropertyException();
349
350 mpDoc = mpDocSh->GetDoc();
351 if (nullptr == mpDoc)
352 throw UnknownPropertyException();
353}
354
356{
357 if (rInfo.mnAttributes & PropertyAttribute::READONLY)
358 throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
359
360 switch( rInfo.mnHandle )
361 {
362 case HANDLE_FORBIDDEN_CHARS:
363 break;
364 case HANDLE_LINK_UPDATE_MODE:
365 {
366 sal_Int16 nMode = 0;
367 rValue >>= nMode;
368 switch (nMode)
369 {
370 case NEVER:
371 case MANUAL:
372 case AUTOMATIC:
373 case GLOBALSETTING:
374 break;
375 default:
376 throw IllegalArgumentException();
377 }
379 }
380 break;
381 case HANDLE_FIELD_AUTO_UPDATE:
382 {
383 bool bUpdateField = *o3tl::doAccess<bool>(rValue);
386 nFlag == AUTOUPD_FIELD_AND_CHARTS ?
389 AUTOUPD_OFF );
390 }
391 break;
392 case HANDLE_CHART_AUTO_UPDATE:
393 {
394 bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
397 bUpdateChart ?
400 AUTOUPD_OFF );
401 }
402 break;
403 case HANDLE_ADD_PARA_TABLE_SPACING:
404 {
405 bool bParaSpace = false;
406 rValue >>= bParaSpace;
408 }
409 break;
410 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
411 {
412 bool bParaSpacePage = false;
413 rValue >>= bParaSpacePage;
415 }
416 break;
417 case HANDLE_ALIGN_TAB_STOP_POSITION:
418 {
419 bool bAlignTab = *o3tl::doAccess<bool>(rValue);
421 }
422 break;
423 case HANDLE_PRINTER_NAME:
424 {
425 //the printer must be created
426 OUString sPrinterName;
427 if( !(rValue >>= sPrinterName) )
428 throw IllegalArgumentException();
429
430 if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
431 {
433 if ( pPrinter->GetName() != sPrinterName )
434 {
435 VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
436 assert (! pNewPrinter->isDisposed() );
437 if( pNewPrinter->IsKnown() )
438 {
439 // set printer only once; in _postSetValues
440 mpPrinter = pNewPrinter;
441 }
442 else
443 {
444 pNewPrinter.disposeAndClear();
445 }
446 }
447 }
448
449 }
450 break;
451 case HANDLE_PRINTER_SETUP:
452 {
453 Sequence < sal_Int8 > aSequence;
454 if ( !(rValue >>= aSequence) )
455 throw IllegalArgumentException();
456
457 sal_uInt32 nSize = aSequence.getLength();
458 if( nSize > 0 )
459 {
460 SvMemoryStream aStream (aSequence.getArray(), nSize,
461 StreamMode::READ );
462 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
463 auto pItemSet = std::make_unique<SfxItemSetFixed<
464 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
465 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
466 SID_HTML_MODE, SID_HTML_MODE,
468 VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
469 assert (! pPrinter->isDisposed() );
470 // set printer only once; in _postSetValues
472 mpPrinter = pPrinter;
473 }
474
475 }
476 break;
477 case HANDLE_PRINTER_PAPER:
478 {
479 bool bPreferPrinterPapersize = {}; // spurious -Werror=maybe-uninitialized
480 if(!(rValue >>= bPreferPrinterPapersize))
481 throw IllegalArgumentException();
482 mbPreferPrinterPapersize = bPreferPrinterPapersize;
483 }
484 break;
485 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
486 {
487 bool bIsKern = *o3tl::doAccess<bool>(rValue);
489 SwEditShell* pEditSh = mpDoc->GetEditShell();
490 if(pEditSh)
491 pEditSh->ChgHyphenation();
492 }
493 break;
494 case HANDLE_CHARACTER_COMPRESSION_TYPE:
495 {
496 sal_Int16 nMode = 0;
497 rValue >>= nMode;
498 switch (static_cast<CharCompressType>(nMode))
499 {
500 case CharCompressType::NONE:
501 case CharCompressType::PunctuationOnly:
502 case CharCompressType::PunctuationAndKana:
503 break;
504 default:
505 throw IllegalArgumentException();
506 }
508 }
509 break;
510 case HANDLE_APPLY_USER_DATA:
511 {
512 mpDocSh->SetUseUserData(*o3tl::doAccess<bool>(rValue));
513 }
514 break;
515 case HANDLE_SAVE_THUMBNAIL:
516 {
517 mpDocSh->SetUseThumbnailSave(*o3tl::doAccess<bool>(rValue));
518 }
519 break;
520 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
521 {
522 bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
524 }
525 break;
526 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
527 {
529 if ( rValue >>= aData.sDataSource )
531 }
532 break;
533 case HANDLE_CURRENT_DATABASE_COMMAND:
534 {
536
537 if ( rValue >>= aData.sCommand )
539
540 SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
541 "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
542 }
543 break;
544 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
545 {
547 if ( rValue >>= aData.nCommandType )
549 SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
550 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
551 SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
552 "\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
553 }
554 break;
555 case HANDLE_EMBEDDED_DATABASE_NAME:
556 {
557#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
558 OUString sEmbeddedName;
559 if (rValue >>= sEmbeddedName)
560 mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
561#endif
562 }
563 break;
564 case HANDLE_SAVE_VERSION_ON_CLOSE:
565 {
566 mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
567 }
568 break;
569 case HANDLE_UPDATE_FROM_TEMPLATE:
570 {
571 mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
572 }
573 break;
574 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
575 {
576 sal_Int16 nTmp = 0;
577 rValue >>= nTmp;
578
579 bool bUseVirDev = true;
580 bool bHiResVirDev = true;
581 if( nTmp == document::PrinterIndependentLayout::DISABLED )
582 bUseVirDev = false;
583 else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
584 bHiResVirDev = false;
585 else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
586 throw IllegalArgumentException();
587
588 mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
589 }
590 break;
591 case HANDLE_IS_LABEL_DOC :
592 {
593 bool bSet = false;
594 if(!(rValue >>= bSet))
595 throw IllegalArgumentException();
597 }
598 break;
599 case HANDLE_IS_ADD_FLY_OFFSET:
600 {
601 bool bTmp = *o3tl::doAccess<bool>(rValue);
603 }
604 break;
605 case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
606 {
607 bool bTmp = *o3tl::doAccess<bool>(rValue);
609 }
610 break;
611 case HANDLE_IS_ADD_EXTERNAL_LEADING:
612 {
613 bool bTmp = *o3tl::doAccess<bool>(rValue);
615 }
616 break;
617 case HANDLE_OLD_NUMBERING:
618 {
619 bool bTmp = *o3tl::doAccess<bool>(rValue);
621 }
622 break;
623 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
624 {
625 // ignore - this is a dead property
626 }
627 break;
628 case HANDLE_ALLOW_PRINTJOB_CANCEL:
629 {
630 bool bState = false;
631 if (!(rValue >>= bState))
632 throw IllegalArgumentException();
634 }
635 break;
636 case HANDLE_USE_FORMER_LINE_SPACING:
637 {
638 bool bTmp = *o3tl::doAccess<bool>(rValue);
640 }
641 break;
642 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
643 {
644 bool bTmp = *o3tl::doAccess<bool>(rValue);
646 }
647 break;
648 case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
649 {
650 bool bTmp = *o3tl::doAccess<bool>(rValue);
652 }
653 break;
654 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
655 {
656 bool bTmp = *o3tl::doAccess<bool>(rValue);
658 }
659 break;
660 case HANDLE_USE_FORMER_TEXT_WRAPPING:
661 {
662 bool bTmp = *o3tl::doAccess<bool>(rValue);
664 }
665 break;
666 case HANDLE_CHANGES_PASSWORD:
667 {
668 Sequence <sal_Int8> aNew;
669 if(rValue >>= aNew)
670 {
672 if(aNew.hasElements())
673 {
677 }
678 }
679 }
680 break;
681 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
682 {
683 bool bTmp = *o3tl::doAccess<bool>(rValue);
685 }
686 break;
687 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
688 {
689 bool bTmp = *o3tl::doAccess<bool>(rValue);
691 }
692 break;
693 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
694 {
695 bool bTmp = *o3tl::doAccess<bool>(rValue);
697 }
698 break;
699 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
700 {
701 bool bTmp = *o3tl::doAccess<bool>(rValue);
703 }
704 break;
705 case HANDLE_TABLE_ROW_KEEP:
706 {
707 bool bTmp = *o3tl::doAccess<bool>(rValue);
709 }
710 break;
711 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
712 {
713 bool bTmp = *o3tl::doAccess<bool>(rValue);
715 }
716 break;
717 case HANDLE_LOAD_READONLY:
718 {
719 mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
720 }
721 break;
722 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
723 {
724 bool bTmp = *o3tl::doAccess<bool>(rValue);
726 }
727 break;
728 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
729 {
730 bool bTmp = *o3tl::doAccess<bool>(rValue);
732 }
733 break;
734 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
735 {
736 bool bTmp = *o3tl::doAccess<bool>(rValue);
738 }
739 break;
740 case HANDLE_USE_OLD_PRINTER_METRICS:
741 // ignore - this is a dead property
742 break;
743 case HANDLE_TABS_RELATIVE_TO_INDENT:
744 {
745 bool bTmp = *o3tl::doAccess<bool>(rValue);
747 }
748 break;
749 case HANDLE_RSID:
750 {
751 sal_uInt32 nTmp = 0;
752 rValue >>= nTmp;
753 mpDoc->setRsid( nTmp );
754 }
755 break;
756 case HANDLE_RSID_ROOT:
757 {
758 sal_uInt32 nTmp = 0;
759 rValue >>= nTmp;
760 mpDoc->setRsidRoot( nTmp );
761 }
762 break;
763 case HANDLE_PROTECT_FORM:
764 {
765 bool bTmp = *o3tl::doAccess<bool>(rValue);
767 }
768 break;
769 case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
770 {
771 bool bTmp = *o3tl::doAccess<bool>(rValue);
773 }
774 break;
775 case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
776 {
777 bool bTmp = *o3tl::doAccess<bool>(rValue);
779 }
780 break;
781 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
782 {
783 bool bTmp = *o3tl::doAccess<bool>(rValue);
785 }
786 break;
787 case HANDLE_MODIFYPASSWORDINFO:
788 {
789 uno::Sequence< beans::PropertyValue > aInfo;
790 if ( !( rValue >>= aInfo ) )
791 throw lang::IllegalArgumentException(
792 "Value of type Sequence<PropertyValue> expected!",
793 uno::Reference< uno::XInterface >(),
794 2 );
795
796 if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
797 throw beans::PropertyVetoException(
798 "The hash is not allowed to be changed now!",
799 uno::Reference< uno::XInterface >() );
800 }
801 break;
802 case HANDLE_MATH_BASELINE_ALIGNMENT:
803 {
804 bool bTmp = *o3tl::doAccess<bool>(rValue);
806 }
807 break;
808 case HANDLE_INVERT_BORDER_SPACING:
809 {
810 bool bTmp = *o3tl::doAccess<bool>(rValue);
812 }
813 break;
814 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
815 {
816 bool bTmp = *o3tl::doAccess<bool>(rValue);
818 }
819 break;
820 case HANDLE_SMALL_CAPS_PERCENTAGE_66:
821 {
822 bool bTmp = *o3tl::doAccess<bool>(rValue);
824 }
825 break;
826 case HANDLE_TAB_OVERFLOW:
827 {
828 bool bTmp = *o3tl::doAccess<bool>(rValue);
830 }
831 break;
832 case HANDLE_UNBREAKABLE_NUMBERINGS:
833 {
834 bool bTmp = *o3tl::doAccess<bool>(rValue);
836 }
837 break;
838 case HANDLE_STYLES_NODEFAULT:
839 {
840 bool bTmp = *o3tl::doAccess<bool>(rValue);
842 }
843 break;
844 case HANDLE_FLOATTABLE_NOMARGINS:
845 {
846 bool bTmp = *o3tl::doAccess<bool>(rValue);
848 }
849 break;
850 case HANDLE_CLIPPED_PICTURES:
851 {
852 bool bTmp = *o3tl::doAccess<bool>(rValue);
854 }
855 break;
856 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
857 {
858 bool bTmp = *o3tl::doAccess<bool>(rValue);
860 }
861 break;
862 case HANDLE_EMBED_FONTS:
863 {
864 bool bTmp = *o3tl::doAccess<bool>(rValue);
866 }
867 break;
868 case HANDLE_EMBED_USED_FONTS:
869 {
870 bool bTmp = *o3tl::doAccess<bool>(rValue);
872 }
873 break;
874 case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
875 {
876 bool bTmp = *o3tl::doAccess<bool>(rValue);
878 }
879 break;
880 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
881 {
882 bool bTmp = *o3tl::doAccess<bool>(rValue);
884 }
885 break;
886 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
887 {
888 bool bTmp = *o3tl::doAccess<bool>(rValue);
890 }
891 break;
892 case HANDLE_EMBED_SYSTEM_FONTS:
893 {
894 bool bTmp = *o3tl::doAccess<bool>(rValue);
896 }
897 break;
898 case HANDLE_TAB_OVER_MARGIN:
899 {
900 bool bTmp = *o3tl::doAccess<bool>(rValue);
902 }
903 break;
904 case HANDLE_TAB_OVER_SPACING:
905 {
906 bool bTmp = *o3tl::doAccess<bool>(rValue);
908 }
909 break;
910 case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
911 {
912 bool bTmp = *o3tl::doAccess<bool>(rValue);
914 }
915 break;
916 case HANDLE_SURROUND_TEXT_WRAP_SMALL:
917 {
918 bool bTmp = *o3tl::doAccess<bool>(rValue);
920 }
921 break;
922 case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
923 {
924 bool bTmp = *o3tl::doAccess<bool>(rValue);
926 }
927 break;
928 case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
929 {
930 bool bTmp;
931 if (rValue >>= bTmp)
932 {
935 }
936 }
937 break;
938 case HANDLE_SUBTRACT_FLYS:
939 {
940 bool bTmp;
941 if (rValue >>= bTmp)
942 {
945 }
946 }
947 break;
948 case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
949 {
950 bool bTmp;
951 if (rValue >>= bTmp)
952 {
955 }
956 }
957 break;
958 case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
959 {
960 bool bTmp;
961 if (rValue >>= bTmp)
962 {
964 bTmp);
965 }
966 }
967 break;
968 case HANDLE_CONTINUOUS_ENDNOTES:
969 {
970 bool bTmp;
971 if (rValue >>= bTmp)
972 {
974 bTmp);
975 }
976 }
977 break;
978 case HANDLE_PROTECT_BOOKMARKS:
979 {
980 bool bTmp;
981 if (rValue >>= bTmp)
982 {
984 bTmp);
985 }
986 }
987 break;
988 case HANDLE_PROTECT_FIELDS:
989 {
990 bool bTmp;
991 if (rValue >>= bTmp)
992 {
994 bTmp);
995 }
996 }
997 break;
998 case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
999 {
1000 bool bTmp;
1001 if (rValue >>= bTmp)
1002 {
1005 }
1006 }
1007 break;
1008 case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1009 {
1010 bool bTmp;
1011 if (rValue >>= bTmp)
1012 {
1015 }
1016 }
1017 break;
1018 case HANDLE_GUTTER_AT_TOP:
1019 {
1020 bool bTmp;
1021 if (rValue >>= bTmp)
1022 {
1024 }
1025 }
1026 break;
1027 case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1028 {
1029 bool bTmp;
1030 if (rValue >>= bTmp)
1031 {
1034 }
1035 }
1036 break;
1037 case HANDLE_IMAGE_PREFERRED_DPI:
1038 {
1039 sal_uInt32 nValue = 0;
1040 if (rValue >>= nValue)
1041 {
1043 }
1044 }
1045 break;
1046 case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1047 {
1048 bool bTmp;
1049 if (rValue >>= bTmp)
1050 {
1053 }
1054 }
1055 break;
1056 case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
1057 {
1058 bool bValue = false;
1059 if (rValue >>= bValue)
1062 }
1063 break;
1064 default:
1065 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1066 }
1067}
1068
1070{
1071 // set printer only once, namely here!
1072 if( mpPrinter != nullptr )
1073 {
1074 // #i86352# the printer is also used as container for options by sfx
1075 // when setting a printer it should have decent default options
1076 SfxItemSet aOptions( mpPrinter->GetOptions() );
1078 SwAddPrinterItem aAddPrinterItem (aPrtData);
1079 aOptions.Put(aAddPrinterItem);
1080 mpPrinter->SetOptions( aOptions );
1081 mpPrinter->SetPrinterSettingsPreferred( mbPreferPrinterPapersize );
1082
1084 }
1085
1086 mpPrinter = nullptr;
1087 mpDocSh = nullptr;
1088 mpDoc = nullptr;
1089}
1090
1092{
1094 if (nullptr == mpDocSh)
1095 throw UnknownPropertyException();
1096 mpDoc = mpDocSh->GetDoc();
1097 if (nullptr == mpDoc)
1098 throw UnknownPropertyException();
1099}
1100
1102{
1103 switch( rInfo.mnHandle )
1104 {
1105 case HANDLE_FORBIDDEN_CHARS:
1106 {
1107 Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
1108 rValue <<= xRet;
1109 }
1110 break;
1111 case HANDLE_LINK_UPDATE_MODE:
1112 {
1113 rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
1114 }
1115 break;
1116 case HANDLE_FIELD_AUTO_UPDATE:
1117 {
1119 rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
1120 }
1121 break;
1122 case HANDLE_CHART_AUTO_UPDATE:
1123 {
1125 rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
1126 }
1127 break;
1128 case HANDLE_ADD_PARA_TABLE_SPACING:
1129 {
1131 }
1132 break;
1133 case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
1134 {
1136 }
1137 break;
1138 case HANDLE_ALIGN_TAB_STOP_POSITION:
1139 {
1141 }
1142 break;
1143 case HANDLE_PRINTER_NAME:
1144 {
1145 SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1146 rValue <<= pPrinter ? pPrinter->GetName() : OUString();
1147 }
1148 break;
1149 case HANDLE_PRINTER_SETUP:
1150 {
1151 SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1152 if (pPrinter)
1153 {
1154 SvMemoryStream aStream;
1155 pPrinter->Store( aStream );
1156 sal_uInt32 nSize = aStream.TellEnd();
1157 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1158 Sequence < sal_Int8 > aSequence( nSize );
1159 aStream.ReadBytes(aSequence.getArray(), nSize);
1160 rValue <<= aSequence;
1161 }
1162 else
1163 {
1164 Sequence < sal_Int8 > aSequence ( 0 );
1165 rValue <<= aSequence;
1166 }
1167 }
1168 break;
1169 case HANDLE_PRINTER_PAPER:
1170 {
1171 SfxPrinter *pTempPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
1172 rValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
1173 }
1174 break;
1175 case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
1176 {
1178 }
1179 break;
1180 case HANDLE_APPLY_USER_DATA:
1181 {
1182 rValue <<= mpDocSh->IsUseUserData();
1183 }
1184 break;
1185 case HANDLE_SAVE_THUMBNAIL:
1186 {
1187 rValue <<= mpDocSh->IsUseThumbnailSave();
1188 }
1189 break;
1190 case HANDLE_CHARACTER_COMPRESSION_TYPE:
1191 {
1192 rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
1193 }
1194 break;
1195 case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
1196 {
1198 }
1199 break;
1200 case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
1201 {
1202 const SwDBData& rData = mpDoc->GetDBData();
1203 rValue <<= rData.sDataSource;
1204 }
1205 break;
1206 case HANDLE_CURRENT_DATABASE_COMMAND:
1207 {
1208 const SwDBData& rData = mpDoc->GetDBData();
1209 rValue <<= rData.sCommand;
1210 }
1211 break;
1212 case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
1213 {
1214 const SwDBData& rData = mpDoc->GetDBData();
1215 rValue <<= rData.nCommandType;
1216 }
1217 break;
1218 case HANDLE_EMBEDDED_DATABASE_NAME:
1219 {
1220#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1221 rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
1222#else
1223 rValue = uno::Any();
1224#endif
1225 }
1226 break;
1227 case HANDLE_SAVE_VERSION_ON_CLOSE:
1228 {
1229 rValue <<= mpDocSh->IsSaveVersionOnClose();
1230 }
1231 break;
1232 case HANDLE_UPDATE_FROM_TEMPLATE:
1233 {
1234 rValue <<= mpDocSh->IsQueryLoadTemplate();
1235 }
1236 break;
1237 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1238 {
1239 // returns short (see css.document.PrinterIndependentLayout)
1242 document::PrinterIndependentLayout::HIGH_RESOLUTION :
1243 document::PrinterIndependentLayout::LOW_RESOLUTION ) :
1244 document::PrinterIndependentLayout::DISABLED;
1245 rValue <<= nVirDevType;
1246 }
1247 break;
1248 case HANDLE_IS_LABEL_DOC:
1249 {
1251 rValue <<= bLabel;
1252 }
1253 break;
1254 case HANDLE_IS_ADD_FLY_OFFSET:
1255 {
1257 }
1258 break;
1259 case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
1260 {
1262 }
1263 break;
1264 case HANDLE_IS_ADD_EXTERNAL_LEADING:
1265 {
1267 }
1268 break;
1269 case HANDLE_OLD_NUMBERING:
1270 {
1272 }
1273 break;
1274 case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
1275 {
1276 rValue <<= false;
1277 }
1278 break;
1279 case HANDLE_ALLOW_PRINTJOB_CANCEL:
1280 {
1281 rValue <<= mpDocSh->Stamp_GetPrintCancelState();
1282 }
1283 break;
1284 case HANDLE_USE_FORMER_LINE_SPACING:
1285 {
1287 }
1288 break;
1289 case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
1290 {
1292 }
1293 break;
1294 case HANDLE_ADD_PARA_LINE_SPACING_TO_TABLE_CELLS:
1295 {
1297 }
1298 break;
1299 case HANDLE_USE_FORMER_OBJECT_POSITIONING:
1300 {
1302 }
1303 break;
1304 case HANDLE_USE_FORMER_TEXT_WRAPPING:
1305 {
1307 }
1308 break;
1309 case HANDLE_CHANGES_PASSWORD:
1310 {
1312 }
1313 break;
1314 case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
1315 {
1317 }
1318 break;
1319 case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
1320 {
1322 }
1323 break;
1324 case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
1325 {
1327 }
1328 break;
1329 case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
1330 {
1332 }
1333 break;
1334 case HANDLE_TABLE_ROW_KEEP :
1335 {
1337 }
1338 break;
1339 case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
1340 {
1342 }
1343 break;
1344 case HANDLE_LOAD_READONLY:
1345 {
1346 rValue <<= mpDocSh->IsLoadReadonly();
1347 }
1348 break;
1349 case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
1350 {
1352 }
1353 break;
1354 case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
1355 {
1357 }
1358 break;
1359 case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
1360 {
1362 }
1363 break;
1364 case HANDLE_USE_OLD_PRINTER_METRICS:
1365 {
1366 rValue <<= false;
1367 }
1368 break;
1369 case HANDLE_TABS_RELATIVE_TO_INDENT:
1370 {
1372 }
1373 break;
1374 case HANDLE_RSID:
1375 {
1376 rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
1377 }
1378 break;
1379 case HANDLE_RSID_ROOT:
1380 {
1381 rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
1382 }
1383 break;
1384 case HANDLE_PROTECT_FORM:
1385 {
1387 }
1388 break;
1389 case HANDLE_MS_WORD_COMP_TRAILING_BLANKS:
1390 {
1392 }
1393 break;
1394 case HANDLE_MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY:
1395 {
1397 }
1398 break;
1399 case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
1400 {
1402 }
1403 break;
1404 case HANDLE_MODIFYPASSWORDINFO:
1405 {
1406 rValue <<= mpDocSh->GetModifyPasswordInfo();
1407 }
1408 break;
1409 case HANDLE_MATH_BASELINE_ALIGNMENT:
1410 {
1412 }
1413 break;
1414 case HANDLE_INVERT_BORDER_SPACING:
1415 {
1417 }
1418 break;
1419 case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
1420 {
1422 }
1423 break;
1424 case HANDLE_SMALL_CAPS_PERCENTAGE_66:
1425 {
1427 }
1428 break;
1429 case HANDLE_TAB_OVERFLOW:
1430 {
1432 }
1433 break;
1434 case HANDLE_UNBREAKABLE_NUMBERINGS:
1435 {
1437 }
1438 break;
1439 case HANDLE_STYLES_NODEFAULT:
1440 {
1442 }
1443 break;
1444 case HANDLE_FLOATTABLE_NOMARGINS:
1445 {
1447 }
1448 break;
1449 case HANDLE_CLIPPED_PICTURES:
1450 {
1452 }
1453 break;
1454 case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
1455 {
1457 }
1458 break;
1459 case HANDLE_EMBED_FONTS:
1460 {
1462 }
1463 break;
1464 case HANDLE_EMBED_USED_FONTS:
1465 {
1467 }
1468 break;
1469 case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
1470 {
1472 }
1473 break;
1474 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
1475 {
1477 }
1478 break;
1479 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
1480 {
1482 }
1483 break;
1484 case HANDLE_EMBED_SYSTEM_FONTS:
1485 {
1487 }
1488 break;
1489 case HANDLE_TAB_OVER_MARGIN:
1490 {
1492 }
1493 break;
1494 case HANDLE_TAB_OVER_SPACING:
1495 {
1497 }
1498 break;
1499 case HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK:
1500 {
1502 }
1503 break;
1504 case HANDLE_SURROUND_TEXT_WRAP_SMALL:
1505 {
1507 }
1508 break;
1509 case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
1510 {
1512 }
1513 break;
1514 case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
1515 {
1517 }
1518 break;
1519 case HANDLE_SUBTRACT_FLYS:
1520 {
1522 }
1523 break;
1524 case HANDLE_DISABLE_OFF_PAGE_POSITIONING:
1525 {
1527 }
1528 break;
1529 case HANDLE_EMPTY_DB_FIELD_HIDES_PARA:
1530 {
1531 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1533 }
1534 break;
1535 case HANDLE_CONTINUOUS_ENDNOTES:
1536 {
1537 rValue
1539 }
1540 break;
1541 case HANDLE_PROTECT_BOOKMARKS:
1542 {
1543 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1545 }
1546 break;
1547 case HANDLE_PROTECT_FIELDS:
1548 {
1549 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1551 }
1552 break;
1553 case HANDLE_HEADER_SPACING_BELOW_LAST_PARA:
1554 {
1555 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1557 }
1558 break;
1559 case HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA:
1560 {
1561 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1563 }
1564 break;
1565 case HANDLE_GUTTER_AT_TOP:
1566 {
1568 }
1569 break;
1570 case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
1571 {
1572 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1574 }
1575 break;
1576 case HANDLE_IMAGE_PREFERRED_DPI:
1577 {
1579 }
1580 break;
1581 case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
1582 {
1583 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1585 }
1586 break;
1587 case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS:
1588 {
1589 rValue <<= mpDoc->getIDocumentSettingAccess().get(
1591 }
1592 break;
1593 default:
1594 throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
1595 }
1596}
1597
1599{
1600 mpDocSh = nullptr;
1601 mpDoc = nullptr;
1602}
1603
1604// XServiceInfo
1606{
1607 return "SwXDocumentSettings";
1608}
1609
1610sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
1611{
1612 return cppu::supportsService(this, ServiceName);
1613}
1614
1616{
1617 return { "com.sun.star.document.Settings", "com.sun.star.text.DocumentSettings", "com.sun.star.text.PrintSettings" };
1618}
1619
1620/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ On
RedlineFlags on.
@ CONSIDER_WRAP_ON_OBJECT_POSITION
@ CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME
@ TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK
@ DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
@ IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
@ APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
@ AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE
@ TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
@ MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY
@ IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION
@ DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE
@ PROP_LINE_SPACING_SHRINKS_FIRST_LINE
@ DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT
@ ADD_PARA_LINE_SPACING_TO_TABLE_CELLS
static rtl::Reference< MasterPropertySetInfo > lcl_createSettingsInfo()
CharCompressType
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual void setReferenceDeviceType(bool bNewVirtual, bool bNewHiRes)=0
Sets the type of the reference device used for formatting the document.
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
virtual const SwPrintData & getPrintData() const =0
Returns the PrintData.
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const =0
Get the current link update mode.
virtual void setFieldUpdateFlags(SwFieldUpdateFlags nMode)=0
Set the current field update mode.
virtual void setImagePreferredDPI(sal_Int32 nValue)=0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void setLinkUpdateMode(sal_uInt16 nMode)=0
Set the current link update mode.
virtual void setCharacterCompressionType(CharCompressType nType)=0
Set the character compression type for Asian characters.
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
virtual SwFieldUpdateFlags getFieldUpdateFlags(bool bGlobalSettings) const =0
Get the current field update mode.
virtual CharCompressType getCharacterCompressionType() const =0
Get the character compression type for Asian characters.
virtual sal_Int32 getImagePreferredDPI()=0
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool SetModifyPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
bool IsLoadReadonly() const
bool IsUseUserData() const
void SetQueryLoadTemplate(bool b)
void SetSaveVersionOnClose(bool bSet)
void SetUseThumbnailSave(bool _bNew)
void SetUseUserData(bool bNew)
bool IsUseThumbnailSave() const
bool IsSaveVersionOnClose() const
void SetLoadReadonly(bool _bReadonly)
SfxObjectCreateMode GetCreateMode() const
bool Stamp_GetPrintCancelState() const
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
bool IsQueryLoadTemplate() const
void Stamp_SetPrintCancelState(bool bState)
void Store(SvStream &rStream) const
static VclPtr< SfxPrinter > Create(SvStream &rStream, std::unique_ptr< SfxItemSet > &&pOptions)
const SfxItemSet & GetOptions() const
virtual sal_uInt64 TellEnd() override
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
const OUString & getEmbeddedName() const
Definition: dbmgr.cxx:3158
void setEmbeddedName(const OUString &rEmbeddedName, SwDocShell &rDocShell)
Definition: dbmgr.cxx:3137
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
SwDBData const & GetDBData()
Definition: docfld.cxx:384
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
SwDBManager * GetDBManager() const
Definition: doc.hxx:669
sal_uInt32 getRsid() const
Definition: doc.cxx:196
sal_uInt32 getRsidRoot() const
Definition: doc.cxx:216
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
void setRsidRoot(sal_uInt32 nVal)
Definition: doc.cxx:221
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
void setRsid(sal_uInt32 nVal)
Definition: doc.cxx:201
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
void ChgDBData(const SwDBData &rNewData)
Definition: doc.cxx:453
void ChgHyphenation()
Definition: viewsh.hxx:208
virtual void _preGetValues() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual ~SwXDocumentSettings() noexcept override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL acquire() noexcept override
SwXTextDocument * mpModel
virtual void _postGetValues() override
virtual void _postSetValues() override
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue) override
VclPtr< SfxPrinter > mpPrinter
the printer should be set only once; since there are several printer-related properties,...
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
SwXDocumentSettings(SwXTextDocument *pModel)
virtual void _preSetValues() override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL release() noexcept override
SwXDocumentPropertyHelper * GetPropertyHelper()
Definition: unotxdoc.cxx:401
SwDocShell * GetDocShell()
Definition: unotxdoc.hxx:468
void disposeAndClear()
void registerSlave(ChainablePropertySet *pNewSet) noexcept
css::uno::Type const & get()
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:779
SwFieldUpdateFlags
Definition: fldupde.hxx:23
@ AUTOUPD_FIELD_ONLY
Definition: fldupde.hxx:25
@ AUTOUPD_OFF
Definition: fldupde.hxx:24
@ AUTOUPD_FIELD_AND_CHARTS
Definition: fldupde.hxx:26
sal_Int16 nValue
Mode eMode
@ NEVER
Definition: linkenum.hxx:24
@ MANUAL
Definition: linkenum.hxx:25
@ GLOBALSETTING
Definition: linkenum.hxx:27
#define SAL_WARN_IF(condition, area, stream)
const ContentProperties & rData
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
class SAL_NO_VTABLE XPropertySet
Type
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
AUTOMATIC
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define STREAM_SEEK_TO_BEGIN
unsigned char sal_Bool
const SvXMLTokenMapEntry aTypes[]