summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranuragkanungo <anuragkanungo@gmail.com>2014-04-05 14:29:54 +0530
committerMichael Stahl <mstahl@redhat.com>2014-04-22 14:36:25 +0200
commite2a349c19dd1f8e00ae677c26900938d11f13938 (patch)
treeec5b985d1b667bef14586de3ca52a37bbb52a21b
parent28fc951233a58fb4d8515ed4380140aaee0afd32 (diff)
Refactor IDocumentSettingAccess Interface of SwDoc
Change-Id: I4a7ec73d3bdf9888e50d071b593798b74780b80c
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/doc.hxx58
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx504
-rw-r--r--sw/source/core/doc/doc.cxx327
-rw-r--r--sw/source/core/doc/docnew.cxx100
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx120
6 files changed, 658 insertions, 452 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 0bdee22c9ec5..5e74b79e283e 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -186,6 +186,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/doc/docstat \
sw/source/core/doc/doctxm \
sw/source/core/doc/docxforms \
+ sw/source/core/doc/DocumentSettingManager \
sw/source/core/doc/extinput \
sw/source/core/doc/fmtcol \
sw/source/core/doc/ftnidx \
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index cfff535409a5..ce2cc6e6e3da 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -208,6 +208,7 @@ namespace sw {
class MetaFieldManager;
class UndoManager;
class IShellCursorSupplier;
+ class DocumentSettingManager;
}
namespace com { namespace sun { namespace star {
@@ -290,6 +291,7 @@ class SW_DLLPUBLIC SwDoc :
const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager;
const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
+ const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
// Pointer
SwFrmFmt *mpDfltFrmFmt; //< Default formats.
@@ -400,10 +402,7 @@ private:
sal_uInt16 mnAutoFmtRedlnCommentNo; /**< SeqNo for conjoining of AutoFmt-Redlines.
by the UI. Managed by SwAutoFmt! */
- sal_uInt16 mnLinkUpdMode; //< UpdateMode for links.
- SwFldUpdateFlags meFldUpdMode;//< Automatically Update Mode for fields/charts.
RedlineMode_t meRedlineMode; //< Current Redline Mode.
- SwCharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana
sal_uInt32 mnRsid; //< current session ID of the document
sal_uInt32 mnRsidRoot; //< session ID when the document was created
@@ -441,11 +440,7 @@ private:
bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary.
bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
- bool mbHTMLMode : 1; //< TRUE: Document is in HTMLMode.
bool mbInCallModified : 1; //< TRUE: in Set/Reset-Modified link.
- bool mbIsGlobalDoc : 1; //< TRUE: It's a global document.
- bool mbGlblDocSaveLinks : 1; //< TRUE: Save sections linked in global document.
- bool mbIsLabelDoc : 1; //< TRUE: It's a label document.
bool mbIsAutoFmtRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of
::com::sun::star::sdbcx::View
@@ -454,8 +449,6 @@ private:
bool mbIsRedlineMove : 1; //< True: Redlines are moved into to / out of the section.
bool mbInsOnlyTxtGlssry : 1; //< True: insert 'only text' glossary into doc
bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
- bool mbPurgeOLE : 1; //< sal_True: Purge OLE-Objects
- bool mbKernAsianPunctuation : 1; //< sal_True: kerning also for ASIAN punctuation
bool mbReadlineChecked : 1; //< sal_True: if the query was already shown
bool mbLinksUpdated : 1; /**< #i38810#
flag indicating, that the links have been updated. */
@@ -532,53 +525,8 @@ private:
// label is followed by a tab character.
// mbTabAtLeftIndentForParagraphsInList def = sal_False, hidden
- bool mbParaSpaceMax : 1;
- bool mbParaSpaceMaxAtPages : 1;
- bool mbTabCompat : 1;
- bool mbUseVirtualDevice : 1;
- bool mbAddFlyOffsets : 1;
- bool mbAddExternalLeading : 1;
- bool mbUseHiResolutionVirtualDevice : 1;
- bool mbOldLineSpacing : 1; // #i11859#
- bool mbAddParaSpacingToTableCells : 1;
- bool mbUseFormerObjectPos : 1; // #i11860#
- bool mbUseFormerTextWrapping : 1;
- bool mbConsiderWrapOnObjPos : 1; // #i28701#
- // sal_True: object positioning algorithm has consider the wrapping style of // the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos'
- // floating screen objects as given by its
- // attribute 'WrapInfluenceOnObjPos'.
- bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972#
- bool mbStylesNoDefault : 1;
- bool mbFloattableNomargins : 1; //< If paragraph margins next to a floating table should be ignored.
- bool mEmbedFonts : 1; //< Whether to embed fonts used by the document when saving.
- bool mEmbedSystemFonts : 1; //< Whether to embed also system fonts.
-
// non-ui-compatibility flags:
- bool mbOldNumbering : 1;
- bool mbIgnoreFirstLineIndentInNumbering : 1; // #i47448#
- bool mbDoNotJustifyLinesWithManualBreak : 1; // #i49277#
- bool mbDoNotResetParaAttrsForNumFont : 1; // #i53199#
- bool mbTableRowKeep : 1;
- bool mbIgnoreTabsAndBlanksForLineCalculation : 1; // #i3952#
- bool mbDoNotCaptureDrawObjsOnPage : 1; // #i62875#
- bool mbOutlineLevelYieldsOutlineRule : 1;
- bool mbClipAsCharacterAnchoredWriterFlyFrames : 1;
- bool mbUnixForceZeroExtLeading : 1; // #i60945#
bool mbOldPrinterMetrics : 1;
- bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
- bool mbProtectForm : 1;
- bool mbInvertBorderSpacing : 1;
- bool mbCollapseEmptyCellPara : 1;
- bool mbTabAtLeftIndentForParagraphsInList; // #i89181# - see above
- bool mbSmallCapsPercentage66;
- bool mbTabOverflow;
- bool mbUnbreakableNumberings;
- bool mbClippedPictures;
- bool mbBackgroundParaOverDrawings;
- bool mbTabOverMargin;
- bool mbSurroundTextWrapSmall;
-
- bool mbLastBrowseMode : 1;
sal_uInt32 mn32DummyCompatabilityOptions1;
sal_uInt32 mn32DummyCompatabilityOptions2;
@@ -2080,6 +2028,8 @@ public:
::sw::MetaFieldManager & GetMetaFieldManager();
::sw::UndoManager & GetUndoManager();
::sw::UndoManager const& GetUndoManager() const;
+ ::sw::DocumentSettingManager & GetDocumentSettingManager();
+ ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
SfxObjectShell* CreateCopy(bool bCallInitNew) const;
/**
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
new file mode 100644
index 000000000000..599df11e02ae
--- /dev/null
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -0,0 +1,504 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <DocumentSettingManager.hxx>
+#include <doc.hxx>
+#include <comphelper/processfactory.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svx/svdmodel.hxx>
+#include <unotools/compatibility.hxx>
+#include <swmodule.hxx>
+#include <linkenum.hxx>
+#include <rootfrm.hxx>
+#include <breakit.hxx>
+#include <docary.hxx>
+#include <SwUndoFmt.hxx>
+
+/* IDocumentSettingAccess */
+
+sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
+ :m_rDoc(rDoc)
+ ,
+ mnLinkUpdMode( GLOBALSETTING ),
+ meFldUpdMode( AUTOUPD_GLOBALSETTING ),
+ meChrCmprType( CHARCOMPRESS_NONE ),
+ mbHTMLMode(false),
+ mbIsGlobalDoc(false),
+ mbGlblDocSaveLinks(false),
+ mbIsLabelDoc(false),
+ mbPurgeOLE(true),
+ mbKernAsianPunctuation(false),
+
+ // COMPATIBILITY FLAGS START
+
+ mbAddFlyOffsets(false),
+ mbUseHiResolutionVirtualDevice(true),
+ mbMathBaselineAlignment(false), // default for *old* documents is 'off'
+ mbStylesNoDefault(false),
+ mbFloattableNomargins(false),
+ mEmbedFonts(false),
+ mEmbedSystemFonts(false),
+ mbOldNumbering(false),
+ mbIgnoreFirstLineIndentInNumbering(false),
+ mbDoNotResetParaAttrsForNumFont(false),
+ mbTableRowKeep(false),
+ mbIgnoreTabsAndBlanksForLineCalculation(false),
+ mbDoNotCaptureDrawObjsOnPage(false),
+ mbOutlineLevelYieldsOutlineRule(false),
+ mbClipAsCharacterAnchoredWriterFlyFrames(false),
+ mbUnixForceZeroExtLeading(false),
+ mbTabRelativeToIndent(true),
+ mbProtectForm(false), // i#78591#
+ mbInvertBorderSpacing (false),
+ mbCollapseEmptyCellPara(true),
+ mbTabAtLeftIndentForParagraphsInList(false), //#i89181#
+ mbSmallCapsPercentage66(false),
+ mbTabOverflow(true),
+ mbUnbreakableNumberings(false),
+ mbClippedPictures(false),
+ mbBackgroundParaOverDrawings(false),
+ mbTabOverMargin(false),
+ mbSurroundTextWrapSmall(false),
+ mbLastBrowseMode( false )
+
+ // COMPATIBILITY FLAGS END
+{
+ // COMPATIBILITY FLAGS START
+
+ // Note: Any non-hidden compatibility flag should obtain its default
+ // by asking SvtCompatibilityOptions, see below.
+
+ const SvtCompatibilityOptions aOptions;
+ mbParaSpaceMax = aOptions.IsAddSpacing();
+ mbParaSpaceMaxAtPages = aOptions.IsAddSpacingAtPages();
+ mbTabCompat = !aOptions.IsUseOurTabStops();
+ mbUseVirtualDevice = !aOptions.IsUsePrtDevice();
+ mbAddExternalLeading = !aOptions.IsNoExtLeading();
+ mbOldLineSpacing = aOptions.IsUseLineSpacing();
+ mbAddParaSpacingToTableCells = aOptions.IsAddTableSpacing();
+ mbUseFormerObjectPos = aOptions.IsUseObjectPositioning();
+ mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping();
+ mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle();
+
+ mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace();
+
+ // COMPATIBILITY FLAGS END
+
+}
+
+
+sw::DocumentSettingManager::~DocumentSettingManager()
+{
+}
+
+/* IDocumentSettingAccess */
+bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
+{
+ switch (id)
+ {
+ // COMPATIBILITY FLAGS START
+ case PARA_SPACE_MAX: return mbParaSpaceMax; //(n8Dummy1 & DUMMY_PARASPACEMAX);
+ case PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES);
+ case TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT);
+ case ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS);
+ case ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING);
+ case USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE);
+ case USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV);
+ case OLD_NUMBERING: return mbOldNumbering;
+ case OLD_LINE_SPACING: return mbOldLineSpacing;
+ case ADD_PARA_SPACING_TO_TABLE_CELLS: return mbAddParaSpacingToTableCells;
+ case USE_FORMER_OBJECT_POS: return mbUseFormerObjectPos;
+ case USE_FORMER_TEXT_WRAPPING: return mbUseFormerTextWrapping;
+ case CONSIDER_WRAP_ON_OBJECT_POSITION: return mbConsiderWrapOnObjPos;
+ case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: return mbDoNotJustifyLinesWithManualBreak;
+ case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: return mbIgnoreFirstLineIndentInNumbering;
+ case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE: return mbOutlineLevelYieldsOutlineRule;
+ case TABLE_ROW_KEEP: return mbTableRowKeep;
+ case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: return mbIgnoreTabsAndBlanksForLineCalculation;
+ case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: return mbDoNotCaptureDrawObjsOnPage;
+ // #i68949#
+ case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME: return mbClipAsCharacterAnchoredWriterFlyFrames;
+ case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
+ case TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
+ case PROTECT_FORM: return mbProtectForm;
+ // #i89181#
+ case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
+ case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
+ case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
+ case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66;
+ case TAB_OVERFLOW: return mbTabOverflow;
+ case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
+ case CLIPPED_PICTURES: return mbClippedPictures;
+ case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
+ case TAB_OVER_MARGIN: return mbTabOverMargin;
+ case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
+
+ case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked!
+ case HTML_MODE: return mbHTMLMode;
+ case GLOBAL_DOCUMENT: return mbIsGlobalDoc;
+ case GLOBAL_DOCUMENT_SAVE_LINKS: return mbGlblDocSaveLinks;
+ case LABEL_DOCUMENT: return mbIsLabelDoc;
+ case PURGE_OLE: return mbPurgeOLE;
+ case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation;
+ case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont;
+ case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment;
+ case STYLES_NODEFAULT: return mbStylesNoDefault;
+ case FLOATTABLE_NOMARGINS: return mbFloattableNomargins;
+ case EMBED_FONTS: return mEmbedFonts;
+ case EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
+ default:
+ OSL_FAIL("Invalid setting id");
+ }
+ return false;
+}
+
+void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
+{
+ switch (id)
+ {
+ // COMPATIBILITY FLAGS START
+ case PARA_SPACE_MAX:
+ mbParaSpaceMax = value;
+ break;
+ case PARA_SPACE_MAX_AT_PAGES:
+ mbParaSpaceMaxAtPages = value;
+ break;
+ case TAB_COMPAT:
+ mbTabCompat = value;
+ break;
+ case ADD_FLY_OFFSETS:
+ mbAddFlyOffsets = value;
+ break;
+ case ADD_EXT_LEADING:
+ mbAddExternalLeading = value;
+ break;
+ case USE_VIRTUAL_DEVICE:
+ mbUseVirtualDevice = value;
+ break;
+ case USE_HIRES_VIRTUAL_DEVICE:
+ mbUseHiResolutionVirtualDevice = value;
+ break;
+ case OLD_NUMBERING:
+ if (mbOldNumbering != value)
+ {
+ mbOldNumbering = value;
+
+ const SwNumRuleTbl& rNmTbl = m_rDoc.GetNumRuleTbl();
+ for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n )
+ rNmTbl[n]->SetInvalidRule(sal_True);
+
+ m_rDoc.UpdateNumRule();
+
+ SwNumRule *pOutlineRule = m_rDoc.GetOutlineNumRule();
+ if (pOutlineRule)
+ {
+ pOutlineRule->Validate();
+ // counting of phantoms depends on <IsOldNumbering()>
+ pOutlineRule->SetCountPhantoms( !mbOldNumbering );
+ }
+ }
+ break;
+ case OLD_LINE_SPACING:
+ mbOldLineSpacing = value;
+ break;
+ case ADD_PARA_SPACING_TO_TABLE_CELLS:
+ mbAddParaSpacingToTableCells = value;
+ break;
+ case USE_FORMER_OBJECT_POS:
+ mbUseFormerObjectPos = value;
+ break;
+ case USE_FORMER_TEXT_WRAPPING:
+ mbUseFormerTextWrapping = value;
+ break;
+ case CONSIDER_WRAP_ON_OBJECT_POSITION:
+ mbConsiderWrapOnObjPos = value;
+ break;
+ case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
+ mbDoNotJustifyLinesWithManualBreak = value;
+ break;
+ case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
+ mbIgnoreFirstLineIndentInNumbering = value;
+ break;
+
+ case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE:
+ mbOutlineLevelYieldsOutlineRule = value;
+ break;
+
+ case TABLE_ROW_KEEP:
+ mbTableRowKeep = value;
+ break;
+
+ case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
+ mbIgnoreTabsAndBlanksForLineCalculation = value;
+ break;
+
+ case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
+ mbDoNotCaptureDrawObjsOnPage = value;
+ break;
+
+ // #i68949#
+ case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME:
+ mbClipAsCharacterAnchoredWriterFlyFrames = value;
+ break;
+
+ case UNIX_FORCE_ZERO_EXT_LEADING:
+ mbUnixForceZeroExtLeading = value;
+ break;
+
+ case PROTECT_FORM:
+ mbProtectForm = value;
+ break;
+
+ case TABS_RELATIVE_TO_INDENT:
+ mbTabRelativeToIndent = value;
+ break;
+ // #i89181#
+ case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
+ mbTabAtLeftIndentForParagraphsInList = value;
+ break;
+
+ case INVERT_BORDER_SPACING:
+ mbInvertBorderSpacing = value;
+ break;
+
+ case COLLAPSE_EMPTY_CELL_PARA:
+ mbCollapseEmptyCellPara = value;
+ break;
+
+ case SMALL_CAPS_PERCENTAGE_66:
+ mbSmallCapsPercentage66 = value;
+ break;
+
+ case TAB_OVERFLOW:
+ mbTabOverflow = value;
+ break;
+
+ case UNBREAKABLE_NUMBERINGS:
+ mbUnbreakableNumberings = value;
+ break;
+
+ case CLIPPED_PICTURES:
+ mbClippedPictures = value;
+ break;
+
+ case BACKGROUND_PARA_OVER_DRAWINGS:
+ mbBackgroundParaOverDrawings = value;
+ break;
+
+ case TAB_OVER_MARGIN:
+ mbTabOverMargin = value;
+ break;
+
+ case SURROUND_TEXT_WRAP_SMALL:
+ mbSurroundTextWrapSmall = value;
+ break;
+
+ // COMPATIBILITY FLAGS END
+
+ case BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available
+ mbLastBrowseMode = value;
+ break;
+
+ case HTML_MODE:
+ mbHTMLMode = value;
+ break;
+
+ case GLOBAL_DOCUMENT:
+ mbIsGlobalDoc = value;
+ break;
+
+ case GLOBAL_DOCUMENT_SAVE_LINKS:
+ mbGlblDocSaveLinks = value;
+ break;
+
+ case LABEL_DOCUMENT:
+ mbIsLabelDoc = value;
+ break;
+
+ case PURGE_OLE:
+ mbPurgeOLE = value;
+ break;
+
+ case KERN_ASIAN_PUNCTUATION:
+ mbKernAsianPunctuation = value;
+ break;
+
+ case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
+ mbDoNotResetParaAttrsForNumFont = value;
+ break;
+ case MATH_BASELINE_ALIGNMENT:
+ mbMathBaselineAlignment = value;
+ break;
+ case STYLES_NODEFAULT:
+ mbStylesNoDefault = value;
+ break;
+ case FLOATTABLE_NOMARGINS:
+ mbFloattableNomargins = value;
+ break;
+ case EMBED_FONTS:
+ mEmbedFonts = value;
+ break;
+ case EMBED_SYSTEM_FONTS:
+ mEmbedSystemFonts = value;
+ break;
+ default:
+ OSL_FAIL("Invalid setting id");
+ }
+}
+
+const i18n::ForbiddenCharacters*
+ sw::DocumentSettingManager::getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const
+{
+ const i18n::ForbiddenCharacters* pRet = 0;
+ if( mxForbiddenCharsTable.is() )
+ pRet = mxForbiddenCharsTable->GetForbiddenCharacters( nLang, false );
+ if( bLocaleData && !pRet && g_pBreakIt )
+ pRet = &g_pBreakIt->GetForbidden( (LanguageType)nLang );
+ return pRet;
+}
+
+void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang,
+ /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rFChars )
+{
+ if( !mxForbiddenCharsTable.is() )
+ {
+ mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
+ }
+ mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
+
+ SdrModel *pDrawModel = m_rDoc.GetDrawModel();
+ if( pDrawModel )
+ {
+ pDrawModel->SetForbiddenCharsTable( mxForbiddenCharsTable );
+ if( !m_rDoc.IsInReading() )
+ pDrawModel->ReformatAllTextObjects();
+ }
+
+ SwRootFrm* pTmpRoot = m_rDoc.GetCurrentLayout();
+ if( pTmpRoot && !m_rDoc.IsInReading() )
+ {
+ pTmpRoot->StartAllAction();
+ std::set<SwRootFrm*> aAllLayouts = m_rDoc.GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
+ pTmpRoot->EndAllAction();
+ }
+ m_rDoc.SetModified();
+}
+
+rtl::Reference<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
+{
+ if( !mxForbiddenCharsTable.is() )
+ {
+ mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
+ }
+ return mxForbiddenCharsTable;
+}
+
+const rtl::Reference<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable() const
+{
+ return mxForbiddenCharsTable;
+}
+
+sal_uInt16 sw::DocumentSettingManager::getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const
+{
+ sal_uInt16 nRet = mnLinkUpdMode;
+ if( bGlobalSettings && GLOBALSETTING == nRet )
+ nRet = SW_MOD()->GetLinkUpdMode(get(IDocumentSettingAccess::HTML_MODE));
+ return nRet;
+}
+
+void sw::DocumentSettingManager::setLinkUpdateMode( /*[in]*/sal_uInt16 eMode )
+{
+ mnLinkUpdMode = eMode;
+}
+
+SwFldUpdateFlags sw::DocumentSettingManager::getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const
+{
+ SwFldUpdateFlags eRet = meFldUpdMode;
+ if( bGlobalSettings && AUTOUPD_GLOBALSETTING == eRet )
+ eRet = SW_MOD()->GetFldUpdateFlags(get(IDocumentSettingAccess::HTML_MODE));
+ return eRet;
+}
+
+void sw::DocumentSettingManager::setFieldUpdateFlags(/*[in]*/SwFldUpdateFlags eMode )
+{
+ meFldUpdMode = eMode;
+}
+
+SwCharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const
+{
+ return meChrCmprType;
+}
+
+void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharCompressType n )
+{
+ if( meChrCmprType != n )
+ {
+ meChrCmprType = n;
+
+ SdrModel *pDrawModel = m_rDoc.GetDrawModel();
+ if( pDrawModel )
+ {
+ pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) );
+ if( !m_rDoc.IsInReading() )
+ pDrawModel->ReformatAllTextObjects();
+ }
+
+ SwRootFrm* pTmpRoot = m_rDoc.GetCurrentLayout();
+ if( pTmpRoot && !m_rDoc.IsInReading() )
+ {
+ pTmpRoot->StartAllAction();
+ std::set<SwRootFrm*> aAllLayouts = m_rDoc.GetAllLayouts();
+ std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
+ pTmpRoot->EndAllAction();
+ }
+ m_rDoc.SetModified();
+ }
+}
+
+
+void sw::DocumentSettingManager::ReplaceCompatabilityOptions(const DocumentSettingManager& rSource)
+{
+ mbParaSpaceMax = rSource.mbParaSpaceMax;
+ mbParaSpaceMaxAtPages = rSource.mbParaSpaceMaxAtPages;
+ mbTabCompat = rSource.mbTabCompat;
+ mbUseVirtualDevice = rSource.mbUseVirtualDevice;
+ mbAddExternalLeading = rSource.mbAddExternalLeading;
+ mbOldLineSpacing = rSource.mbOldLineSpacing;
+ mbAddParaSpacingToTableCells = rSource.mbAddParaSpacingToTableCells;
+ mbUseFormerObjectPos = rSource.mbUseFormerObjectPos;
+ mbUseFormerTextWrapping = rSource.mbUseFormerTextWrapping;
+ mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
+ mbAddFlyOffsets = rSource.mbAddFlyOffsets;
+ mbOldNumbering = rSource.mbOldNumbering;
+ mbUseHiResolutionVirtualDevice = rSource.mbUseHiResolutionVirtualDevice;
+ mbIgnoreFirstLineIndentInNumbering = rSource.mbIgnoreFirstLineIndentInNumbering;
+ mbDoNotJustifyLinesWithManualBreak = rSource.mbDoNotJustifyLinesWithManualBreak;
+ mbDoNotResetParaAttrsForNumFont = rSource.mbDoNotResetParaAttrsForNumFont;
+ mbOutlineLevelYieldsOutlineRule = rSource.mbOutlineLevelYieldsOutlineRule;
+ mbTableRowKeep = rSource.mbTableRowKeep;
+ mbIgnoreTabsAndBlanksForLineCalculation = rSource.mbIgnoreTabsAndBlanksForLineCalculation;
+ mbDoNotCaptureDrawObjsOnPage = rSource.mbDoNotCaptureDrawObjsOnPage;
+ mbClipAsCharacterAnchoredWriterFlyFrames = rSource.mbClipAsCharacterAnchoredWriterFlyFrames;
+ mbUnixForceZeroExtLeading = rSource.mbUnixForceZeroExtLeading;
+ mbTabRelativeToIndent = rSource.mbTabRelativeToIndent;
+ mbTabAtLeftIndentForParagraphsInList = rSource.mbTabAtLeftIndentForParagraphsInList;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 8b3d92567be8..a479d26d479a 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -18,6 +18,7 @@
*/
#include <doc.hxx>
+#include <DocumentSettingManager.hxx>
#include <UndoManager.hxx>
#include <hintids.hxx>
@@ -33,7 +34,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
-#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <tools/urlobj.hxx>
#include <tools/poly.hxx>
@@ -48,7 +48,6 @@
#include <editeng/charsetcoloritem.hxx>
#include <editeng/formatbreakitem.hxx>
#include <sfx2/linkmgr.hxx>
-#include <editeng/forbiddencharacterstable.hxx>
#include <svx/svdmodel.hxx>
#include <editeng/pbinitem.hxx>
#include <unotools/charclass.hxx>
@@ -67,7 +66,6 @@
#include <txtinet.hxx>
#include <txtrfmrk.hxx>
#include <frmatr.hxx>
-#include <linkenum.hxx>
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <swtable.hxx>
@@ -79,7 +77,6 @@
#include <UndoSplitMove.hxx>
#include <UndoTable.hxx>
#include <pagedesc.hxx>
-#include <breakit.hxx>
#include <ndole.hxx>
#include <ndgrf.hxx>
#include <rolbck.hxx>
@@ -101,7 +98,6 @@
#include <statstr.hrc>
#include <comcore.hrc>
#include <SwUndoTOXChange.hxx>
-#include <SwUndoFmt.hxx>
#include <unocrsr.hxx>
#include <docsh.hxx>
#include <viewopt.hxx>
@@ -154,319 +150,44 @@ sal_Int32 SwDoc::getReferenceCount() const
/* IDocumentSettingAccess */
bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
{
- switch (id)
- {
- // COMPATIBILITY FLAGS START
- case PARA_SPACE_MAX: return mbParaSpaceMax; //(n8Dummy1 & DUMMY_PARASPACEMAX);
- case PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES);
- case TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT);
- case ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS);
- case ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING);
- case USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE);
- case USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV);
- case OLD_NUMBERING: return mbOldNumbering;
- case OLD_LINE_SPACING: return mbOldLineSpacing;
- case ADD_PARA_SPACING_TO_TABLE_CELLS: return mbAddParaSpacingToTableCells;
- case USE_FORMER_OBJECT_POS: return mbUseFormerObjectPos;
- case USE_FORMER_TEXT_WRAPPING: return mbUseFormerTextWrapping;
- case CONSIDER_WRAP_ON_OBJECT_POSITION: return mbConsiderWrapOnObjPos;
- case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK: return mbDoNotJustifyLinesWithManualBreak;
- case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING: return mbIgnoreFirstLineIndentInNumbering;
- case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE: return mbOutlineLevelYieldsOutlineRule;
- case TABLE_ROW_KEEP: return mbTableRowKeep;
- case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION: return mbIgnoreTabsAndBlanksForLineCalculation;
- case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE: return mbDoNotCaptureDrawObjsOnPage;
- // #i68949#
- case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME: return mbClipAsCharacterAnchoredWriterFlyFrames;
- case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
- case TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
- case PROTECT_FORM: return mbProtectForm;
- // #i89181#
- case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList;
- case INVERT_BORDER_SPACING: return mbInvertBorderSpacing;
- case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara;
- case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66;
- case TAB_OVERFLOW: return mbTabOverflow;
- case UNBREAKABLE_NUMBERINGS: return mbUnbreakableNumberings;
- case CLIPPED_PICTURES: return mbClippedPictures;
- case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings;
- case TAB_OVER_MARGIN: return mbTabOverMargin;
- case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall;
-
- case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked!
- case HTML_MODE: return mbHTMLMode;
- case GLOBAL_DOCUMENT: return mbIsGlobalDoc;
- case GLOBAL_DOCUMENT_SAVE_LINKS: return mbGlblDocSaveLinks;
- case LABEL_DOCUMENT: return mbIsLabelDoc;
- case PURGE_OLE: return mbPurgeOLE;
- case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation;
- case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont;
- case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment;
- case STYLES_NODEFAULT: return mbStylesNoDefault;
- case FLOATTABLE_NOMARGINS: return mbFloattableNomargins;
- case EMBED_FONTS: return mEmbedFonts;
- case EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
- default:
- OSL_FAIL("Invalid setting id");
- }
- return false;
+ return m_pDocumentSettingManager->get(id);
}
void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
{
- switch (id)
- {
- // COMPATIBILITY FLAGS START
- case PARA_SPACE_MAX:
- mbParaSpaceMax = value;
- break;
- case PARA_SPACE_MAX_AT_PAGES:
- mbParaSpaceMaxAtPages = value;
- break;
- case TAB_COMPAT:
- mbTabCompat = value;
- break;
- case ADD_FLY_OFFSETS:
- mbAddFlyOffsets = value;
- break;
- case ADD_EXT_LEADING:
- mbAddExternalLeading = value;
- break;
- case USE_VIRTUAL_DEVICE:
- mbUseVirtualDevice = value;
- break;
- case USE_HIRES_VIRTUAL_DEVICE:
- mbUseHiResolutionVirtualDevice = value;
- break;
- case OLD_NUMBERING:
- if (mbOldNumbering != value)
- {
- mbOldNumbering = value;
-
- const SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
- for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n )
- rNmTbl[n]->SetInvalidRule(sal_True);
-
- UpdateNumRule();
-
- if (mpOutlineRule)
- {
- mpOutlineRule->Validate();
- // counting of phantoms depends on <IsOldNumbering()>
- mpOutlineRule->SetCountPhantoms( !mbOldNumbering );
- }
- }
- break;
- case OLD_LINE_SPACING:
- mbOldLineSpacing = value;
- break;
- case ADD_PARA_SPACING_TO_TABLE_CELLS:
- mbAddParaSpacingToTableCells = value;
- break;
- case USE_FORMER_OBJECT_POS:
- mbUseFormerObjectPos = value;
- break;
- case USE_FORMER_TEXT_WRAPPING:
- mbUseFormerTextWrapping = value;
- break;
- case CONSIDER_WRAP_ON_OBJECT_POSITION:
- mbConsiderWrapOnObjPos = value;
- break;
- case DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
- mbDoNotJustifyLinesWithManualBreak = value;
- break;
- case IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
- mbIgnoreFirstLineIndentInNumbering = value;
- break;
-
- case OUTLINE_LEVEL_YIELDS_OUTLINE_RULE:
- mbOutlineLevelYieldsOutlineRule = value;
- break;
-
- case TABLE_ROW_KEEP:
- mbTableRowKeep = value;
- break;
-
- case IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
- mbIgnoreTabsAndBlanksForLineCalculation = value;
- break;
-
- case DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
- mbDoNotCaptureDrawObjsOnPage = value;
- break;
-
- // #i68949#
- case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME:
- mbClipAsCharacterAnchoredWriterFlyFrames = value;
- break;
-
- case UNIX_FORCE_ZERO_EXT_LEADING:
- mbUnixForceZeroExtLeading = value;
- break;
-
- case PROTECT_FORM:
- mbProtectForm = value;
- break;
-
- case TABS_RELATIVE_TO_INDENT:
- mbTabRelativeToIndent = value;
- break;
- // #i89181#
- case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
- mbTabAtLeftIndentForParagraphsInList = value;
- break;
-
- case INVERT_BORDER_SPACING:
- mbInvertBorderSpacing = value;
- break;
-
- case COLLAPSE_EMPTY_CELL_PARA:
- mbCollapseEmptyCellPara = value;
- break;
-
- case SMALL_CAPS_PERCENTAGE_66:
- mbSmallCapsPercentage66 = value;
- break;
-
- case TAB_OVERFLOW:
- mbTabOverflow = value;
- break;
-
- case UNBREAKABLE_NUMBERINGS:
- mbUnbreakableNumberings = value;
- break;
-
- case CLIPPED_PICTURES:
- mbClippedPictures = value;
- break;
-
- case BACKGROUND_PARA_OVER_DRAWINGS:
- mbBackgroundParaOverDrawings = value;
- break;
-
- case TAB_OVER_MARGIN:
- mbTabOverMargin = value;
- break;
-
- case SURROUND_TEXT_WRAP_SMALL:
- mbSurroundTextWrapSmall = value;
- break;
-
- // COMPATIBILITY FLAGS END
-
- case BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available
- mbLastBrowseMode = value;
- break;
-
- case HTML_MODE:
- mbHTMLMode = value;
- break;
-
- case GLOBAL_DOCUMENT:
- mbIsGlobalDoc = value;
- break;
-
- case GLOBAL_DOCUMENT_SAVE_LINKS:
- mbGlblDocSaveLinks = value;
- break;
-
- case LABEL_DOCUMENT:
- mbIsLabelDoc = value;
- break;
-
- case PURGE_OLE:
- mbPurgeOLE = value;
- break;
-
- case KERN_ASIAN_PUNCTUATION:
- mbKernAsianPunctuation = value;
- break;
-
- case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
- mbDoNotResetParaAttrsForNumFont = value;
- break;
- case MATH_BASELINE_ALIGNMENT:
- mbMathBaselineAlignment = value;
- break;
- case STYLES_NODEFAULT:
- mbStylesNoDefault = value;
- break;
- case FLOATTABLE_NOMARGINS:
- mbFloattableNomargins = value;
- break;
- case EMBED_FONTS:
- mEmbedFonts = value;
- break;
- case EMBED_SYSTEM_FONTS:
- mEmbedSystemFonts = value;
- break;
- default:
- OSL_FAIL("Invalid setting id");
- }
+ m_pDocumentSettingManager->set(id,value);
}
const i18n::ForbiddenCharacters*
SwDoc::getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const
{
- const i18n::ForbiddenCharacters* pRet = 0;
- if( mxForbiddenCharsTable.is() )
- pRet = mxForbiddenCharsTable->GetForbiddenCharacters( nLang, false );
- if( bLocaleData && !pRet && g_pBreakIt )
- pRet = &g_pBreakIt->GetForbidden( (LanguageType)nLang );
- return pRet;
+ return m_pDocumentSettingManager->getForbiddenCharacters(nLang,bLocaleData);
}
void SwDoc::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang,
/*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rFChars )
{
- if( !mxForbiddenCharsTable.is() )
- {
- mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
- }
- mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
- if( mpDrawModel )
- {
- mpDrawModel->SetForbiddenCharsTable( mxForbiddenCharsTable );
- if( !mbInReading )
- mpDrawModel->ReformatAllTextObjects();
- }
-
- SwRootFrm* pTmpRoot = GetCurrentLayout();
- if( pTmpRoot && !mbInReading )
- {
- pTmpRoot->StartAllAction();
- std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
- std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
- pTmpRoot->EndAllAction();
- }
- SetModified();
+ m_pDocumentSettingManager->setForbiddenCharacters(nLang,rFChars);
}
rtl::Reference<SvxForbiddenCharactersTable>& SwDoc::getForbiddenCharacterTable()
{
- if( !mxForbiddenCharsTable.is() )
- {
- mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
- }
- return mxForbiddenCharsTable;
+ return m_pDocumentSettingManager->getForbiddenCharacterTable();
}
const rtl::Reference<SvxForbiddenCharactersTable>& SwDoc::getForbiddenCharacterTable() const
{
- return mxForbiddenCharsTable;
+ return m_pDocumentSettingManager->getForbiddenCharacterTable();
}
sal_uInt16 SwDoc::getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const
{
- sal_uInt16 nRet = mnLinkUpdMode;
- if( bGlobalSettings && GLOBALSETTING == nRet )
- nRet = SW_MOD()->GetLinkUpdMode(get(IDocumentSettingAccess::HTML_MODE));
- return nRet;
+ return m_pDocumentSettingManager->getLinkUpdateMode(bGlobalSettings);
}
void SwDoc::setLinkUpdateMode( /*[in]*/sal_uInt16 eMode )
{
- mnLinkUpdMode = eMode;
+ m_pDocumentSettingManager->setLinkUpdateMode(eMode);
}
sal_uInt32 SwDoc::getRsid() const
@@ -503,44 +224,22 @@ void SwDoc::setRsidRoot( sal_uInt32 nVal )
SwFldUpdateFlags SwDoc::getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const
{
- SwFldUpdateFlags eRet = meFldUpdMode;
- if( bGlobalSettings && AUTOUPD_GLOBALSETTING == eRet )
- eRet = SW_MOD()->GetFldUpdateFlags(get(IDocumentSettingAccess::HTML_MODE));
- return eRet;
+ return m_pDocumentSettingManager->getFieldUpdateFlags(bGlobalSettings);
}
void SwDoc::setFieldUpdateFlags(/*[in]*/SwFldUpdateFlags eMode )
{
- meFldUpdMode = eMode;
+ m_pDocumentSettingManager->setFieldUpdateFlags(eMode);
}
SwCharCompressType SwDoc::getCharacterCompressionType() const
{
- return meChrCmprType;
+ return m_pDocumentSettingManager->getCharacterCompressionType();
}
void SwDoc::setCharacterCompressionType( /*[in]*/SwCharCompressType n )
{
- if( meChrCmprType != n )
- {
- meChrCmprType = n;
- if( mpDrawModel )
- {
- mpDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) );
- if( !mbInReading )
- mpDrawModel->ReformatAllTextObjects();
- }
-
- SwRootFrm* pTmpRoot = GetCurrentLayout();
- if( pTmpRoot && !mbInReading )
- {
- pTmpRoot->StartAllAction();
- std::set<SwRootFrm*> aAllLayouts = GetAllLayouts();
- std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
- pTmpRoot->EndAllAction();
- }
- SetModified();
- }
+ m_pDocumentSettingManager->setCharacterCompressionType(n);
}
/* IDocumentDeviceAccess */
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 66eb19c588fd..c18438e4ef7b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -20,6 +20,7 @@
#include <config_features.h>
#include <doc.hxx>
+#include <DocumentSettingManager.hxx>
#include <dcontact.hxx>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
@@ -42,7 +43,6 @@
#include <sfx2/linkmgr.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <svl/zforlist.hxx>
-#include <unotools/compatibility.hxx>
#include <unotools/lingucfg.hxx>
#include <svx/svdpage.hxx>
#include <paratr.hxx>
@@ -189,6 +189,7 @@ SwDoc::SwDoc()
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
m_pUndoManager(new ::sw::UndoManager(
boost::shared_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)),
+ m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ),
mpColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, mpDfltFrmFmt ) ),
@@ -242,10 +243,7 @@ SwDoc::SwDoc()
mpListItemsList( new tImplSortedNodeNumList() ), // #i83479#
m_pXmlIdRegistry(),
mnAutoFmtRedlnCommentNo( 0 ),
- mnLinkUpdMode( GLOBALSETTING ),
- meFldUpdMode( AUTOUPD_GLOBALSETTING ),
meRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
- meChrCmprType( CHARCOMPRESS_NONE ),
mReferenceCount(0),
mIdleBlockCount(0),
mnLockExpFld( 0 ),
@@ -263,19 +261,13 @@ SwDoc::SwDoc()
mbInXMLImport(false),
mbUpdateTOX(false),
mbInLoadAsynchron(false),
- mbHTMLMode(false),
mbInCallModified(false),
- mbIsGlobalDoc(false),
- mbGlblDocSaveLinks(false),
- mbIsLabelDoc(false),
mbIsAutoFmtRedline(false),
mbOLEPrtNotifyPending(false),
mbAllOLENotify(false),
mbIsRedlineMove(false),
mbInsOnlyTxtGlssry(false),
mbContains_MSVBasic(false),
- mbPurgeOLE(true),
- mbKernAsianPunctuation(false),
mbReadlineChecked(false),
mbLinksUpdated( false ), //#i38810#
mbClipBoard( false ),
@@ -288,36 +280,7 @@ SwDoc::SwDoc()
// COMPATIBILITY FLAGS START
- mbAddFlyOffsets(false),
- mbUseHiResolutionVirtualDevice(true),
- mbMathBaselineAlignment(false), // default for *old* documents is 'off'
- mbStylesNoDefault(false),
- mbFloattableNomargins(false),
- mEmbedFonts(false),
- mEmbedSystemFonts(false),
- mbOldNumbering(false),
- mbIgnoreFirstLineIndentInNumbering(false),
- mbDoNotResetParaAttrsForNumFont(false),
- mbTableRowKeep(false),
- mbIgnoreTabsAndBlanksForLineCalculation(false),
- mbDoNotCaptureDrawObjsOnPage(false),
- mbOutlineLevelYieldsOutlineRule(false),
- mbClipAsCharacterAnchoredWriterFlyFrames(false),
- mbUnixForceZeroExtLeading(false),
mbOldPrinterMetrics(false),
- mbTabRelativeToIndent(true),
- mbProtectForm(false), // i#78591#
- mbInvertBorderSpacing (false),
- mbCollapseEmptyCellPara(true),
- mbTabAtLeftIndentForParagraphsInList(false), //#i89181#
- mbSmallCapsPercentage66(false),
- mbTabOverflow(true),
- mbUnbreakableNumberings(false),
- mbClippedPictures(false),
- mbBackgroundParaOverDrawings(false),
- mbTabOverMargin(false),
- mbSurroundTextWrapSmall(false),
- mbLastBrowseMode( false ),
mn32DummyCompatabilityOptions1(0),
mn32DummyCompatabilityOptions2(0),
@@ -327,27 +290,6 @@ SwDoc::SwDoc()
mbReadOnly(false),
meDocType(DOCTYPE_NATIVE)
{
- // COMPATIBILITY FLAGS START
-
- // Note: Any non-hidden compatibility flag should obtain its default
- // by asking SvtCompatibilityOptions, see below.
-
- const SvtCompatibilityOptions aOptions;
- mbParaSpaceMax = aOptions.IsAddSpacing();
- mbParaSpaceMaxAtPages = aOptions.IsAddSpacingAtPages();
- mbTabCompat = !aOptions.IsUseOurTabStops();
- mbUseVirtualDevice = !aOptions.IsUsePrtDevice();
- mbAddExternalLeading = !aOptions.IsNoExtLeading();
- mbOldLineSpacing = aOptions.IsUseLineSpacing();
- mbAddParaSpacingToTableCells = aOptions.IsAddTableSpacing();
- mbUseFormerObjectPos = aOptions.IsUseObjectPositioning();
- mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping();
- mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle();
-
- mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace();
-
- // COMPATIBILITY FLAGS END
-
/*
* DefaultFormats and DefaultFormatCollections (FmtColl)
* are inserted at position 0 at the respective array.
@@ -1035,6 +977,18 @@ SwDoc::GetUndoManager() const
return *m_pUndoManager;
}
+::sw::DocumentSettingManager &
+SwDoc::GetDocumentSettingManager()
+{
+ return *m_pDocumentSettingManager;
+}
+
+::sw::DocumentSettingManager const&
+SwDoc::GetDocumentSettingManager() const
+{
+ return *m_pDocumentSettingManager;
+}
+
IDocumentUndoRedo &
SwDoc::GetIDocumentUndoRedo()
{
@@ -1105,31 +1059,9 @@ void SwDoc::ReplaceCompatabilityOptions(const SwDoc& rSource)
{
mn32DummyCompatabilityOptions1 = rSource.mn32DummyCompatabilityOptions1;
mn32DummyCompatabilityOptions2 = rSource.mn32DummyCompatabilityOptions2;
- mbParaSpaceMax = rSource.mbParaSpaceMax;
- mbParaSpaceMaxAtPages = rSource.mbParaSpaceMaxAtPages;
- mbTabCompat = rSource.mbTabCompat;
- mbUseVirtualDevice = rSource.mbUseVirtualDevice;
- mbAddExternalLeading = rSource.mbAddExternalLeading;
- mbOldLineSpacing = rSource.mbOldLineSpacing;
- mbAddParaSpacingToTableCells = rSource.mbAddParaSpacingToTableCells;
- mbUseFormerObjectPos = rSource.mbUseFormerObjectPos;
- mbUseFormerTextWrapping = rSource.mbUseFormerTextWrapping;
- mbConsiderWrapOnObjPos = rSource.mbConsiderWrapOnObjPos;
- mbAddFlyOffsets = rSource.mbAddFlyOffsets;
- mbOldNumbering = rSource.mbOldNumbering;
- mbUseHiResolutionVirtualDevice = rSource.mbUseHiResolutionVirtualDevice;
- mbIgnoreFirstLineIndentInNumbering = rSource.mbIgnoreFirstLineIndentInNumbering;
- mbDoNotJustifyLinesWithManualBreak = rSource.mbDoNotJustifyLinesWithManualBreak;
- mbDoNotResetParaAttrsForNumFont = rSource.mbDoNotResetParaAttrsForNumFont;
- mbOutlineLevelYieldsOutlineRule = rSource.mbOutlineLevelYieldsOutlineRule;
- mbTableRowKeep = rSource.mbTableRowKeep;
- mbIgnoreTabsAndBlanksForLineCalculation = rSource.mbIgnoreTabsAndBlanksForLineCalculation;
- mbDoNotCaptureDrawObjsOnPage = rSource.mbDoNotCaptureDrawObjsOnPage;
- mbClipAsCharacterAnchoredWriterFlyFrames = rSource.mbClipAsCharacterAnchoredWriterFlyFrames;
- mbUnixForceZeroExtLeading = rSource.mbUnixForceZeroExtLeading;
mbOldPrinterMetrics = rSource.mbOldPrinterMetrics;
- mbTabRelativeToIndent = rSource.mbTabRelativeToIndent;
- mbTabAtLeftIndentForParagraphsInList = rSource.mbTabAtLeftIndentForParagraphsInList;
+
+ m_pDocumentSettingManager->ReplaceCompatabilityOptions(rSource.GetDocumentSettingManager());
}
SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
new file mode 100644
index 000000000000..10a2a5aa5132
--- /dev/null
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SW_INC_DOCSETTING_HXX
+#define INCLUDED_SW_INC_DOCSETTING_HXX
+
+#include <IDocumentSettingAccess.hxx>
+class SwDoc;
+
+namespace sw {
+class DocumentSettingManager :
+ public IDocumentSettingAccess
+{
+ rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
+ SwDoc &m_rDoc;
+
+ sal_uInt16 mnLinkUpdMode; //< UpdateMode for links.
+
+ SwFldUpdateFlags meFldUpdMode;//< Automatically Update Mode for fields/charts.
+ SwCharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana
+
+ bool mbHTMLMode : 1; //< TRUE: Document is in HTMLMode.
+ bool mbIsGlobalDoc : 1; //< TRUE: It's a global document.
+ bool mbGlblDocSaveLinks : 1; //< TRUE: Save sections linked in global document.
+ bool mbIsLabelDoc : 1; //< TRUE: It's a label document.
+ bool mbPurgeOLE : 1; //< sal_True: Purge OLE-Objects
+ bool mbKernAsianPunctuation : 1; //< sal_True: kerning also for ASIAN punctuation
+
+ bool mbParaSpaceMax : 1;
+ bool mbParaSpaceMaxAtPages : 1;
+ bool mbTabCompat : 1;
+ bool mbUseVirtualDevice : 1;
+ bool mbAddFlyOffsets : 1;
+ bool mbAddExternalLeading : 1;
+ bool mbUseHiResolutionVirtualDevice : 1;
+ bool mbOldLineSpacing : 1; // #i11859#
+ bool mbAddParaSpacingToTableCells : 1;
+ bool mbUseFormerObjectPos : 1; // #i11860#
+ bool mbUseFormerTextWrapping : 1;
+ bool mbConsiderWrapOnObjPos : 1; // #i28701#
+ // sal_True: object positioning algorithm has consider the wrapping style of // the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos'
+ // floating screen objects as given by its
+ // attribute 'WrapInfluenceOnObjPos'.
+ bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972#
+ bool mbStylesNoDefault : 1;
+ bool mbFloattableNomargins : 1; //< If paragraph margins next to a floating table should be ignored.
+ bool mEmbedFonts : 1; //< Whether to embed fonts used by the document when saving.
+ bool mEmbedSystemFonts : 1; //< Whether to embed also system fonts.
+
+ // non-ui-compatibility flags:
+ bool mbOldNumbering : 1;
+ bool mbIgnoreFirstLineIndentInNumbering : 1; // #i47448#
+ bool mbDoNotJustifyLinesWithManualBreak : 1; // #i49277#
+ bool mbDoNotResetParaAttrsForNumFont : 1; // #i53199#
+ bool mbTableRowKeep : 1;
+ bool mbIgnoreTabsAndBlanksForLineCalculation : 1; // #i3952#
+ bool mbDoNotCaptureDrawObjsOnPage : 1; // #i62875#
+ bool mbOutlineLevelYieldsOutlineRule : 1;
+ bool mbClipAsCharacterAnchoredWriterFlyFrames : 1;
+ bool mbUnixForceZeroExtLeading : 1; // #i60945#
+ bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
+ bool mbProtectForm : 1;
+ bool mbInvertBorderSpacing : 1;
+ bool mbCollapseEmptyCellPara : 1;
+ bool mbTabAtLeftIndentForParagraphsInList; // #i89181# - see above
+ bool mbSmallCapsPercentage66;
+ bool mbTabOverflow;
+ bool mbUnbreakableNumberings;
+ bool mbClippedPictures;
+ bool mbBackgroundParaOverDrawings;
+ bool mbTabOverMargin;
+ bool mbSurroundTextWrapSmall;
+
+ bool mbLastBrowseMode : 1;
+
+public:
+
+ DocumentSettingManager(SwDoc &rDoc);
+ ~DocumentSettingManager();
+
+ // IDocumentSettingAccess
+ virtual bool get(/*[in]*/ DocumentSettingId id) const;
+ virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value);
+ virtual const com::sun::star::i18n::ForbiddenCharacters* getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const;
+ virtual void setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters );
+ virtual rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable();
+ virtual const rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const;
+ virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const;
+ virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode );
+ virtual SwFldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const;
+ virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags eMode );
+ virtual SwCharCompressType getCharacterCompressionType() const;
+ virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType );
+
+
+// Replace all compatability options with those from rSource.
+ void ReplaceCompatabilityOptions(const DocumentSettingManager& rSource);
+
+};
+
+}
+
+#endif //_DOCSETTING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */