sw/Library_sw.mk | 1 sw/inc/IDocumentState.hxx | 2 sw/inc/doc.hxx | 28 -- sw/source/core/crsr/annotationmark.cxx | 3 sw/source/core/crsr/bookmrk.cxx | 5 sw/source/core/crsr/findattr.cxx | 3 sw/source/core/crsr/findcoll.cxx | 3 sw/source/core/crsr/findtxt.cxx | 3 sw/source/core/doc/DocumentContentOperationsManager.cxx | 39 ++-- sw/source/core/doc/DocumentDeviceManager.cxx | 3 sw/source/core/doc/DocumentFieldsManager.cxx | 13 - sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 3 sw/source/core/doc/DocumentRedlineManager.cxx | 17 - sw/source/core/doc/DocumentSettingManager.cxx | 5 sw/source/core/doc/DocumentStateManager.cxx | 133 ++++++++++++++ sw/source/core/doc/DocumentStatisticsManager.cxx | 7 sw/source/core/doc/doc.cxx | 109 ++--------- sw/source/core/doc/docchart.cxx | 3 sw/source/core/doc/doccomp.cxx | 15 - sw/source/core/doc/docdesc.cxx | 7 sw/source/core/doc/docdraw.cxx | 3 sw/source/core/doc/docedt.cxx | 3 sw/source/core/doc/docfld.cxx | 3 sw/source/core/doc/docfly.cxx | 11 - sw/source/core/doc/docfmt.cxx | 43 ++-- sw/source/core/doc/docftn.cxx | 7 sw/source/core/doc/doclay.cxx | 15 - sw/source/core/doc/docnew.cxx | 14 - sw/source/core/doc/docnum.cxx | 27 +- sw/source/core/doc/docredln.cxx | 7 sw/source/core/doc/docsort.cxx | 3 sw/source/core/doc/doctxm.cxx | 7 sw/source/core/doc/lineinfo.cxx | 3 sw/source/core/doc/number.cxx | 5 sw/source/core/doc/poolfmt.cxx | 15 - sw/source/core/docnode/ndsect.cxx | 13 - sw/source/core/docnode/ndtbl.cxx | 43 ++-- sw/source/core/docnode/ndtbl1.cxx | 17 - sw/source/core/docnode/nodedump.cxx | 3 sw/source/core/docnode/section.cxx | 3 sw/source/core/edit/edfld.cxx | 3 sw/source/core/edit/edglbldc.cxx | 5 sw/source/core/edit/editsh.cxx | 5 sw/source/core/edit/ednumber.cxx | 11 - sw/source/core/edit/edtab.cxx | 5 sw/source/core/edit/edws.cxx | 11 - sw/source/core/fields/ddefld.cxx | 3 sw/source/core/fields/usrfld.cxx | 5 sw/source/core/frmedt/fefly1.cxx | 3 sw/source/core/frmedt/feshview.cxx | 13 - sw/source/core/frmedt/fetab.cxx | 5 sw/source/core/inc/DocumentStateManager.hxx | 66 ++++++ sw/source/core/layout/anchoreddrawobject.cxx | 5 sw/source/core/layout/colfrm.cxx | 5 sw/source/core/layout/frmtool.cxx | 5 sw/source/core/txtnode/txtatr2.cxx | 9 sw/source/core/undo/docundo.cxx | 1 sw/source/core/unocore/unofield.cxx | 3 sw/source/core/unocore/unotbl.cxx | 3 sw/source/core/view/viewsh.cxx | 5 sw/source/core/view/vnew.cxx | 9 sw/source/filter/basflt/shellio.cxx | 9 sw/source/filter/html/swhtml.cxx | 5 sw/source/filter/ww1/fltshell.cxx | 3 sw/source/filter/ww8/ww8par5.cxx | 3 sw/source/uibase/app/docsh.cxx | 15 - sw/source/uibase/app/docsh2.cxx | 19 +- sw/source/uibase/app/docshini.cxx | 7 sw/source/uibase/app/docst.cxx | 13 - sw/source/uibase/app/docstyle.cxx | 7 sw/source/uibase/dochdl/swdtflvr.cxx | 5 sw/source/uibase/misc/glshell.cxx | 7 sw/source/uibase/uiview/srcview.cxx | 7 sw/source/uibase/uiview/view.cxx | 7 sw/source/uibase/uno/unoatxt.cxx | 3 sw/source/uibase/uno/unotxdoc.cxx | 3 76 files changed, 568 insertions(+), 372 deletions(-)
New commits: commit c176d8ead7dd9e2f74a55e3b5dce5bef2271ef2d Author: Valentin Kettner <vakevk+libreoff...@gmail.com> Date: Fri Aug 1 17:09:54 2014 +0200 Refactored IDocumentState out of SwDoc. Into the new class DocumentStateManager. Change-Id: I91c9097b091ff6118d58fd15fff2a4cefe0171fd diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 6fec65f..29f1e66 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -198,6 +198,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/DocumentRedlineManager \ sw/source/core/doc/DocumentFieldsManager \ sw/source/core/doc/DocumentStatisticsManager \ + sw/source/core/doc/DocumentStateManager \ sw/source/core/doc/extinput \ sw/source/core/doc/fmtcol \ sw/source/core/doc/ftnidx \ diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx index 8ba1c74..bc4034c 100644 --- a/sw/inc/IDocumentState.hxx +++ b/sw/inc/IDocumentState.hxx @@ -37,6 +37,8 @@ public: */ virtual bool IsModified() const = 0; + virtual bool IsInCallModified() const = 0; + /** State of being loaded or not. Formerly DocInfo. */ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 60278c0..7fd488f 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -23,7 +23,6 @@ #include <IInterface.hxx> #include <IDocumentMarkAccess.hxx> #include <IDocumentStylePoolAccess.hxx> -#include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentExternalData.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> @@ -191,6 +190,7 @@ class IDocumentOutlineNodes; class IDocumentContentOperations; class IDocumentRedlineAccess; class IDocumentStatistics; +class IDocumentState; class _SetGetExpFlds; namespace sw { namespace mark { @@ -213,6 +213,7 @@ namespace sw { class DocumentRedlineManager; class DocumentFieldsManager; class DocumentStatisticsManager; + class DocumentStateManager; } namespace com { namespace sun { namespace star { @@ -251,7 +252,6 @@ void StartGrammarChecking( SwDoc &rDoc ); class SW_DLLPUBLIC SwDoc : public IInterface, public IDocumentStylePoolAccess, - public IDocumentState, public IDocumentLayoutAccess, public IDocumentExternalData { @@ -280,6 +280,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager; const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager; const ::boost::scoped_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager; + const ::boost::scoped_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager; const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager; const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager; const ::boost::scoped_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager; @@ -371,21 +372,15 @@ private: sal_Int32 mReferenceCount; bool mbGlossDoc : 1; //< TRUE: glossary document. - bool mbModified : 1; //< TRUE: document has changed. bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR. and unfortunately temorarily also in SwSwgReader::InLayout() when flawed frames need deletion. */ - bool mbPageNums : 1; //< TRUE: There are virtual page numbers. - bool mbLoaded : 1; //< TRUE: Doc loaded. - bool mbUpdateExpFld : 1; //< TRUE: Update expression fields. - bool mbNewDoc : 1; //< TRUE: new Doc. bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move. bool mbInReading : 1; //< TRUE: Document is in the process of being read. 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 mbInCallModified : 1; //< TRUE: in Set/Reset-Modified link. bool mbIsAutoFmtRedline : 1; //< TRUE: Redlines are recorded by Autoformat. bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of View @@ -572,17 +567,11 @@ public: ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager(); // IDocumentState - virtual void SetModified() SAL_OVERRIDE; - virtual void ResetModified() SAL_OVERRIDE; - virtual bool IsModified() const SAL_OVERRIDE; - virtual bool IsLoaded() const SAL_OVERRIDE; - virtual bool IsUpdateExpFld() const SAL_OVERRIDE; - virtual bool IsNewDoc() const SAL_OVERRIDE; - virtual bool IsPageNums() const SAL_OVERRIDE; - virtual void SetPageNums(bool b) SAL_OVERRIDE; - virtual void SetNewDoc(bool b) SAL_OVERRIDE; - virtual void SetUpdateExpFldStat(bool b) SAL_OVERRIDE; - virtual void SetLoaded(bool b) SAL_OVERRIDE; + IDocumentState const & getIDocumentState() const; + IDocumentState & getIDocumentState(); + + ::sw::DocumentStateManager const & GetDocumentStateManager() const; + ::sw::DocumentStateManager & GetDocumentStateManager(); // IDocumentDrawModelAccess DECL_LINK( AddDrawUndo, SdrUndoAction * ); @@ -755,7 +744,6 @@ public: void ChangeAuthorityData(const SwAuthEntry* pNewData); - bool IsInCallModified() const { return mbInCallModified; } bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const; short GetTextDirection( const SwPosition& rPos, const Point* pPt = 0 ) const; diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx index faa379c..4e2e958 100644 --- a/sw/source/core/crsr/annotationmark.cxx +++ b/sw/source/core/crsr/annotationmark.cxx @@ -22,6 +22,7 @@ #include <doc.hxx> #include <IDocumentMarkAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <fldbas.hxx> #include <switerator.hxx> #include <fmtfld.hxx> @@ -75,7 +76,7 @@ namespace sw { namespace mark { io_pDoc->GetIDocumentUndoRedo().AppendUndo( new SwUndoInsBookmark(*this) ); } - io_pDoc->SetModified(); + io_pDoc->getIDocumentState().SetModified(); } const SwFmtFld* AnnotationMark::GetAnnotationFmtFld() const diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 0f533d1..4fb51af 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -21,6 +21,7 @@ #include <IDocumentMarkAccess.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentState.hxx> #include <doc.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -265,7 +266,7 @@ namespace sw { namespace mark io_pDoc->GetIDocumentUndoRedo().AppendUndo( new SwUndoInsBookmark(*this)); } - io_pDoc->SetModified(); + io_pDoc->getIDocumentState().SetModified(); } ::sfx2::IXmlIdRegistry& Bookmark::GetRegistry() @@ -386,7 +387,7 @@ namespace sw { namespace mark // mark document as modified SwDoc *const pDoc( GetMarkPos().GetDoc() ); if ( pDoc ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); } } diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 82e9904..310c8d6 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -35,6 +35,7 @@ #include <charfmt.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <swcrsr.hxx> #include <editsh.hxx> #include <ndtxt.hxx> @@ -1240,7 +1241,7 @@ sal_uLong SwCursor::Find( const SfxItemSet& rSet, bool bNoCollections, sal_uLong nRet = FindAll( aSwFindParaAttr, nStart, nEnd, eFndRngs, bCancel ); pDoc->SetOle2Link( aLnk ); if( nRet && bReplace ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); if (bStartUndo) { diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 1e67ae5..f0e88e1 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -21,6 +21,7 @@ #include <swcrsr.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <pamtyp.hxx> #include <swundo.hxx> #include <SwRewriter.hxx> @@ -91,7 +92,7 @@ sal_uLong SwCursor::Find( const SwTxtFmtColl& rFmtColl, SwDocPositions nStart, pDoc->SetOle2Link( aLnk ); if( nRet && pReplFmtColl ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); if (bStartUndo) { diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9f329fc..277b729 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -31,6 +31,7 @@ #include <swcrsr.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <pamtyp.hxx> #include <ndtxt.hxx> #include <swundo.hxx> @@ -630,7 +631,7 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes, sal_uLong nRet = FindAll( aSwFindParaText, nStart, nEnd, eFndRngs, bCancel ); pDoc->SetOle2Link( aLnk ); if( nRet && bReplace ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); if (bStartUndo) { diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 8c777ad..73e2e660 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -21,6 +21,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentMarkAccess.hxx> #include <DocumentRedlineManager.hxx> +#include <IDocumentState.hxx> #include <UndoManager.hxx> #include <docary.hxx> #include <textboxhelper.hxx> @@ -1691,7 +1692,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons *pRedlineRange->GetMark() = *aPam.GetMark(); } - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); bRet = true; } @@ -1869,7 +1870,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) m_rSwdoc.GetNodes().Delete( aRg.aStart, nNodeDiff+1 ); } rPam.DeleteMark(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2120,7 +2121,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, m_rSwdoc.GetFtnIdxs().UpdateAllFtn(); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2253,7 +2254,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod m_rSwdoc.GetFtnIdxs().UpdateAllFtn(); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2384,7 +2385,7 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2480,7 +2481,7 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS } } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2558,7 +2559,7 @@ void DocumentContentOperationsManager::TransliterateText( else delete pUndo; } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } SwFlyFrmFmt* DocumentContentOperationsManager::Insert( const SwPaM &rRg, @@ -2657,7 +2658,7 @@ void DocumentContentOperationsManager::ReRead( SwPaM& rPam, const OUString& rGrf pGrfNd->SetAttr( SwMirrorGrf() ); pGrfNd->ReRead( rGrfName, rFltName, pGraphic, pGrafObj, true ); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } } @@ -2768,7 +2769,7 @@ SwDrawFrmFmt* DocumentContentOperationsManager::InsertDrawObj( m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) ); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return pFmt; } @@ -2869,7 +2870,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b if( pUndo ) pUndo->SetTblFlag(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } } @@ -2900,7 +2901,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b } } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -2938,7 +2939,7 @@ bool DocumentContentOperationsManager::AppendTxtNode( SwPosition& rPos ) m_rSwdoc.getIDocumentRedlineAccess().SplitRedline( aPam ); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -3044,7 +3045,7 @@ bool DocumentContentOperationsManager::InsertPoolItem( if( bRet ) { - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } return bRet; } @@ -3068,7 +3069,7 @@ bool DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const S } if( bRet ) - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return bRet; } @@ -3476,7 +3477,7 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa if ( *rPam.GetPoint() != *rPam.GetMark() ) m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true ); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); if ( pUndo ) { @@ -3614,7 +3615,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( rPam ) ); } - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -3724,7 +3725,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) if( !m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ) m_rSwdoc.getIDocumentRedlineAccess().CompressRedlines(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -3964,7 +3965,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt if( bJoinTxt ) ::sw_JoinText( rPam, bJoinPrev ); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return true; } @@ -4450,7 +4451,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, } pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld ); - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); return true; } diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index f1b76a4..6198f89 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -23,6 +23,7 @@ #include <doc.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentState.hxx> #include <sfx2/printer.hxx> #include <vcl/virdev.hxx> #include <vcl/outdev.hxx> @@ -166,7 +167,7 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /* m_rSwdoc.GetDocumentSettingManager().set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual ); m_rSwdoc.GetDocumentSettingManager().set(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes ); PrtDataChanged(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } } diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 860765f..764bfa3 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -20,6 +20,7 @@ #include <config_features.h> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <dbmgr.hxx> #include <chpfld.hxx> #include <dbfld.hxx> @@ -223,7 +224,7 @@ SwFieldType* DocumentFieldsManager::InsertFldType(const SwFieldType &rFldTyp) } mpFldTypes->insert( mpFldTypes->begin() + nSize, pNew ); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return (*mpFldTypes)[ nSize ]; } @@ -325,7 +326,7 @@ void DocumentFieldsManager::RemoveFldType(sal_uInt16 nFld) delete pTmp; } mpFldTypes->erase( mpFldTypes->begin() + nFld ); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } } @@ -386,7 +387,7 @@ void DocumentFieldsManager::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB ) #endif } // Only evaluate on full update - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } void DocumentFieldsManager::InsDeletedFldType( SwFieldType& rFldTyp ) @@ -1171,7 +1172,7 @@ void DocumentFieldsManager::UpdateUsrFlds() if( pCalc ) { delete pCalc; - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } } @@ -1263,7 +1264,7 @@ bool DocumentFieldsManager::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLon void DocumentFieldsManager::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) { - bool bIsModified = m_rSwdoc.IsModified(); + bool bIsModified = m_rSwdoc.getIDocumentState().IsModified(); sal_Int32 nDate; sal_Int64 nTime; @@ -1365,7 +1366,7 @@ void DocumentFieldsManager::SetFixFields( bool bOnlyTimeDate, const DateTime* pN } if( !bIsModified ) - m_rSwdoc.ResetModified(); + m_rSwdoc.getIDocumentState().ResetModified(); } diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 892727b..4cd8725 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -22,6 +22,7 @@ #include <doc.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <sfx2/objsh.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/docfile.hxx> @@ -416,7 +417,7 @@ bool DocumentLinksAdministrationManager::EmbedAllLinks() } m_rSwdoc.GetIDocumentUndoRedo().DelAllUndoObj(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } return bRet; } diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 983df66..7ae86b3 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -20,6 +20,7 @@ #include <DocumentRedlineManager.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <redline.hxx> #include <UndoRedline.hxx> #include <docary.hxx> @@ -635,7 +636,7 @@ void DocumentRedlineManager::SetRedlineMode( RedlineMode_t eMode ) m_rSwdoc.SetInXMLImport( bSaveInXMLImportFlag ); } meRedlineMode = eMode; - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } // #TODO - add 'SwExtraRedlineTbl' also ? @@ -1980,7 +1981,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd } if( bChg ) - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return bChg; @@ -2141,7 +2142,7 @@ bool DocumentRedlineManager::AcceptRedline( sal_uInt16 nPos, bool bCallDelete ) if( bRet ) { CompressRedlines(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) @@ -2178,7 +2179,7 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete if( nRet > 0 ) { CompressRedlines(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) { @@ -2255,7 +2256,7 @@ bool DocumentRedlineManager::RejectRedline( sal_uInt16 nPos, bool bCallDelete ) if( bRet ) { CompressRedlines(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) @@ -2292,7 +2293,7 @@ bool DocumentRedlineManager::RejectRedline( const SwPaM& rPam, bool bCallDelete if( nRet > 0 ) { CompressRedlines(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo()) { @@ -2578,7 +2579,7 @@ bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUStrin } } if( bRet ) - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); return bRet; @@ -2619,7 +2620,7 @@ void DocumentRedlineManager::SetRedlinePassword( /*[in]*/const uno::Sequence <sal_Int8>& rNewPassword) { maRedlinePasswd = rNewPassword; - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } /// Set comment text for the Redline, which is inserted later on via diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 6886d86..79cffb6 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -20,6 +20,7 @@ #include <DocumentSettingManager.hxx> #include <doc.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentState.hxx> #include <comphelper/processfactory.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> @@ -406,7 +407,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLan std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE)); pTmpRoot->EndAllAction(); } - m_rDoc.SetModified(); + m_rDoc.getIDocumentState().SetModified(); } rtl::Reference<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable() @@ -476,7 +477,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp std::for_each( aAllLayouts.begin(), aAllLayouts.end(), std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE)); pTmpRoot->EndAllAction(); } - m_rDoc.SetModified(); + m_rDoc.getIDocumentState().SetModified(); } } diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx new file mode 100644 index 0000000..9b65443 --- /dev/null +++ b/sw/source/core/doc/DocumentStateManager.cxx @@ -0,0 +1,133 @@ +/* -*- 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 <DocumentStateManager.hxx> +#include <doc.hxx> +#include <DocumentStatisticsManager.hxx> +#include <IDocumentUndoRedo.hxx> +#include <docstat.hxx> +#include <acorrect.hxx> + +namespace sw +{ + +DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) : + m_rSwdoc( i_rSwdoc ), + mbModified(false), + mbLoaded(false), + mbUpdateExpFld(false), + mbNewDoc(false), + mbPageNums(false), + mbInCallModified(false) +{ +} + +void DocumentStateManager::SetModified() +{ + m_rSwdoc.ClearSwLayouterEntries(); + // give the old and new modified state to the link + // Bit 0: -> old state + // Bit 1: -> new state + sal_IntPtr nCall = mbModified ? 3 : 2; + mbModified = true; + m_rSwdoc.GetDocumentStatisticsManager().GetDocStat().bModified = true; + if( m_rSwdoc.GetOle2Link().IsSet() ) + { + mbInCallModified = true; + m_rSwdoc.GetOle2Link().Call( (void*)nCall ); + mbInCallModified = false; + } + + if( m_rSwdoc.GetAutoCorrExceptWord() && !m_rSwdoc.GetAutoCorrExceptWord()->IsDeleted() ) + m_rSwdoc.DeleteAutoCorrExceptWord(); +} + +void DocumentStateManager::ResetModified() +{ + // give the old and new modified state to the link + // Bit 0: -> old state + // Bit 1: -> new state + sal_IntPtr nCall = mbModified ? 1 : 0; + mbModified = false; + m_rSwdoc.GetIDocumentUndoRedo().SetUndoNoModifiedPosition(); + if( nCall && m_rSwdoc.GetOle2Link().IsSet() ) + { + mbInCallModified = true; + m_rSwdoc.GetOle2Link().Call( (void*)nCall ); + mbInCallModified = false; + } +} + +bool DocumentStateManager::IsModified() const +{ + return mbModified; +} + +bool DocumentStateManager::IsInCallModified() const +{ + return mbInCallModified; +} + +bool DocumentStateManager::IsLoaded() const +{ + return mbLoaded; +} + +bool DocumentStateManager::IsUpdateExpFld() const +{ + return mbUpdateExpFld; +} + +bool DocumentStateManager::IsNewDoc() const +{ + return mbNewDoc; +} + +bool DocumentStateManager::IsPageNums() const +{ + return mbPageNums; +} + +void DocumentStateManager::SetPageNums(bool b) +{ + mbPageNums = b; +} + +void DocumentStateManager::SetNewDoc(bool b) +{ + mbNewDoc = b; +} + +void DocumentStateManager::SetUpdateExpFldStat(bool b) +{ + mbUpdateExpFld = b; +} + +void DocumentStateManager::SetLoaded(bool b) +{ + mbLoaded = b; +} + +} + + + + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index e2571a8..0434eeb 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -21,6 +21,7 @@ #include <fldbas.hxx> #include <docsh.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <view.hxx> #include <ndtxt.hxx> #include <switerator.hxx> @@ -82,7 +83,7 @@ void DocumentStatisticsManager::DocInfoChgd( ) { m_rSwdoc.getIDocumentFieldsAccess().GetSysFldType( RES_DOCINFOFLD )->UpdateFlds(); m_rSwdoc.getIDocumentFieldsAccess().GetSysFldType( RES_TEMPLNAMEFLD )->UpdateFlds(); - m_rSwdoc.SetModified(); + m_rSwdoc.getIDocumentState().SetModified(); } const SwDocStat& DocumentStatisticsManager::GetDocStat() const @@ -202,7 +203,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF const uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); // #i96786#: do not set modified flag when updating statistics - const bool bDocWasModified( m_rSwdoc.IsModified() ); + const bool bDocWasModified( m_rSwdoc.getIDocumentState().IsModified() ); const ModifyBlocker_Impl b(pObjShell); // rhbz#1081176: don't jump to cursor pos because of (temporary) // activation of modified flag triggering move to input position @@ -210,7 +211,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF xDocProps->setDocumentStatistics(aStat); if (!bDocWasModified) { - m_rSwdoc.ResetModified(); + m_rSwdoc.getIDocumentState().ResetModified(); } } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index aea02b0..0ce75a9 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -31,6 +31,7 @@ #include <DocumentRedlineManager.hxx> #include <DocumentFieldsManager.hxx> #include <DocumentStatisticsManager.hxx> +#include <DocumentStateManager.hxx> #include <UndoManager.hxx> #include <hintids.hxx> #include <tools/shl.hxx> @@ -428,6 +429,27 @@ IDocumentStatistics & SwDoc::getIDocumentStatistics() return *m_pDocumentStatisticsManager; } +//IDocumentState +IDocumentState const & SwDoc::getIDocumentState() const +{ + return *m_pDocumentStateManager; +} + +IDocumentState & SwDoc::getIDocumentState() +{ + return *m_pDocumentStateManager; +} + +::sw::DocumentStateManager const & SwDoc::GetDocumentStateManager() const +{ + return *m_pDocumentStateManager; +} + +::sw::DocumentStateManager & SwDoc::GetDocumentStateManager() +{ + return *m_pDocumentStateManager; +} + /* Implementations the next Interface here */ /* @@ -439,7 +461,7 @@ void SwDoc::ChgDBData(const SwDBData& rNewData) if( rNewData != maDBData ) { maDBData = rNewData; - SetModified(); + getIDocumentState().SetModified(); } getIDocumentFieldsAccess().GetSysFldType(RES_DBNAMEFLD)->UpdateFlds(); } @@ -1025,51 +1047,6 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const return nCount; } -bool SwDoc::IsLoaded() const -{ - return mbLoaded; -} - -bool SwDoc::IsUpdateExpFld() const -{ - return mbUpdateExpFld; -} - -bool SwDoc::IsNewDoc() const -{ - return mbNewDoc; -} - -bool SwDoc::IsPageNums() const -{ - return mbPageNums; -} - -void SwDoc::SetPageNums(bool b) -{ - mbPageNums = b; -} - -void SwDoc::SetNewDoc(bool b) -{ - mbNewDoc = b; -} - -void SwDoc::SetUpdateExpFldStat(bool b) -{ - mbUpdateExpFld = b; -} - -void SwDoc::SetLoaded(bool b) -{ - mbLoaded = b; -} - -bool SwDoc::IsModified() const -{ - return mbModified; -} - //Load document from fdo#42534 under valgrind, drag the scrollbar down so full //document layout is triggered. Close document before layout has completed, and //SwAnchoredObject objects deleted by the deletion of layout remain referenced @@ -1082,42 +1059,6 @@ void SwDoc::ClearSwLayouterEntries() SwLayouter::ClearMoveBwdLayoutInfo( *this ); } -void SwDoc::SetModified() -{ - ClearSwLayouterEntries(); - // give the old and new modified state to the link - // Bit 0: -> old state - // Bit 1: -> new state - sal_IntPtr nCall = mbModified ? 3 : 2; - mbModified = true; - GetDocumentStatisticsManager().GetDocStat().bModified = true; - if( maOle2Link.IsSet() ) - { - mbInCallModified = true; - maOle2Link.Call( (void*)nCall ); - mbInCallModified = false; - } - - if( mpACEWord && !mpACEWord->IsDeleted() ) - delete mpACEWord, mpACEWord = 0; -} - -void SwDoc::ResetModified() -{ - // give the old and new modified state to the link - // Bit 0: -> old state - // Bit 1: -> new state - sal_IntPtr nCall = mbModified ? 1 : 0; - mbModified = false; - GetIDocumentUndoRedo().SetUndoNoModifiedPosition(); - if( nCall && maOle2Link.IsSet() ) - { - mbInCallModified = true; - maOle2Link.Call( (void*)nCall ); - mbInCallModified = false; - } -} - static bool lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs ) { SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); @@ -1458,7 +1399,7 @@ bool SwDoc::RemoveInvisibleContent() } if( bRet ) - SetModified(); + getIDocumentState().SetModified(); GetIDocumentUndoRedo().EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); return bRet; } @@ -1592,7 +1533,7 @@ bool SwDoc::ConvertFieldsToText() } if( bRet ) - SetModified(); + getIDocumentState().SetModified(); GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE, NULL ); getIDocumentFieldsAccess().UnlockExpFlds(); return bRet; diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 4e294de..9d3d3db 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -22,6 +22,7 @@ #include <vcl/window.hxx> #include <doc.hxx> #include <IDocumentChartDataProviderAccess.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <ndindex.hxx> #include <swtable.hxx> @@ -187,7 +188,7 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName ) } aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); } - SetModified(); + getIDocumentState().SetModified(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index a03c3be..dcbfc1c 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -29,6 +29,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -1548,7 +1549,7 @@ void SwCompareData::ShowDelete( SwNodeIndex aSavePos( aInsPos, -1 ); ((SwCompareData&)rData).rDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos ); - rDoc.SetModified(); + rDoc.getIDocumentState().SetModified(); ++aSavePos; // #i65201#: These SwPaMs are calculated when the (old) delete-redlines are hidden, @@ -1802,9 +1803,9 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) } GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); - bool bDocWasModified = IsModified(); + bool bDocWasModified = getIDocumentState().IsModified(); SwDoc& rSrcDoc = (SwDoc&)rDoc; - bool bSrcModified = rSrcDoc.IsModified(); + bool bSrcModified = rSrcDoc.getIDocumentState().IsModified(); RedlineMode_t eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineMode(); rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT ); @@ -1823,14 +1824,14 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); aD1.SetRedlinesToDoc( !bDocWasModified ); - SetModified(); + getIDocumentState().SetModified(); } rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( eSrcRedlMode ); getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); if( !bSrcModified ) - rSrcDoc.ResetModified(); + rSrcDoc.getIDocumentState().ResetModified(); GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); @@ -2022,7 +2023,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); SwDoc& rSrcDoc = (SwDoc&)rDoc; - bool bSrcModified = rSrcDoc.IsModified(); + bool bSrcModified = rSrcDoc.getIDocumentState().IsModified(); RedlineMode_t eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineMode(); rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE ); @@ -2086,7 +2087,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( eSrcRedlMode ); if( !bSrcModified ) - rSrcDoc.ResetModified(); + rSrcDoc.getIDocumentState().ResetModified(); getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index e10e9aa..7ae3f56 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -36,6 +36,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> #include <DocumentContentOperationsManager.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <rootfrm.hxx> #include <frmtool.hxx> @@ -510,7 +511,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) pDesc->GetFirstLeft().ModifyBroadcast( &aInfo, 0, TYPE(SwFrm) ); } } - SetModified(); + getIDocumentState().SetModified(); // #i46909# no undo if header or footer changed if( bHeaderFooterChanged ) @@ -624,7 +625,7 @@ void SwDoc::DelPageDesc( sal_uInt16 i, bool bBroadcast ) maPageDescs.erase( maPageDescs.begin() + i ); delete pDel; - SetModified(); + getIDocumentState().SetModified(); } SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy, @@ -668,7 +669,7 @@ SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy, GetIDocumentUndoRedo().AppendUndo(new SwUndoPageDescCreate(pNew, this)); } - SetModified(); + getIDocumentState().SetModified(); return pNew; } diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index f7dd645..f276ed6 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -42,6 +42,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentState.hxx> #include <docsh.hxx> #include <rootfrm.hxx> #include <poolfmt.hxx> @@ -467,7 +468,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) } bCallBase = true; } - SetModified(); + getIDocumentState().SetModified(); GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 8520791..7de0dce 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -23,6 +23,7 @@ #include <acorrect.hxx> #include <UndoManager.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentState.hxx> #include <docsh.hxx> #include <docary.hxx> #include <doctxm.hxx> @@ -273,7 +274,7 @@ void _SaveRedlEndPosForRestore::_Restore() void SwDoc::SetModified(SwPaM &rPaM) { SwDataChanged aTmp( rPaM ); - SetModified(); + getIDocumentState().SetModified(); } /// Convert list of ranges of whichIds to a corresponding list of whichIds diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 00562e0..44fa72b 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -31,6 +31,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -687,7 +688,7 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames, if (bExpand) pTxtFld->ExpandTxtFld( true ); } - SetModified(); + getIDocumentState().SetModified(); #endif } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index f2b8466..2c7ee3f 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -32,6 +32,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentState.hxx> #include <ndindex.hxx> #include <docary.hxx> #include <drawdoc.hxx> @@ -525,7 +526,7 @@ bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) } } - SetModified(); + getIDocumentState().SetModified(); SwTextBoxHelper::syncFlyFrmAttr(rFlyFmt, rSet); @@ -553,7 +554,7 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt, rFlyFrmFmt.SetObjTitle( sNewTitle, true ); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt, @@ -576,7 +577,7 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt, rFlyFrmFmt.SetObjDescription( sNewDescription, true ); - SetModified(); + getIDocumentState().SetModified(); } bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, @@ -663,7 +664,7 @@ bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, if( pUndo ) pUndo->DeRegisterFromFormat( rFmt ); - SetModified(); + getIDocumentState().SetModified(); return bChgAnchor; } @@ -917,7 +918,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); - SetModified(); + getIDocumentState().SetModified(); return bUnmark; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index b1001b8..8140e63 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -39,6 +39,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> @@ -224,7 +225,7 @@ void SwDoc::RstTxtAttrs(const SwPaM &rRg, bool bInclRefToxMark ) aPara.bInclRefToxMark = bInclRefToxMark; GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, sw::DocumentContentOperationsManager::lcl_RstTxtAttr, &aPara ); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::ResetAttrs( const SwPaM &rRg, @@ -392,7 +393,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, if( pPam != &rRg ) delete pPam; - SetModified(); + getIDocumentState().SetModified(); } /// Set the rsid of the next nLen symbols of rRg to the current session number @@ -466,7 +467,7 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) { rFmt.SetFmtAttr( rSet ); } - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, @@ -485,7 +486,7 @@ void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, GetIDocumentUndoRedo().AppendUndo( pUndo ); } - SetModified(); + getIDocumentState().SetModified(); } else delete pUndo; @@ -640,7 +641,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) ) aCallMod.Remove( pDep ); - SetModified(); + getIDocumentState().SetModified(); } /// Get the default attribute in this document @@ -669,7 +670,7 @@ void SwDoc::DelCharFmt(sal_uInt16 nFmt, bool bBroadcast) delete (*mpCharFmtTbl)[nFmt]; mpCharFmtTbl->erase(mpCharFmtTbl->begin() + nFmt); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::DelCharFmt( SwCharFmt *pFmt, bool bBroadcast ) @@ -736,7 +737,7 @@ SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const OUString &rFmtName, { SwFlyFrmFmt *pFmt = new SwFlyFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom ); GetSpzFrmFmts()->push_back(pFmt); - SetModified(); + getIDocumentState().SetModified(); return pFmt; } @@ -745,7 +746,7 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const OUString &rFmtName, { SwDrawFrmFmt *pFmt = new SwDrawFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom); GetSpzFrmFmts()->push_back(pFmt); - SetModified(); + getIDocumentState().SetModified(); return pFmt; } @@ -786,7 +787,7 @@ SwTableFmt* SwDoc::MakeTblFrmFmt( const OUString &rFmtName, { SwTableFmt* pFmt = new SwTableFmt( GetAttrPool(), rFmtName, pDerivedFrom ); mpTblFrmFmtTbl->push_back( pFmt ); - SetModified(); + getIDocumentState().SetModified(); return pFmt; } @@ -799,7 +800,7 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const OUString &rFmtName, pFmt->SetAuto(bAuto); mpFrmFmtTbl->push_back( pFmt ); - SetModified(); + getIDocumentState().SetModified(); if (GetIDocumentUndoRedo().DoesUndo()) { @@ -835,7 +836,7 @@ SwCharFmt *SwDoc::MakeCharFmt( const OUString &rFmtName, SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom ); mpCharFmtTbl->push_back( pFmt ); pFmt->SetAuto( false ); - SetModified(); + getIDocumentState().SetModified(); if (GetIDocumentUndoRedo().DoesUndo()) { @@ -872,7 +873,7 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const OUString &rFmtName, pDerivedFrom ); mpTxtFmtCollTbl->push_back(pFmtColl); pFmtColl->SetAuto( false ); - SetModified(); + getIDocumentState().SetModified(); if (GetIDocumentUndoRedo().DoesUndo()) { @@ -906,7 +907,7 @@ SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const OUString &rFmtName, rFmtName, pDerivedFrom ); mpTxtFmtCollTbl->push_back(pFmtColl); pFmtColl->SetAuto( false ); - SetModified(); + getIDocumentState().SetModified(); if (GetIDocumentUndoRedo().DoesUndo()) { @@ -931,7 +932,7 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const OUString &rFmtName, pDerivedFrom ); mpGrfFmtCollTbl->push_back( pFmtColl ); pFmtColl->SetAuto( false ); - SetModified(); + getIDocumentState().SetModified(); return pFmtColl; } @@ -969,7 +970,7 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast) for( SwTxtFmtColls::const_iterator it = mpTxtFmtCollTbl->begin() + 1; it != mpTxtFmtCollTbl->end(); ++it ) SetTxtFmtCollNext( *it, pDel ); delete pDel; - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, bool bBroadcast ) @@ -1080,7 +1081,7 @@ bool SwDoc::SetTxtFmtColl(const SwPaM &rRg, if (bRet) { - SetModified(); + getIDocumentState().SetModified(); } return bRet; @@ -1157,7 +1158,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pParent); mpTxtFmtCollTbl->push_back( pNewColl ); pNewColl->SetAuto( false ); - SetModified(); + getIDocumentState().SetModified(); // copy the conditions ((SwConditionTxtFmtColl*)pNewColl)->SetConditions( @@ -1569,7 +1570,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles ) GetIDocumentUndoRedo().DelAllUndoObj(); } - SetModified(); + getIDocumentState().SetModified(); } SwFmt* SwDoc::FindFmtByName( const SwFmtsBase& rFmtArr, @@ -1647,7 +1648,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus ) } ++aIdx; } - SetModified(); + getIDocumentState().SetModified(); } bool SwDoc::DontExpandFmt( const SwPosition& rPos, bool bFlag ) @@ -1669,7 +1670,7 @@ SwTableBoxFmt* SwDoc::MakeTableBoxFmt() { SwTableBoxFmt* pFmt = new SwTableBoxFmt( GetAttrPool(), aEmptyOUStr, mpDfltFrmFmt ); - SetModified(); + getIDocumentState().SetModified(); return pFmt; } @@ -1677,7 +1678,7 @@ SwTableLineFmt* SwDoc::MakeTableLineFmt() { SwTableLineFmt* pFmt = new SwTableLineFmt( GetAttrPool(), aEmptyOUStr, mpDfltFrmFmt ); - SetModified(); + getIDocumentState().SetModified(); return pFmt; } diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index eb7dad4..5052714 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -30,6 +30,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <ndtxt.hxx> #include <poolfmt.hxx> #include <ftninfo.hxx> @@ -311,7 +312,7 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) { getIDocumentFieldsAccess().UpdateRefFlds(NULL); } - SetModified(); + getIDocumentState().SetModified(); } } @@ -379,7 +380,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) { getIDocumentFieldsAccess().UpdateRefFlds(NULL); } - SetModified(); + getIDocumentState().SetModified(); } } @@ -488,7 +489,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const OUString& rNumStr, std::set<SwRootFrm*> aAllLayouts = GetAllLayouts(); std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::UpdateFtnNums)); } - SetModified(); + getIDocumentState().SetModified(); } else delete pUndo; diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index c0a7394..70dc450 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -67,6 +67,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -119,7 +120,7 @@ static bool lcl_IsItemSet(const SwCntntNode & rNode, sal_uInt16 which) SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) { SwFrmFmt *pFmt = 0; - const bool bMod = IsModified(); + const bool bMod = getIDocumentState().IsModified(); bool bHeader = false; switch ( eRequest ) @@ -164,7 +165,7 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) // Why set it back? Doc has changed, or not? // In any case, wrong for the FlyFrames! if ( !bMod ) - ResetModified(); + getIDocumentState().ResetModified(); } break; @@ -330,7 +331,7 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) DelFrmFmt( pFmt ); } - SetModified(); + getIDocumentState().SetModified(); } /** Copies the stated format (pSrc) to pDest and returns pDest. @@ -684,7 +685,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx )); } - SetModified(); + getIDocumentState().SetModified(); return pFmt; } @@ -857,7 +858,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, } while( false ); } - SetModified(); + getIDocumentState().SetModified(); GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL ); @@ -1341,7 +1342,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, pUndo->SetUndoKeep(); } } - rDoc.SetModified(); + rDoc.getIDocumentState().SetModified(); } return pNewFmt; @@ -1781,7 +1782,7 @@ void SwDoc::SetFlyName( SwFlyFrmFmt& rFmt, const OUString& rName ) sName = lcl_GetUniqueFlyName( this, nTyp ); } rFmt.SetName( sName, true ); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::SetAllUniqueFlyNames() diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 197b82f..db82e2b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -100,6 +100,7 @@ #include <DocumentRedlineManager.hxx> #include <DocumentFieldsManager.hxx> #include <DocumentStatisticsManager.hxx> +#include <DocumentStateManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -202,8 +203,9 @@ SwDoc::SwDoc() m_pMetaFieldManager(new ::sw::MetaFieldManager()), m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ), m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ), + m_pDocumentStateManager( new ::sw::DocumentStateManager( *this ) ), m_pUndoManager(new ::sw::UndoManager( - boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *this)), + boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *m_pDocumentStateManager)), m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)), m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ), m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ), @@ -253,18 +255,12 @@ SwDoc::SwDoc() m_pXmlIdRegistry(), mReferenceCount(0), mbGlossDoc(false), - mbModified(false), mbDtor(false), - mbPageNums(false), - mbLoaded(false), - mbUpdateExpFld(false), - mbNewDoc(false), mbCopyIsMove(false), mbInReading(false), mbInXMLImport(false), mbUpdateTOX(false), mbInLoadAsynchron(false), - mbInCallModified(false), mbIsAutoFmtRedline(false), mbOLEPrtNotifyPending(false), mbAllOLENotify(false), @@ -373,7 +369,7 @@ SwDoc::SwDoc() } mnRsidRoot = mnRsid; - ResetModified(); + getIDocumentState().ResetModified(); } static void DeleteAndDestroy(SwFrmFmts& rFmts, int aStartIdx, int aEndIdx) @@ -791,7 +787,7 @@ void SwDoc::SetPreviewPrtData( const SwPagePreviewPrtData* pNew ) } else if( mpPgPViewPrtData ) DELETEZ( mpPgPViewPrtData ); - SetModified(); + getIDocumentState().SetModified(); } /** SwDoc: Reading and writing of the layout cache. */ diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 04e6b2d..69550f5 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -28,6 +28,7 @@ #include <IDocumentListsAccess.hxx> #include <DocumentRedlineManager.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <doctxm.hxx> @@ -143,7 +144,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) getIDocumentFieldsAccess().UpdateExpFlds(NULL, true); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::PropagateOutlineRule() @@ -408,7 +409,7 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) } ChkCondColls(); - SetModified(); + getIDocumentState().SetModified(); return true; } @@ -943,7 +944,7 @@ void SwDoc::SetNumRule( const SwPaM& rPam, GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL ); } - SetModified(); + getIDocumentState().SetModified(); } @@ -976,7 +977,7 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, bool bFlag ) pTxtNd->SetListRestart(bFlag); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -997,7 +998,7 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt ) } pTxtNd->SetAttrListRestartValue( nStt ); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -1038,7 +1039,7 @@ bool SwDoc::DelNumRule( const OUString& rName, bool bBroadcast ) mpNumRuleTbl->erase( mpNumRuleTbl->begin() + nPos ); maNumRuleMap.erase(aTmpName); - SetModified(); + getIDocumentState().SetModified(); return true; } return false; @@ -1061,7 +1062,7 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule ) if( pUndo ) pUndo->SetLRSpaceEndPos(); - SetModified(); + getIDocumentState().SetModified(); } } @@ -1171,7 +1172,7 @@ bool SwDoc::ReplaceNumRule( const SwPosition& rPos, } } GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); - SetModified(); + getIDocumentState().SetModified(); bRet = true; } @@ -1274,7 +1275,7 @@ bool SwDoc::NoNum( const SwPaM& rPam ) { pNd->SetCountedInList(false); - SetModified(); + getIDocumentState().SetModified(); } else bRet = false; // no Numbering or just always sal_True? @@ -1680,7 +1681,7 @@ bool SwDoc::NumUpDown( const SwPaM& rPam, bool bDown ) } ChkCondColls(); - SetModified(); + getIDocumentState().SetModified(); } } @@ -1978,7 +1979,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) // Still NEEDS to be optimized! getIDocumentRedlineAccess().SetRedlineMode( eOld ); GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); - SetModified(); + getIDocumentState().SetModified(); return true; } @@ -2035,7 +2036,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) } } - SetModified(); + getIDocumentState().SetModified(); return true; } @@ -2053,7 +2054,7 @@ bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, bool bDel ) bool bNewNum = !bDel; pTxtNd->SetCountedInList(bNewNum); - SetModified(); + getIDocumentState().SetModified(); bResult = true; diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index f71ab49..97774c9 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -30,6 +30,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <redline.hxx> @@ -169,7 +170,7 @@ bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTab } if( bChg ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); return bChg; } @@ -216,7 +217,7 @@ bool SwExtraRedlineTbl::DeleteTableRowRedline( SwDoc* pDoc, const SwTableLine& r } if( bChg ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); return bChg; } @@ -263,7 +264,7 @@ bool SwExtraRedlineTbl::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& r } if( bChg ) - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); return bChg; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index fa3fa25..219ae41 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -33,6 +33,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <node.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -598,7 +599,7 @@ bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) aSortList.clear(); SwSortElement::Finit(); - SetModified(); + getIDocumentState().SetModified(); return true; } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index b635e8d..b930830 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -39,6 +39,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -171,7 +172,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) if( rTxtNd.GetpSwpHints() ) rTxtNd.GetpSwpHints()->DeRegister(); } - SetModified(); + getIDocumentState().SetModified(); } /// Travel between table of content Marks @@ -675,7 +676,7 @@ bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName) { pTOX->SetTOXName(rName); pTOX->SetSectionName(rName); - SetModified(); + getIDocumentState().SetModified(); } return bRet; } @@ -819,7 +820,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, } } - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); // get current Language SwTOXInternational aIntl( GetLanguage(), diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 1d69209..d05db20 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -18,6 +18,7 @@ */ #include "doc.hxx" +#include <IDocumentState.hxx> #include "lineinfo.hxx" #include "charfmt.hxx" #include "poolfmt.hxx" @@ -41,7 +42,7 @@ void SwDoc::SetLineNumberInfo( const SwLineNumberInfo &rNew ) pTmpRoot->EndAllAction(); } *mpLineNumberInfo = rNew; - SetModified(); + getIDocumentState().SetModified(); } const SwLineNumberInfo& SwDoc::GetLineNumberInfo() const diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 3645ca4..d88e844 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -50,6 +50,7 @@ #include <unotools/saveopt.hxx> #include <IDocumentListsAccess.hxx> +#include <IDocumentState.hxx> using namespace ::com::sun::star; @@ -336,7 +337,7 @@ sal_Int16 SwNumFmt::GetVertOrient() const void SwNumFmt::UpdateNumNodes( SwDoc* pDoc ) { - bool bDocIsModified = pDoc->IsModified(); + bool bDocIsModified = pDoc->getIDocumentState().IsModified(); bool bFnd = false; const SwNumRule* pRule; for( sal_uInt16 n = pDoc->GetNumRuleTbl().size(); !bFnd && n; ) @@ -358,7 +359,7 @@ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc ) } if( bFnd && !bDocIsModified ) - pDoc->ResetModified(); + pDoc->getIDocumentState().ResetModified(); } const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 55d8223..98c900e 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -47,6 +47,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentState.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> #include <fmtsrnd.hxx> @@ -1174,7 +1175,7 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId ) SwAttrSet aSet( GetAttrPool(), pWhichRange ); { - bool bIsModified = IsModified(); + bool bIsModified = getIDocumentState().IsModified(); { ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); @@ -1192,7 +1193,7 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId ) } if( !bIsModified ) - ResetModified(); + getIDocumentState().ResetModified(); pNewFmt->SetPoolFmtId( nId ); pNewFmt->SetAuto( false ); // no AutoFormat } @@ -1481,7 +1482,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) { const ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr ); const OUString aNm( aResId ); - const bool bIsModified = IsModified(); + const bool bIsModified = getIDocumentState().IsModified(); { ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); @@ -1491,7 +1492,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) pNewPgDsc->SetPoolFmtId( nId ); if ( !bIsModified ) { - ResetModified(); + getIDocumentState().ResetModified(); } } @@ -1660,7 +1661,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId ) const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178# { - bool bIsModified = IsModified(); + bool bIsModified = getIDocumentState().IsModified(); sal_uInt16 n = MakeNumRule( aNm, 0, false, eNumberFormatPositionAndSpaceMode ); @@ -1676,7 +1677,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId ) pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); if( !bIsModified ) - ResetModified(); + getIDocumentState().ResetModified(); } switch( nId ) @@ -2260,7 +2261,7 @@ sal_uInt16 SwDoc::SetDocPattern( const OUString& rPatternName ) maPatternNms.erase(maPatternNms.begin() + nNewPos); // Free space again maPatternNms.insert(maPatternNms.begin() + nNewPos, new OUString(rPatternName)); - SetModified(); + getIDocumentState().SetModified(); return nNewPos; } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index ee8baa6..eda4af4 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -30,6 +30,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentLinksAdministration.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <rootfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -378,7 +379,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, GetFtnIdxs().UpdateFtn( SwNodeIndex( *pNewSectNode )); } - SetModified(); + getIDocumentState().SetModified(); return &pNewSectNode->GetSection(); } @@ -540,7 +541,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes ) GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM )); if( pFtnEndAtTxtEnd ) GetFtnIdxs().UpdateFtn( aUpdIdx ); - SetModified(); + getIDocumentState().SetModified(); //#126178# start/end undo have to be pairs! GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; @@ -554,7 +555,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes ) getIDocumentContentOperations().DeleteSection( (SwNode*)pSectNd ); if( pFtnEndAtTxtEnd ) GetFtnIdxs().UpdateFtn( aUpdIdx ); - SetModified(); + getIDocumentState().SetModified(); //#126178# start/end undo have to be pairs! GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; @@ -601,7 +602,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes ) GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, @@ -647,7 +648,7 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, // We don't want them. ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); pFmt->SetFmtAttr( *pAttr ); - SetModified(); + getIDocumentState().SetModified(); } return; } @@ -743,7 +744,7 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, getIDocumentLinksAdministration().GetLinkManager().Remove( &pSection->GetBaseLink() ); } - SetModified(); + getIDocumentState().SetModified(); } void sw_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index fd145a2..123c8c1 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -44,6 +44,7 @@ #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swcrsr.hxx> @@ -548,7 +549,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, getIDocumentRedlineAccess().SplitRedline( aPam ); } - SetModified(); + getIDocumentState().SetModified(); CHECK_TABLE( *pNdTbl ); return pNdTbl; } @@ -871,7 +872,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL ); } - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty(true, NULL, 0); return pNdTbl; } @@ -1225,7 +1226,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > sal_uLong nIdx = pTblNd->GetIndex(); aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 ); - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); return pNdTbl; } @@ -1447,7 +1448,7 @@ bool SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) } if( bRet ) - SetModified(); + getIDocumentState().SetModified(); return bRet; } @@ -1708,7 +1709,7 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind ); if (bRet) { - SetModified(); + getIDocumentState().SetModified(); ::ClearFEShellTabCols(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } @@ -1770,7 +1771,7 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind ) bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind ); if (bRet) { - SetModified(); + getIDocumentState().SetModified(); ::ClearFEShellTabCols(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } @@ -2076,7 +2077,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) pTblNd->DelFrms(); getIDocumentContentOperations().DeleteSection( pTblNd ); } - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); return true; } @@ -2107,7 +2108,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, true, true ); if (bRet) { - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } } @@ -2175,7 +2176,7 @@ bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt, if (bRet) { - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } } @@ -2282,7 +2283,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam ) if( pTblNd->GetTable().Merge( this, aBoxes, aMerged, pMergeBox, pUndo )) { nRet = TBLMERGE_OK; - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); if( pUndo ) { @@ -2883,7 +2884,7 @@ void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rO } rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly ); ::ClearFEShellTabCols(); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet ) @@ -2900,7 +2901,7 @@ void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet ) SwMsgPoolItem aChg( RES_TBLHEADLINECHG ); rTable.SetRowsToRepeat( nSet ); rTable.GetFrmFmt()->ModifyNotification( &aChg, &aChg ); - SetModified(); + getIDocumentState().SetModified(); } void SwCollectTblLineBoxes::AddToUndoHistory( const SwCntntNode& rNd ) @@ -3493,7 +3494,7 @@ bool SwDoc::MergeTable( const SwPosition& rPos, bool bWithPrev, sal_uInt16 nMode } if( bRet ) { - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } return bRet; @@ -3766,7 +3767,7 @@ bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe GetIDocumentUndoRedo().DoUndo(bUndo); } - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); return true; @@ -3956,7 +3957,7 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType, if( bRet ) { - SetModified(); + getIDocumentState().SetModified(); if( nsTblChgWidthHeightType::WH_FLAG_INSDEL & eType ) getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } @@ -4101,7 +4102,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, bool bCallUpdate ) if (AUTOUPD_FIELD_AND_CHARTS == GetDocumentSettingManager().getFieldUpdateFlags(true)) pTblNd->GetTable().UpdateCharts(); } - SetModified(); + getIDocumentState().SetModified(); } } @@ -4126,7 +4127,7 @@ void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ) pBoxFmt->UnlockModify(); } pBoxFmt->SetFmtAttr( rSet ); - SetModified(); + getIDocumentState().SetModified(); } void SwDoc::ClearLineNumAttrs( SwPosition & rPos ) @@ -4205,7 +4206,7 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) pBoxFmt->SetFmtAttr( *GetDfltAttr( RES_BOXATR_FORMAT )); pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE ); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -4365,7 +4366,7 @@ bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( bRet ) { - SetModified(); + getIDocumentState().SetModified(); getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 ); } return bRet; @@ -4409,7 +4410,7 @@ bool SwDoc::UnProtectCells( const OUString& rName ) { bChgd = _UnProtectTblCells( *SwTable::FindTable( pFmt ) ); if( bChgd ) - SetModified(); + getIDocumentState().SetModified(); } return bChgd; @@ -4497,7 +4498,7 @@ bool SwDoc::UnProtectTbls( const SwPaM& rPam ) GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( bChgd ) - SetModified(); + getIDocumentState().SetModified(); return bChgd; } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 038281f..1805d3b 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -36,6 +36,7 @@ #include <svx/svxids.hrc> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include "pam.hxx" #include "swcrsr.hxx" #include "viscrs.hxx" @@ -311,7 +312,7 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew ) ::lcl_ProcessRowAttr( aFmtCmp, aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -377,7 +378,7 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew ) ::lcl_ProcessRowSize( aFmtCmp, aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -447,7 +448,7 @@ bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly ) ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew ); SwTblFmtCmp::Delete( aFmtCmp ); - SetModified(); + getIDocumentState().SetModified(); } bRet = true; } @@ -477,7 +478,7 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew ::lcl_ProcessRowAttr( aFmtCmp, aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); - SetModified(); + getIDocumentState().SetModified(); } } } @@ -801,7 +802,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) } SwTblFmtCmp::Delete( aFmtCmp ); ::ClearFEShellTabCols(); - SetModified(); + getIDocumentState().SetModified(); } } @@ -897,7 +898,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), true ); } ::ClearFEShellTabCols(); - SetModified(); + getIDocumentState().SetModified(); } } @@ -1168,7 +1169,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), true ); } SwTblFmtCmp::Delete( aFmtCmp ); - SetModified(); + getIDocumentState().SetModified(); } } @@ -1581,7 +1582,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) } } - SetModified(); + getIDocumentState().SetModified(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 1e82f0d..0d16911 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -12,6 +12,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <UndoManager.hxx> #include "ndtxt.hxx" #include "MarkManager.hxx" @@ -197,7 +198,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w ) lcl_dumpSdrModel( writer, getIDocumentDrawModelAccess().GetDrawModel() ); writer.startElement("mbModified"); - writer.writeFormatAttribute("value", TMP_FORMAT, static_cast<int>(mbModified)); + writer.writeFormatAttribute("value", TMP_FORMAT, static_cast<int>(getIDocumentState().IsModified())); writer.endElement(); writer.endElement(); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 0a21afb..fe53dc8 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -37,6 +37,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <node.hxx> #include <pam.hxx> #include <frmtool.hxx> @@ -1181,7 +1182,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) // #i38810# - Due to possible existing signatures, the // document has to be modified after updating a link. - pDoc->SetModified(); + pDoc->getIDocumentState().SetModified(); // set additional flag that links have been updated, in order to check this // during load. pDoc->getIDocumentLinksAdministration().SetLinksUpdated( true ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index d25a72f..5d070bf 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -24,6 +24,7 @@ #include <fldbas.hxx> #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <fmtfld.hxx> #include <txtfld.hxx> @@ -332,7 +333,7 @@ void SwEditShell::UpdateFlds( SwField &rFld ) FOREACHPAM_END() } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 30cafd3..10058b8 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -20,6 +20,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentState.hxx> #include <editsh.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -38,11 +39,11 @@ bool SwEditShell::IsGlobalDoc() const void SwEditShell::SetGlblDocSaveLinks( bool bFlag ) { getIDocumentSettingAccess()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); - if( !GetDoc()->IsModified() ) // Bug 57028 + if( !GetDoc()->getIDocumentState().IsModified() ) // Bug 57028 { GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } bool SwEditShell::IsGlblDocSaveLinks() const diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index c4267f0..4ec7dd0 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -35,6 +35,7 @@ #include <IDocumentLinksAdministration.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <editsh.hxx> #include <frame.hxx> @@ -341,7 +342,7 @@ void SwEditShell::SetGraphicPolygon( const PolyPolygon *pPoly ) SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper(); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -356,7 +357,7 @@ void SwEditShell::ClearAutomaticContour() SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper(); const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround(); pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } } diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 1f36489..7e41893 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -22,6 +22,7 @@ #include <edimp.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <ndtxt.hxx> #include <paratr.hxx> #include <swundo.hxx> @@ -297,7 +298,7 @@ void SwEditShell::DelNumRules() // Cursor cannot be in front of a label anymore, because numbering/bullet is deleted. SetInFrontOfLabel( false ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -319,7 +320,7 @@ bool SwEditShell::NumUpDown( bool bDown ) bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown ); GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); // #i54693# Update marked numbering levels if ( IsInFrontOfLabel() ) @@ -404,7 +405,7 @@ bool SwEditShell::MoveParagraph( long nOffset ) bool bRet = GetDoc()->MoveParagraph( *pCrsr, nOffset ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); return bRet; } @@ -518,7 +519,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) } } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); return bRet; } @@ -541,7 +542,7 @@ bool SwEditShell::OutlineUpDown( short nOffset ) aRangeArr.SetPam( n, aPam ), nOffset ); GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); return bRet; } diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 7e95ed4..511d956 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -33,6 +33,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -281,11 +282,11 @@ void SwEditShell::SetTblChgMode( TblChgMode eMode ) if( pTblNd ) { ((SwTable&)pTblNd->GetTable()).SetTblChgMode( eMode ); - if( !GetDoc()->IsModified() ) // Bug 57028 + if( !GetDoc()->getIDocumentState().IsModified() ) // Bug 57028 { GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } } diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 8be5eaa..443eb69 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -22,6 +22,7 @@ #include <editsh.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <pam.hxx> #include <docary.hxx> #include <acorrect.hxx> @@ -48,22 +49,22 @@ SwEditShell::~SwEditShell() // USED bool SwEditShell::IsModified() const { - return GetDoc()->IsModified(); + return GetDoc()->getIDocumentState().IsModified(); } void SwEditShell::SetModified() { - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } void SwEditShell::ResetModified() { - GetDoc()->ResetModified(); + GetDoc()->getIDocumentState().ResetModified(); } void SwEditShell::SetUndoNoResetModified() { - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); } @@ -261,7 +262,7 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, bool bInsert, void SwEditShell::SetNewDoc(bool bNew) { - GetDoc()->SetNewDoc(bNew); + GetDoc()->getIDocumentState().SetNewDoc(bNew); } bool SwEditShell::GetPrevAutoCorrWord( SvxAutoCorrect& rACorr, OUString& rWord ) diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index e120a1c..a698cab 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -21,6 +21,7 @@ #include <sfx2/linkmgr.hxx> #include <doc.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentState.hxx> #include <editsh.hxx> #include <ndtxt.hxx> #include <fmtfld.hxx> @@ -133,7 +134,7 @@ public: pSh->EndAction(); if( pSh ) - pSh->GetDoc()->SetModified(); + pSh->GetDoc()->getIDocumentState().SetModified(); } } diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index 7601676..d370137 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -28,6 +28,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <editsh.hxx> #include <dpage.hxx> #include <unofldmid.h> @@ -269,8 +270,8 @@ void SwUserFieldType::SetContent( const OUString& rStr, sal_uInt32 nFmt ) } } - bool bModified = GetDoc()->IsModified(); - GetDoc()->SetModified(); + bool bModified = GetDoc()->getIDocumentState().IsModified(); + GetDoc()->getIDocumentState().SetModified(); if( !bModified ) // Bug 57028 { GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 3c8ea5d..2886323 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -45,6 +45,7 @@ #include <viscrs.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentState.hxx> #include <dview.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> @@ -1134,7 +1135,7 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet ) bRet = true; EndAllActionAndCall(); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } } return bRet; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 8aa17a8..36a12e6 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -38,6 +38,7 @@ #include <svx/svdpagv.hxx> #include <IDocumentSettingAccess.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentState.hxx> #include <cmdid.h> #include <drawdoc.hxx> #include <textboxhelper.hxx> @@ -666,7 +667,7 @@ long SwFEShell::EndDrag( const Point *, bool ) ((SwCrsrShell*)pSh)->CallChgLnk(); } while ( this != (pSh = (SwViewShell*)pSh->GetNext()) ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); ::FrameNotify( this, FLY_DRAG ); return 1; } @@ -809,7 +810,7 @@ void SwFEShell::SelectionToTop( bool bTop ) else Imp()->GetDrawView()->MovMarkedToTop(); ::lcl_NotifyNeighbours( &rMrkList ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -829,7 +830,7 @@ void SwFEShell::SelectionToBottom( bool bBottom ) else Imp()->GetDrawView()->MovMarkedToBtm(); ::lcl_NotifyNeighbours( &rMrkList ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllAction(); } @@ -897,7 +898,7 @@ void SwFEShell::ChangeOpaque( SdrLayerID nLayerId ) } } } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } } @@ -1820,7 +1821,7 @@ bool SwFEShell::ImpEndCreate() } } - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); KillPams(); EndAllActionAndCall(); @@ -2372,7 +2373,7 @@ bool SwFEShell::SetObjAttr( const SfxItemSet& rSet ) EndUndo( UNDO_INSATTR ); EndAllActionAndCall(); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); return true; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 20df05e..2a33bfa 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -34,6 +34,7 @@ #include <docary.hxx> #include <fesh.hxx> #include <doc.hxx> +#include <IDocumentState.hxx> #include <cntfrm.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> @@ -840,7 +841,7 @@ void SwFEShell::SetTabBackground( const SvxBrushItem &rNew ) StartAllAction(); GetDoc()->SetAttr( rNew, *pFrm->ImplFindTabFrm()->GetFmt() ); EndAllAction(); // no call, nothing changes! - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); } void SwFEShell::GetTabBackground( SvxBrushItem &rToFill ) const @@ -2067,7 +2068,7 @@ void SwFEShell::SetTblAttr( const SfxItemSet &rNew ) SwTabFrm *pTab = pFrm->FindTabFrm(); pTab->GetTable()->SetHTMLTableLayout( 0 ); GetDoc()->SetAttr( rNew, *pTab->GetFmt() ); - GetDoc()->SetModified(); + GetDoc()->getIDocumentState().SetModified(); EndAllActionAndCall(); } } diff --git a/sw/source/core/inc/DocumentStateManager.hxx b/sw/source/core/inc/DocumentStateManager.hxx new file mode 100644 index 0000000..b789c68 --- /dev/null +++ b/sw/source/core/inc/DocumentStateManager.hxx @@ -0,0 +1,66 @@ +/* -*- 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_SOURCE_CORE_INC_DOCUMENTSTATEMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATEMANAGER_HXX + +#include <IDocumentState.hxx> +#include <boost/utility.hpp> + +class SwDoc; + + +namespace sw { + +class DocumentStateManager : public IDocumentState, + public ::boost::noncopyable +{ + +public: + DocumentStateManager( SwDoc& i_rSwdoc ); + + void SetModified() SAL_OVERRIDE; + void ResetModified() SAL_OVERRIDE; + bool IsModified() const SAL_OVERRIDE; + bool IsInCallModified() const SAL_OVERRIDE; + bool IsLoaded() const SAL_OVERRIDE; + bool IsUpdateExpFld() const SAL_OVERRIDE; + bool IsNewDoc() const SAL_OVERRIDE; + bool IsPageNums() const SAL_OVERRIDE; + void SetPageNums(bool b) SAL_OVERRIDE; + void SetNewDoc(bool b) SAL_OVERRIDE; + void SetUpdateExpFldStat(bool b) SAL_OVERRIDE; + void SetLoaded(bool b) SAL_OVERRIDE; + +private: + SwDoc& m_rSwdoc; + + bool mbModified ; //< TRUE: document has changed. + bool mbLoaded ; //< TRUE: Doc loaded. + bool mbUpdateExpFld ; //< TRUE: Update expression fields. + bool mbNewDoc ; //< TRUE: new Doc. + bool mbPageNums ; //< TRUE: There are virtual page numbers. + bool mbInCallModified; //< TRUE: in Set/Reset-Modified link. +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 09451a5..43aeb13 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -28,6 +28,7 @@ #include <vector> #include <svx/svdogrp.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentState.hxx> #include <txtfly.hxx> using namespace ::com::sun::star; @@ -657,12 +658,12 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) ) { SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrm()->GetFmt()->GetDoc()); - bool bModified = pDoc->IsModified(); + bool bModified = pDoc->getIDocumentState().IsModified(); const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(), Fraction( nTargetWidth, aCurrObjRect.GetWidth() ), Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false ); if (!bModified) - pDoc->ResetModified(); + pDoc->getIDocumentState().ResetModified(); } } return GetDrawObj()->GetCurrentBoundRect(); diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index c35553b..c6c44e6 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -29,6 +29,7 @@ #include "sectfrm.hxx" #include "switerator.hxx" #include "ftnfrm.hxx" +#include <IDocumentState.hxx> SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt, SwFrm* pSib ): SwFtnBossFrm( pFmt, pSib ) @@ -94,7 +95,7 @@ static SwLayoutFrm * lcl_FindColumns( SwLayoutFrm *pLay, sal_uInt16 nCount ) static bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) { SwDoc *pDoc = pCont->GetFmt()->GetDoc(); - const bool bMod = pDoc->IsModified(); + const bool bMod = pDoc->getIDocumentState().IsModified(); //Formats should be shared whenever possible. If a neighbour already has //the same column settings we can add them to the same format. @@ -154,7 +155,7 @@ static bool lcl_AddColumns( SwLayoutFrm *pCont, sal_uInt16 nCount ) } if ( !bMod ) - pDoc->ResetModified(); + pDoc->getIDocumentState().ResetModified(); return bRet; } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 49bde44..663551f 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -65,6 +65,7 @@ #include <IDocumentTimerAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentState.hxx> //UUUU #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> @@ -875,7 +876,7 @@ SwCntntNotify::~SwCntntNotify() // have a look at the occurrence of CalcLayout in // uiview/view.cxx. if ( !pNd->IsOLESizeInvalid() && - !pSh->GetDoc()->IsUpdateExpFld() ) + !pSh->GetDoc()->getIDocumentState().IsUpdateExpFld() ) pFESh->CalcAndSetScale( xObj, &pFly->Prt(), &pFly->Frm(), bNoTxtFrmPrtAreaChanged ); @@ -904,7 +905,7 @@ SwCntntNotify::~SwCntntNotify() SwDoc *pDoc = pCnt->GetNode()->GetDoc(); if ( !pDoc->GetSpzFrmFmts()->empty() && - pDoc->DoesContainAtPageObjWithContentAnchor() && !pDoc->IsNewDoc() ) + pDoc->DoesContainAtPageObjWithContentAnchor() && !pDoc->getIDocumentState().IsNewDoc() ) { // If certain import filters for foreign file format import // AT_PAGE anchored objects, the corresponding page number is diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index 11f4f2f..d355d61 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -32,6 +32,7 @@ #include <doc.hxx> #include <fmtruby.hxx> #include <fmtmeta.hxx> +#include <IDocumentState.hxx> TYPEINIT1(SwTxtINetFmt,SwClient); TYPEINIT1(SwTxtRuby,SwClient); @@ -135,7 +136,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt() // JP 10.02.2000, Bug 72806: dont modify the doc for getting the // correct charstyle. - bool bResetMod = !pDoc->IsModified(); + bool bResetMod = !pDoc->getIDocumentState().IsModified(); Link aOle2Lnk; if ( bResetMod ) { @@ -149,7 +150,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt() if ( bResetMod ) { - ( (SwDoc*) pDoc )->ResetModified(); + ( (SwDoc*) pDoc )->getIDocumentState().ResetModified(); ( (SwDoc*) pDoc )->SetOle2Link( aOle2Lnk ); } } @@ -256,7 +257,7 @@ SwCharFmt* SwTxtRuby::GetCharFmt() // JP 10.02.2000, Bug 72806: dont modify the doc for getting the // correct charstyle. - const bool bResetMod = !pDoc->IsModified(); + const bool bResetMod = !pDoc->getIDocumentState().IsModified(); Link aOle2Lnk; if( bResetMod ) { @@ -270,7 +271,7 @@ SwCharFmt* SwTxtRuby::GetCharFmt() if( bResetMod ) { - ((SwDoc*)pDoc)->ResetModified(); + ((SwDoc*)pDoc)->getIDocumentState().ResetModified(); ((SwDoc*)pDoc)->SetOle2Link( aOle2Lnk ); } } ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits