LibreOffice Module sw (master)  1
DocumentSettingManager.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 <libxml/xmlwriter.h>
21 
23 #include <doc.hxx>
25 #include <IDocumentState.hxx>
29 #include <svx/svdmodel.hxx>
30 #include <svl/asiancfg.hxx>
32 #include <unotools/configmgr.hxx>
33 #include <drawdoc.hxx>
34 #include <swmodule.hxx>
35 #include <linkenum.hxx>
36 #include <rootfrm.hxx>
37 #include <breakit.hxx>
38 #include <docary.hxx>
39 
40 /* IDocumentSettingAccess */
41 
43  :m_rDoc(rDoc),
44  mnLinkUpdMode( GLOBALSETTING ),
45  meFieldUpdMode( AUTOUPD_GLOBALSETTING ),
46  meChrCmprType( CharCompressType::NONE ),
47  mn32DummyCompatibilityOptions1(0),
48  mn32DummyCompatibilityOptions2(0),
49  mbHTMLMode(false),
50  mbIsGlobalDoc(false),
51  mbGlblDocSaveLinks(false),
52  mbIsLabelDoc(false),
53  mbPurgeOLE(true),
54  mbKernAsianPunctuation(false),
55 
56  // COMPATIBILITY FLAGS START
57 
58  mbAddFlyOffsets(false),
59  mbAddVerticalFlyOffsets(false),
60  mbUseHiResolutionVirtualDevice(true),
61  mbMathBaselineAlignment(false), // default for *old* documents is 'off'
62  mbStylesNoDefault(false),
63  mbFloattableNomargins(false),
64  mEmbedFonts(false),
65  mEmbedUsedFonts(false),
66  mEmbedLatinScriptFonts(true),
67  mEmbedAsianScriptFonts(true),
68  mEmbedComplexScriptFonts(true),
69  mEmbedSystemFonts(false),
70  mbOldNumbering(false),
71  mbIgnoreFirstLineIndentInNumbering(false),
72  mbDoNotResetParaAttrsForNumFont(false),
73  mbTableRowKeep(false),
74  mbIgnoreTabsAndBlanksForLineCalculation(false),
75  mbDoNotCaptureDrawObjsOnPage(false),
76  mbClipAsCharacterAnchoredWriterFlyFrames(false),
77  mbUnixForceZeroExtLeading(false),
78  mbTabRelativeToIndent(true),
79  mbProtectForm(false), // i#78591#
80  mbMsWordCompTrailingBlanks(false), // tdf#104349 tdf#104668
81  mbMsWordCompMinLineHeightByFly(false),
82  mbInvertBorderSpacing (false),
83  mbCollapseEmptyCellPara(true),
84  mbTabAtLeftIndentForParagraphsInList(false), //#i89181#
85  mbSmallCapsPercentage66(false),
86  mbTabOverflow(true),
87  mbUnbreakableNumberings(false),
88  mbClippedPictures(false),
89  mbBackgroundParaOverDrawings(false),
90  mbTabOverMargin(false),
91  mbTreatSingleColumnBreakAsPageBreak(false),
92  mbSurroundTextWrapSmall(false),
93  mbPropLineSpacingShrinksFirstLine(true),
94  mbSubtractFlys(false),
95  mApplyParagraphMarkFormatToNumbering(false),
96  mbLastBrowseMode( false ),
97  mbDisableOffPagePositioning ( false ),
98  mbProtectBookmarks(false),
99  mbProtectFields(false),
100  mbHeaderSpacingBelowLastPara(false)
101 
102  // COMPATIBILITY FLAGS END
103 {
104  // COMPATIBILITY FLAGS START
105 
106  // Note: Any non-hidden compatibility flag should obtain its default
107  // by asking SvtCompatibilityOptions, see below.
108 
110  {
111  const SvtCompatibilityOptions aOptions;
128  }
129  else
130  {
131  mbParaSpaceMax = false;
132  mbParaSpaceMaxAtPages = false;
133  mbTabCompat = true;
134  mbUseVirtualDevice = true;
135  mbAddExternalLeading = true;
136  mbOldLineSpacing = false;
138  mbUseFormerObjectPos = false;
139  mbUseFormerTextWrapping = false;
140  mbConsiderWrapOnObjPos = false;
142  mbProtectForm = false;
144  mbSubtractFlys = false;
146  }
147 
148  // COMPATIBILITY FLAGS END
149 
150 }
151 
152 
154 {
155 }
156 
157 /* IDocumentSettingAccess */
159 {
160  switch (id)
161  {
162  // COMPATIBILITY FLAGS START
163  case DocumentSettingId::PARA_SPACE_MAX: return mbParaSpaceMax; //(n8Dummy1 & DUMMY_PARASPACEMAX);
164  case DocumentSettingId::PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES);
165  case DocumentSettingId::TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT);
166  case DocumentSettingId::ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS);
167  case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: return mbAddVerticalFlyOffsets;
168  case DocumentSettingId::ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING);
169  case DocumentSettingId::USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE);
170  case DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV);
171  case DocumentSettingId::OLD_NUMBERING: return mbOldNumbering;
172  case DocumentSettingId::OLD_LINE_SPACING: return mbOldLineSpacing;
173  case DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS: return mbAddParaSpacingToTableCells;
174  case DocumentSettingId::USE_FORMER_OBJECT_POS: return mbUseFormerObjectPos;
175  case DocumentSettingId::USE_FORMER_TEXT_WRAPPING: return mbUseFormerTextWrapping;
176  case DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION: return mbConsiderWrapOnObjPos;
177  case DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: return mbDoNotJustifyLinesWithManualBreak;
178  case DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: return mbIgnoreFirstLineIndentInNumbering;
179  case DocumentSettingId::TABLE_ROW_KEEP: return mbTableRowKeep;
180  case DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: return mbIgnoreTabsAndBlanksForLineCalculation;
181  case DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: return mbDoNotCaptureDrawObjsOnPage;
182  // #i68949#
183  case DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME: return mbClipAsCharacterAnchoredWriterFlyFrames;
184  case DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
185  case DocumentSettingId::TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
186  case DocumentSettingId::PROTECT_FORM: return mbProtectForm;
187  // tdf#104349 tdf#104668
188  case DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS: return mbMsWordCompTrailingBlanks;
189  case DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY: return mbMsWordCompMinLineHeightByFly;
190  // #i89181#
191  case DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
192  case DocumentSettingId::INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
193  case DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
194  case DocumentSettingId::SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66;
195  case DocumentSettingId::TAB_OVERFLOW: return mbTabOverflow;
196  case DocumentSettingId::UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
197  case DocumentSettingId::CLIPPED_PICTURES: return mbClippedPictures;
198  case DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
199  case DocumentSettingId::TAB_OVER_MARGIN: return mbTabOverMargin;
200  case DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK: return mbTreatSingleColumnBreakAsPageBreak;
201  case DocumentSettingId::SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
202  case DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine;
203  case DocumentSettingId::SUBTRACT_FLYS: return mbSubtractFlys;
204 
205  case DocumentSettingId::BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked!
206  case DocumentSettingId::HTML_MODE: return mbHTMLMode;
207  case DocumentSettingId::GLOBAL_DOCUMENT: return mbIsGlobalDoc;
208  case DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS: return mbGlblDocSaveLinks;
209  case DocumentSettingId::LABEL_DOCUMENT: return mbIsLabelDoc;
210  case DocumentSettingId::PURGE_OLE: return mbPurgeOLE;
211  case DocumentSettingId::KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation;
212  case DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont;
213  case DocumentSettingId::MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment;
214  case DocumentSettingId::STYLES_NODEFAULT: return mbStylesNoDefault;
215  case DocumentSettingId::FLOATTABLE_NOMARGINS: return mbFloattableNomargins;
216  case DocumentSettingId::EMBED_FONTS: return mEmbedFonts;
217  case DocumentSettingId::EMBED_USED_FONTS: return mEmbedUsedFonts;
218  case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS: return mEmbedLatinScriptFonts;
219  case DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS: return mEmbedAsianScriptFonts;
220  case DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS: return mEmbedComplexScriptFonts;
221  case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
222  case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering;
223  case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning;
224  case DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA: return mbEmptyDbFieldHidesPara;
225  case DocumentSettingId::CONTINUOUS_ENDNOTES: return mbContinuousEndnotes;
226  case DocumentSettingId::PROTECT_BOOKMARKS: return mbProtectBookmarks;
227  case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields;
228  case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return mbHeaderSpacingBelowLastPara;
229  default:
230  OSL_FAIL("Invalid setting id");
231  }
232  return false;
233 }
234 
235 void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
236 {
237  switch (id)
238  {
239  // COMPATIBILITY FLAGS START
241  mbParaSpaceMax = value;
242  break;
244  mbParaSpaceMaxAtPages = value;
245  break;
247  mbTabCompat = value;
248  break;
250  mbAddFlyOffsets = value;
251  break;
253  mbAddVerticalFlyOffsets = value;
254  break;
256  mbAddExternalLeading = value;
257  break;
259  mbUseVirtualDevice = value;
260  break;
262  mbUseHiResolutionVirtualDevice = value;
263  break;
265  if (mbOldNumbering != value)
266  {
267  mbOldNumbering = value;
268 
269  const SwNumRuleTable& rNmTable = m_rDoc.GetNumRuleTable();
270  for( SwNumRuleTable::size_type n = 0; n < rNmTable.size(); ++n )
271  rNmTable[n]->SetInvalidRule(true);
272 
273  m_rDoc.UpdateNumRule();
274 
275  SwNumRule *pOutlineRule = m_rDoc.GetOutlineNumRule();
276  if (pOutlineRule)
277  {
278  pOutlineRule->Validate();
279  // counting of phantoms depends on <IsOldNumbering()>
280  pOutlineRule->SetCountPhantoms( !mbOldNumbering );
281  }
282  }
283  break;
285  mbOldLineSpacing = value;
286  break;
288  mbAddParaSpacingToTableCells = value;
289  break;
291  mbUseFormerObjectPos = value;
292  break;
294  mbUseFormerTextWrapping = value;
295  break;
297  mbConsiderWrapOnObjPos = value;
298  break;
300  mbDoNotJustifyLinesWithManualBreak = value;
301  break;
303  mbIgnoreFirstLineIndentInNumbering = value;
304  break;
305 
307  mbTableRowKeep = value;
308  break;
309 
311  mbIgnoreTabsAndBlanksForLineCalculation = value;
312  break;
313 
315  mbDoNotCaptureDrawObjsOnPage = value;
316  break;
317 
318  // #i68949#
320  mbClipAsCharacterAnchoredWriterFlyFrames = value;
321  break;
322 
324  mbUnixForceZeroExtLeading = value;
325  break;
326 
328  mbProtectForm = value;
329  break;
330 
331  // tdf#140349
333  mbMsWordCompTrailingBlanks = value;
334  break;
335 
337  mbMsWordCompMinLineHeightByFly = value;
338  break;
339 
341  mbTabRelativeToIndent = value;
342  break;
343  // #i89181#
345  mbTabAtLeftIndentForParagraphsInList = value;
346  break;
347 
349  mbInvertBorderSpacing = value;
350  break;
351 
353  mbCollapseEmptyCellPara = value;
354  break;
355 
357  mbSmallCapsPercentage66 = value;
358  break;
359 
361  mbTabOverflow = value;
362  break;
363 
365  mbUnbreakableNumberings = value;
366  break;
367 
369  mbClippedPictures = value;
370  break;
371 
373  mbBackgroundParaOverDrawings = value;
374  break;
375 
377  mbTabOverMargin = value;
378  break;
379 
381  mbTreatSingleColumnBreakAsPageBreak = value;
382  break;
383 
385  mbSurroundTextWrapSmall = value;
386  break;
387 
389  mbPropLineSpacingShrinksFirstLine = value;
390  break;
391 
393  mbSubtractFlys = value;
394  break;
395 
396  // COMPATIBILITY FLAGS END
397 
398  case DocumentSettingId::BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available
399  mbLastBrowseMode = value;
400  break;
401 
403  mbHTMLMode = value;
404  break;
405 
407  mbIsGlobalDoc = value;
408  break;
409 
411  mbGlblDocSaveLinks = value;
412  break;
413 
415  mbIsLabelDoc = value;
416  break;
417 
419  mbPurgeOLE = value;
420  break;
421 
423  mbKernAsianPunctuation = value;
424  break;
425 
427  mbDoNotResetParaAttrsForNumFont = value;
428  break;
430  mbMathBaselineAlignment = value;
431  break;
433  mbStylesNoDefault = value;
434  break;
436  mbFloattableNomargins = value;
437  break;
439  mEmbedFonts = value;
440  break;
442  mEmbedUsedFonts = value;
443  break;
445  mEmbedLatinScriptFonts = value;
446  break;
448  mEmbedAsianScriptFonts = value;
449  break;
451  mEmbedComplexScriptFonts = value;
452  break;
454  mEmbedSystemFonts = value;
455  break;
457  mApplyParagraphMarkFormatToNumbering = value;
458  break;
460  mbDisableOffPagePositioning = value;
461  break;
463  mbEmptyDbFieldHidesPara = value;
464  break;
466  mbContinuousEndnotes = value;
467  break;
469  mbProtectBookmarks = value;
470  break;
472  mbProtectFields = value;
473  break;
475  mbHeaderSpacingBelowLastPara = value;
476  break;
477  default:
478  OSL_FAIL("Invalid setting id");
479  }
480 }
481 
482 const css::i18n::ForbiddenCharacters*
483  sw::DocumentSettingManager::getForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ bool bLocaleData ) const
484 {
485  const css::i18n::ForbiddenCharacters* pRet = nullptr;
486  if (mxForbiddenCharsTable)
487  pRet = mxForbiddenCharsTable->GetForbiddenCharacters( nLang, false );
488  if( bLocaleData && !pRet && g_pBreakIt )
489  pRet = &g_pBreakIt->GetForbidden( nLang );
490  return pRet;
491 }
492 
494  /*[in]*/ const css::i18n::ForbiddenCharacters& rFChars )
495 {
496  if (!mxForbiddenCharsTable)
498  mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
499 
500  SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
501  if( pDrawModel )
502  {
503  pDrawModel->SetForbiddenCharsTable(mxForbiddenCharsTable);
504  if( !m_rDoc.IsInReading() )
505  pDrawModel->ReformatAllTextObjects();
506  }
507 
508  SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
509  if( pTmpRoot && !m_rDoc.IsInReading() )
510  {
511  pTmpRoot->StartAllAction();
512  for(SwRootFrame* aLayout : m_rDoc.GetAllLayouts())
513  aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
514  pTmpRoot->EndAllAction();
515  }
516  m_rDoc.getIDocumentState().SetModified();
517 }
518 
519 std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
520 {
521  if (!mxForbiddenCharsTable)
523  return mxForbiddenCharsTable;
524 }
525 
526 const std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable() const
527 {
528  return mxForbiddenCharsTable;
529 }
530 
531 sal_uInt16 sw::DocumentSettingManager::getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const
532 {
533  sal_uInt16 nRet = mnLinkUpdMode;
534  if( bGlobalSettings && GLOBALSETTING == nRet )
535  nRet = SW_MOD()->GetLinkUpdMode();
536  return nRet;
537 }
538 
539 void sw::DocumentSettingManager::setLinkUpdateMode( /*[in]*/sal_uInt16 eMode )
540 {
541  mnLinkUpdMode = eMode;
542 }
543 
545 {
546  SwFieldUpdateFlags eRet = meFieldUpdMode;
547  if( bGlobalSettings && AUTOUPD_GLOBALSETTING == eRet )
548  eRet = SW_MOD()->GetFieldUpdateFlags();
549  return eRet;
550 }
551 
553 {
554  meFieldUpdMode = eMode;
555 }
556 
558 {
559  return meChrCmprType;
560 }
561 
563 {
564  if( meChrCmprType != n )
565  {
566  meChrCmprType = n;
567 
568  SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
569  if( pDrawModel )
570  {
571  pDrawModel->SetCharCompressType( n );
572  if( !m_rDoc.IsInReading() )
573  pDrawModel->ReformatAllTextObjects();
574  }
575 
576  SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
577  if( pTmpRoot && !m_rDoc.IsInReading() )
578  {
579  pTmpRoot->StartAllAction();
580  for( auto aLayout : m_rDoc.GetAllLayouts() )
581  aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
582  pTmpRoot->EndAllAction();
583  }
584  m_rDoc.getIDocumentState().SetModified();
585  }
586 }
587 
588 
590 {
591  Setn32DummyCompatibilityOptions1( rSource.Getn32DummyCompatibilityOptions1() );
592  Setn32DummyCompatibilityOptions2( rSource.Getn32DummyCompatibilityOptions2() );
593 
594  // No mbHTMLMode
595  // No mbIsGlobalDoc
596  // No mbGlblDocSaveLinks
597  // No mbIsLabelDoc
598  // No mbPurgeOLE
599  // No mbKernAsianPunctuation
600  mbParaSpaceMax = rSource.mbParaSpaceMax;
601  mbParaSpaceMaxAtPages = rSource.mbParaSpaceMaxAtPages;
602  mbTabCompat = rSource.mbTabCompat;
603  mbUseVirtualDevice = rSource.mbUseVirtualDevice;
604  mbAddFlyOffsets = rSource.mbAddFlyOffsets;
605  // No mbAddVerticalFlyOffsets
606  mbAddExternalLeading = rSource.mbAddExternalLeading;
607  mbUseHiResolutionVirtualDevice = rSource.mbUseHiResolutionVirtualDevice;
608  mbOldLineSpacing = rSource.mbOldLineSpacing;
609  mbAddParaSpacingToTableCells = rSource.mbAddParaSpacingToTableCells;
610  mbUseFormerObjectPos = rSource.mbUseFormerObjectPos;
611  mbUseFormerTextWrapping = rSource.mbUseFormerTextWrapping;
612  mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
613  // No mbMathBaselineAlignment
614  // No mbStylesNoDefault
615  // No mbFloattableNomargins
616  mbOldNumbering = rSource.mbOldNumbering;
617  mbIgnoreFirstLineIndentInNumbering = rSource.mbIgnoreFirstLineIndentInNumbering;
618  mbDoNotJustifyLinesWithManualBreak = rSource.mbDoNotJustifyLinesWithManualBreak;
619  mbDoNotResetParaAttrsForNumFont = rSource.mbDoNotResetParaAttrsForNumFont;
620  mbTableRowKeep = rSource.mbTableRowKeep;
621  mbIgnoreTabsAndBlanksForLineCalculation = rSource.mbIgnoreTabsAndBlanksForLineCalculation;
622  mbDoNotCaptureDrawObjsOnPage = rSource.mbDoNotCaptureDrawObjsOnPage;
623  mbClipAsCharacterAnchoredWriterFlyFrames = rSource.mbClipAsCharacterAnchoredWriterFlyFrames;
624  mbUnixForceZeroExtLeading = rSource.mbUnixForceZeroExtLeading;
625  mbTabRelativeToIndent = rSource.mbTabRelativeToIndent;
626  // No mbProtectForm
627  mbMsWordCompTrailingBlanks = rSource.mbMsWordCompTrailingBlanks;
628  mbMsWordCompMinLineHeightByFly = rSource.mbMsWordCompMinLineHeightByFly;
629  // No mbInvertBorderSpacing
630  mbCollapseEmptyCellPara = rSource.mbCollapseEmptyCellPara;
631  mbTabAtLeftIndentForParagraphsInList = rSource.mbTabAtLeftIndentForParagraphsInList;
632  // No mbSmallCapsPercentage66
633  // No mbTabOverflow
634  mbUnbreakableNumberings = rSource.mbUnbreakableNumberings;
635  // No mbClippedPictures
636  mbBackgroundParaOverDrawings = rSource.mbBackgroundParaOverDrawings;
637  mbTabOverMargin = rSource.mbTabOverMargin;
638  mbTreatSingleColumnBreakAsPageBreak = rSource.mbTreatSingleColumnBreakAsPageBreak;
639  mbSurroundTextWrapSmall = rSource.mbSurroundTextWrapSmall;
640  mbPropLineSpacingShrinksFirstLine = rSource.mbPropLineSpacingShrinksFirstLine;
641  mbSubtractFlys = rSource.mbSubtractFlys;
642  // No mbLastBrowseMode: this is false by default everywhere
643  mbDisableOffPagePositioning = rSource.mbDisableOffPagePositioning;
644  mbEmptyDbFieldHidesPara = rSource.mbEmptyDbFieldHidesPara;
645  mbContinuousEndnotes = rSource.mbContinuousEndnotes;
646  // No mbProtectBookmarks: this is false by default everywhere
647  // No mbProtectFields: this is false by default everywhere
648  mbHeaderSpacingBelowLastPara = rSource.mbHeaderSpacingBelowLastPara;
649 }
650 
652 {
653  return mn32DummyCompatibilityOptions1;
654 }
655 
656 void sw::DocumentSettingManager::Setn32DummyCompatibilityOptions1( const sal_uInt32 CompatibilityOptions1 )
657 {
658  mn32DummyCompatibilityOptions1 = CompatibilityOptions1;
659 }
660 
662 {
663  return mn32DummyCompatibilityOptions2;
664 }
665 
666 void sw::DocumentSettingManager::Setn32DummyCompatibilityOptions2( const sal_uInt32 CompatibilityOptions2 )
667 {
668  mn32DummyCompatibilityOptions2 = CompatibilityOptions2;
669 }
670 
672 {
673  xmlTextWriterStartElement(pWriter, BAD_CAST("DocumentSettingManager"));
674 
675  xmlTextWriterStartElement(pWriter, BAD_CAST("mbHTMLMode"));
676  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
677  BAD_CAST(OString::boolean(mbHTMLMode).getStr()));
678  xmlTextWriterEndElement(pWriter);
679 
680  xmlTextWriterStartElement(pWriter, BAD_CAST("mbIsGlobalDoc"));
681  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
682  BAD_CAST(OString::boolean(mbIsGlobalDoc).getStr()));
683  xmlTextWriterEndElement(pWriter);
684 
685  xmlTextWriterStartElement(pWriter, BAD_CAST("mbGlblDocSaveLinks"));
686  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
687  BAD_CAST(OString::boolean(mbGlblDocSaveLinks).getStr()));
688  xmlTextWriterEndElement(pWriter);
689 
690  xmlTextWriterStartElement(pWriter, BAD_CAST("mbIsLabelDoc"));
691  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
692  BAD_CAST(OString::boolean(mbIsLabelDoc).getStr()));
693  xmlTextWriterEndElement(pWriter);
694 
695  xmlTextWriterStartElement(pWriter, BAD_CAST("mbPurgeOLE"));
696  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
697  BAD_CAST(OString::boolean(mbPurgeOLE).getStr()));
698  xmlTextWriterEndElement(pWriter);
699 
700  xmlTextWriterStartElement(pWriter, BAD_CAST("mbKernAsianPunctuation"));
701  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
702  BAD_CAST(OString::boolean(mbKernAsianPunctuation).getStr()));
703  xmlTextWriterEndElement(pWriter);
704 
705  xmlTextWriterStartElement(pWriter, BAD_CAST("mbParaSpaceMax"));
706  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
707  BAD_CAST(OString::boolean(mbParaSpaceMax).getStr()));
708  xmlTextWriterEndElement(pWriter);
709 
710  xmlTextWriterStartElement(pWriter, BAD_CAST("mbParaSpaceMaxAtPages"));
711  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
712  BAD_CAST(OString::boolean(mbParaSpaceMaxAtPages).getStr()));
713  xmlTextWriterEndElement(pWriter);
714 
715  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabCompat"));
716  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
717  BAD_CAST(OString::boolean(mbTabCompat).getStr()));
718  xmlTextWriterEndElement(pWriter);
719 
720  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUseVirtualDevice"));
721  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
722  BAD_CAST(OString::boolean(mbUseVirtualDevice).getStr()));
723  xmlTextWriterEndElement(pWriter);
724 
725  xmlTextWriterStartElement(pWriter, BAD_CAST("mbAddFlyOffsets"));
726  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
727  BAD_CAST(OString::boolean(mbAddFlyOffsets).getStr()));
728  xmlTextWriterEndElement(pWriter);
729 
730  xmlTextWriterStartElement(pWriter, BAD_CAST("mbAddVerticalFlyOffsets"));
731  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
732  BAD_CAST(OString::boolean(mbAddVerticalFlyOffsets).getStr()));
733  xmlTextWriterEndElement(pWriter);
734 
735  xmlTextWriterStartElement(pWriter, BAD_CAST("mbAddExternalLeading"));
736  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
737  BAD_CAST(OString::boolean(mbAddExternalLeading).getStr()));
738  xmlTextWriterEndElement(pWriter);
739 
740  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUseHiResolutionVirtualDevice"));
741  xmlTextWriterWriteAttribute(
742  pWriter, BAD_CAST("value"),
743  BAD_CAST(OString::boolean(mbUseHiResolutionVirtualDevice).getStr()));
744  xmlTextWriterEndElement(pWriter);
745 
746  xmlTextWriterStartElement(pWriter, BAD_CAST("mbOldLineSpacing"));
747  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
748  BAD_CAST(OString::boolean(mbOldLineSpacing).getStr()));
749  xmlTextWriterEndElement(pWriter);
750 
751  xmlTextWriterStartElement(pWriter, BAD_CAST("mbAddParaSpacingToTableCells"));
752  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
753  BAD_CAST(OString::boolean(mbAddParaSpacingToTableCells).getStr()));
754  xmlTextWriterEndElement(pWriter);
755 
756  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUseFormerObjectPos"));
757  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
758  BAD_CAST(OString::boolean(mbUseFormerObjectPos).getStr()));
759  xmlTextWriterEndElement(pWriter);
760 
761  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUseFormerTextWrapping"));
762  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
763  BAD_CAST(OString::boolean(mbUseFormerTextWrapping).getStr()));
764  xmlTextWriterEndElement(pWriter);
765 
766  xmlTextWriterStartElement(pWriter, BAD_CAST("mbConsiderWrapOnObjPos"));
767  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
768  BAD_CAST(OString::boolean(mbConsiderWrapOnObjPos).getStr()));
769  xmlTextWriterEndElement(pWriter);
770 
771  xmlTextWriterStartElement(pWriter, BAD_CAST("mbMathBaselineAlignment"));
772  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
773  BAD_CAST(OString::boolean(mbMathBaselineAlignment).getStr()));
774  xmlTextWriterEndElement(pWriter);
775 
776  xmlTextWriterStartElement(pWriter, BAD_CAST("mbStylesNoDefault"));
777  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
778  BAD_CAST(OString::boolean(mbStylesNoDefault).getStr()));
779  xmlTextWriterEndElement(pWriter);
780 
781  xmlTextWriterStartElement(pWriter, BAD_CAST("mbFloattableNomargins"));
782  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
783  BAD_CAST(OString::boolean(mbFloattableNomargins).getStr()));
784  xmlTextWriterEndElement(pWriter);
785 
786  xmlTextWriterStartElement(pWriter, BAD_CAST("mbOldNumbering"));
787  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
788  BAD_CAST(OString::boolean(mbOldNumbering).getStr()));
789  xmlTextWriterEndElement(pWriter);
790 
791  xmlTextWriterStartElement(pWriter, BAD_CAST("mbIgnoreFirstLineIndentInNumbering"));
792  xmlTextWriterWriteAttribute(
793  pWriter, BAD_CAST("value"),
794  BAD_CAST(OString::boolean(mbIgnoreFirstLineIndentInNumbering).getStr()));
795  xmlTextWriterEndElement(pWriter);
796 
797  xmlTextWriterStartElement(pWriter, BAD_CAST("mbDoNotJustifyLinesWithManualBreak"));
798  xmlTextWriterWriteAttribute(
799  pWriter, BAD_CAST("value"),
800  BAD_CAST(OString::boolean(mbDoNotJustifyLinesWithManualBreak).getStr()));
801  xmlTextWriterEndElement(pWriter);
802 
803  xmlTextWriterStartElement(pWriter, BAD_CAST("mbDoNotResetParaAttrsForNumFont"));
804  xmlTextWriterWriteAttribute(
805  pWriter, BAD_CAST("value"),
806  BAD_CAST(OString::boolean(mbDoNotResetParaAttrsForNumFont).getStr()));
807  xmlTextWriterEndElement(pWriter);
808 
809  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTableRowKeep"));
810  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
811  BAD_CAST(OString::boolean(mbTableRowKeep).getStr()));
812  xmlTextWriterEndElement(pWriter);
813 
814  xmlTextWriterStartElement(pWriter, BAD_CAST("mbIgnoreTabsAndBlanksForLineCalculation"));
815  xmlTextWriterWriteAttribute(
816  pWriter, BAD_CAST("value"),
817  BAD_CAST(OString::boolean(mbIgnoreTabsAndBlanksForLineCalculation).getStr()));
818  xmlTextWriterEndElement(pWriter);
819 
820  xmlTextWriterStartElement(pWriter, BAD_CAST("mbDoNotCaptureDrawObjsOnPage"));
821  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
822  BAD_CAST(OString::boolean(mbDoNotCaptureDrawObjsOnPage).getStr()));
823  xmlTextWriterEndElement(pWriter);
824 
825  xmlTextWriterStartElement(pWriter, BAD_CAST("mbClipAsCharacterAnchoredWriterFlyFrames"));
826  xmlTextWriterWriteAttribute(
827  pWriter, BAD_CAST("value"),
828  BAD_CAST(OString::boolean(mbClipAsCharacterAnchoredWriterFlyFrames).getStr()));
829  xmlTextWriterEndElement(pWriter);
830 
831  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUnixForceZeroExtLeading"));
832  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
833  BAD_CAST(OString::boolean(mbUnixForceZeroExtLeading).getStr()));
834  xmlTextWriterEndElement(pWriter);
835 
836  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabRelativeToIndent"));
837  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
838  BAD_CAST(OString::boolean(mbTabRelativeToIndent).getStr()));
839  xmlTextWriterEndElement(pWriter);
840 
841  xmlTextWriterStartElement(pWriter, BAD_CAST("mbProtectForm"));
842  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
843  BAD_CAST(OString::boolean(mbProtectForm).getStr()));
844  xmlTextWriterEndElement(pWriter);
845 
846  xmlTextWriterStartElement(pWriter, BAD_CAST("mbMsWordCompTrailingBlanks"));
847  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
848  BAD_CAST(OString::boolean(mbMsWordCompTrailingBlanks).getStr()));
849  xmlTextWriterEndElement(pWriter);
850 
851  xmlTextWriterStartElement(pWriter, BAD_CAST("mbMsWordCompMinLineHeightByFly"));
852  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
853  BAD_CAST(OString::boolean(mbMsWordCompMinLineHeightByFly).getStr()));
854  xmlTextWriterEndElement(pWriter);
855 
856  xmlTextWriterStartElement(pWriter, BAD_CAST("mbInvertBorderSpacing"));
857  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
858  BAD_CAST(OString::boolean(mbInvertBorderSpacing).getStr()));
859  xmlTextWriterEndElement(pWriter);
860 
861  xmlTextWriterStartElement(pWriter, BAD_CAST("mbCollapseEmptyCellPara"));
862  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
863  BAD_CAST(OString::boolean(mbCollapseEmptyCellPara).getStr()));
864  xmlTextWriterEndElement(pWriter);
865 
866  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabAtLeftIndentForParagraphsInList"));
867  xmlTextWriterWriteAttribute(
868  pWriter, BAD_CAST("value"),
869  BAD_CAST(OString::boolean(mbTabAtLeftIndentForParagraphsInList).getStr()));
870  xmlTextWriterEndElement(pWriter);
871 
872  xmlTextWriterStartElement(pWriter, BAD_CAST("mbSmallCapsPercentage66"));
873  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
874  BAD_CAST(OString::boolean(mbSmallCapsPercentage66).getStr()));
875  xmlTextWriterEndElement(pWriter);
876 
877  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabOverflow"));
878  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
879  BAD_CAST(OString::boolean(mbTabOverflow).getStr()));
880  xmlTextWriterEndElement(pWriter);
881 
882  xmlTextWriterStartElement(pWriter, BAD_CAST("mbUnbreakableNumberings"));
883  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
884  BAD_CAST(OString::boolean(mbUnbreakableNumberings).getStr()));
885  xmlTextWriterEndElement(pWriter);
886 
887  xmlTextWriterStartElement(pWriter, BAD_CAST("mbClippedPictures"));
888  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
889  BAD_CAST(OString::boolean(mbClippedPictures).getStr()));
890  xmlTextWriterEndElement(pWriter);
891 
892  xmlTextWriterStartElement(pWriter, BAD_CAST("mbBackgroundParaOverDrawings"));
893  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
894  BAD_CAST(OString::boolean(mbBackgroundParaOverDrawings).getStr()));
895  xmlTextWriterEndElement(pWriter);
896 
897  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTabOverMargin"));
898  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
899  BAD_CAST(OString::boolean(mbTabOverMargin).getStr()));
900  xmlTextWriterEndElement(pWriter);
901 
902  xmlTextWriterStartElement(pWriter, BAD_CAST("mbTreatSingleColumnBreakAsPageBreak"));
903  xmlTextWriterWriteAttribute(
904  pWriter, BAD_CAST("value"),
905  BAD_CAST(OString::boolean(mbTreatSingleColumnBreakAsPageBreak).getStr()));
906  xmlTextWriterEndElement(pWriter);
907 
908  xmlTextWriterStartElement(pWriter, BAD_CAST("mbSurroundTextWrapSmall"));
909  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
910  BAD_CAST(OString::boolean(mbSurroundTextWrapSmall).getStr()));
911  xmlTextWriterEndElement(pWriter);
912 
913  xmlTextWriterStartElement(pWriter, BAD_CAST("mbPropLineSpacingShrinksFirstLine"));
914  xmlTextWriterWriteAttribute(
915  pWriter, BAD_CAST("value"),
916  BAD_CAST(OString::boolean(mbPropLineSpacingShrinksFirstLine).getStr()));
917  xmlTextWriterEndElement(pWriter);
918 
919  xmlTextWriterStartElement(pWriter, BAD_CAST("mbSubtractFlys"));
920  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
921  BAD_CAST(OString::boolean(mbSubtractFlys).getStr()));
922  xmlTextWriterEndElement(pWriter);
923 
924  xmlTextWriterStartElement(pWriter, BAD_CAST("mbLastBrowseMode"));
925  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
926  BAD_CAST(OString::boolean(mbLastBrowseMode).getStr()));
927  xmlTextWriterEndElement(pWriter);
928 
929  xmlTextWriterStartElement(pWriter, BAD_CAST("mbDisableOffPagePositioning"));
930  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
931  BAD_CAST(OString::boolean(mbDisableOffPagePositioning).getStr()));
932  xmlTextWriterEndElement(pWriter);
933 
934  xmlTextWriterStartElement(pWriter, BAD_CAST("mbEmptyDbFieldHidesPara"));
935  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
936  BAD_CAST(OString::boolean(mbEmptyDbFieldHidesPara).getStr()));
937  xmlTextWriterEndElement(pWriter);
938 
939  xmlTextWriterStartElement(pWriter, BAD_CAST("mbContinuousEndnotes"));
940  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
941  BAD_CAST(OString::boolean(mbContinuousEndnotes).getStr()));
942  xmlTextWriterEndElement(pWriter);
943 
944  xmlTextWriterStartElement(pWriter, BAD_CAST("mbHeaderSpacingBelowLastPara"));
945  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
946  BAD_CAST(OString::boolean(mbHeaderSpacingBelowLastPara).getStr()));
947  xmlTextWriterEndElement(pWriter);
948 
949  xmlTextWriterEndElement(pWriter);
950 }
951 
952 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const css::i18n::ForbiddenCharacters * getForbiddenCharacters(LanguageType nLang, bool bLocaleData) const override
Return the forbidden characters.
bool GetDefault(SvtCompatibilityEntry::Index rIdx) const
SwFieldUpdateFlags
Definition: fldupde.hxx:22
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
void SetForbiddenCharsTable(const std::shared_ptr< SvxForbiddenCharactersTable > &xForbiddenChars)
sal_Int64 n
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: doc.hxx:184
virtual CharCompressType getCharacterCompressionType() const override
Get the character compression type for Asian characters.
virtual void set(DocumentSettingId id, bool value) override
Set the specified document setting.
void SetCharCompressType(CharCompressType nType)
void Setn32DummyCompatibilityOptions1(const sal_uInt32 CompatibilityOptions1) override
Set the n32DummyCompatabilityOptions1.
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
static LanguageType nLang
Definition: srtdlg.cxx:51
void ReformatAllTextObjects()
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
static bool IsFuzzing()
static std::shared_ptr< SvxForbiddenCharactersTable > makeForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual void setLinkUpdateMode(sal_uInt16 nMode) override
Set the current link update mode.
void ReplaceCompatibilityOptions(const DocumentSettingManager &rSource)
struct _xmlTextWriter * xmlTextWriterPtr
virtual void setFieldUpdateFlags(SwFieldUpdateFlags eMode) override
Set the current field update mode.
#define SW_MOD()
Definition: swmodule.hxx:255
CharCompressType
std::vector< SwNumRule * >::size_type size_type
Definition: docary.hxx:63
virtual std::shared_ptr< SvxForbiddenCharactersTable > & getForbiddenCharacterTable() override
Get the forbidden character table and creates one if necessary.
void Setn32DummyCompatibilityOptions2(const sal_uInt32 CompatibilityOptions2) override
Set the n32DummyCompatabilityOptions2.
size_t size() const
Definition: docary.hxx:84
void SetCountPhantoms(bool bCountPhantoms)
Definition: number.cxx:1034
PDFDocument & m_rDoc
virtual void setCharacterCompressionType(CharCompressType nType) override
Set the character compression type for Asian characters.
sal_uInt32 Getn32DummyCompatibilityOptions2() const override
Get the n32DummyCompatabilityOptions2.
void Validate()
Definition: number.cxx:1021
virtual SwFieldUpdateFlags getFieldUpdateFlags(bool bGlobalSettings) const override
Get the current field update mode.
virtual void setForbiddenCharacters(LanguageType nLang, const css::i18n::ForbiddenCharacters &rForbiddenCharacters) override
Set the forbidden characters.
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const override
Get the current link update mode.
sal_uInt32 Getn32DummyCompatibilityOptions1() const override
Get the n32DummyCompatabilityOptions1.
Reference< XComponentContext > getProcessComponentContext()
virtual ~DocumentSettingManager() override
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1865
void EndAllAction(bool bVirDev=false)
Definition: pagechg.cxx:1877
const css::i18n::ForbiddenCharacters & GetForbidden(const LanguageType aLang)
Definition: breakit.hxx:103