summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx1
-rw-r--r--sw/inc/doc.hxx61
-rw-r--r--sw/qa/core/uwriter.cxx25
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx2
-rw-r--r--sw/source/core/access/accpara.cxx3
-rw-r--r--sw/source/core/crsr/crstrvl.cxx11
-rw-r--r--sw/source/core/crsr/swcrsr.cxx9
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx203
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx2676
-rw-r--r--sw/source/core/doc/doc.cxx22
-rw-r--r--sw/source/core/doc/docbm.cxx3
-rw-r--r--sw/source/core/doc/doccomp.cxx53
-rw-r--r--sw/source/core/doc/doccorr.cxx4
-rw-r--r--sw/source/core/doc/docedt.cxx29
-rw-r--r--sw/source/core/doc/docfmt.cxx10
-rw-r--r--sw/source/core/doc/docglbl.cxx3
-rw-r--r--sw/source/core/doc/doclay.cxx7
-rw-r--r--sw/source/core/doc/docnew.cxx22
-rw-r--r--sw/source/core/doc/docnum.cxx39
-rw-r--r--sw/source/core/doc/docredln.cxx2631
-rw-r--r--sw/source/core/doc/docsort.cxx16
-rw-r--r--sw/source/core/doc/doctxm.cxx3
-rw-r--r--sw/source/core/doc/tblcpy.cxx3
-rw-r--r--sw/source/core/doc/tblrwcl.cxx13
-rw-r--r--sw/source/core/docnode/ndsect.cxx14
-rw-r--r--sw/source/core/docnode/ndtbl.cxx29
-rw-r--r--sw/source/core/docnode/node.cxx5
-rw-r--r--sw/source/core/docnode/nodedump.cxx5
-rw-r--r--sw/source/core/docnode/section.cxx7
-rw-r--r--sw/source/core/edit/autofmt.cxx15
-rw-r--r--sw/source/core/edit/edglss.cxx5
-rw-r--r--sw/source/core/edit/edlingu.cxx9
-rw-r--r--sw/source/core/edit/edredln.cxx30
-rw-r--r--sw/source/core/edit/edundo.cxx13
-rw-r--r--sw/source/core/frmedt/fecopy.cxx11
-rw-r--r--sw/source/core/inc/DocumentRedlineManager.hxx144
-rw-r--r--sw/source/core/layout/frmtool.cxx3
-rw-r--r--sw/source/core/table/swtable.cxx9
-rw-r--r--sw/source/core/text/redlnitr.cxx13
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx9
-rw-r--r--sw/source/core/txtnode/txtedt.cxx7
-rw-r--r--sw/source/core/undo/docundo.cxx1
-rw-r--r--sw/source/core/undo/unattr.cxx21
-rw-r--r--sw/source/core/undo/undel.cxx5
-rw-r--r--sw/source/core/undo/undobj.cxx33
-rw-r--r--sw/source/core/undo/unins.cxx43
-rw-r--r--sw/source/core/undo/unovwr.cxx7
-rw-r--r--sw/source/core/undo/unredln.cxx65
-rw-r--r--sw/source/core/undo/unsect.cxx21
-rw-r--r--sw/source/core/undo/unspnd.cxx21
-rw-r--r--sw/source/core/undo/untbl.cxx45
-rw-r--r--sw/source/core/undo/untblk.cxx21
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx6
-rw-r--r--sw/source/core/unocore/unoportenum.cxx3
-rw-r--r--sw/source/core/unocore/unoredline.cxx2
-rw-r--r--sw/source/core/unocore/unoredlines.cxx10
-rw-r--r--sw/source/core/unocore/unosect.cxx2
-rw-r--r--sw/source/core/unocore/unotbl.cxx2
-rw-r--r--sw/source/core/unocore/unotext.cxx2
-rw-r--r--sw/source/core/view/viewsh.cxx4
-rw-r--r--sw/source/filter/basflt/shellio.cxx35
-rw-r--r--sw/source/filter/html/swhtml.cxx3
-rw-r--r--sw/source/filter/ww1/fltshell.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx5
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx6
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx26
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx10
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx2
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx8
-rw-r--r--sw/source/filter/xml/swxml.cxx17
-rw-r--r--sw/source/filter/xml/wrtxml.cxx9
-rw-r--r--sw/source/filter/xml/xmlexp.cxx9
-rw-r--r--sw/source/ui/vba/vbarevision.cxx5
-rw-r--r--sw/source/uibase/app/docsh.cxx3
-rw-r--r--sw/source/uibase/uiview/view2.cxx2
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx4
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx9
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx5
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx21
83 files changed, 3470 insertions, 3224 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 75f26b296a67..849ca27810d3 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -195,6 +195,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/doc/DocumentListsManager \
sw/source/core/doc/DocumentOutlineNodesManager \
sw/source/core/doc/DocumentContentOperationsManager \
+ sw/source/core/doc/DocumentRedlineManager \
sw/source/core/doc/extinput \
sw/source/core/doc/fmtcol \
sw/source/core/doc/ftnidx \
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index e9748806c293..4ff9600139bd 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -127,6 +127,7 @@ public:
virtual bool IsIgnoreRedline() const = 0;
virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
+ virtual SwRedlineTbl& GetRedlineTbl() = 0;
virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const = 0;
virtual SwExtraRedlineTbl& GetExtraRedlineTbl() = 0;
virtual bool HasExtraRedlineTbl() const = 0;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 779df32d016a..0a1eb82172bf 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -22,7 +22,6 @@
// SwDoc interfaces
#include <IInterface.hxx>
#include <IDocumentMarkAccess.hxx>
-#include <IDocumentRedlineAccess.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentStylePoolAccess.hxx>
#include <IDocumentLineNumberAccess.hxx>
@@ -193,6 +192,7 @@ class IDocumentListItems;
class IDocumentListsAccess;
class IDocumentOutlineNodes;
class IDocumentContentOperations;
+class IDocumentRedlineAccess;
class _SetGetExpFlds;
namespace sw { namespace mark {
@@ -212,6 +212,7 @@ namespace sw {
class DocumentListsManager;
class DocumentOutlineNodesManager;
class DocumentContentOperationsManager;
+ class DocumentRedlineManager;
}
namespace com { namespace sun { namespace star {
@@ -249,7 +250,6 @@ void StartGrammarChecking( SwDoc &rDoc );
// Represents the model of a Writer document.
class SW_DLLPUBLIC SwDoc :
public IInterface,
- public IDocumentRedlineAccess,
public IDocumentFieldsAccess,
public IDocumentStylePoolAccess,
public IDocumentLineNumberAccess,
@@ -274,7 +274,6 @@ class SW_DLLPUBLIC SwDoc :
Timer maOLEModifiedTimer; //< Timer for update modified OLE-Objecs
Timer maStatsUpdateTimer; //< Timer for asynchronous stats calculation
SwDBData maDBData; //< database descriptor
- ::com::sun::star::uno::Sequence <sal_Int8 > maRedlinePasswd;
OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
boost::ptr_vector< boost::nullable<OUString> > maPatternNms; // Array for names of document-templates
com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
@@ -284,6 +283,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::DocumentDrawModelManager > m_pDocumentDrawModelManager;
+ const ::boost::scoped_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
const ::boost::scoped_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
@@ -343,10 +343,6 @@ class SW_DLLPUBLIC SwDoc :
// Hash map to find numrules by name
mutable boost::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap;
- SwRedlineTbl *mpRedlineTbl; //< List of all Ranged Redlines.
- SwExtraRedlineTbl *mpExtraRedlineTbl; //< List of all Extra Redlines.
- OUString *mpAutoFmtRedlnComment; //< Comment for Redlines inserted via AutoFormat.
-
SwUnoCrsrTbl *mpUnoCrsrTbl;
SwPagePreviewPrtData *mpPgPViewPrtData; //< Indenting / spacing for printing of page view.
@@ -374,11 +370,6 @@ private:
sal_uInt16 mnUndoCnt; //< Count of Undo Actions.
sal_uInt16 mnUndoSttEnd; //< != 0 -> within parentheses.
- sal_uInt16 mnAutoFmtRedlnCommentNo; /**< SeqNo for conjoining of AutoFmt-Redlines.
- by the UI. Managed by SwAutoFmt! */
-
- RedlineMode_t meRedlineMode; //< Current Redline Mode.
-
sal_uInt32 mnRsid; //< current session ID of the document
sal_uInt32 mnRsidRoot; //< session ID when the document was created
@@ -410,7 +401,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 mbReadlineChecked : 1; //< sal_True: if the query was already shown
bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
bool mbColumnSelection : 1; /**< TRUE: this content has bee created by a column selection
(clipboard docs only) */
@@ -427,8 +417,6 @@ private:
static SwAutoCompleteWord *mpACmpltWords; //< List of all words for AutoComplete
// private methods
- void checkRedlining(RedlineMode_t& _rReadlineMode);
-
SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
const SwCntntNode& rNode, RndStdIds eRequestId,
const SfxItemSet* pFlyAttrSet,
@@ -539,39 +527,11 @@ public:
const IDocumentMarkAccess* getIDocumentMarkAccess() const;
// IDocumentRedlineAccess
- virtual RedlineMode_t GetRedlineMode() const SAL_OVERRIDE;
- virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) SAL_OVERRIDE;
- virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) SAL_OVERRIDE;
- virtual bool IsRedlineOn() const SAL_OVERRIDE;
- virtual bool IsIgnoreRedline() const SAL_OVERRIDE;
- virtual bool IsInRedlines(const SwNode& rNode) const SAL_OVERRIDE;
- virtual const SwRedlineTbl& GetRedlineTbl() const SAL_OVERRIDE;
- virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const SAL_OVERRIDE;
- virtual SwExtraRedlineTbl& GetExtraRedlineTbl() SAL_OVERRIDE;
- virtual bool HasExtraRedlineTbl() const SAL_OVERRIDE;
- virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool SplitRedline(const SwPaM& rPam) SAL_OVERRIDE;
- virtual bool DeleteRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType) SAL_OVERRIDE;
- virtual bool DeleteRedline(/*[in]*/const SwStartNode& rSection, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType) SAL_OVERRIDE;
- virtual sal_uInt16 GetRedlinePos(/*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const SAL_OVERRIDE;
- virtual void CompressRedlines() SAL_OVERRIDE;
- virtual const SwRangeRedline* GetRedline(/*[in]*/const SwPosition& rPos, /*[in]*/sal_uInt16* pFndPos) const SAL_OVERRIDE;
- virtual bool IsRedlineMove() const SAL_OVERRIDE;
- virtual void SetRedlineMove(/*[in]*/bool bFlag) SAL_OVERRIDE;
- virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
- virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const SAL_OVERRIDE;
- virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const SAL_OVERRIDE;
- virtual void UpdateRedlineAttr() SAL_OVERRIDE;
- virtual sal_uInt16 GetRedlineAuthor() SAL_OVERRIDE;
- virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) SAL_OVERRIDE;
- virtual bool SetRedlineComment(/*[in]*/const SwPaM& rPam, /*[in]*/const OUString& rComment) SAL_OVERRIDE;
- virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const SAL_OVERRIDE;
- virtual void SetRedlinePassword(/*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) SAL_OVERRIDE;
+ IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
+ IDocumentRedlineAccess& getIDocumentRedlineAccess();
+
+ ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
+ ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
// IDocumentUndoRedo
IDocumentUndoRedo & GetIDocumentUndoRedo();
@@ -1573,11 +1533,6 @@ public:
// Merge two documents.
long MergeDoc( const SwDoc& rDoc );
- /** Set comment-text for Redline. It then comes in via AppendRedLine.
- Used by AutoFormat. 0-pointer resets mode.
- Sequence number is for conjoining of Redlines by the UI. */
- void SetAutoFmtRedlineComment( const OUString* pTxt, sal_uInt16 nSeqNo = 0 );
-
bool IsAutoFmtRedline() const { return mbIsAutoFmtRedline; }
void SetAutoFmtRedline( bool bFlag ) { mbIsAutoFmtRedline = bFlag; }
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 75cbf77806bc..d58f5bc39f68 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -32,6 +32,7 @@
#include "breakit.hxx"
#include "doc.hxx"
+#include <IDocumentRedlineAccess.hxx>
#include "docsh.hxx"
#include "docstat.hxx"
#include "docufld.hxx"
@@ -252,9 +253,9 @@ void SwDocTest::testModelToViewHelper()
aPaM.DeleteMark();
//turn on red-lining and show changes
- m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
- CPPUNIT_ASSERT_MESSAGE("redlining should be on", m_pDoc->IsRedlineOn());
- CPPUNIT_ASSERT_MESSAGE("redlines should be visible", IDocumentRedlineAccess::IsShowChanges(m_pDoc->GetRedlineMode()));
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on", m_pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE("redlines should be visible", IDocumentRedlineAccess::IsShowChanges(m_pDoc->getIDocumentRedlineAccess().GetRedlineMode()));
//set start of selection to last A
aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 4);
@@ -623,9 +624,9 @@ void SwDocTest::testSwScanner()
CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast<sal_uLong>(2));
//turn on red-lining and show changes
- m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
- CPPUNIT_ASSERT_MESSAGE("redlining should be on", m_pDoc->IsRedlineOn());
- CPPUNIT_ASSERT_MESSAGE("redlines should be visible", IDocumentRedlineAccess::IsShowChanges(m_pDoc->GetRedlineMode()));
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on", m_pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE("redlines should be visible", IDocumentRedlineAccess::IsShowChanges(m_pDoc->getIDocumentRedlineAccess().GetRedlineMode()));
//delete everything except the first word
aPaM.SetMark(); //set start of selection to current pos
@@ -642,9 +643,9 @@ void SwDocTest::testSwScanner()
pTxtNode->SetWordCountDirty(true);
//keep red-lining on but hide changes
- m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON);
- CPPUNIT_ASSERT_MESSAGE("redlining should be still on", m_pDoc->IsRedlineOn());
- CPPUNIT_ASSERT_MESSAGE("redlines should be invisible", !IDocumentRedlineAccess::IsShowChanges(m_pDoc->GetRedlineMode()));
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode(nsRedlineMode_t::REDLINE_ON);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be still on", m_pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE("redlines should be invisible", !IDocumentRedlineAccess::IsShowChanges(m_pDoc->getIDocumentRedlineAccess().GetRedlineMode()));
aDocStat.Reset();
pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //but word-counting the text should only count the non-deleted text
@@ -653,7 +654,7 @@ void SwDocTest::testSwScanner()
OUString sLorem = pTxtNode->GetTxt();
CPPUNIT_ASSERT(sLorem == "Lorem");
- const SwRedlineTbl& rTbl = m_pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = m_pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
SwNodes& rNds = m_pDoc->GetNodes();
CPPUNIT_ASSERT(rTbl.size() == 1);
@@ -876,7 +877,7 @@ getRandomPosition(SwDoc *pDoc, int /* nOffset */)
void SwDocTest::randomTest()
{
- CPPUNIT_ASSERT_MESSAGE("SwDoc::IsRedlineOn()", !m_pDoc->IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE("SwDoc::IsRedlineOn()", !m_pDoc->getIDocumentRedlineAccess().IsRedlineOn());
RedlineMode_t modes[] = {
nsRedlineMode_t::REDLINE_ON,
nsRedlineMode_t::REDLINE_SHOW_MASK,
@@ -896,7 +897,7 @@ void SwDocTest::randomTest()
m_pDoc->ClearDoc();
// setup redlining
- m_pDoc->SetRedlineMode(modes[rlm]);
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode(modes[rlm]);
SW_MOD()->SetRedlineAuthor(OUString::createFromAscii(authors[0]));
for( int i = 0; i < 2000; i++ )
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index f13d1c7c8d7f..10cb4545bb84 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -330,7 +330,7 @@ void SwUiWriterTest::testCp1000071()
SwDoc* pDoc = createDoc("cp1000071.odt");
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
CPPUNIT_ASSERT_EQUAL( size_t( 2 ), rTbl.size());
sal_uLong redlineStart0NodeIndex = rTbl[ 0 ]->Start()->nNode.GetIndex();
sal_Int32 redlineStart0Index = rTbl[ 0 ]->Start()->nContent.GetIndex();
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 3ac13e295f5a..77ace642a3e6 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -51,6 +51,7 @@
#include <unocrsr.hxx>
#include <unoport.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <crsskip.hxx>
#include <txtatr.hxx>
#include <acchyperlink.hxx>
@@ -719,7 +720,7 @@ const SwRangeRedline* SwAccessibleParagraph::GetRedlineAtIndex( sal_Int32 )
const SwDoc* pDoc = pNode->GetDoc();
if ( pDoc )
{
- pRedline = pDoc->GetRedline( *pStart, NULL );
+ pRedline = pDoc->getIDocumentRedlineAccess().GetRedline( *pStart, NULL );
}
}
}
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 7bdca7302112..856a5265ff3f 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -27,6 +27,7 @@
#include <crsrsh.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pagefrm.hxx>
#include <cntfrm.hxx>
#include <rootfrm.hxx>
@@ -1412,7 +1413,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt,
if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
{
- const SwRangeRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
+ const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, NULL);
if( pRedl )
{
rCntntAtPos.aFnd.pRedl = pRedl;
@@ -1941,7 +1942,7 @@ const SwRangeRedline* SwCrsrShell::SelNextRedline()
SwCallLink aLk( *this ); // watch Crsr-Moves
SwCrsrSaveState aSaveState( *m_pCurCrsr );
- pFnd = GetDoc()->SelNextRedline( *m_pCurCrsr );
+ pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( *m_pCurCrsr );
if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
else
@@ -1959,7 +1960,7 @@ const SwRangeRedline* SwCrsrShell::SelPrevRedline()
SwCallLink aLk( *this ); // watch Crsr-Moves
SwCrsrSaveState aSaveState( *m_pCurCrsr );
- pFnd = GetDoc()->SelPrevRedline( *m_pCurCrsr );
+ pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( *m_pCurCrsr );
if( pFnd && !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
else
@@ -1974,7 +1975,7 @@ const SwRangeRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, bool bSelec
SwCallLink aLk( *this ); // watch Crsr-Moves
SwCrsrSaveState aSaveState( *m_pCurCrsr );
- pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ];
+ pFnd = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl()[ nArrPos ];
if( pFnd )
{
*m_pCurCrsr->GetPoint() = *pFnd->Start();
@@ -2043,7 +2044,7 @@ const SwRangeRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect
{
SET_CURR_SHELL( this );
- const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
const SwRangeRedline* pTmp = rTbl[ nArrPos ];
sal_uInt16 nSeqNo = pTmp->GetSeqNo();
if( nSeqNo && bSelect )
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index c93bfc77326a..396940aba967 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -30,6 +30,7 @@
#include <unocrsr.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
#include <section.hxx>
@@ -1410,13 +1411,13 @@ static OUString lcl_MaskDeletedRedlines( const SwTxtNode* pTxtNd )
//mask deleted redlines
OUString sNodeText(pTxtNd->GetTxt());
const SwDoc& rDoc = *pTxtNd->GetDoc();
- const bool nShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
+ const bool nShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
if ( nShowChg )
{
- sal_uInt16 nAct = rDoc.GetRedlinePos( *pTxtNd, USHRT_MAX );
- for ( ; nAct < rDoc.GetRedlineTbl().size(); nAct++ )
+ sal_uInt16 nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( *pTxtNd, USHRT_MAX );
+ for ( ; nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size(); nAct++ )
{
- const SwRangeRedline* pRed = rDoc.GetRedlineTbl()[ nAct ];
+ const SwRangeRedline* pRed = rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ];
if ( pRed->Start()->nNode > pTxtNd->GetIndex() )
break;
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index fbcd83fd3380..8c777add8ba1 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -20,6 +20,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentMarkAccess.hxx>
+#include <DocumentRedlineManager.hxx>
#include <UndoManager.hxx>
#include <docary.hxx>
#include <textboxhelper.hxx>
@@ -284,7 +285,7 @@ namespace
static void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
{
const SwDoc* pSrcDoc = rPam.GetDoc();
- const SwRedlineTbl& rTbl = pSrcDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pSrcDoc->getIDocumentRedlineAccess().GetRedlineTbl();
if( !rTbl.empty() )
{
SwDoc* pDestDoc = rCpyPam.GetDoc();
@@ -296,7 +297,7 @@ namespace
SwNodeIndex aCorrIdx( pStt->nNode );
sal_uInt16 n = 0;
- pSrcDoc->GetRedline( *pStt, &n );
+ pSrcDoc->getIDocumentRedlineAccess().GetRedline( *pStt, &n );
for( ; n < rTbl.size(); ++n )
{
const SwRangeRedline* pRedl = rTbl[ n ];
@@ -344,8 +345,8 @@ namespace
if( pDelPam )
{
- RedlineMode_t eOld = pDestDoc->GetRedlineMode();
- pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = pDestDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDestDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
@@ -357,7 +358,7 @@ namespace
} while( true );
delete pDelPam;
- pDestDoc->SetRedlineMode_intern( eOld );
+ pDestDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
}
}
@@ -365,7 +366,7 @@ namespace
static void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
{
SwDoc* pSrcDoc = rRg.aStart.GetNode().GetDoc();
- if( !pSrcDoc->GetRedlineTbl().empty() )
+ if( !pSrcDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( rCpyRg.aStart, rCpyRg.aEnd );
@@ -625,17 +626,17 @@ namespace
// get first relevant redline
sal_uInt16 nCurrentRedline;
- pDoc->GetRedline( *pStart, &nCurrentRedline );
+ pDoc->getIDocumentRedlineAccess().GetRedline( *pStart, &nCurrentRedline );
if( nCurrentRedline > 0)
nCurrentRedline--;
// redline mode REDLINE_IGNORE|REDLINE_ON; save old mode
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
// iterate over relevant redlines and decide for each whether it should
// be saved, or split + saved
- SwRedlineTbl& rRedlineTable = const_cast<SwRedlineTbl&>( pDoc->GetRedlineTbl() );
+ SwRedlineTbl& rRedlineTable = const_cast<SwRedlineTbl&>( pDoc->getIDocumentRedlineAccess().GetRedlineTbl() );
for( ; nCurrentRedline < rRedlineTable.size(); nCurrentRedline++ )
{
SwRangeRedline* pCurrent = rRedlineTable[ nCurrentRedline ];
@@ -660,7 +661,7 @@ namespace
SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent );
*pNewRedline->End() = *pStart;
*pCurrent->Start() = *pStart;
- pDoc->AppendRedline( pNewRedline, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
}
// split end, if necessary
@@ -670,7 +671,7 @@ namespace
SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent );
*pNewRedline->Start() = *pEnd;
*pCurrent->End() = *pEnd;
- pDoc->AppendRedline( pNewRedline, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
}
// save the current redline
@@ -680,21 +681,21 @@ namespace
}
// restore old redline mode
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
static void lcl_RestoreRedlines( SwDoc* pDoc, const SwPosition& rPos, _SaveRedlines& rArr )
{
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
for( size_t n = 0; n < rArr.size(); ++n )
{
rArr[ n ].SetPos( rPos );
- pDoc->AppendRedline( rArr[ n ].pRedl, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( rArr[ n ].pRedl, true );
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
static void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
@@ -703,14 +704,14 @@ namespace
sal_uInt16 nRedlPos;
SwPosition aSrchPos( rRg.aStart ); aSrchPos.nNode--;
aSrchPos.nContent.Assign( aSrchPos.nNode.GetNode().GetCntntNode(), 0 );
- if( pDoc->GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
+ if( pDoc->getIDocumentRedlineAccess().GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
--nRedlPos;
- else if( nRedlPos >= pDoc->GetRedlineTbl().size() )
+ else if( nRedlPos >= pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size() )
return ;
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
- SwRedlineTbl& rRedlTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ SwRedlineTbl& rRedlTbl = (SwRedlineTbl&)pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
do {
SwRangeRedline* pTmp = rRedlTbl[ nRedlPos ];
@@ -773,28 +774,28 @@ namespace
pTmpPos->nNode = rRg.aEnd;
pTmpPos->nContent.Assign(
pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
- pDoc->AppendRedline( pTmp, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( pTmp, true );
}
}
else
break;
- } while( ++nRedlPos < pDoc->GetRedlineTbl().size() );
- pDoc->SetRedlineMode_intern( eOld );
+ } while( ++nRedlPos < pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size() );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
static void lcl_RestoreRedlines( SwDoc* pDoc, sal_uInt32 nInsPos, _SaveRedlines& rArr )
{
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
for( size_t n = 0; n < rArr.size(); ++n )
{
rArr[ n ].SetPos( nInsPos );
- pDoc->AppendRedline( rArr[ n ].pRedl, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( rArr[ n ].pRedl, true );
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
static bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
@@ -1125,8 +1126,8 @@ namespace //local functions originally from docfmt.cxx
bRet = history.InsertItems(
aTxtSet, rSt.GetIndex(), rSt.GetIndex(), nFlags ) || bRet;
- if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
- && !pDoc->GetRedlineTbl().empty())))
+ if (bRet && (pDoc->getIDocumentRedlineAccess().IsRedlineOn() || (!pDoc->getIDocumentRedlineAccess().IsIgnoreRedline()
+ && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty())))
{
SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
pStt->nNode, pStt->nContent.GetIndex() );
@@ -1134,10 +1135,10 @@ namespace //local functions originally from docfmt.cxx
if( pUndo )
pUndo->SaveRedlineData( aPam, true );
- if( pDoc->IsRedlineOn() )
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
else
- pDoc->SplitRedline( aPam );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
}
@@ -1165,8 +1166,8 @@ namespace //local functions originally from docfmt.cxx
bRet = history.InsertItems( aTxtSet, nInsCnt, nEnd, nFlags )
|| bRet;
- if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
- && !pDoc->GetRedlineTbl().empty())))
+ if (bRet && (pDoc->getIDocumentRedlineAccess().IsRedlineOn() || (!pDoc->getIDocumentRedlineAccess().IsIgnoreRedline()
+ && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty())))
{
// Was text content inserted? (RefMark/TOXMarks without an end)
bool bTxtIns = nInsCnt != rSt.GetIndex();
@@ -1176,13 +1177,13 @@ namespace //local functions originally from docfmt.cxx
if( pUndo )
pUndo->SaveRedlineData( aPam, bTxtIns );
- if( pDoc->IsRedlineOn() )
- pDoc->AppendRedline(
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ pDoc->getIDocumentRedlineAccess().AppendRedline(
new SwRangeRedline(
bTxtIns ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_FORMAT, aPam ),
true);
else if( bTxtIns )
- pDoc->SplitRedline( aPam );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
}
@@ -1348,13 +1349,13 @@ namespace //local functions originally from docfmt.cxx
bRet = history.InsertItems( *pCharSet, nMkPos, nPtPos, nFlags )
|| bRet;
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos );
if( pUndo )
pUndo->SaveRedlineData( aPam, false );
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
}
}
if( pOtherSet && pOtherSet->Count() )
@@ -1374,11 +1375,11 @@ namespace //local functions originally from docfmt.cxx
return bRet;
}
- if( pDoc->IsRedlineOn() && pCharSet && pCharSet->Count() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() && pCharSet && pCharSet->Count() )
{
if( pUndo )
pUndo->SaveRedlineData( rRg, false );
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true);
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true);
}
/* now if range */
@@ -1606,11 +1607,11 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons
}
SwPaM* pRedlineRange = 0;
- if( pDoc->IsRedlineOn() ||
- (!pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() ) )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ||
+ (!pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() ) )
pRedlineRange = new SwPaM( rPos );
- RedlineMode_t eOld = pDoc->GetRedlineMode();
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
bool bRet = false;
@@ -1634,7 +1635,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons
OSL_ENSURE( &m_rSwdoc == pDoc, " invalid copy branch!" );
OSL_FAIL("mst: i thought this could be dead code;"
"please tell me what you did to get here!");
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
// Then copy the area to the underlying document area
// (with start/end nodes clamped) and move them to
@@ -1694,13 +1695,13 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons
bRet = true;
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
if( pRedlineRange )
{
- if( pDoc->IsRedlineOn() )
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlineRange ), true);
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlineRange ), true);
else
- pDoc->SplitRedline( *pRedlineRange );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( *pRedlineRange );
delete pRedlineRange;
}
@@ -1719,7 +1720,7 @@ void DocumentContentOperationsManager::DeleteSection( SwNode *pNode )
// delete all Flys, Bookmarks, ...
DelFlyInRange( aSttIdx, aEndIdx );
- m_rSwdoc.DeleteRedline( *pSttNd, true, USHRT_MAX );
+ m_rSwdoc.getIDocumentRedlineAccess().DeleteRedline( *pSttNd, true, USHRT_MAX );
_DelBookmarks(aSttIdx, aEndIdx);
{
@@ -1744,7 +1745,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam )
pNd->StartOfSectionIndex();
sal_uInt32 nNodeDiff = rEnd.nNode.GetIndex() - rStt.nNode.GetIndex();
- if ( nSectDiff-2 <= nNodeDiff || m_rSwdoc.IsRedlineOn() ||
+ if ( nSectDiff-2 <= nNodeDiff || m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() ||
/* #i9185# Prevent getting the node after the end node (see below) */
rEnd.nNode.GetIndex() + 1 == m_rSwdoc.GetNodes().Count() )
{
@@ -1880,7 +1881,7 @@ bool DocumentContentOperationsManager::DeleteAndJoin( SwPaM & rPam,
if ( lcl_StrLenOverflow( rPam ) )
return false;
- return lcl_DoWithBreaks( *this, rPam, (m_rSwdoc.IsRedlineOn())
+ return lcl_DoWithBreaks( *this, rPam, (m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn())
? &DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl
: &DocumentContentOperationsManager::DeleteAndJoinImpl,
bForceJoinNext );
@@ -1902,7 +1903,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
// save redlines (if DOC_MOVEREDLINES is used)
_SaveRedlines aSaveRedl;
- if( DOC_MOVEREDLINES & eMvFlags && !m_rSwdoc.GetRedlineTbl().empty() )
+ if( DOC_MOVEREDLINES & eMvFlags && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
lcl_SaveRedlines( rPaM, aSaveRedl );
@@ -2150,25 +2151,25 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod
_SaveRedlines aSaveRedl;
std::vector<SwRangeRedline*> aSavRedlInsPosArr;
- if( DOC_MOVEREDLINES & eMvFlags && !m_rSwdoc.GetRedlineTbl().empty() )
+ if( DOC_MOVEREDLINES & eMvFlags && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
lcl_SaveRedlines( rRange, aSaveRedl );
// Find all RedLines that end at the InsPos.
// These have to be moved back to the "old" position after the Move.
- sal_uInt16 nRedlPos = m_rSwdoc.GetRedlinePos( rPos.GetNode(), USHRT_MAX );
+ sal_uInt16 nRedlPos = m_rSwdoc.getIDocumentRedlineAccess().GetRedlinePos( rPos.GetNode(), USHRT_MAX );
if( USHRT_MAX != nRedlPos )
{
const SwPosition *pRStt, *pREnd;
do {
- SwRangeRedline* pTmp = m_rSwdoc.GetRedlineTbl()[ nRedlPos ];
+ SwRangeRedline* pTmp = m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlPos ];
pRStt = pTmp->Start();
pREnd = pTmp->End();
if( pREnd->nNode == rPos && pRStt->nNode < rPos )
{
aSavRedlInsPosArr.push_back( pTmp );
}
- } while( pRStt->nNode < rPos && ++nRedlPos < m_rSwdoc.GetRedlineTbl().size());
+ } while( pRStt->nNode < rPos && ++nRedlPos < m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().size());
}
}
@@ -2221,7 +2222,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod
for( sal_uInt16 n = 0; n < aSavRedlInsPosArr.size(); ++n )
{
SwRangeRedline* pTmp = aSavRedlInsPosArr[ n ];
- if( m_rSwdoc.GetRedlineTbl().Contains( pTmp ) )
+ if( m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().Contains( pTmp ) )
{
SwPosition* pEnd = pTmp->End();
pEnd->nNode = aIdx;
@@ -2370,17 +2371,17 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri
}
if (!m_rSwdoc.GetIDocumentUndoRedo().DoesUndo() &&
- !m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty())
+ !m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty())
{
SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
- m_rSwdoc.DeleteRedline( aPam, true, USHRT_MAX );
+ m_rSwdoc.getIDocumentRedlineAccess().DeleteRedline( aPam, true, USHRT_MAX );
}
- else if( m_rSwdoc.IsRedlineOn() )
+ else if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
// FIXME: this redline is WRONG: there is no DELETE, and the skipped
// characters are also included in aPam
SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
- m_rSwdoc.AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
}
m_rSwdoc.SetModified();
@@ -2464,18 +2465,18 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS
}
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( m_rSwdoc.IsRedlineOn() || (!m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty() ))
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() || (!m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( rPos.nNode, aTmp.GetCntnt(),
rPos.nNode, rPos.nContent.GetIndex());
- if( m_rSwdoc.IsRedlineOn() )
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
- m_rSwdoc.AppendRedline(
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline(
new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
}
else
{
- m_rSwdoc.SplitRedline( aPam );
+ m_rSwdoc.getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
@@ -2887,15 +2888,15 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b
pCntntStore->Restore( &m_rSwdoc, rPos.nNode.GetIndex()-1, 0, true );
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( m_rSwdoc.IsRedlineOn() || (!m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty() ))
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() || (!m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( rPos );
aPam.SetMark();
aPam.Move( fnMoveBackward );
- if( m_rSwdoc.IsRedlineOn() )
- m_rSwdoc.AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() )
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
else
- m_rSwdoc.SplitRedline( aPam );
+ m_rSwdoc.getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
@@ -2926,15 +2927,15 @@ bool DocumentContentOperationsManager::AppendTxtNode( SwPosition& rPos )
}
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( m_rSwdoc.IsRedlineOn() || (!m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty() ))
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() || (!m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( rPos );
aPam.SetMark();
aPam.Move( fnMoveBackward );
- if( m_rSwdoc.IsRedlineOn() )
- m_rSwdoc.AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() )
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
else
- m_rSwdoc.SplitRedline( aPam );
+ m_rSwdoc.getIDocumentRedlineAccess().SplitRedline( aPam );
}
m_rSwdoc.SetModified();
@@ -2997,7 +2998,7 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString
rStart.nContent = *iter + 1;
if (rEnd.nContent != rStart.nContent) // check if part is empty
{
- bRet &= (m_rSwdoc.IsRedlineOn())
+ bRet &= (m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn())
? DeleteAndJoinWithRedlineImpl(aPam)
: DeleteAndJoinImpl(aPam, false);
}
@@ -3159,7 +3160,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
aCpyTmp );
}
- if( bDelRedlines && ( nsRedlineMode_t::REDLINE_DELETE_REDLINES & pDest->GetRedlineMode() ))
+ if( bDelRedlines && ( nsRedlineMode_t::REDLINE_DELETE_REDLINES & pDest->getIDocumentRedlineAccess().GetRedlineMode() ))
lcl_DeleteRedlines( rRg, aCpyRange );
pDest->GetNodes()._DelDummyNodes( aCpyRange );
@@ -3194,7 +3195,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
(pAnchor->GetAnchorId() == FLY_AT_CHAR)) &&
(( bCopyFlyAtFly && FLY_AT_FLY == pAnchor->GetAnchorId() )
? rRg.aStart <= pAPos->nNode.GetIndex() + 1
- : ( m_rSwdoc.IsRedlineMove()
+ : ( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineMove()
? rRg.aStart < pAPos->nNode
: rRg.aStart <= pAPos->nNode )) &&
pAPos->nNode <= rRg.aEnd )
@@ -3207,7 +3208,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
bool bAdd = false;
if( pAPos->nNode < rRg.aEnd )
bAdd = true;
- if (!bAdd && !m_rSwdoc.IsRedlineMove()) // fdo#40599: not for redline move
+ if (!bAdd && !m_rSwdoc.getIDocumentRedlineAccess().IsRedlineMove()) // fdo#40599: not for redline move
{
bool bEmptyNode = false;
bool bLastNode = false;
@@ -3453,19 +3454,19 @@ DocumentContentOperationsManager::~DocumentContentOperationsManager()
bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
{
- OSL_ENSURE( m_rSwdoc.IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
+ OSL_ENSURE( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
{
SwUndoRedlineDelete* pUndo = 0;
- RedlineMode_t eOld = m_rSwdoc.GetRedlineMode();
- m_rSwdoc.checkRedlining( eOld );
+ RedlineMode_t eOld = m_rSwdoc.getIDocumentRedlineAccess().GetRedlineMode();
+ m_rSwdoc.GetDocumentRedlineManager().checkRedlining( eOld );
if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
{
/* please don't translate -- for cultural reasons this comment is protected
until the redline implementation is finally fixed some day */
//JP 06.01.98: MUSS noch optimiert werden!!!
- m_rSwdoc.SetRedlineMode(
+ m_rSwdoc.getIDocumentRedlineAccess().SetRedlineMode(
(RedlineMode_t) ( nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) );
m_rSwdoc.GetIDocumentUndoRedo().StartUndo( UNDO_DELETE, NULL );
@@ -3474,7 +3475,7 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
}
if ( *rPam.GetPoint() != *rPam.GetMark() )
- m_rSwdoc.AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true );
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true );
m_rSwdoc.SetModified();
if ( pUndo )
@@ -3501,7 +3502,7 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
}
}
//JP 06.01.98: MUSS noch optimiert werden!!!
- m_rSwdoc.SetRedlineMode( eOld );
+ m_rSwdoc.getIDocumentRedlineAccess().SetRedlineMode( eOld );
}
return true;
}
@@ -3618,8 +3619,8 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
return true;
}
- if( !m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty() )
- m_rSwdoc.DeleteRedline( rPam, true, USHRT_MAX );
+ if( !m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ m_rSwdoc.getIDocumentRedlineAccess().DeleteRedline( rPam, true, USHRT_MAX );
// Delete and move all "Flys at the paragraph", which are within the Selection
DelFlyInRange(rPam.GetMark()->nNode, rPam.GetPoint()->nNode);
@@ -3721,8 +3722,8 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
} while( false );
- if( !m_rSwdoc.IsIgnoreRedline() && !m_rSwdoc.GetRedlineTbl().empty() )
- m_rSwdoc.CompressRedlines();
+ if( !m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ m_rSwdoc.getIDocumentRedlineAccess().CompressRedlines();
m_rSwdoc.SetModified();
return true;
@@ -3763,10 +3764,10 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
SwDataChanged aTmp( aDelPam );
- if( m_rSwdoc.IsRedlineOn() )
+ if( m_rSwdoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
- RedlineMode_t eOld = m_rSwdoc.GetRedlineMode();
- m_rSwdoc.checkRedlining(eOld);
+ RedlineMode_t eOld = m_rSwdoc.getIDocumentRedlineAccess().GetRedlineMode();
+ m_rSwdoc.GetDocumentRedlineManager().checkRedlining(eOld);
if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
{
m_rSwdoc.GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
@@ -3775,7 +3776,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
const ::sw::mark::IMark* pBkmk = m_rSwdoc.getIDocumentMarkAccess()->makeMark( aDelPam, OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
//JP 06.01.98: MUSS noch optimiert werden!!!
- m_rSwdoc.SetRedlineMode(
+ m_rSwdoc.getIDocumentRedlineAccess().SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
*aDelPam.GetPoint() = pBkmk->GetMarkPos();
@@ -3855,7 +3856,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE );
m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(pUndoRD);
}
- m_rSwdoc.AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true);
+ m_rSwdoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true);
*rPam.GetMark() = *aDelPam.GetMark();
if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
@@ -3873,7 +3874,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
rPam.GetPoint()->nContent = rIdx;
*rPam.GetMark() = *rPam.GetPoint();
//JP 06.01.98: MUSS noch optimiert werden!!!
- m_rSwdoc.SetRedlineMode( eOld );
+ m_rSwdoc.getIDocumentRedlineAccess().SetRedlineMode( eOld );
*rPam.GetPoint() = pBkmk->GetMarkPos();
if(pBkmk->IsExpanded())
@@ -3884,8 +3885,8 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
}
else
{
- if( !m_rSwdoc.IsIgnoreRedline() && m_rSwdoc.GetRedlineTbl().size() )
- m_rSwdoc.DeleteRedline( aDelPam, true, USHRT_MAX );
+ if( !m_rSwdoc.getIDocumentRedlineAccess().IsIgnoreRedline() && m_rSwdoc.getIDocumentRedlineAccess().GetRedlineTbl().size() )
+ m_rSwdoc.getIDocumentRedlineAccess().DeleteRedline( aDelPam, true, USHRT_MAX );
SwUndoReplace* pUndoRpl = 0;
bool const bDoesUndo = m_rSwdoc.GetIDocumentUndoRedo().DoesUndo();
@@ -4018,8 +4019,8 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
}
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
// Move the PaM one node back from the insert position, so that
// the position doesn't get moved
@@ -4448,7 +4449,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
aListIdToPropagate, true, true );
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
pDoc->SetModified();
return true;
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
new file mode 100644
index 000000000000..983df66760b1
--- /dev/null
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -0,0 +1,2676 @@
+
+/* -*- 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 <DocumentRedlineManager.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <redline.hxx>
+#include <UndoRedline.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <comcore.hrc>
+#include <swmodule.hxx>
+#include <editsh.hxx>
+#include <vcl/layout.hxx>
+
+using namespace com::sun::star;
+
+#ifdef DBG_UTIL
+
+ #define _ERROR_PREFIX "redline table corrupted: "
+
+ namespace
+ {
+ // helper function for lcl_CheckRedline
+ // 1. make sure that pPos->nContent points into pPos->nNode
+ // (or into the 'special' no-content-node-IndexReg)
+ // 2. check that position is valid and doesn't point behind text
+ static void lcl_CheckPosition( const SwPosition* pPos )
+ {
+ SwPosition aComparePos( *pPos );
+ aComparePos.nContent.Assign(
+ aComparePos.nNode.GetNode().GetCntntNode(), 0 );
+ OSL_ENSURE( pPos->nContent.GetIdxReg() ==
+ aComparePos.nContent.GetIdxReg(),
+ _ERROR_PREFIX "illegal position" );
+
+ SwTxtNode* pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ OSL_ENSURE( pPos->nContent == 0,
+ _ERROR_PREFIX "non-text-node with content" );
+ }
+ else
+ {
+ OSL_ENSURE( pPos->nContent >= 0 &&
+ pPos->nContent <= pTxtNode->Len(),
+ _ERROR_PREFIX "index behind text" );
+ }
+ }
+
+ static void lcl_CheckPam( const SwPaM* pPam )
+ {
+ OSL_ENSURE( pPam != NULL, _ERROR_PREFIX "illegal argument" );
+ lcl_CheckPosition( pPam->GetPoint() );
+ lcl_CheckPosition( pPam->GetMark() );
+ }
+
+ // check validity of the redline table. Checks redline bounds, and make
+ // sure the redlines are sorted and non-overlapping.
+ static void lcl_CheckRedline( IDocumentRedlineAccess& redlineAccess )
+ {
+ const SwRedlineTbl& rTbl = redlineAccess.GetRedlineTbl();
+
+ // verify valid redline positions
+ for( sal_uInt16 i = 0; i < rTbl.size(); ++i )
+ lcl_CheckPam( rTbl[ i ] );
+
+ for( sal_uInt16 j = 0; j < rTbl.size(); ++j )
+ {
+ // check for empty redlines
+ OSL_ENSURE( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) ||
+ ( rTbl[j]->GetContentIdx() != NULL ),
+ _ERROR_PREFIX "empty redline" );
+ }
+
+ // verify proper redline sorting
+ for( sal_uInt16 n = 1; n < rTbl.size(); ++n )
+ {
+ const SwRangeRedline* pPrev = rTbl[ n-1 ];
+ const SwRangeRedline* pCurrent = rTbl[ n ];
+
+ // check redline sorting
+ SAL_WARN_IF( *pPrev->Start() > *pCurrent->Start(), "sw",
+ _ERROR_PREFIX "not sorted correctly" );
+
+ // check for overlapping redlines
+ SAL_WARN_IF( *pPrev->End() > *pCurrent->Start(), "sw",
+ _ERROR_PREFIX "overlapping redlines" );
+ }
+ }
+ }
+
+ #define _CHECK_REDLINE( pDoc ) lcl_CheckRedline( pDoc );
+
+#else
+
+ #define _CHECK_REDLINE( pDoc )
+
+#endif
+
+namespace
+{
+ static inline bool IsPrevPos( const SwPosition rPos1, const SwPosition rPos2 )
+ {
+ const SwCntntNode* pCNd;
+ return 0 == rPos2.nContent.GetIndex() &&
+ rPos2.nNode.GetIndex() - 1 == rPos1.nNode.GetIndex() &&
+ 0 != ( pCNd = rPos1.nNode.GetNode().GetCntntNode() ) &&
+ rPos1.nContent.GetIndex() == pCNd->Len();
+ }
+
+ static bool lcl_AcceptRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ bool bCallDelete,
+ const SwPosition* pSttRng = 0,
+ const SwPosition* pEndRng = 0 )
+ {
+ bool bRet = true;
+ SwRangeRedline* pRedl = rArr[ rPos ];
+ SwPosition *pRStt = 0, *pREnd = 0;
+ SwComparePosition eCmp = POS_OUTSIDE;
+ if( pSttRng && pEndRng )
+ {
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
+ }
+
+ pRedl->InvalidateRange();
+
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ case nsRedlineType_t::REDLINE_FORMAT:
+ {
+ bool bCheck = false, bReplace = false;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( *pSttRng == *pRStt )
+ pRedl->SetStart( *pEndRng, pRStt );
+ else
+ {
+ if( *pEndRng != *pREnd )
+ {
+ // split up
+ SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
+ pNew->SetStart( *pEndRng );
+ rArr.Insert( pNew ); ++rPos;
+ }
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = true;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = true;
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = false;
+ }
+
+ if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
+ {
+ // re-insert
+ rArr.Remove( pRedl );
+ rArr.Insert( pRedl );
+ }
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ SwDoc& rDoc = *pRedl->GetDoc();
+ const SwPosition *pDelStt = 0, *pDelEnd = 0;
+ bool bDelRedl = false;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ pDelStt = pSttRng;
+ pDelEnd = pEndRng;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( bCallDelete )
+ {
+ pDelStt = pRStt;
+ pDelEnd = pEndRng;
+ }
+ break;
+ case POS_OVERLAP_BEHIND:
+ if( bCallDelete )
+ {
+ pDelStt = pREnd;
+ pDelEnd = pSttRng;
+ }
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ rArr.Remove( rPos-- );
+ bDelRedl = true;
+ if( bCallDelete )
+ {
+ pDelStt = pRedl->Start();
+ pDelEnd = pRedl->End();
+ }
+ }
+ break;
+ default:
+ bRet = false;
+ }
+
+ if( pDelStt && pDelEnd )
+ {
+ SwPaM aPam( *pDelStt, *pDelEnd );
+ SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
+
+ if( bDelRedl )
+ delete pRedl;
+
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+
+ if( pCSttNd && pCEndNd )
+ rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+ else
+ {
+ rDoc.getIDocumentContentOperations().DeleteRange( aPam );
+
+ if( pCSttNd && !pCEndNd )
+ {
+ aPam.GetBound( true ).nContent.Assign( 0, 0 );
+ aPam.GetBound( false ).nContent.Assign( 0, 0 );
+ aPam.DeleteMark();
+ rDoc.getIDocumentContentOperations().DelFullPara( aPam );
+ }
+ }
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
+ }
+ else if( bDelRedl )
+ delete pRedl;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = false;
+ }
+ return bRet;
+ }
+
+ static bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ bool bCallDelete,
+ const SwPosition* pSttRng = 0,
+ const SwPosition* pEndRng = 0 )
+ {
+ bool bRet = true;
+ SwRangeRedline* pRedl = rArr[ rPos ];
+ SwPosition *pRStt = 0, *pREnd = 0;
+ SwComparePosition eCmp = POS_OUTSIDE;
+ if( pSttRng && pEndRng )
+ {
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
+ }
+
+ pRedl->InvalidateRange();
+
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ SwDoc& rDoc = *pRedl->GetDoc();
+ const SwPosition *pDelStt = 0, *pDelEnd = 0;
+ bool bDelRedl = false;
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ pDelStt = pSttRng;
+ pDelEnd = pEndRng;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( bCallDelete )
+ {
+ pDelStt = pRStt;
+ pDelEnd = pEndRng;
+ }
+ break;
+ case POS_OVERLAP_BEHIND:
+ if( bCallDelete )
+ {
+ pDelStt = pREnd;
+ pDelEnd = pSttRng;
+ }
+ break;
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ // delete the range again
+ rArr.Remove( rPos-- );
+ bDelRedl = true;
+ if( bCallDelete )
+ {
+ pDelStt = pRedl->Start();
+ pDelEnd = pRedl->End();
+ }
+ }
+ break;
+
+ default:
+ bRet = false;
+ }
+ if( pDelStt && pDelEnd )
+ {
+ SwPaM aPam( *pDelStt, *pDelEnd );
+
+ SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
+ SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
+
+ if( bDelRedl )
+ delete pRedl;
+
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+
+ if( pCSttNd && pCEndNd )
+ rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+ else
+ {
+ rDoc.getIDocumentContentOperations().DeleteRange( aPam );
+
+ if( pCSttNd && !pCEndNd )
+ {
+ aPam.GetBound( true ).nContent.Assign( 0, 0 );
+ aPam.GetBound( false ).nContent.Assign( 0, 0 );
+ aPam.DeleteMark();
+ rDoc.getIDocumentContentOperations().DelFullPara( aPam );
+ }
+ }
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
+ }
+ else if( bDelRedl )
+ delete pRedl;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ SwRangeRedline* pNew = 0;
+ bool bCheck = false, bReplace = false;
+
+ switch( eCmp )
+ {
+ case POS_INSIDE:
+ {
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->PopData();
+ }
+ if( *pSttRng == *pRStt )
+ {
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = true;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ }
+ else
+ {
+ if( *pEndRng != *pREnd )
+ {
+ // split up
+ SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
+ pCpy->SetStart( *pEndRng );
+ rArr.Insert( pCpy ); ++rPos;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ }
+
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = true;
+ if( pNew )
+ pNew->SetStart( *pSttRng );
+ }
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->PopData();
+ }
+ pRedl->SetStart( *pEndRng, pRStt );
+ bReplace = true;
+ if( pNew )
+ pNew->SetEnd( *pEndRng );
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ if( 1 < pRedl->GetStackCount() )
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->PopData();
+ }
+ pRedl->SetEnd( *pSttRng, pREnd );
+ bCheck = true;
+ if( pNew )
+ pNew->SetStart( *pSttRng );
+ break;
+
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ if( !pRedl->PopData() )
+ // deleting the RedlineObject is enough
+ rArr.DeleteAndDestroy( rPos-- );
+ break;
+
+ default:
+ bRet = false;
+ }
+
+ if( pNew )
+ {
+ rArr.Insert( pNew ); ++rPos;
+ }
+
+ if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
+ {
+ // re-insert
+ rArr.Remove( pRedl );
+ rArr.Insert( pRedl );
+ }
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ {
+ if( pRedl->GetExtraData() )
+ pRedl->GetExtraData()->Reject( *pRedl );
+ rArr.DeleteAndDestroy( rPos-- );
+ }
+ break;
+
+ default:
+ bRet = false;
+ }
+ return bRet;
+ }
+
+ typedef bool (*Fn_AcceptReject)( SwRedlineTbl& rArr, sal_uInt16& rPos,
+ bool bCallDelete,
+ const SwPosition* pSttRng,
+ const SwPosition* pEndRng);
+
+
+ static int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
+ SwRedlineTbl& rArr, bool bCallDelete,
+ const SwPaM& rPam)
+ {
+ sal_uInt16 n = 0;
+ int nCount = 0;
+
+ const SwPosition* pStt = rPam.Start(),
+ * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
+ : rPam.GetPoint();
+ const SwRangeRedline* pFnd = rArr.FindAtPosition( *pStt, n, true );
+ if( pFnd && // Is new a part of it?
+ ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd ))
+ {
+ // Only revoke the partial selection
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
+ nCount++;
+ ++n;
+ }
+
+ for( ; n < rArr.size(); ++n )
+ {
+ SwRangeRedline* pTmp = rArr[ n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if( *pTmp->End() <= *pEnd )
+ {
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, 0, 0 ))
+ nCount++;
+ }
+ else
+ {
+ if( *pTmp->Start() < *pEnd )
+ {
+ // Only revoke the partial selection
+ if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
+ nCount++;
+ }
+ break;
+ }
+ }
+ }
+ return nCount;
+ }
+
+ static void lcl_AdjustRedlineRange( SwPaM& rPam )
+ {
+ // The Selection is only in the ContentSection. If there are Redlines
+ // to Non-ContentNodes before or after that, then the Selections
+ // expand to them.
+ SwPosition* pStt = rPam.Start(),
+ * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
+ : rPam.GetPoint();
+ SwDoc* pDoc = rPam.GetDoc();
+ if( !pStt->nContent.GetIndex() &&
+ !pDoc->GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsCntntNode() )
+ {
+ const SwRangeRedline* pRedl = pDoc->getIDocumentRedlineAccess().GetRedline( *pStt, 0 );
+ if( pRedl )
+ {
+ const SwPosition* pRStt = pRedl->Start();
+ if( !pRStt->nContent.GetIndex() && pRStt->nNode.GetIndex() ==
+ pStt->nNode.GetIndex() - 1 )
+ *pStt = *pRStt;
+ }
+ }
+ if( pEnd->nNode.GetNode().IsCntntNode() &&
+ !pDoc->GetNodes()[ pEnd->nNode.GetIndex() + 1 ]->IsCntntNode() &&
+ pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
+ {
+ const SwRangeRedline* pRedl = pDoc->getIDocumentRedlineAccess().GetRedline( *pEnd, 0 );
+ if( pRedl )
+ {
+ const SwPosition* pREnd = pRedl->End();
+ if( !pREnd->nContent.GetIndex() && pREnd->nNode.GetIndex() ==
+ pEnd->nNode.GetIndex() + 1 )
+ *pEnd = *pREnd;
+ }
+ }
+ }
+}
+
+namespace sw
+{
+
+DocumentRedlineManager::DocumentRedlineManager( SwDoc& i_rSwdoc ) : m_rSwdoc( i_rSwdoc ),
+ meRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
+ mpRedlineTbl( new SwRedlineTbl ),
+ mpExtraRedlineTbl ( new SwExtraRedlineTbl ),
+ mpAutoFmtRedlnComment( 0 ),
+ mbIsRedlineMove(false),
+ mbReadlineChecked(false),
+ mnAutoFmtRedlnCommentNo( 0 )
+{
+}
+
+RedlineMode_t DocumentRedlineManager::GetRedlineMode() const
+{
+ return meRedlineMode;
+}
+
+void DocumentRedlineManager::SetRedlineMode( RedlineMode_t eMode )
+{
+ if( meRedlineMode != eMode )
+ {
+ if( (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) != (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode)
+ || 0 == (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode) )
+ {
+ bool bSaveInXMLImportFlag = m_rSwdoc.IsInXMLImport();
+ m_rSwdoc.SetInXMLImport( false );
+ // and then hide/display everything
+ void (SwRangeRedline::*pFnc)( sal_uInt16 ) = 0;
+
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eMode )
+ {
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE :
+ pFnc = &SwRangeRedline::Show;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT:
+ pFnc = &SwRangeRedline::Hide;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ pFnc = &SwRangeRedline::ShowOriginal;
+ break;
+
+ default:
+ pFnc = &SwRangeRedline::Hide;
+ eMode = (RedlineMode_t)(eMode | nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ break;
+ }
+
+ _CHECK_REDLINE( *this )
+
+ if( pFnc )
+ for( sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop )
+ for( sal_uInt16 i = 0; i < mpRedlineTbl->size(); ++i )
+ ((*mpRedlineTbl)[ i ]->*pFnc)( nLoop );
+ _CHECK_REDLINE( *this )
+ m_rSwdoc.SetInXMLImport( bSaveInXMLImportFlag );
+ }
+ meRedlineMode = eMode;
+ m_rSwdoc.SetModified();
+ }
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::IsRedlineOn() const
+{
+ return IDocumentRedlineAccess::IsRedlineOn(meRedlineMode);
+}
+
+bool DocumentRedlineManager::IsIgnoreRedline() const
+{
+ return (nsRedlineMode_t::REDLINE_IGNORE & meRedlineMode);
+}
+
+void DocumentRedlineManager::SetRedlineMode_intern(RedlineMode_t eMode)
+{
+ meRedlineMode = eMode;
+}
+
+const SwRedlineTbl& DocumentRedlineManager::GetRedlineTbl() const
+{
+ return *mpRedlineTbl;
+}
+
+SwRedlineTbl& DocumentRedlineManager::GetRedlineTbl()
+{
+ return *mpRedlineTbl;
+}
+
+const SwExtraRedlineTbl& DocumentRedlineManager::GetExtraRedlineTbl() const
+{
+ return *mpExtraRedlineTbl;
+}
+
+SwExtraRedlineTbl& DocumentRedlineManager::GetExtraRedlineTbl()
+{
+ return *mpExtraRedlineTbl;
+}
+
+bool DocumentRedlineManager::HasExtraRedlineTbl() const
+{
+ return mpExtraRedlineTbl ? true : false;
+}
+
+bool DocumentRedlineManager::IsInRedlines(const SwNode & rNode) const
+{
+ SwPosition aPos(rNode);
+ SwNode & rEndOfRedlines = m_rSwdoc.GetNodes().GetEndOfRedlines();
+ SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),
+ SwPosition(rEndOfRedlines));
+
+ return aPam.ContainsPosition(aPos);
+}
+
+bool DocumentRedlineManager::IsRedlineMove() const
+{
+ return mbIsRedlineMove;
+}
+
+void DocumentRedlineManager::SetRedlineMove(bool bFlag)
+{
+ mbIsRedlineMove = bFlag;
+}
+
+/*
+Text means Text not "polluted" by Redlines.
+
+Behaviour of Insert-Redline:
+ - in the Text - insert Redline Object
+ - in InsertRedline (own) - ignore, existing is extended
+ - in InsertRedline (others) - split up InsertRedline and
+ insert Redline Object
+ - in DeleteRedline - split up DeleteRedline or
+ move at the end/beginning
+
+Behaviour of Delete-Redline:
+ - in the Text - insert Redline Object
+ - in DeleteRedline (own/others) - ignore
+ - in InsertRedline (own) - ignore, but delete character
+ - in InsertRedline (others) - split up InsertRedline and
+ insert Redline Object
+ - Text and own Insert overlap - delete Text in the own Insert,
+ extend in the other Text
+ (up to the Insert!)
+ - Text and other Insert overlap - insert Redline Object, the
+ other Insert is overlapped by
+ the Delete
+*/
+bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCallDelete )
+{
+ bool bMerged = false;
+ _CHECK_REDLINE( *this )
+
+ if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
+ {
+ pNewRedl->InvalidateRange();
+
+ if( m_rSwdoc.IsAutoFmtRedline() )
+ {
+ pNewRedl->SetAutoFmtFlag();
+ if( mpAutoFmtRedlnComment && !mpAutoFmtRedlnComment->isEmpty() )
+ {
+ pNewRedl->SetComment( *mpAutoFmtRedlnComment );
+ pNewRedl->SetSeqNo( mnAutoFmtRedlnCommentNo );
+ }
+ }
+
+ SwPosition* pStt = pNewRedl->Start(),
+ * pEnd = pStt == pNewRedl->GetPoint() ? pNewRedl->GetMark()
+ : pNewRedl->GetPoint();
+ {
+ SwTxtNode* pTxtNode = pStt->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ if( pStt->nContent > 0 )
+ {
+ OSL_ENSURE( false, "Redline start: non-text-node with content" );
+ pStt->nContent = 0;
+ }
+ }
+ else
+ {
+ if( pStt->nContent > pTxtNode->Len() )
+ {
+ OSL_ENSURE( false, "Redline start: index behind text" );
+ pStt->nContent = pTxtNode->Len();
+ }
+ }
+ pTxtNode = pEnd->nNode.GetNode().GetTxtNode();
+ if( pTxtNode == NULL )
+ {
+ if( pEnd->nContent > 0 )
+ {
+ OSL_ENSURE( false, "Redline end: non-text-node with content" );
+ pEnd->nContent = 0;
+ }
+ }
+ else
+ {
+ if( pEnd->nContent > pTxtNode->Len() )
+ {
+ OSL_ENSURE( false, "Redline end: index behind text" );
+ pEnd->nContent = pTxtNode->Len();
+ }
+ }
+ }
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ { // Do not insert empty redlines
+ delete pNewRedl;
+ return false;
+ }
+ bool bCompress = false;
+ sal_uInt16 n = 0;
+ // look up the first Redline for the starting position
+ if( !GetRedline( *pStt, &n ) && n )
+ --n;
+ bool bDec = false;
+
+ for( ; pNewRedl && n < mpRedlineTbl->size(); bDec ? n : ++n )
+ {
+ bDec = false;
+
+ SwRangeRedline* pRedl = (*mpRedlineTbl)[ n ];
+ SwPosition* pRStt = pRedl->Start(),
+ * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
+ : pRedl->GetPoint();
+
+ // #i8518# remove empty redlines while we're at it
+ if( ( *pRStt == *pREnd ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ mpRedlineTbl->DeleteAndDestroy(n);
+ continue;
+ }
+
+ SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
+
+ switch( pNewRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ if( pRedl->IsOwnRedline( *pNewRedl ) )
+ {
+ bool bDelete = false;
+
+ // Merge if applicable?
+ if( (( POS_BEHIND == eCmpPos &&
+ IsPrevPos( *pREnd, *pStt ) ) ||
+ ( POS_COLLIDE_START == eCmpPos ) ||
+ ( POS_OVERLAP_BEHIND == eCmpPos ) ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ ( n+1 >= (sal_uInt16)mpRedlineTbl->size() ||
+ ( *(*mpRedlineTbl)[ n+1 ]->Start() >= *pEnd &&
+ *(*mpRedlineTbl)[ n+1 ]->Start() != *pREnd ) ) )
+ {
+ pRedl->SetEnd( *pEnd, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ }
+
+ bMerged = true;
+ bDelete = true;
+ }
+ else if( (( POS_BEFORE == eCmpPos &&
+ IsPrevPos( *pEnd, *pRStt ) ) ||
+ ( POS_COLLIDE_END == eCmpPos ) ||
+ ( POS_OVERLAP_BEFORE == eCmpPos ) ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ ( !n ||
+ *(*mpRedlineTbl)[ n-1 ]->End() != *pRStt ))
+ {
+ pRedl->SetStart( *pStt, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+
+ bMerged = true;
+ bDelete = true;
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // own insert-over-insert redlines:
+ // just scrap the inside ones
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ {
+ *pStt = *pREnd;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ bDelete = true;
+ }
+ else if( POS_OVERLAP_BEFORE == eCmpPos )
+ {
+ *pEnd = *pRStt;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ bDelete = true;
+ }
+ else if( POS_INSIDE == eCmpPos || POS_EQUAL == eCmpPos)
+ bDelete = true;
+
+ if( bDelete )
+ {
+ delete pNewRedl, pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ else if( POS_INSIDE == eCmpPos )
+ {
+ // split up
+ if( *pEnd != *pREnd )
+ {
+ SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ mpRedlineTbl->Insert( pCpy );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ }
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // handle overlapping redlines in broken documents
+
+ // split up the new redline, since it covers the
+ // existing redline. Insert the first part, and
+ // progress with the remainder as usual
+ SwRangeRedline* pSplit = new SwRangeRedline( *pNewRedl );
+ pSplit->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd );
+ mpRedlineTbl->Insert( pSplit );
+ if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ else if ( POS_OVERLAP_BEHIND == eCmpPos )
+ {
+ // handle overlapping redlines in broken documents
+ pNewRedl->SetStart( *pREnd );
+ }
+ else if ( POS_OVERLAP_BEFORE == eCmpPos )
+ {
+ // handle overlapping redlines in broken documents
+ *pEnd = *pRStt;
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ if( POS_INSIDE == eCmpPos )
+ {
+ // split up
+ if( *pEnd != *pREnd )
+ {
+ SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ mpRedlineTbl->Insert( pCpy );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ {
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ }
+ }
+ else if ( POS_OUTSIDE == eCmpPos )
+ {
+ // handle overlapping redlines in broken documents
+
+ // split up the new redline, since it covers the
+ // existing redline. Insert the first part, and
+ // progress with the remainder as usual
+ SwRangeRedline* pSplit = new SwRangeRedline( *pNewRedl );
+ pSplit->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd );
+ mpRedlineTbl->Insert( pSplit );
+ if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
+ {
+ delete pNewRedl;
+ pNewRedl = 0;
+ bCompress = true;
+ }
+ }
+ else if ( POS_EQUAL == eCmpPos )
+ {
+ // handle identical redlines in broken documents
+ // delete old (delete) redline
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if ( POS_OVERLAP_BEHIND == eCmpPos )
+ { // Another workaround for broken redlines
+ pNewRedl->SetStart( *pREnd );
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pStt, pREnd );
+ if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
+ {
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ // Overlaps the current one completely or has the
+ // same dimension, delete the old one
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ break;
+
+ case POS_INSIDE:
+ // Overlaps the current one completely,
+ // split or shorten the new one
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
+ mpRedlineTbl->DeleteAndDestroy( n );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( eCmpPos )
+ {
+ case POS_OUTSIDE:
+ {
+ // Overlaps the current one completely,
+ // split the new one
+ if( *pEnd != *pREnd )
+ {
+ SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
+ pNew->SetStart( *pREnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ }
+ break;
+
+ case POS_INSIDE:
+ case POS_EQUAL:
+ delete pNewRedl, pNewRedl = 0;
+ bCompress = true;
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ case POS_OVERLAP_BEHIND:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ))
+ {
+ // If that's the case we can merge it, meaning
+ // the new one covers this well
+ if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pREnd, pStt );
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_COLLIDE_START:
+ case POS_COLLIDE_END:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ) )
+ {
+ if( IsHideChanges( meRedlineMode ))
+ {
+ // Before we can merge, we make it visible!
+ // We insert temporarily so that pNew is
+ // also dealt with when moving the indices.
+ mpRedlineTbl->Insert( pNewRedl );
+ pRedl->Show();
+ mpRedlineTbl->Remove( pNewRedl );
+ pRStt = pRedl->Start();
+ pREnd = pRedl->End();
+ }
+
+ // If that's the case we can merge it, meaning
+ // the new one covers this well
+ if( POS_COLLIDE_START == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+
+ // delete current (below), and restart process with
+ // previous
+ sal_uInt16 nToBeDeleted = n;
+ bDec = true;
+
+ if( *(pNewRedl->Start()) <= *pREnd )
+ {
+ // Whoooah, we just extended the new 'redline'
+ // beyond previous redlines, so better start
+ // again. Of course this is not supposed to
+ // happen, and in an ideal world it doesn't,
+ // but unfortunately this code is buggy and
+ // totally rotten so it does happen and we
+ // better fix it.
+ n = 0;
+ bDec = true;
+ }
+
+ mpRedlineTbl->DeleteAndDestroy( nToBeDeleted );
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ // b62341295: Do not throw away redlines
+ // even if they are not allowed to be combined
+ RedlineMode_t eOld = meRedlineMode;
+ if( !( eOld & nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES ) &&
+ pRedl->IsOwnRedline( *pNewRedl ) )
+ {
+
+ // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
+ // The ShowMode needs to be retained!
+ meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ switch( eCmpPos )
+ {
+ case POS_EQUAL:
+ bCompress = true;
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ // no break!
+
+ case POS_INSIDE:
+ if( bCallDelete )
+ {
+ meRedlineMode = (RedlineMode_t)(meRedlineMode | nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES);
+
+ // DeleteAndJoin does not yield the
+ // desired result if there is no paragraph to
+ // join with, i.e. at the end of the document.
+ // For this case, we completely delete the
+ // paragraphs (if, of course, we also start on
+ // a paragraph boundary).
+ if( (pStt->nContent == 0) &&
+ pEnd->nNode.GetNode().IsEndNode() )
+ {
+ pEnd->nNode--;
+ pEnd->nContent.Assign(
+ pEnd->nNode.GetNode().GetTxtNode(), 0);
+ m_rSwdoc.getIDocumentContentOperations().DelFullPara( *pNewRedl );
+ }
+ else
+ m_rSwdoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
+
+ bCompress = true;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ break;
+
+ case POS_OUTSIDE:
+ {
+ mpRedlineTbl->Remove( n );
+ bDec = true;
+ // We insert temporarily so that pNew is
+ // also dealt with when moving the indices.
+ if( bCallDelete )
+ {
+ mpRedlineTbl->Insert( pNewRedl );
+ m_rSwdoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
+ if( !mpRedlineTbl->Remove( pNewRedl ) )
+ pNewRedl = 0;
+ }
+ delete pRedl;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ {
+ SwPaM aPam( *pRStt, *pEnd );
+
+ if( *pEnd == *pREnd )
+ mpRedlineTbl->DeleteAndDestroy( n );
+ else
+ {
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ }
+
+ if( bCallDelete )
+ {
+ // We insert temporarily so that pNew is
+ // also dealt with when moving the indices.
+ mpRedlineTbl->Insert( pNewRedl );
+ m_rSwdoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+ if( !mpRedlineTbl->Remove( pNewRedl ) )
+ pNewRedl = 0;
+ n = 0; // re-initialize
+ }
+ bDec = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ {
+ SwPaM aPam( *pStt, *pREnd );
+
+ if( *pStt == *pRStt )
+ {
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+
+ if( bCallDelete )
+ {
+ // We insert temporarily so that pNew is
+ // also dealt with when moving the indices.
+ mpRedlineTbl->Insert( pNewRedl );
+ m_rSwdoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+ if( !mpRedlineTbl->Remove( pNewRedl ) )
+ pNewRedl = 0;
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ meRedlineMode = eOld;
+ }
+ else
+ {
+ // it may be necessary to split the existing redline in
+ // two. In this case, pRedl will be changed to cover
+ // only part of it's former range, and pNew will cover
+ // the remainder.
+ SwRangeRedline* pNew = 0;
+
+ switch( eCmpPos )
+ {
+ case POS_EQUAL:
+ {
+ pRedl->PushData( *pNewRedl );
+ delete pNewRedl, pNewRedl = 0;
+ if( IsHideChanges( meRedlineMode ))
+ pRedl->Hide();
+ bCompress = true;
+ }
+ break;
+
+ case POS_INSIDE:
+ {
+ if( *pRStt == *pStt )
+ {
+ // #i97421#
+ // redline w/out extent loops
+ if (*pStt != *pEnd)
+ {
+ pNewRedl->PushData( *pRedl, false );
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ }
+ }
+ else
+ {
+ pNewRedl->PushData( *pRedl, false );
+ if( *pREnd != *pEnd )
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ }
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ }
+ }
+ }
+ break;
+
+ case POS_OUTSIDE:
+ {
+ pRedl->PushData( *pNewRedl );
+ if( *pEnd == *pREnd )
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ else
+ {
+ pNew = new SwRangeRedline( *pNewRedl );
+ pNew->SetEnd( *pRStt );
+ pNewRedl->SetStart( *pREnd, pStt );
+ }
+ bCompress = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ {
+ if( *pEnd == *pREnd )
+ {
+ pRedl->PushData( *pNewRedl );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ if( IsHideChanges( meRedlineMode ))
+ {
+ mpRedlineTbl->Insert( pNewRedl );
+ pRedl->Hide();
+ mpRedlineTbl->Remove( pNewRedl );
+ }
+ }
+ else
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->PushData( *pNewRedl );
+ pNew->SetEnd( *pEnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ pRedl->SetStart( *pNew->End(), pRStt ) ;
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ bDec = true;
+ }
+ }
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ {
+ if( *pStt == *pRStt )
+ {
+ pRedl->PushData( *pNewRedl );
+ pNewRedl->SetStart( *pREnd, pStt );
+ if( IsHideChanges( meRedlineMode ))
+ {
+ mpRedlineTbl->Insert( pNewRedl );
+ pRedl->Hide();
+ mpRedlineTbl->Remove( pNewRedl );
+ }
+ }
+ else
+ {
+ pNew = new SwRangeRedline( *pRedl );
+ pNew->PushData( *pNewRedl );
+ pNew->SetStart( *pStt );
+ pNewRedl->SetStart( *pREnd, pStt );
+ pRedl->SetEnd( *pNew->Start(), pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ // insert the pNew part (if it exists)
+ if( pNew )
+ {
+ mpRedlineTbl->Insert( pNew );
+
+ // pNew must be deleted if Insert() wasn't
+ // successful. But that can't happen, since pNew is
+ // part of the original pRedl redline.
+ // OSL_ENSURE( bRet, "Can't insert existing redline?" );
+
+ // restart (now with pRedl being split up)
+ n = 0;
+ bDec = true;
+ }
+ }
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ // Overlaps the current one completely or has the
+ // same dimension, delete the old one
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ break;
+
+ case POS_INSIDE:
+ // Overlaps the current one completely,
+ // split or shorten the new one
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ if( ( *pStt == *pRStt ) &&
+ ( pRedl->GetContentIdx() == NULL ) )
+ mpRedlineTbl->DeleteAndDestroy( n );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ }
+ else
+ pRedl->SetEnd( *pStt, pREnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( pRedl->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ case nsRedlineType_t::REDLINE_DELETE:
+ switch( eCmpPos )
+ {
+ case POS_OVERLAP_BEFORE:
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pNewRedl->SetStart( *pREnd, pStt );
+ break;
+
+ case POS_EQUAL:
+ case POS_INSIDE:
+ delete pNewRedl, pNewRedl = 0;
+ break;
+
+ case POS_OUTSIDE:
+ // Overlaps the current one completely,
+ // split or shorten the new one
+ if( *pEnd != *pREnd )
+ {
+ if( *pEnd != *pRStt )
+ {
+ SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
+ pNew->SetStart( *pREnd );
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ }
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+ default:
+ break;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ switch( eCmpPos )
+ {
+ case POS_OUTSIDE:
+ case POS_EQUAL:
+ {
+ // Overlaps the current one completely or has the
+ // same dimension, delete the old one
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+
+ case POS_INSIDE:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ))
+ // own one can be ignored completely
+ delete pNewRedl, pNewRedl = 0;
+
+ else if( *pREnd == *pEnd )
+ // or else only shorten the current one
+ pRedl->SetEnd( *pStt, pREnd );
+ else if( *pRStt == *pStt )
+ {
+ // or else only shorten the current one
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl, n );
+ bDec = true;
+ }
+ else
+ {
+ // If it lies completely within the current one
+ // we need to split it
+ SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
+ pNew->SetStart( *pEnd );
+ pRedl->SetEnd( *pStt, pREnd );
+ AppendRedline( pNew, bCallDelete );
+ n = 0; // re-initialize
+ bDec = true;
+ }
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ case POS_OVERLAP_BEHIND:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ))
+ {
+ // If that's the case we can merge it, meaning
+ // the new one covers this well
+ if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pRStt, pStt );
+ else
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = false;
+ }
+ else if( POS_OVERLAP_BEHIND == eCmpPos )
+ pNewRedl->SetStart( *pREnd, pStt );
+ else
+ pNewRedl->SetEnd( *pRStt, pEnd );
+ break;
+
+ case POS_COLLIDE_END:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ) && n &&
+ *(*mpRedlineTbl)[ n-1 ]->End() < *pStt )
+ {
+ // If that's the case we can merge it, meaning
+ // the new one covers this well
+ pNewRedl->SetEnd( *pREnd, pEnd );
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+ case POS_COLLIDE_START:
+ if( pRedl->IsOwnRedline( *pNewRedl ) &&
+ pRedl->CanCombine( *pNewRedl ) &&
+ n+1 < (sal_uInt16)mpRedlineTbl->size() &&
+ *(*mpRedlineTbl)[ n+1 ]->Start() < *pEnd )
+ {
+ // If that's the case we can merge it, meaning
+ // the new one covers this well
+ pNewRedl->SetStart( *pRStt, pStt );
+ mpRedlineTbl->DeleteAndDestroy( n );
+ bDec = true;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case nsRedlineType_t::REDLINE_FMTCOLL:
+ // How should we behave here?
+ // insert as is
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( pNewRedl )
+ {
+ if( ( *pStt == *pEnd ) &&
+ ( pNewRedl->GetContentIdx() == NULL ) )
+ { // Do not insert empty redlines
+ delete pNewRedl;
+ pNewRedl = 0;
+ }
+ else
+ mpRedlineTbl->Insert( pNewRedl );
+ }
+
+ if( bCompress )
+ CompressRedlines();
+ }
+ else
+ {
+ if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
+ {
+ RedlineMode_t eOld = meRedlineMode;
+ // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
+ // The ShowMode needs to be retained!
+ meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ m_rSwdoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
+ meRedlineMode = eOld;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ }
+ _CHECK_REDLINE( *this )
+
+ return ( 0 != pNewRedl ) || bMerged;
+}
+
+bool DocumentRedlineManager::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool bCallDelete )
+{
+ (void)bCallDelete;
+
+ // #TODO - equivelant for 'SwTableRowRedline'
+ bool bMerged = false;
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
+ {
+ // #TODO - equivelant for 'SwTableRowRedline'
+ /*
+ pNewRedl->InvalidateRange();
+ */
+
+ // Make equivelant of 'AppendRedline' checks inside here too
+
+ mpExtraRedlineTbl->Insert( pNewRedl );
+ }
+ else
+ {
+ // TO DO - equivelant for 'SwTableRowRedline'
+ /*
+ if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
+ {
+ RedlineMode_t eOld = meRedlineMode;
+ // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
+ // The ShowMode needs to be retained!
+ meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ DeleteAndJoin( *pNewRedl );
+ meRedlineMode = eOld;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ */
+ }
+ // #TODO - equivelant for 'SwTableRowRedline'
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ return ( 0 != pNewRedl ) || bMerged;
+}
+
+bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRedl, bool bCallDelete )
+{
+ (void)bCallDelete;
+
+ // #TODO - equivelant for 'SwTableCellRedline'
+ bool bMerged = false;
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
+ {
+ // #TODO - equivelant for 'SwTableCellRedline'
+ /*
+ pNewRedl->InvalidateRange();
+ */
+
+ // Make equivelant of 'AppendRedline' checks inside here too
+
+ mpExtraRedlineTbl->Insert( pNewRedl );
+ }
+ else
+ {
+ // TO DO - equivelant for 'SwTableCellRedline'
+ /*
+ if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
+ {
+ RedlineMode_t eOld = meRedlineMode;
+ // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
+ // The ShowMode needs to be retained!
+ meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
+ DeleteAndJoin( *pNewRedl );
+ meRedlineMode = eOld;
+ }
+ delete pNewRedl, pNewRedl = 0;
+ */
+ }
+ // #TODO - equivelant for 'SwTableCellRedline'
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ return ( 0 != pNewRedl ) || bMerged;
+}
+
+void DocumentRedlineManager::CompressRedlines()
+{
+ _CHECK_REDLINE( *this )
+
+ void (SwRangeRedline::*pFnc)(sal_uInt16) = 0;
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode )
+ {
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE:
+ pFnc = &SwRangeRedline::Show;
+ break;
+ case nsRedlineMode_t::REDLINE_SHOW_INSERT:
+ pFnc = &SwRangeRedline::Hide;
+ break;
+ }
+
+ // Try to merge identical ones
+ for( sal_uInt16 n = 1; n < mpRedlineTbl->size(); ++n )
+ {
+ SwRangeRedline* pPrev = (*mpRedlineTbl)[ n-1 ],
+ * pCur = (*mpRedlineTbl)[ n ];
+ const SwPosition* pPrevStt = pPrev->Start(),
+ * pPrevEnd = pPrevStt == pPrev->GetPoint()
+ ? pPrev->GetMark() : pPrev->GetPoint();
+ const SwPosition* pCurStt = pCur->Start(),
+ * pCurEnd = pCurStt == pCur->GetPoint()
+ ? pCur->GetMark() : pCur->GetPoint();
+ if( *pPrevEnd == *pCurStt && pPrev->CanCombine( *pCur ) &&
+ pPrevStt->nNode.GetNode().StartOfSectionNode() ==
+ pCurEnd->nNode.GetNode().StartOfSectionNode() &&
+ !pCurEnd->nNode.GetNode().StartOfSectionNode()->IsTableNode() )
+ {
+ // we then can merge them
+ pPrev->Show();
+ pCur->Show();
+
+ pPrev->SetEnd( *pCur->End() );
+ mpRedlineTbl->DeleteAndDestroy( n );
+ --n;
+ if( pFnc )
+ (pPrev->*pFnc)(0);
+ }
+ }
+ _CHECK_REDLINE( *this )
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange )
+{
+ bool bChg = false;
+ sal_uInt16 n = 0;
+ const SwPosition* pStt = rRange.Start(),
+ * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
+ : rRange.GetPoint();
+ GetRedline( *pStt, &n );
+ for( ; n < mpRedlineTbl->size() ; ++n )
+ {
+ SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
+ SwPosition* pTStt = pTmp->Start(),
+ * pTEnd = pTStt == pTmp->GetPoint() ? pTmp->GetMark()
+ : pTmp->GetPoint();
+ if( *pTStt <= *pStt && *pStt <= *pTEnd &&
+ *pTStt <= *pEnd && *pEnd <= *pTEnd )
+ {
+ bChg = true;
+ int nn = 0;
+ if( *pStt == *pTStt )
+ nn += 1;
+ if( *pEnd == *pTEnd )
+ nn += 2;
+
+ SwRangeRedline* pNew = 0;
+ switch( nn )
+ {
+ case 0:
+ pNew = new SwRangeRedline( *pTmp );
+ pTmp->SetEnd( *pStt, pTEnd );
+ pNew->SetStart( *pEnd );
+ break;
+
+ case 1:
+ *pTStt = *pEnd;
+ break;
+
+ case 2:
+ *pTEnd = *pStt;
+ break;
+
+ case 3:
+ pTmp->InvalidateRange();
+ mpRedlineTbl->DeleteAndDestroy( n-- );
+ pTmp = 0;
+ break;
+ }
+ if( pTmp && !pTmp->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pTmp, n );
+ }
+ if( pNew )
+ mpRedlineTbl->Insert( pNew, n );
+ }
+ else if( *pEnd < *pTStt )
+ break;
+ }
+ return bChg;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
+ sal_uInt16 nDelType )
+{
+ if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & meRedlineMode ||
+ !rRange.HasMark() || *rRange.GetMark() == *rRange.GetPoint() )
+ return false;
+
+ bool bChg = false;
+
+ if (bSaveInUndo && m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange );
+ if( pUndo->GetRedlSaveCount() )
+ {
+ m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+ else
+ delete pUndo;
+ }
+
+ const SwPosition* pStt = rRange.Start(),
+ * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
+ : rRange.GetPoint();
+ sal_uInt16 n = 0;
+ GetRedline( *pStt, &n );
+ for( ; n < mpRedlineTbl->size() ; ++n )
+ {
+ SwRangeRedline* pRedl = (*mpRedlineTbl)[ n ];
+ if( USHRT_MAX != nDelType && nDelType != pRedl->GetType() )
+ continue;
+
+ SwPosition* pRStt = pRedl->Start(),
+ * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
+ : pRedl->GetPoint();
+ switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) )
+ {
+ case POS_EQUAL:
+ case POS_OUTSIDE:
+ pRedl->InvalidateRange();
+ mpRedlineTbl->DeleteAndDestroy( n-- );
+ bChg = true;
+ break;
+
+ case POS_OVERLAP_BEFORE:
+ pRedl->InvalidateRange();
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ --n;
+ break;
+
+ case POS_OVERLAP_BEHIND:
+ pRedl->InvalidateRange();
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ break;
+
+ case POS_INSIDE:
+ {
+ // this one needs to be splitted
+ pRedl->InvalidateRange();
+ if( *pRStt == *pStt )
+ {
+ pRedl->SetStart( *pEnd, pRStt );
+ // re-insert
+ mpRedlineTbl->Remove( n );
+ mpRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ else
+ {
+ SwRangeRedline* pCpy;
+ if( *pREnd != *pEnd )
+ {
+ pCpy = new SwRangeRedline( *pRedl );
+ pCpy->SetStart( *pEnd );
+ }
+ else
+ pCpy = 0;
+ pRedl->SetEnd( *pStt, pREnd );
+ if( !pRedl->HasValidRange() )
+ {
+ // re-insert
+ mpRedlineTbl->Remove( pRedl );
+ mpRedlineTbl->Insert( pRedl );
+ --n;
+ }
+ if( pCpy )
+ mpRedlineTbl->Insert( pCpy );
+ }
+ }
+ break;
+
+ case POS_COLLIDE_END:
+ case POS_BEFORE:
+ n = mpRedlineTbl->size();
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( bChg )
+ m_rSwdoc.SetModified();
+
+ return bChg;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::DeleteRedline( const SwStartNode& rNode, bool bSaveInUndo,
+ sal_uInt16 nDelType )
+{
+ SwPaM aTemp(*rNode.EndOfSectionNode(), rNode);
+ return DeleteRedline(aTemp, bSaveInUndo, nDelType);
+}
+
+sal_uInt16 DocumentRedlineManager::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const
+{
+ const sal_uLong nNdIdx = rNd.GetIndex();
+ for( sal_uInt16 n = 0; n < mpRedlineTbl->size() ; ++n )
+ {
+ const SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
+ sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
+ nMk = pTmp->GetMark()->nNode.GetIndex();
+ if( nPt < nMk ) { long nTmp = nMk; nMk = nPt; nPt = nTmp; }
+
+ if( ( USHRT_MAX == nType || nType == pTmp->GetType()) &&
+ nMk <= nNdIdx && nNdIdx <= nPt )
+ return n;
+
+ if( nMk > nNdIdx )
+ break;
+ }
+ return USHRT_MAX;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+const SwRangeRedline* DocumentRedlineManager::GetRedline( const SwPosition& rPos,
+ sal_uInt16* pFndPos ) const
+{
+ sal_uInt16 nO = mpRedlineTbl->size(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ const SwRangeRedline* pRedl = (*mpRedlineTbl)[ nM ];
+ const SwPosition* pStt = pRedl->Start();
+ const SwPosition* pEnd = pStt == pRedl->GetPoint()
+ ? pRedl->GetMark()
+ : pRedl->GetPoint();
+ if( pEnd == pStt
+ ? *pStt == rPos
+ : ( *pStt <= rPos && rPos < *pEnd ) )
+ {
+ while( nM && rPos == *(*mpRedlineTbl)[ nM - 1 ]->End() &&
+ rPos == *(*mpRedlineTbl)[ nM - 1 ]->Start() )
+ {
+ --nM;
+ pRedl = (*mpRedlineTbl)[ nM ];
+ }
+ // if there are format and insert changes in the same position
+ // show insert change first.
+ // since the redlines are sorted by position, only check the redline
+ // before and after the current redline
+ if( nsRedlineType_t::REDLINE_FORMAT == pRedl->GetType() )
+ {
+ if( nM && rPos >= *(*mpRedlineTbl)[ nM - 1 ]->Start() &&
+ rPos <= *(*mpRedlineTbl)[ nM - 1 ]->End() &&
+ ( nsRedlineType_t::REDLINE_INSERT == (*mpRedlineTbl)[ nM - 1 ]->GetType() ) )
+ {
+ --nM;
+ pRedl = (*mpRedlineTbl)[ nM ];
+ }
+ else if( ( nM + 1 ) <= nO && rPos >= *(*mpRedlineTbl)[ nM + 1 ]->Start() &&
+ rPos <= *(*mpRedlineTbl)[ nM + 1 ]->End() &&
+ ( nsRedlineType_t::REDLINE_INSERT == (*mpRedlineTbl)[ nM + 1 ]->GetType() ) )
+ {
+ ++nM;
+ pRedl = (*mpRedlineTbl)[ nM ];
+ }
+ }
+
+ if( pFndPos )
+ *pFndPos = nM;
+ return pRedl;
+ }
+ else if( *pEnd <= rPos )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pFndPos )
+ *pFndPos = nU;
+ return 0;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
+{
+ bool bRet = false;
+
+ // Switch to visible in any case
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
+
+ SwRangeRedline* pTmp = (*mpRedlineTbl)[ nPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UndoArg1, pTmp->GetDescr());
+ m_rSwdoc.GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter);
+ }
+
+ int nLoopCnt = 2;
+ sal_uInt16 nSeqNo = pTmp->GetSeqNo();
+
+ do {
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) );
+ m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ bRet |= lcl_AcceptRedline( *mpRedlineTbl, nPos, bCallDelete );
+
+ if( nSeqNo )
+ {
+ if( USHRT_MAX == nPos )
+ nPos = 0;
+ sal_uInt16 nFndPos = 2 == nLoopCnt
+ ? mpRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
+ : mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
+ if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
+ USHRT_MAX != ( nFndPos =
+ mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
+ pTmp = (*mpRedlineTbl)[ nPos = nFndPos ];
+ else
+ nLoopCnt = 0;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+
+ if( bRet )
+ {
+ CompressRedlines();
+ m_rSwdoc.SetModified();
+ }
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_rSwdoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ }
+ return bRet;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
+{
+ // Switch to visible in any case
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
+
+ // The Selection is only in the ContentSection. If there are Redlines
+ // to Non-ContentNodes before or after that, then the Selections
+ // expand to them.
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ lcl_AdjustRedlineRange( aPam );
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_rSwdoc.GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL );
+ m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam ));
+ }
+
+ int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, *mpRedlineTbl,
+ bCallDelete, aPam );
+ if( nRet > 0 )
+ {
+ CompressRedlines();
+ m_rSwdoc.SetModified();
+ }
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ OUString aTmpStr;
+
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, OUString::number(nRet));
+ aTmpStr = aRewriter.Apply(OUString(SW_RES(STR_N_REDLINES)));
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, aTmpStr);
+
+ m_rSwdoc.GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter );
+ }
+ return nRet != 0;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
+{
+ bool bRet = false;
+
+ // Switch to visible in any case
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
+ SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
+
+ SwRangeRedline* pTmp = (*mpRedlineTbl)[ nPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UndoArg1, pTmp->GetDescr());
+ m_rSwdoc.GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter);
+ }
+
+ int nLoopCnt = 2;
+ sal_uInt16 nSeqNo = pTmp->GetSeqNo();
+
+ do {
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) );
+ m_rSwdoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ bRet |= lcl_RejectRedline( *mpRedlineTbl, nPos, bCallDelete );
+
+ if( nSeqNo )
+ {
+ if( USHRT_MAX == nPos )
+ nPos = 0;
+ sal_uInt16 nFndPos = 2 == nLoopCnt
+ ? mpRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
+ : mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
+ if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
+ USHRT_MAX != ( nFndPos =
+ mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
+ pTmp = (*mpRedlineTbl)[ nPos = nFndPos ];
+ else
+ nLoopCnt = 0;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+
+ if( bRet )
+ {
+ CompressRedlines();
+ m_rSwdoc.SetModified();
+ }
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_rSwdoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ }
+ return bRet;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+bool DocumentRedlineManager::RejectRedline( const SwPaM& rPam, bool bCallDelete )
+{
+ // Switch to visible in any case
+ if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
+ (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
+ SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
+
+ // The Selection is only in the ContentSection. If there are Redlines
+ // to Non-ContentNodes before or after that, then the Selections
+ // expand to them.
+ SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
+ lcl_AdjustRedlineRange( aPam );
+
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_rSwdoc.GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL );
+ m_rSwdoc.GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) );
+ }
+
+ int nRet = lcl_AcceptRejectRedl( lcl_RejectRedline, *mpRedlineTbl,
+ bCallDelete, aPam );
+ if( nRet > 0 )
+ {
+ CompressRedlines();
+ m_rSwdoc.SetModified();
+ }
+ if (m_rSwdoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ OUString aTmpStr;
+
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, OUString::number(nRet));
+ aTmpStr = aRewriter.Apply(OUString(SW_RES(STR_N_REDLINES)));
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, aTmpStr);
+
+ m_rSwdoc.GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter );
+ }
+
+ return nRet != 0;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+const SwRangeRedline* DocumentRedlineManager::SelNextRedline( SwPaM& rPam ) const
+{
+ rPam.DeleteMark();
+ rPam.SetMark();
+
+ SwPosition& rSttPos = *rPam.GetPoint();
+ SwPosition aSavePos( rSttPos );
+ bool bRestart;
+
+ // If the starting position points to the last valid ContentNode,
+ // we take the next Redline in any case.
+ sal_uInt16 n = 0;
+ const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, true );
+ if( pFnd )
+ {
+ const SwPosition* pEnd = pFnd->End();
+ if( !pEnd->nNode.GetNode().IsCntntNode() )
+ {
+ SwNodeIndex aTmp( pEnd->nNode );
+ SwCntntNode* pCNd = m_rSwdoc.GetNodes().GoPrevSection( &aTmp );
+ if( !pCNd || ( aTmp == rSttPos.nNode &&
+ pCNd->Len() == rSttPos.nContent.GetIndex() ))
+ pFnd = 0;
+ }
+ if( pFnd )
+ rSttPos = *pFnd->End();
+ }
+
+ do {
+ bRestart = false;
+
+ for( ; !pFnd && n < mpRedlineTbl->size(); ++n )
+ {
+ pFnd = (*mpRedlineTbl)[ n ];
+ if( pFnd->HasMark() && pFnd->IsVisible() )
+ {
+ *rPam.GetMark() = *pFnd->Start();
+ rSttPos = *pFnd->End();
+ break;
+ }
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ // Merge all of the same type and author that are
+ // consecutive into one Selection.
+ const SwPosition* pPrevEnd = pFnd->End();
+ while( ++n < mpRedlineTbl->size() )
+ {
+ const SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition *pRStt;
+ if( pFnd->GetType() == pTmp->GetType() &&
+ pFnd->GetAuthor() == pTmp->GetAuthor() &&
+ ( *pPrevEnd == *( pRStt = pTmp->Start() ) ||
+ IsPrevPos( *pPrevEnd, *pRStt )) )
+ {
+ pPrevEnd = pTmp->End();
+ rSttPos = *pPrevEnd;
+ }
+ else
+ break;
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ const SwRangeRedline* pSaveFnd = pFnd;
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = m_rSwdoc.GetNodes().GoNextSection( pIdx )) )
+ {
+ if( *pIdx <= rPam.GetPoint()->nNode )
+ rPam.GetMark()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ pIdx = &rPam.GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = m_rSwdoc.GetNodes().GoPrevSection( pIdx )) )
+ {
+ if( *pIdx >= rPam.GetMark()->nNode )
+ rPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
+ {
+ if( n < mpRedlineTbl->size() )
+ {
+ bRestart = true;
+ *rPam.GetPoint() = *pSaveFnd->End();
+ }
+ else
+ {
+ rPam.DeleteMark();
+ *rPam.GetPoint() = aSavePos;
+ }
+ pFnd = 0;
+ }
+ }
+ } while( bRestart );
+
+ return pFnd;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+const SwRangeRedline* DocumentRedlineManager::SelPrevRedline( SwPaM& rPam ) const
+{
+ rPam.DeleteMark();
+ rPam.SetMark();
+
+ SwPosition& rSttPos = *rPam.GetPoint();
+ SwPosition aSavePos( rSttPos );
+ bool bRestart;
+
+ // If the starting position points to the last valid ContentNode,
+ // we take the previous Redline in any case.
+ sal_uInt16 n = 0;
+ const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, false );
+ if( pFnd )
+ {
+ const SwPosition* pStt = pFnd->Start();
+ if( !pStt->nNode.GetNode().IsCntntNode() )
+ {
+ SwNodeIndex aTmp( pStt->nNode );
+ SwCntntNode* pCNd = m_rSwdoc.GetNodes().GoNextSection( &aTmp );
+ if( !pCNd || ( aTmp == rSttPos.nNode &&
+ !rSttPos.nContent.GetIndex() ))
+ pFnd = 0;
+ }
+ if( pFnd )
+ rSttPos = *pFnd->Start();
+ }
+
+ do {
+ bRestart = false;
+
+ while( !pFnd && 0 < n )
+ {
+ pFnd = (*mpRedlineTbl)[ --n ];
+ if( pFnd->HasMark() && pFnd->IsVisible() )
+ {
+ *rPam.GetMark() = *pFnd->End();
+ rSttPos = *pFnd->Start();
+ }
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ // Merge all of the same type and author that are
+ // consecutive into one Selection.
+ const SwPosition* pNextStt = pFnd->Start();
+ while( 0 < n )
+ {
+ const SwRangeRedline* pTmp = (*mpRedlineTbl)[ --n ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition *pREnd;
+ if( pFnd->GetType() == pTmp->GetType() &&
+ pFnd->GetAuthor() == pTmp->GetAuthor() &&
+ ( *pNextStt == *( pREnd = pTmp->End() ) ||
+ IsPrevPos( *pREnd, *pNextStt )) )
+ {
+ pNextStt = pTmp->Start();
+ rSttPos = *pNextStt;
+ }
+ else
+ {
+ ++n;
+ break;
+ }
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ const SwRangeRedline* pSaveFnd = pFnd;
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = m_rSwdoc.GetNodes().GoPrevSection( pIdx )) )
+ {
+ if( *pIdx >= rPam.GetPoint()->nNode )
+ rPam.GetMark()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd )
+ {
+ pIdx = &rPam.GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = m_rSwdoc.GetNodes().GoNextSection( pIdx )) )
+ {
+ if( *pIdx <= rPam.GetMark()->nNode )
+ rPam.GetPoint()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
+ {
+ if( n )
+ {
+ bRestart = true;
+ *rPam.GetPoint() = *pSaveFnd->Start();
+ }
+ else
+ {
+ rPam.DeleteMark();
+ *rPam.GetPoint() = aSavePos;
+ }
+ pFnd = 0;
+ }
+ }
+ } while( bRestart );
+
+ return pFnd;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+// Set comment at the Redline
+bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUString& rS )
+{
+ bool bRet = false;
+ const SwPosition* pStt = rPaM.Start(),
+ * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
+ : rPaM.GetPoint();
+ sal_uInt16 n = 0;
+ if( GetRedlineTbl().FindAtPosition( *pStt, n, true ) )
+ {
+ for( ; n < mpRedlineTbl->size(); ++n )
+ {
+ bRet = true;
+ SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
+ if( pStt != pEnd && *pTmp->Start() > *pEnd )
+ break;
+
+ pTmp->SetComment( rS );
+ if( *pTmp->End() >= *pEnd )
+ break;
+ }
+ }
+ if( bRet )
+ m_rSwdoc.SetModified();
+
+ return bRet;
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+// Create a new author if necessary
+sal_uInt16 DocumentRedlineManager::GetRedlineAuthor()
+{
+ return SW_MOD()->GetRedlineAuthor();
+}
+
+/// Insert new author into the Table for the Readers etc.
+sal_uInt16 DocumentRedlineManager::InsertRedlineAuthor( const OUString& rNew )
+{
+ return SW_MOD()->InsertRedlineAuthor(rNew);
+}
+
+void DocumentRedlineManager::UpdateRedlineAttr()
+{
+ const SwRedlineTbl& rTbl = GetRedlineTbl();
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
+ {
+ SwRangeRedline* pRedl = rTbl[ n ];
+ if( pRedl->IsVisible() )
+ pRedl->InvalidateRange();
+ }
+
+ // #TODO - add 'SwExtraRedlineTbl' also ?
+}
+
+const uno::Sequence <sal_Int8>& DocumentRedlineManager::GetRedlinePassword() const
+{
+ return maRedlinePasswd;
+}
+
+void DocumentRedlineManager::SetRedlinePassword(
+ /*[in]*/const uno::Sequence <sal_Int8>& rNewPassword)
+{
+ maRedlinePasswd = rNewPassword;
+ m_rSwdoc.SetModified();
+}
+
+/// Set comment text for the Redline, which is inserted later on via
+/// AppendRedline. Is used by Autoformat.
+/// A null pointer resets the mode. The pointer is not copied, so it
+/// needs to stay valid!
+void DocumentRedlineManager::SetAutoFmtRedlineComment( const OUString* pTxt, sal_uInt16 nSeqNo )
+{
+ m_rSwdoc.SetAutoFmtRedline( 0 != pTxt );
+ if( pTxt )
+ {
+ if( !mpAutoFmtRedlnComment )
+ mpAutoFmtRedlnComment = new OUString( *pTxt );
+ else
+ *mpAutoFmtRedlnComment = *pTxt;
+ }
+ else
+ delete mpAutoFmtRedlnComment, mpAutoFmtRedlnComment = 0;
+
+ mnAutoFmtRedlnCommentNo = nSeqNo;
+}
+
+#define MAX_REDLINE_COUNT 250
+
+void DocumentRedlineManager::checkRedlining(RedlineMode_t& _rReadlineMode)
+{
+ const SwRedlineTbl& rRedlineTbl = GetRedlineTbl();
+ SwEditShell* pEditShell = m_rSwdoc.GetEditShell();
+ Window* pParent = pEditShell ? pEditShell->GetWin() : NULL;
+ if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT
+ && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) )
+ {
+ MessageDialog aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
+ sal_uInt16 nResult = aQuery.Execute();
+ mbReadlineChecked = true;
+ if ( nResult == RET_YES )
+ {
+ sal_Int32 nMode = (sal_Int32)_rReadlineMode;
+ nMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ _rReadlineMode = (RedlineMode_t)nMode;
+ }
+ }
+}
+
+DocumentRedlineManager::~DocumentRedlineManager()
+{
+ delete mpRedlineTbl; mpRedlineTbl = 0;
+ delete mpExtraRedlineTbl; mpExtraRedlineTbl = 0;
+ delete mpAutoFmtRedlnComment; mpAutoFmtRedlnComment = 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index c6d3fcd88c6d..a7034e405865 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -28,6 +28,7 @@
#include <DocumentListsManager.hxx>
#include <DocumentOutlineNodesManager.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <DocumentRedlineManager.hxx>
#include <UndoManager.hxx>
#include <hintids.hxx>
#include <tools/shl.hxx>
@@ -361,6 +362,27 @@ IDocumentContentOperations & SwDoc::getIDocumentContentOperations()
return *m_pDocumentContentOperationsManager;
}
+//IDocumentRedlineAccess
+IDocumentRedlineAccess const & SwDoc::getIDocumentRedlineAccess() const
+{
+ return *m_pDocumentRedlineManager;
+}
+
+IDocumentRedlineAccess& SwDoc::getIDocumentRedlineAccess()
+{
+ return *m_pDocumentRedlineManager;
+}
+
+::sw::DocumentRedlineManager const & SwDoc::GetDocumentRedlineManager() const
+{
+ return *m_pDocumentRedlineManager;
+}
+
+::sw::DocumentRedlineManager& SwDoc::GetDocumentRedlineManager()
+{
+ return *m_pDocumentRedlineManager;
+}
+
/* Implementations the next Interface here */
/*
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 233637c34d88..68499060670c 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -27,6 +27,7 @@
#include <annotationmark.hxx>
#include <dcontact.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <xmloff/odffields.hxx>
#include <editsh.hxx>
@@ -1267,7 +1268,7 @@ void _DelBookmarks(
// Copy all Redlines which are in the move area into an array
// which holds all position information as offset.
// Assignement happens after moving.
- SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
+ SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
for(sal_uInt16 nCnt = 0; nCnt < rTbl.size(); ++nCnt )
{
// Is at position?
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 33ea33f5f44b..a03c3be42d07 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -28,6 +28,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -1628,7 +1629,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
SwPaM* pTmp = pDelRing;
// get the Author / TimeStamp from the "other" document info
- sal_uInt16 nAuthor = rDoc.GetRedlineAuthor();
+ sal_uInt16 nAuthor = rDoc.getIDocumentRedlineAccess().GetRedlineAuthor();
DateTime aTimeStamp( DateTime::SYSTEM );
SwDocShell *pDocShell(rDoc.GetDocShell());
OSL_ENSURE(pDocShell, "no SwDocShell");
@@ -1652,7 +1653,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
if( !aTmp.isEmpty() )
{
- nAuthor = rDoc.InsertRedlineAuthor( aTmp );
+ nAuthor = rDoc.getIDocumentRedlineAccess().InsertRedlineAuthor( aTmp );
aTimeStamp = aDT;
}
}
@@ -1680,14 +1681,14 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
(pContentNode) ? pContentNode->Len() : 0 );
}
- rDoc.DeleteRedline( *pTmp, false, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *pTmp, false, USHRT_MAX );
if (rDoc.GetIDocumentUndoRedo().DoesUndo())
{
SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, false )) ;
rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
}
- rDoc.AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true );
} while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
}
@@ -1748,7 +1749,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
}
do {
- if( rDoc.AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true) &&
+ if( rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true) &&
rDoc.GetIDocumentUndoRedo().DoesUndo())
{
SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, true ));
@@ -1805,9 +1806,9 @@ long SwDoc::CompareDoc( const SwDoc& rDoc )
SwDoc& rSrcDoc = (SwDoc&)rDoc;
bool bSrcModified = rSrcDoc.IsModified();
- RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode();
- rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
- SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT));
+ RedlineMode_t eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
+ getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT));
SwCompareData aD0( rSrcDoc );
SwCompareData aD1( *this );
@@ -1818,15 +1819,15 @@ long SwDoc::CompareDoc( const SwDoc& rDoc )
if( nRet )
{
- SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
+ getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
aD1.SetRedlinesToDoc( !bDocWasModified );
SetModified();
}
- rSrcDoc.SetRedlineMode( eSrcRedlMode );
- SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+ rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( eSrcRedlMode );
+ getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
if( !bSrcModified )
rSrcDoc.ResetModified();
@@ -1885,14 +1886,14 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 );
const sal_Int32 nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
pSrcRedl->GetDoc()->getIDocumentContentOperations().CopyRange(
*const_cast<SwPaM*>(static_cast<const SwPaM*>(pSrcRedl)),
*pDestRedl->GetPoint(), false );
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
pDestRedl->SetMark();
++aSaveNd;
@@ -1916,10 +1917,10 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
sal_uInt16 n = 0;
// find the first redline for StartPos
- if( !pDoc->GetRedline( *pDStt, &n ) && n )
+ if( !pDoc->getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n )
--n;
- const SwRedlineTbl& rRedlineTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rRedlineTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
for( ; n < rRedlineTbl.size(); ++n )
{
SwRangeRedline* pRedl = rRedlineTbl[ n ];
@@ -1958,7 +1959,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
? new SwUndoCompDoc( *pCpyRedl ) : 0;
// now modify doc: append redline, undo (and count)
- pDoc->AppendRedline( pCpyRedl, true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( pCpyRedl, true );
if( pUndo )
{
pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo);
@@ -1993,7 +1994,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
? new SwUndoCompDoc( *pDestRedl ) : 0;
// now modify doc: append redline, undo (and count)
- bool bRedlineAccepted = pDoc->AppendRedline( pDestRedl, true );
+ bool bRedlineAccepted = pDoc->getIDocumentRedlineAccess().AppendRedline( pDestRedl, true );
if( pUndo )
{
pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
@@ -2023,9 +2024,9 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
SwDoc& rSrcDoc = (SwDoc&)rDoc;
bool bSrcModified = rSrcDoc.IsModified();
- RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode();
- rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
- SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
+ RedlineMode_t eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
+ getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE );
SwCompareData aD0( rSrcDoc );
SwCompareData aD1( *this );
@@ -2038,7 +2039,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
// look for all insert redlines from the SourceDoc and determine their position in the DestDoc
_SaveMergeRedlines* pRing = 0;
- const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.GetRedlineTbl();
+ const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTbl();
sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
for( sal_uInt16 n = 0; n < rSrcRedlTbl.size(); ++n )
@@ -2064,9 +2065,9 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
if( pRing )
{
// Carry over all into DestDoc
- rSrcDoc.SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+ rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
- SetRedlineMode((RedlineMode_t)(
+ getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(
nsRedlineMode_t::REDLINE_ON |
nsRedlineMode_t::REDLINE_SHOW_INSERT |
nsRedlineMode_t::REDLINE_SHOW_DELETE));
@@ -2083,11 +2084,11 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
}
}
- rSrcDoc.SetRedlineMode( eSrcRedlMode );
+ rSrcDoc.getIDocumentRedlineAccess().SetRedlineMode( eSrcRedlMode );
if( !bSrcModified )
rSrcDoc.ResetModified();
- SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
+ getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 8891e1b12bb0..898809912971 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -188,7 +188,7 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
// fix redlines
{
- SwRedlineTbl& rTbl = *mpRedlineTbl;
+ SwRedlineTbl& rTbl = getIDocumentRedlineAccess().GetRedlineTbl();
for (sal_uInt16 n = 0; n < rTbl.size(); )
{
// is on position ??
@@ -306,7 +306,7 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
getIDocumentMarkAccess()->correctMarksRelative(rOldNode, rNewPos, nOffset);
{ // fix the Redlines
- SwRedlineTbl& rTbl = *mpRedlineTbl;
+ SwRedlineTbl& rTbl = getIDocumentRedlineAccess().GetRedlineTbl();
SwPosition aNewPos(rNewPos);
for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 4e081598720d..8520791fdc38 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -22,6 +22,7 @@
#include <txtftn.hxx>
#include <acorrect.hxx>
#include <UndoManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docsh.hxx>
#include <docary.hxx>
#include <doctxm.hxx>
@@ -228,15 +229,15 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
{
SwNode& rNd = rInsIdx.GetNode();
SwDoc* pDest = rNd.GetDoc();
- if( !pDest->GetRedlineTbl().empty() )
+ if( !pDest->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
sal_uInt16 nFndPos;
const SwPosition* pEnd;
SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetCntntNode(), nCnt ));
- pDest->GetRedline( aSrcPos, &nFndPos );
+ pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
const SwRangeRedline* pRedl;
while( nFndPos--
- && *( pEnd = ( pRedl = pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos
+ && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos
&& *pRedl->Start() < aSrcPos )
{
if( !pSavArr )
@@ -798,28 +799,6 @@ void SwDoc::DeleteAutoCorrExceptWord()
mpACEWord = 0;
}
-#define MAX_REDLINE_COUNT 250
-
-void SwDoc::checkRedlining(RedlineMode_t& _rReadlineMode)
-{
- const SwRedlineTbl& rRedlineTbl = GetRedlineTbl();
- SwEditShell* pEditShell = GetEditShell();
- Window* pParent = pEditShell ? pEditShell->GetWin() : NULL;
- if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT
- && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) )
- {
- MessageDialog aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
- sal_uInt16 nResult = aQuery.Execute();
- mbReadlineChecked = true;
- if ( nResult == RET_YES )
- {
- sal_Int32 nMode = (sal_Int32)_rReadlineMode;
- nMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
- _rReadlineMode = (RedlineMode_t)nMode;
- }
- }
-}
-
void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const
{
// This is a modified version of SwDoc::TransliterateText
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 38b8f15f5c9b..cf594d229f1a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1764,7 +1764,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
pRedl->SetExtraData( &aExtraData );
//TODO: Undo is still missing!
- AppendRedline( pRedl, true );
+ getIDocumentRedlineAccess().AppendRedline( pRedl, true );
}
SetTxtFmtColl( aPam, GetTxtCollFromPool( nPoolId ) );
@@ -1782,7 +1782,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
SwTxtNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
assert(pTNd);
- RedlineMode_t eOld = GetRedlineMode();
+ RedlineMode_t eOld = getIDocumentRedlineAccess().GetRedlineMode();
if (mbIsAutoFmtRedline)
{
@@ -1798,9 +1798,9 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
pRedl->SetExtraData( &aExtraData );
//TODO: Undo is still missing!
- AppendRedline( pRedl, true );
+ getIDocumentRedlineAccess().AppendRedline( pRedl, true );
- SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
}
const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
@@ -1828,7 +1828,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
endPam.SetMark();
getIDocumentContentOperations().InsertItemSet(endPam, currentSet, nsSetAttrMode::SETATTR_DEFAULT);
- SetRedlineMode_intern( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet)
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 5a94cc808cfa..b74340a7f6f8 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -32,6 +32,7 @@
#include <fmtanchr.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <DocumentSettingManager.hxx>
#include <DocumentContentOperationsManager.hxx>
#include <docary.hxx>
@@ -214,7 +215,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
// Deactivate Undo/Redline in any case
GetIDocumentUndoRedo().DoUndo(false);
- SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
+ getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(getIDocumentRedlineAccess().GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
OUString sExt = pFilter->GetSuffixes().getToken(0, ',');
if( sExt.isEmpty() )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index e96fb1e06bd5..3595506b482d 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -62,6 +62,7 @@
#include <ndole.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <DocumentSettingManager.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <DocumentContentOperationsManager.hxx>
@@ -826,10 +827,10 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
SwPaM* pTmp = (SwPaM*)&rPam;
bool bOldFlag = mbCopyIsMove;
bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo();
- bool const bOldRedlineMove(IsRedlineMove());
+ bool const bOldRedlineMove(getIDocumentRedlineAccess().IsRedlineMove());
mbCopyIsMove = true;
GetIDocumentUndoRedo().DoUndo(false);
- SetRedlineMove(true);
+ getIDocumentRedlineAccess().SetRedlineMove(true);
do {
if( pTmp->HasMark() &&
*pTmp->GetPoint() != *pTmp->GetMark() )
@@ -838,7 +839,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
}
pTmp = static_cast<SwPaM*>(pTmp->GetNext());
} while ( &rPam != pTmp );
- SetRedlineMove(bOldRedlineMove);
+ getIDocumentRedlineAccess().SetRedlineMove(bOldRedlineMove);
mbCopyIsMove = bOldFlag;
GetIDocumentUndoRedo().DoUndo(bOldUndo);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 3320f61ec013..23ea7e02093d 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -97,6 +97,7 @@
#include <DocumentListsManager.hxx>
#include <DocumentOutlineNodesManager.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <DocumentRedlineManager.hxx>
#include <unochart.hxx>
#include <fldbas.hxx>
@@ -198,8 +199,9 @@ SwDoc::SwDoc()
mpMarkManager(new ::sw::mark::MarkManager(*this)),
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ),
+ m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ),
m_pUndoManager(new ::sw::UndoManager(
- boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *this, *this)),
+ boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *this)),
m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ),
m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ),
@@ -239,9 +241,6 @@ SwDoc::SwDoc()
mpURLStateChgd( 0 ),
mpNumberFormatter( 0 ),
mpNumRuleTbl( new SwNumRuleTbl ),
- mpRedlineTbl( new SwRedlineTbl ),
- mpExtraRedlineTbl ( new SwExtraRedlineTbl ),
- mpAutoFmtRedlnComment( 0 ),
mpUnoCrsrTbl( new SwUnoCrsrTbl() ),
mpPgPViewPrtData( 0 ),
mpExtInputRing( 0 ),
@@ -251,8 +250,6 @@ SwDoc::SwDoc()
mpUnoCallBack(new SwModify(0)),
mpGrammarContact(createGrammarContact()),
m_pXmlIdRegistry(),
- mnAutoFmtRedlnCommentNo( 0 ),
- meRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
mReferenceCount(0),
mnLockExpFld( 0 ),
mbGlossDoc(false),
@@ -272,10 +269,8 @@ SwDoc::SwDoc()
mbIsAutoFmtRedline(false),
mbOLEPrtNotifyPending(false),
mbAllOLENotify(false),
- mbIsRedlineMove(false),
mbInsOnlyTxtGlssry(false),
mbContains_MSVBasic(false),
- mbReadlineChecked(false),
mbClipBoard( false ),
mbColumnSelection( false ),
mbIsPrepareSelAll(false),
@@ -473,10 +468,11 @@ SwDoc::~SwDoc()
mbDtor = true;
- delete mpRedlineTbl;
- delete mpExtraRedlineTbl, mpExtraRedlineTbl = 0;
+ //Clear the redline table before the nodes array is destroyed
+ getIDocumentRedlineAccess().GetRedlineTbl().DeleteAndDestroyAll();
+ getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteAndDestroyAll();
+
delete mpUnoCrsrTbl;
- delete mpAutoFmtRedlnComment;
delete mpUpdtFlds;
delete mpACEWord;
@@ -696,8 +692,8 @@ void SwDoc::ClearDoc()
OSL_ENSURE( !GetDocumentDrawModelManager().GetDrawModel() || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount(),
"not all DrawObjects removed from the page" );
- mpRedlineTbl->DeleteAndDestroyAll();
- mpExtraRedlineTbl->DeleteAndDestroyAll();
+ getIDocumentRedlineAccess().GetRedlineTbl().DeleteAndDestroyAll();
+ getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteAndDestroyAll();
delete mpACEWord;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index b20c6ec2283c..decdb5a7b0a7 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -26,6 +26,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentListsAccess.hxx>
+#include <DocumentRedlineManager.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <doctxm.hxx>
@@ -1784,9 +1785,9 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
}
// Test for Redlining - Can the Selection be moved at all, actually?
- if( !IsIgnoreRedline() )
+ if( !getIDocumentRedlineAccess().IsIgnoreRedline() )
{
- sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE );
+ sal_uInt16 nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE );
if( USHRT_MAX != nRedlPos )
{
SwPosition aStPos( *pStt ), aEndPos( *pEnd );
@@ -1796,9 +1797,9 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
bool bCheckDel = true;
// There is a some Redline Delete Object for the range
- for( ; nRedlPos < GetRedlineTbl().size(); ++nRedlPos )
+ for( ; nRedlPos < getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nRedlPos )
{
- const SwRangeRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
+ const SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlPos ];
if( !bCheckDel || nsRedlineType_t::REDLINE_DELETE == pTmp->GetType() )
{
const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
@@ -1806,7 +1807,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
{
case POS_COLLIDE_START:
case POS_BEHIND: // Pos1 comes after Pos2
- nRedlPos = GetRedlineTbl().size();
+ nRedlPos = getIDocumentRedlineAccess().GetRedlineTbl().size();
break;
case POS_COLLIDE_END:
@@ -1840,13 +1841,13 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
SwNodeRange aMvRg( pStt->nNode, 0, pEnd->nNode, +1 );
SwRangeRedline* pOwnRedl = 0;
- if( IsRedlineOn() )
+ if( getIDocumentRedlineAccess().IsRedlineOn() )
{
// If the range is completely in the own Redline, we can move it!
- sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT );
+ sal_uInt16 nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT );
if( USHRT_MAX != nRedlPos )
{
- SwRangeRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
+ SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlPos ];
const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
SwRangeRedline aTmpRedl( nsRedlineType_t::REDLINE_INSERT, rPam );
const SwCntntNode* pCEndNd = pEnd->nNode.GetNode().GetCntntNode();
@@ -1860,9 +1861,9 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
: !pREnd->nContent.GetIndex() )) )
{
pOwnRedl = pTmp;
- if( nRedlPos + 1 < (sal_uInt16)GetRedlineTbl().size() )
+ if( nRedlPos + 1 < (sal_uInt16)getIDocumentRedlineAccess().GetRedlineTbl().size() )
{
- pTmp = GetRedlineTbl()[ nRedlPos+1 ];
+ pTmp = getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlPos+1 ];
if( *pTmp->Start() == *pREnd )
// then don't!
pOwnRedl = 0;
@@ -1929,9 +1930,9 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
// All, that are in the to-be-deleted Node, need to be
// moved to the next Node
SwPosition* pPos;
- for( sal_uInt16 n = 0; n < GetRedlineTbl().size(); ++n )
+ for( sal_uInt16 n = 0; n < getIDocumentRedlineAccess().GetRedlineTbl().size(); ++n )
{
- SwRangeRedline* pTmp = GetRedlineTbl()[ n ];
+ SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTbl()[ n ];
if( ( pPos = &pTmp->GetBound(true))->nNode == aIdx )
{
pPos->nNode++;
@@ -1952,12 +1953,12 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
rOrigPam.GetPoint()->nNode++;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetCntntNode(), 0 );
- RedlineMode_t eOld = GetRedlineMode();
- checkRedlining(eOld);
+ RedlineMode_t eOld = getIDocumentRedlineAccess().GetRedlineMode();
+ GetDocumentRedlineManager().checkRedlining(eOld);
if (GetIDocumentUndoRedo().DoesUndo())
{
// Still NEEDS to be optimized (even after 14 years)
- SetRedlineMode(
+ getIDocumentRedlineAccess().SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE));
GetIDocumentUndoRedo().AppendUndo(pUndo);
@@ -1971,10 +1972,10 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
aPam.GetBound(true).nContent.Assign( NULL, 0 );
aPam.GetBound(false).nContent.Assign( NULL, 0 );
- AppendRedline( pNewRedline, true );
+ getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
// Still NEEDS to be optimized!
- SetRedlineMode( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode( eOld );
GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
SetModified();
@@ -1982,10 +1983,10 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
}
}
- if( !pOwnRedl && !IsIgnoreRedline() && !GetRedlineTbl().empty() )
+ if( !pOwnRedl && !getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPaM aTemp(aIdx);
- SplitRedline(aTemp);
+ getIDocumentRedlineAccess().SplitRedline(aTemp);
}
sal_uLong nRedlSttNd(0), nRedlEndNd(0);
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 43a5aad5c31d..236dd16f4963 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -29,6 +29,7 @@
#include <docredln.hxx>
#include <IDocumentUndoRedo.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
@@ -49,82 +50,10 @@ TYPEINIT1(SwRedlineHint, SfxHint);
#ifdef DBG_UTIL
- #define _ERROR_PREFIX "redline table corrupted: "
-
- // helper function for lcl_CheckRedline
- // 1. make sure that pPos->nContent points into pPos->nNode
- // (or into the 'special' no-content-node-IndexReg)
- // 2. check that position is valid and doesn't point behind text
- static void lcl_CheckPosition( const SwPosition* pPos )
- {
- SwPosition aComparePos( *pPos );
- aComparePos.nContent.Assign(
- aComparePos.nNode.GetNode().GetCntntNode(), 0 );
- OSL_ENSURE( pPos->nContent.GetIdxReg() ==
- aComparePos.nContent.GetIdxReg(),
- _ERROR_PREFIX "illegal position" );
-
- SwTxtNode* pTxtNode = pPos->nNode.GetNode().GetTxtNode();
- if( pTxtNode == NULL )
- {
- OSL_ENSURE( pPos->nContent == 0,
- _ERROR_PREFIX "non-text-node with content" );
- }
- else
- {
- OSL_ENSURE( pPos->nContent >= 0 &&
- pPos->nContent <= pTxtNode->Len(),
- _ERROR_PREFIX "index behind text" );
- }
- }
-
- static void lcl_CheckPam( const SwPaM* pPam )
- {
- OSL_ENSURE( pPam != NULL, _ERROR_PREFIX "illegal argument" );
- lcl_CheckPosition( pPam->GetPoint() );
- lcl_CheckPosition( pPam->GetMark() );
- }
-
- // check validity of the redline table. Checks redline bounds, and make
- // sure the redlines are sorted and non-overlapping.
- static void lcl_CheckRedline( const SwDoc* pDoc )
- {
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
-
- // verify valid redline positions
- for( sal_uInt16 i = 0; i < rTbl.size(); ++i )
- lcl_CheckPam( rTbl[ i ] );
-
- for( sal_uInt16 j = 0; j < rTbl.size(); ++j )
- {
- // check for empty redlines
- OSL_ENSURE( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) ||
- ( rTbl[j]->GetContentIdx() != NULL ),
- _ERROR_PREFIX "empty redline" );
- }
-
- // verify proper redline sorting
- for( sal_uInt16 n = 1; n < rTbl.size(); ++n )
- {
- const SwRangeRedline* pPrev = rTbl[ n-1 ];
- const SwRangeRedline* pCurrent = rTbl[ n ];
-
- // check redline sorting
- SAL_WARN_IF( *pPrev->Start() > *pCurrent->Start(), "sw",
- _ERROR_PREFIX "not sorted correctly" );
-
- // check for overlapping redlines
- SAL_WARN_IF( *pPrev->End() > *pCurrent->Start(), "sw",
- _ERROR_PREFIX "overlapping redlines" );
- }
- }
-
- #define _CHECK_REDLINE( pDoc ) lcl_CheckRedline( pDoc );
-
void sw_DebugRedline( const SwDoc* pDoc )
{
static sal_uInt16 nWatch = 0;
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
sal_uInt16 nDummy = 0;
@@ -137,127 +66,14 @@ TYPEINIT1(SwRedlineHint, SfxHint);
}
}
-#else
-
- #define _CHECK_REDLINE( pDoc )
-
#endif
-RedlineMode_t SwDoc::GetRedlineMode() const
-{
- return meRedlineMode;
-}
-
-void SwDoc::SetRedlineMode( RedlineMode_t eMode )
-{
- if( meRedlineMode != eMode )
- {
- if( (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) != (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode)
- || 0 == (nsRedlineMode_t::REDLINE_SHOW_MASK & eMode) )
- {
- bool bSaveInXMLImportFlag = IsInXMLImport();
- SetInXMLImport( false );
- // and then hide/display everything
- void (SwRangeRedline::*pFnc)( sal_uInt16 ) = 0;
-
- switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eMode )
- {
- case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE :
- pFnc = &SwRangeRedline::Show;
- break;
- case nsRedlineMode_t::REDLINE_SHOW_INSERT:
- pFnc = &SwRangeRedline::Hide;
- break;
- case nsRedlineMode_t::REDLINE_SHOW_DELETE:
- pFnc = &SwRangeRedline::ShowOriginal;
- break;
-
- default:
- pFnc = &SwRangeRedline::Hide;
- eMode = (RedlineMode_t)(eMode | nsRedlineMode_t::REDLINE_SHOW_INSERT);
- break;
- }
-
- _CHECK_REDLINE( this )
-
- if( pFnc )
- for( sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop )
- for( sal_uInt16 i = 0; i < mpRedlineTbl->size(); ++i )
- ((*mpRedlineTbl)[ i ]->*pFnc)( nLoop );
- _CHECK_REDLINE( this )
- SetInXMLImport( bSaveInXMLImportFlag );
- }
- meRedlineMode = eMode;
- SetModified();
- }
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::IsRedlineOn() const
-{
- return IDocumentRedlineAccess::IsRedlineOn(meRedlineMode);
-}
-
-bool SwDoc::IsIgnoreRedline() const
-{
- return (nsRedlineMode_t::REDLINE_IGNORE & meRedlineMode);
-}
-
-void SwDoc::SetRedlineMode_intern(RedlineMode_t eMode)
-{
- meRedlineMode = eMode;
-}
-
-const SwRedlineTbl& SwDoc::GetRedlineTbl() const
-{
- return *mpRedlineTbl;
-}
-
-const SwExtraRedlineTbl& SwDoc::GetExtraRedlineTbl() const
-{
- return *mpExtraRedlineTbl;
-}
SwExtraRedlineTbl::~SwExtraRedlineTbl()
{
DeleteAndDestroyAll();
}
-SwExtraRedlineTbl& SwDoc::GetExtraRedlineTbl()
-{
- return *mpExtraRedlineTbl;
-}
-
-bool SwDoc::HasExtraRedlineTbl() const
-{
- return mpExtraRedlineTbl ? true : false;
-}
-
-bool SwDoc::IsRedlineMove() const
-{
- return mbIsRedlineMove;
-}
-
-void SwDoc::SetRedlineMove(bool bFlag)
-{
- mbIsRedlineMove = bFlag;
-}
-
-const uno::Sequence <sal_Int8>& SwDoc::GetRedlinePassword() const
-{
- return maRedlinePasswd;
-}
-
-inline bool IsPrevPos( const SwPosition rPos1, const SwPosition rPos2 )
-{
- const SwCntntNode* pCNd;
- return 0 == rPos2.nContent.GetIndex() &&
- rPos2.nNode.GetIndex() - 1 == rPos1.nNode.GetIndex() &&
- 0 != ( pCNd = rPos1.nNode.GetNode().GetCntntNode() ) &&
- rPos1.nContent.GetIndex() == pCNd->Len();
-}
-
#if OSL_DEBUG_LEVEL > 0
bool CheckPosition( const SwPosition* pStt, const SwPosition* pEnd )
{
@@ -284,1234 +100,9 @@ bool CheckPosition( const SwPosition* pStt, const SwPosition* pEnd )
}
#endif
-/*
-Text means Text not "polluted" by Redlines.
-
-Behaviour of Insert-Redline:
- - in the Text - insert Redline Object
- - in InsertRedline (own) - ignore, existing is extended
- - in InsertRedline (others) - split up InsertRedline and
- insert Redline Object
- - in DeleteRedline - split up DeleteRedline or
- move at the end/beginning
-
-Behaviour of Delete-Redline:
- - in the Text - insert Redline Object
- - in DeleteRedline (own/others) - ignore
- - in InsertRedline (own) - ignore, but delete character
- - in InsertRedline (others) - split up InsertRedline and
- insert Redline Object
- - Text and own Insert overlap - delete Text in the own Insert,
- extend in the other Text
- (up to the Insert!)
- - Text and other Insert overlap - insert Redline Object, the
- other Insert is overlapped by
- the Delete
-*/
-bool SwDoc::AppendRedline( SwRangeRedline* pNewRedl, bool bCallDelete )
-{
- bool bMerged = false;
- _CHECK_REDLINE( this )
-
- if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
- {
- pNewRedl->InvalidateRange();
-
- if( mbIsAutoFmtRedline )
- {
- pNewRedl->SetAutoFmtFlag();
- if( mpAutoFmtRedlnComment && !mpAutoFmtRedlnComment->isEmpty() )
- {
- pNewRedl->SetComment( *mpAutoFmtRedlnComment );
- pNewRedl->SetSeqNo( mnAutoFmtRedlnCommentNo );
- }
- }
-
- SwPosition* pStt = pNewRedl->Start(),
- * pEnd = pStt == pNewRedl->GetPoint() ? pNewRedl->GetMark()
- : pNewRedl->GetPoint();
- {
- SwTxtNode* pTxtNode = pStt->nNode.GetNode().GetTxtNode();
- if( pTxtNode == NULL )
- {
- if( pStt->nContent > 0 )
- {
- OSL_ENSURE( false, "Redline start: non-text-node with content" );
- pStt->nContent = 0;
- }
- }
- else
- {
- if( pStt->nContent > pTxtNode->Len() )
- {
- OSL_ENSURE( false, "Redline start: index behind text" );
- pStt->nContent = pTxtNode->Len();
- }
- }
- pTxtNode = pEnd->nNode.GetNode().GetTxtNode();
- if( pTxtNode == NULL )
- {
- if( pEnd->nContent > 0 )
- {
- OSL_ENSURE( false, "Redline end: non-text-node with content" );
- pEnd->nContent = 0;
- }
- }
- else
- {
- if( pEnd->nContent > pTxtNode->Len() )
- {
- OSL_ENSURE( false, "Redline end: index behind text" );
- pEnd->nContent = pTxtNode->Len();
- }
- }
- }
- if( ( *pStt == *pEnd ) &&
- ( pNewRedl->GetContentIdx() == NULL ) )
- { // Do not insert empty redlines
- delete pNewRedl;
- return false;
- }
- bool bCompress = false;
- sal_uInt16 n = 0;
- // look up the first Redline for the starting position
- if( !GetRedline( *pStt, &n ) && n )
- --n;
- bool bDec = false;
-
- for( ; pNewRedl && n < mpRedlineTbl->size(); bDec ? n : ++n )
- {
- bDec = false;
-
- SwRangeRedline* pRedl = (*mpRedlineTbl)[ n ];
- SwPosition* pRStt = pRedl->Start(),
- * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
- : pRedl->GetPoint();
-
- // #i8518# remove empty redlines while we're at it
- if( ( *pRStt == *pREnd ) &&
- ( pRedl->GetContentIdx() == NULL ) )
- {
- mpRedlineTbl->DeleteAndDestroy(n);
- continue;
- }
-
- SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
-
- switch( pNewRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_INSERT:
- switch( pRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_INSERT:
- if( pRedl->IsOwnRedline( *pNewRedl ) )
- {
- bool bDelete = false;
-
- // Merge if applicable?
- if( (( POS_BEHIND == eCmpPos &&
- IsPrevPos( *pREnd, *pStt ) ) ||
- ( POS_COLLIDE_START == eCmpPos ) ||
- ( POS_OVERLAP_BEHIND == eCmpPos ) ) &&
- pRedl->CanCombine( *pNewRedl ) &&
- ( n+1 >= (sal_uInt16)mpRedlineTbl->size() ||
- ( *(*mpRedlineTbl)[ n+1 ]->Start() >= *pEnd &&
- *(*mpRedlineTbl)[ n+1 ]->Start() != *pREnd ) ) )
- {
- pRedl->SetEnd( *pEnd, pREnd );
- if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- }
-
- bMerged = true;
- bDelete = true;
- }
- else if( (( POS_BEFORE == eCmpPos &&
- IsPrevPos( *pEnd, *pRStt ) ) ||
- ( POS_COLLIDE_END == eCmpPos ) ||
- ( POS_OVERLAP_BEFORE == eCmpPos ) ) &&
- pRedl->CanCombine( *pNewRedl ) &&
- ( !n ||
- *(*mpRedlineTbl)[ n-1 ]->End() != *pRStt ))
- {
- pRedl->SetStart( *pStt, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
-
- bMerged = true;
- bDelete = true;
- }
- else if ( POS_OUTSIDE == eCmpPos )
- {
- // own insert-over-insert redlines:
- // just scrap the inside ones
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else if( POS_OVERLAP_BEHIND == eCmpPos )
- {
- *pStt = *pREnd;
- if( ( *pStt == *pEnd ) &&
- ( pNewRedl->GetContentIdx() == NULL ) )
- bDelete = true;
- }
- else if( POS_OVERLAP_BEFORE == eCmpPos )
- {
- *pEnd = *pRStt;
- if( ( *pStt == *pEnd ) &&
- ( pNewRedl->GetContentIdx() == NULL ) )
- bDelete = true;
- }
- else if( POS_INSIDE == eCmpPos || POS_EQUAL == eCmpPos)
- bDelete = true;
-
- if( bDelete )
- {
- delete pNewRedl, pNewRedl = 0;
- bCompress = true;
- }
- }
- else if( POS_INSIDE == eCmpPos )
- {
- // split up
- if( *pEnd != *pREnd )
- {
- SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
- pCpy->SetStart( *pEnd );
- mpRedlineTbl->Insert( pCpy );
- }
- pRedl->SetEnd( *pStt, pREnd );
- if( ( *pStt == *pRStt ) &&
- ( pRedl->GetContentIdx() == NULL ) )
- {
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- }
- }
- else if ( POS_OUTSIDE == eCmpPos )
- {
- // handle overlapping redlines in broken documents
-
- // split up the new redline, since it covers the
- // existing redline. Insert the first part, and
- // progress with the remainder as usual
- SwRangeRedline* pSplit = new SwRangeRedline( *pNewRedl );
- pSplit->SetEnd( *pRStt );
- pNewRedl->SetStart( *pREnd );
- mpRedlineTbl->Insert( pSplit );
- if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
- {
- delete pNewRedl;
- pNewRedl = 0;
- bCompress = true;
- }
- }
- else if ( POS_OVERLAP_BEHIND == eCmpPos )
- {
- // handle overlapping redlines in broken documents
- pNewRedl->SetStart( *pREnd );
- }
- else if ( POS_OVERLAP_BEFORE == eCmpPos )
- {
- // handle overlapping redlines in broken documents
- *pEnd = *pRStt;
- if( ( *pStt == *pEnd ) &&
- ( pNewRedl->GetContentIdx() == NULL ) )
- {
- delete pNewRedl;
- pNewRedl = 0;
- bCompress = true;
- }
- }
- break;
- case nsRedlineType_t::REDLINE_DELETE:
- if( POS_INSIDE == eCmpPos )
- {
- // split up
- if( *pEnd != *pREnd )
- {
- SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
- pCpy->SetStart( *pEnd );
- mpRedlineTbl->Insert( pCpy );
- }
- pRedl->SetEnd( *pStt, pREnd );
- if( ( *pStt == *pRStt ) &&
- ( pRedl->GetContentIdx() == NULL ) )
- {
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- }
- }
- else if ( POS_OUTSIDE == eCmpPos )
- {
- // handle overlapping redlines in broken documents
-
- // split up the new redline, since it covers the
- // existing redline. Insert the first part, and
- // progress with the remainder as usual
- SwRangeRedline* pSplit = new SwRangeRedline( *pNewRedl );
- pSplit->SetEnd( *pRStt );
- pNewRedl->SetStart( *pREnd );
- mpRedlineTbl->Insert( pSplit );
- if( *pStt == *pEnd && pNewRedl->GetContentIdx() == NULL )
- {
- delete pNewRedl;
- pNewRedl = 0;
- bCompress = true;
- }
- }
- else if ( POS_EQUAL == eCmpPos )
- {
- // handle identical redlines in broken documents
- // delete old (delete) redline
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else if ( POS_OVERLAP_BEHIND == eCmpPos )
- { // Another workaround for broken redlines
- pNewRedl->SetStart( *pREnd );
- }
- break;
- case nsRedlineType_t::REDLINE_FORMAT:
- switch( eCmpPos )
- {
- case POS_OVERLAP_BEFORE:
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- bDec = true;
- break;
-
- case POS_OVERLAP_BEHIND:
- pRedl->SetEnd( *pStt, pREnd );
- if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
- {
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- break;
-
- case POS_EQUAL:
- case POS_OUTSIDE:
- // Overlaps the current one completely or has the
- // same dimension, delete the old one
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- break;
-
- case POS_INSIDE:
- // Overlaps the current one completely,
- // split or shorten the new one
- if( *pEnd != *pREnd )
- {
- if( *pEnd != *pRStt )
- {
- SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
- pNew->SetStart( *pEnd );
- pRedl->SetEnd( *pStt, pREnd );
- if( *pStt == *pRStt && pRedl->GetContentIdx() == NULL )
- mpRedlineTbl->DeleteAndDestroy( n );
- AppendRedline( pNew, bCallDelete );
- n = 0; // re-initialize
- bDec = true;
- }
- }
- else
- pRedl->SetEnd( *pStt, pREnd );
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
-
- case nsRedlineType_t::REDLINE_DELETE:
- switch( pRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_DELETE:
- switch( eCmpPos )
- {
- case POS_OUTSIDE:
- {
- // Overlaps the current one completely,
- // split the new one
- if( *pEnd != *pREnd )
- {
- SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
- pNew->SetStart( *pREnd );
- pNewRedl->SetEnd( *pRStt, pEnd );
- AppendRedline( pNew, bCallDelete );
- n = 0; // re-initialize
- bDec = true;
- }
- else
- pNewRedl->SetEnd( *pRStt, pEnd );
- }
- break;
-
- case POS_INSIDE:
- case POS_EQUAL:
- delete pNewRedl, pNewRedl = 0;
- bCompress = true;
- break;
-
- case POS_OVERLAP_BEFORE:
- case POS_OVERLAP_BEHIND:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ))
- {
- // If that's the case we can merge it, meaning
- // the new one covers this well
- if( POS_OVERLAP_BEHIND == eCmpPos )
- pNewRedl->SetStart( *pRStt, pStt );
- else
- pNewRedl->SetEnd( *pREnd, pEnd );
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else if( POS_OVERLAP_BEHIND == eCmpPos )
- pNewRedl->SetStart( *pREnd, pStt );
- else
- pNewRedl->SetEnd( *pRStt, pEnd );
- break;
-
- case POS_COLLIDE_START:
- case POS_COLLIDE_END:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ) )
- {
- if( IsHideChanges( meRedlineMode ))
- {
- // Before we can merge, we make it visible!
- // We insert temporarily so that pNew is
- // also dealt with when moving the indices.
- mpRedlineTbl->Insert( pNewRedl );
- pRedl->Show();
- mpRedlineTbl->Remove( pNewRedl );
- pRStt = pRedl->Start();
- pREnd = pRedl->End();
- }
-
- // If that's the case we can merge it, meaning
- // the new one covers this well
- if( POS_COLLIDE_START == eCmpPos )
- pNewRedl->SetStart( *pRStt, pStt );
- else
- pNewRedl->SetEnd( *pREnd, pEnd );
-
- // delete current (below), and restart process with
- // previous
- sal_uInt16 nToBeDeleted = n;
- bDec = true;
-
- if( *(pNewRedl->Start()) <= *pREnd )
- {
- // Whoooah, we just extended the new 'redline'
- // beyond previous redlines, so better start
- // again. Of course this is not supposed to
- // happen, and in an ideal world it doesn't,
- // but unfortunately this code is buggy and
- // totally rotten so it does happen and we
- // better fix it.
- n = 0;
- bDec = true;
- }
-
- mpRedlineTbl->DeleteAndDestroy( nToBeDeleted );
- }
- break;
- default:
- break;
- }
- break;
-
- case nsRedlineType_t::REDLINE_INSERT:
- {
- // b62341295: Do not throw away redlines
- // even if they are not allowed to be combined
- RedlineMode_t eOld = meRedlineMode;
- if( !( eOld & nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES ) &&
- pRedl->IsOwnRedline( *pNewRedl ) )
- {
-
- // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
- // The ShowMode needs to be retained!
- meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
- switch( eCmpPos )
- {
- case POS_EQUAL:
- bCompress = true;
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- // no break!
-
- case POS_INSIDE:
- if( bCallDelete )
- {
- meRedlineMode = (RedlineMode_t)(meRedlineMode | nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES);
-
- // DeleteAndJoin does not yield the
- // desired result if there is no paragraph to
- // join with, i.e. at the end of the document.
- // For this case, we completely delete the
- // paragraphs (if, of course, we also start on
- // a paragraph boundary).
- if( (pStt->nContent == 0) &&
- pEnd->nNode.GetNode().IsEndNode() )
- {
- pEnd->nNode--;
- pEnd->nContent.Assign(
- pEnd->nNode.GetNode().GetTxtNode(), 0);
- getIDocumentContentOperations().DelFullPara( *pNewRedl );
- }
- else
- getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
-
- bCompress = true;
- }
- delete pNewRedl, pNewRedl = 0;
- break;
-
- case POS_OUTSIDE:
- {
- mpRedlineTbl->Remove( n );
- bDec = true;
- // We insert temporarily so that pNew is
- // also dealt with when moving the indices.
- if( bCallDelete )
- {
- mpRedlineTbl->Insert( pNewRedl );
- getIDocumentContentOperations().DeleteAndJoin( *pRedl );
- if( !mpRedlineTbl->Remove( pNewRedl ) )
- pNewRedl = 0;
- }
- delete pRedl;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- {
- SwPaM aPam( *pRStt, *pEnd );
-
- if( *pEnd == *pREnd )
- mpRedlineTbl->DeleteAndDestroy( n );
- else
- {
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- }
-
- if( bCallDelete )
- {
- // We insert temporarily so that pNew is
- // also dealt with when moving the indices.
- mpRedlineTbl->Insert( pNewRedl );
- getIDocumentContentOperations().DeleteAndJoin( aPam );
- if( !mpRedlineTbl->Remove( pNewRedl ) )
- pNewRedl = 0;
- n = 0; // re-initialize
- }
- bDec = true;
- }
- break;
-
- case POS_OVERLAP_BEHIND:
- {
- SwPaM aPam( *pStt, *pREnd );
-
- if( *pStt == *pRStt )
- {
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- else
- pRedl->SetEnd( *pStt, pREnd );
-
- if( bCallDelete )
- {
- // We insert temporarily so that pNew is
- // also dealt with when moving the indices.
- mpRedlineTbl->Insert( pNewRedl );
- getIDocumentContentOperations().DeleteAndJoin( aPam );
- if( !mpRedlineTbl->Remove( pNewRedl ) )
- pNewRedl = 0;
- n = 0; // re-initialize
- bDec = true;
- }
- }
- break;
- default:
- break;
- }
-
- meRedlineMode = eOld;
- }
- else
- {
- // it may be necessary to split the existing redline in
- // two. In this case, pRedl will be changed to cover
- // only part of it's former range, and pNew will cover
- // the remainder.
- SwRangeRedline* pNew = 0;
-
- switch( eCmpPos )
- {
- case POS_EQUAL:
- {
- pRedl->PushData( *pNewRedl );
- delete pNewRedl, pNewRedl = 0;
- if( IsHideChanges( meRedlineMode ))
- pRedl->Hide();
- bCompress = true;
- }
- break;
-
- case POS_INSIDE:
- {
- if( *pRStt == *pStt )
- {
- // #i97421#
- // redline w/out extent loops
- if (*pStt != *pEnd)
- {
- pNewRedl->PushData( *pRedl, false );
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- bDec = true;
- }
- }
- else
- {
- pNewRedl->PushData( *pRedl, false );
- if( *pREnd != *pEnd )
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->SetStart( *pEnd );
- }
- pRedl->SetEnd( *pStt, pREnd );
- if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- }
- }
- }
- break;
-
- case POS_OUTSIDE:
- {
- pRedl->PushData( *pNewRedl );
- if( *pEnd == *pREnd )
- pNewRedl->SetEnd( *pRStt, pEnd );
- else
- {
- pNew = new SwRangeRedline( *pNewRedl );
- pNew->SetEnd( *pRStt );
- pNewRedl->SetStart( *pREnd, pStt );
- }
- bCompress = true;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- {
- if( *pEnd == *pREnd )
- {
- pRedl->PushData( *pNewRedl );
- pNewRedl->SetEnd( *pRStt, pEnd );
- if( IsHideChanges( meRedlineMode ))
- {
- mpRedlineTbl->Insert( pNewRedl );
- pRedl->Hide();
- mpRedlineTbl->Remove( pNewRedl );
- }
- }
- else
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->PushData( *pNewRedl );
- pNew->SetEnd( *pEnd );
- pNewRedl->SetEnd( *pRStt, pEnd );
- pRedl->SetStart( *pNew->End(), pRStt ) ;
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- bDec = true;
- }
- }
- break;
-
- case POS_OVERLAP_BEHIND:
- {
- if( *pStt == *pRStt )
- {
- pRedl->PushData( *pNewRedl );
- pNewRedl->SetStart( *pREnd, pStt );
- if( IsHideChanges( meRedlineMode ))
- {
- mpRedlineTbl->Insert( pNewRedl );
- pRedl->Hide();
- mpRedlineTbl->Remove( pNewRedl );
- }
- }
- else
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->PushData( *pNewRedl );
- pNew->SetStart( *pStt );
- pNewRedl->SetStart( *pREnd, pStt );
- pRedl->SetEnd( *pNew->Start(), pREnd );
- if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- }
- }
- }
- break;
- default:
- break;
- }
-
- // insert the pNew part (if it exists)
- if( pNew )
- {
- mpRedlineTbl->Insert( pNew );
-
- // pNew must be deleted if Insert() wasn't
- // successful. But that can't happen, since pNew is
- // part of the original pRedl redline.
- // OSL_ENSURE( bRet, "Can't insert existing redline?" );
-
- // restart (now with pRedl being split up)
- n = 0;
- bDec = true;
- }
- }
- }
- break;
-
- case nsRedlineType_t::REDLINE_FORMAT:
- switch( eCmpPos )
- {
- case POS_OVERLAP_BEFORE:
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- bDec = true;
- break;
-
- case POS_OVERLAP_BEHIND:
- pRedl->SetEnd( *pStt, pREnd );
- break;
-
- case POS_EQUAL:
- case POS_OUTSIDE:
- // Overlaps the current one completely or has the
- // same dimension, delete the old one
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- break;
-
- case POS_INSIDE:
- // Overlaps the current one completely,
- // split or shorten the new one
- if( *pEnd != *pREnd )
- {
- if( *pEnd != *pRStt )
- {
- SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
- pNew->SetStart( *pEnd );
- pRedl->SetEnd( *pStt, pREnd );
- if( ( *pStt == *pRStt ) &&
- ( pRedl->GetContentIdx() == NULL ) )
- mpRedlineTbl->DeleteAndDestroy( n );
- AppendRedline( pNew, bCallDelete );
- n = 0; // re-initialize
- bDec = true;
- }
- }
- else
- pRedl->SetEnd( *pStt, pREnd );
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
-
- case nsRedlineType_t::REDLINE_FORMAT:
- switch( pRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_INSERT:
- case nsRedlineType_t::REDLINE_DELETE:
- switch( eCmpPos )
- {
- case POS_OVERLAP_BEFORE:
- pNewRedl->SetEnd( *pRStt, pEnd );
- break;
-
- case POS_OVERLAP_BEHIND:
- pNewRedl->SetStart( *pREnd, pStt );
- break;
-
- case POS_EQUAL:
- case POS_INSIDE:
- delete pNewRedl, pNewRedl = 0;
- break;
-
- case POS_OUTSIDE:
- // Overlaps the current one completely,
- // split or shorten the new one
- if( *pEnd != *pREnd )
- {
- if( *pEnd != *pRStt )
- {
- SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
- pNew->SetStart( *pREnd );
- pNewRedl->SetEnd( *pRStt, pEnd );
- AppendRedline( pNew, bCallDelete );
- n = 0; // re-initialize
- bDec = true;
- }
- }
- else
- pNewRedl->SetEnd( *pRStt, pEnd );
- break;
- default:
- break;
- }
- break;
- case nsRedlineType_t::REDLINE_FORMAT:
- switch( eCmpPos )
- {
- case POS_OUTSIDE:
- case POS_EQUAL:
- {
- // Overlaps the current one completely or has the
- // same dimension, delete the old one
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- break;
-
- case POS_INSIDE:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ))
- // own one can be ignored completely
- delete pNewRedl, pNewRedl = 0;
-
- else if( *pREnd == *pEnd )
- // or else only shorten the current one
- pRedl->SetEnd( *pStt, pREnd );
- else if( *pRStt == *pStt )
- {
- // or else only shorten the current one
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl, n );
- bDec = true;
- }
- else
- {
- // If it lies completely within the current one
- // we need to split it
- SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
- pNew->SetStart( *pEnd );
- pRedl->SetEnd( *pStt, pREnd );
- AppendRedline( pNew, bCallDelete );
- n = 0; // re-initialize
- bDec = true;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- case POS_OVERLAP_BEHIND:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ))
- {
- // If that's the case we can merge it, meaning
- // the new one covers this well
- if( POS_OVERLAP_BEHIND == eCmpPos )
- pNewRedl->SetStart( *pRStt, pStt );
- else
- pNewRedl->SetEnd( *pREnd, pEnd );
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = false;
- }
- else if( POS_OVERLAP_BEHIND == eCmpPos )
- pNewRedl->SetStart( *pREnd, pStt );
- else
- pNewRedl->SetEnd( *pRStt, pEnd );
- break;
-
- case POS_COLLIDE_END:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ) && n &&
- *(*mpRedlineTbl)[ n-1 ]->End() < *pStt )
- {
- // If that's the case we can merge it, meaning
- // the new one covers this well
- pNewRedl->SetEnd( *pREnd, pEnd );
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- break;
- case POS_COLLIDE_START:
- if( pRedl->IsOwnRedline( *pNewRedl ) &&
- pRedl->CanCombine( *pNewRedl ) &&
- n+1 < (sal_uInt16)mpRedlineTbl->size() &&
- *(*mpRedlineTbl)[ n+1 ]->Start() < *pEnd )
- {
- // If that's the case we can merge it, meaning
- // the new one covers this well
- pNewRedl->SetStart( *pRStt, pStt );
- mpRedlineTbl->DeleteAndDestroy( n );
- bDec = true;
- }
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
-
- case nsRedlineType_t::REDLINE_FMTCOLL:
- // How should we behave here?
- // insert as is
- break;
- default:
- break;
- }
- }
-
- if( pNewRedl )
- {
- if( ( *pStt == *pEnd ) &&
- ( pNewRedl->GetContentIdx() == NULL ) )
- { // Do not insert empty redlines
- delete pNewRedl;
- pNewRedl = 0;
- }
- else
- mpRedlineTbl->Insert( pNewRedl );
- }
-
- if( bCompress )
- CompressRedlines();
- }
- else
- {
- if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
- {
- RedlineMode_t eOld = meRedlineMode;
- // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
- // The ShowMode needs to be retained!
- meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
- getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
- meRedlineMode = eOld;
- }
- delete pNewRedl, pNewRedl = 0;
- }
- _CHECK_REDLINE( this )
-
- return ( 0 != pNewRedl ) || bMerged;
-}
-
-void SwDoc::CompressRedlines()
-{
- _CHECK_REDLINE( this )
-
- void (SwRangeRedline::*pFnc)(sal_uInt16) = 0;
- switch( nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode )
- {
- case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE:
- pFnc = &SwRangeRedline::Show;
- break;
- case nsRedlineMode_t::REDLINE_SHOW_INSERT:
- pFnc = &SwRangeRedline::Hide;
- break;
- }
-
- // Try to merge identical ones
- for( sal_uInt16 n = 1; n < mpRedlineTbl->size(); ++n )
- {
- SwRangeRedline* pPrev = (*mpRedlineTbl)[ n-1 ],
- * pCur = (*mpRedlineTbl)[ n ];
- const SwPosition* pPrevStt = pPrev->Start(),
- * pPrevEnd = pPrevStt == pPrev->GetPoint()
- ? pPrev->GetMark() : pPrev->GetPoint();
- const SwPosition* pCurStt = pCur->Start(),
- * pCurEnd = pCurStt == pCur->GetPoint()
- ? pCur->GetMark() : pCur->GetPoint();
- if( *pPrevEnd == *pCurStt && pPrev->CanCombine( *pCur ) &&
- pPrevStt->nNode.GetNode().StartOfSectionNode() ==
- pCurEnd->nNode.GetNode().StartOfSectionNode() &&
- !pCurEnd->nNode.GetNode().StartOfSectionNode()->IsTableNode() )
- {
- // we then can merge them
- pPrev->Show();
- pCur->Show();
-
- pPrev->SetEnd( *pCur->End() );
- mpRedlineTbl->DeleteAndDestroy( n );
- --n;
- if( pFnc )
- (pPrev->*pFnc)(0);
- }
- }
- _CHECK_REDLINE( this )
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::SplitRedline( const SwPaM& rRange )
-{
- bool bChg = false;
- sal_uInt16 n = 0;
- const SwPosition* pStt = rRange.Start(),
- * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
- : rRange.GetPoint();
- GetRedline( *pStt, &n );
- for( ; n < mpRedlineTbl->size() ; ++n )
- {
- SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
- SwPosition* pTStt = pTmp->Start(),
- * pTEnd = pTStt == pTmp->GetPoint() ? pTmp->GetMark()
- : pTmp->GetPoint();
- if( *pTStt <= *pStt && *pStt <= *pTEnd &&
- *pTStt <= *pEnd && *pEnd <= *pTEnd )
- {
- bChg = true;
- int nn = 0;
- if( *pStt == *pTStt )
- nn += 1;
- if( *pEnd == *pTEnd )
- nn += 2;
-
- SwRangeRedline* pNew = 0;
- switch( nn )
- {
- case 0:
- pNew = new SwRangeRedline( *pTmp );
- pTmp->SetEnd( *pStt, pTEnd );
- pNew->SetStart( *pEnd );
- break;
-
- case 1:
- *pTStt = *pEnd;
- break;
-
- case 2:
- *pTEnd = *pStt;
- break;
-
- case 3:
- pTmp->InvalidateRange();
- mpRedlineTbl->DeleteAndDestroy( n-- );
- pTmp = 0;
- break;
- }
- if( pTmp && !pTmp->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pTmp, n );
- }
- if( pNew )
- mpRedlineTbl->Insert( pNew, n );
- }
- else if( *pEnd < *pTStt )
- break;
- }
- return bChg;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
- sal_uInt16 nDelType )
-{
- if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & meRedlineMode ||
- !rRange.HasMark() || *rRange.GetMark() == *rRange.GetPoint() )
- return false;
-
- bool bChg = false;
-
- if (bSaveInUndo && GetIDocumentUndoRedo().DoesUndo())
- {
- SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange );
- if( pUndo->GetRedlSaveCount() )
- {
- GetIDocumentUndoRedo().AppendUndo(pUndo);
- }
- else
- delete pUndo;
- }
-
- const SwPosition* pStt = rRange.Start(),
- * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
- : rRange.GetPoint();
- sal_uInt16 n = 0;
- GetRedline( *pStt, &n );
- for( ; n < mpRedlineTbl->size() ; ++n )
- {
- SwRangeRedline* pRedl = (*mpRedlineTbl)[ n ];
- if( USHRT_MAX != nDelType && nDelType != pRedl->GetType() )
- continue;
-
- SwPosition* pRStt = pRedl->Start(),
- * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark()
- : pRedl->GetPoint();
- switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) )
- {
- case POS_EQUAL:
- case POS_OUTSIDE:
- pRedl->InvalidateRange();
- mpRedlineTbl->DeleteAndDestroy( n-- );
- bChg = true;
- break;
-
- case POS_OVERLAP_BEFORE:
- pRedl->InvalidateRange();
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- --n;
- break;
-
- case POS_OVERLAP_BEHIND:
- pRedl->InvalidateRange();
- pRedl->SetEnd( *pStt, pREnd );
- if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- --n;
- }
- break;
-
- case POS_INSIDE:
- {
- // this one needs to be splitted
- pRedl->InvalidateRange();
- if( *pRStt == *pStt )
- {
- pRedl->SetStart( *pEnd, pRStt );
- // re-insert
- mpRedlineTbl->Remove( n );
- mpRedlineTbl->Insert( pRedl );
- --n;
- }
- else
- {
- SwRangeRedline* pCpy;
- if( *pREnd != *pEnd )
- {
- pCpy = new SwRangeRedline( *pRedl );
- pCpy->SetStart( *pEnd );
- }
- else
- pCpy = 0;
- pRedl->SetEnd( *pStt, pREnd );
- if( !pRedl->HasValidRange() )
- {
- // re-insert
- mpRedlineTbl->Remove( pRedl );
- mpRedlineTbl->Insert( pRedl );
- --n;
- }
- if( pCpy )
- mpRedlineTbl->Insert( pCpy );
- }
- }
- break;
-
- case POS_COLLIDE_END:
- case POS_BEFORE:
- n = mpRedlineTbl->size();
- break;
- default:
- break;
- }
- }
-
- if( bChg )
- SetModified();
-
- return bChg;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::DeleteRedline( const SwStartNode& rNode, bool bSaveInUndo,
- sal_uInt16 nDelType )
-{
- SwPaM aTemp(*rNode.EndOfSectionNode(), rNode);
- return DeleteRedline(aTemp, bSaveInUndo, nDelType);
-}
-
-sal_uInt16 SwDoc::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const
-{
- const sal_uLong nNdIdx = rNd.GetIndex();
- for( sal_uInt16 n = 0; n < mpRedlineTbl->size() ; ++n )
- {
- const SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
- sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
- nMk = pTmp->GetMark()->nNode.GetIndex();
- if( nPt < nMk ) { long nTmp = nMk; nMk = nPt; nPt = nTmp; }
-
- if( ( USHRT_MAX == nType || nType == pTmp->GetType()) &&
- nMk <= nNdIdx && nNdIdx <= nPt )
- return n;
-
- if( nMk > nNdIdx )
- break;
- }
- return USHRT_MAX;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTable, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete )
{
- if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->GetRedlineMode() )
+ if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->getIDocumentRedlineAccess().GetRedlineMode() )
return false;
bool bChg = false;
@@ -1585,7 +176,7 @@ bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTab
bool SwExtraRedlineTbl::DeleteTableRowRedline( SwDoc* pDoc, const SwTableLine& rTableLine, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete )
{
- if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->GetRedlineMode() )
+ if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->getIDocumentRedlineAccess().GetRedlineMode() )
return false;
bool bChg = false;
@@ -1632,7 +223,7 @@ bool SwExtraRedlineTbl::DeleteTableRowRedline( SwDoc* pDoc, const SwTableLine& r
bool SwExtraRedlineTbl::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& rTableBox, bool bSaveInUndo, sal_uInt16 nRedlineTypeToDelete )
{
- if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->GetRedlineMode() )
+ if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & pDoc->getIDocumentRedlineAccess().GetRedlineMode() )
return false;
bool bChg = false;
@@ -1677,1076 +268,6 @@ bool SwExtraRedlineTbl::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& r
return bChg;
}
-const SwRangeRedline* SwDoc::GetRedline( const SwPosition& rPos,
- sal_uInt16* pFndPos ) const
-{
- sal_uInt16 nO = mpRedlineTbl->size(), nM, nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- const SwRangeRedline* pRedl = (*mpRedlineTbl)[ nM ];
- const SwPosition* pStt = pRedl->Start();
- const SwPosition* pEnd = pStt == pRedl->GetPoint()
- ? pRedl->GetMark()
- : pRedl->GetPoint();
- if( pEnd == pStt
- ? *pStt == rPos
- : ( *pStt <= rPos && rPos < *pEnd ) )
- {
- while( nM && rPos == *(*mpRedlineTbl)[ nM - 1 ]->End() &&
- rPos == *(*mpRedlineTbl)[ nM - 1 ]->Start() )
- {
- --nM;
- pRedl = (*mpRedlineTbl)[ nM ];
- }
- // if there are format and insert changes in the same position
- // show insert change first.
- // since the redlines are sorted by position, only check the redline
- // before and after the current redline
- if( nsRedlineType_t::REDLINE_FORMAT == pRedl->GetType() )
- {
- if( nM && rPos >= *(*mpRedlineTbl)[ nM - 1 ]->Start() &&
- rPos <= *(*mpRedlineTbl)[ nM - 1 ]->End() &&
- ( nsRedlineType_t::REDLINE_INSERT == (*mpRedlineTbl)[ nM - 1 ]->GetType() ) )
- {
- --nM;
- pRedl = (*mpRedlineTbl)[ nM ];
- }
- else if( ( nM + 1 ) <= nO && rPos >= *(*mpRedlineTbl)[ nM + 1 ]->Start() &&
- rPos <= *(*mpRedlineTbl)[ nM + 1 ]->End() &&
- ( nsRedlineType_t::REDLINE_INSERT == (*mpRedlineTbl)[ nM + 1 ]->GetType() ) )
- {
- ++nM;
- pRedl = (*mpRedlineTbl)[ nM ];
- }
- }
-
- if( pFndPos )
- *pFndPos = nM;
- return pRedl;
- }
- else if( *pEnd <= rPos )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pFndPos )
- *pFndPos = nU;
- return 0;
- }
- else
- nO = nM - 1;
- }
- }
- if( pFndPos )
- *pFndPos = nU;
- return 0;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-typedef bool (*Fn_AcceptReject)( SwRedlineTbl& rArr, sal_uInt16& rPos,
- bool bCallDelete,
- const SwPosition* pSttRng,
- const SwPosition* pEndRng);
-
-static bool lcl_AcceptRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
- bool bCallDelete,
- const SwPosition* pSttRng = 0,
- const SwPosition* pEndRng = 0 )
-{
- bool bRet = true;
- SwRangeRedline* pRedl = rArr[ rPos ];
- SwPosition *pRStt = 0, *pREnd = 0;
- SwComparePosition eCmp = POS_OUTSIDE;
- if( pSttRng && pEndRng )
- {
- pRStt = pRedl->Start();
- pREnd = pRedl->End();
- eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
- }
-
- pRedl->InvalidateRange();
-
- switch( pRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_INSERT:
- case nsRedlineType_t::REDLINE_FORMAT:
- {
- bool bCheck = false, bReplace = false;
- switch( eCmp )
- {
- case POS_INSIDE:
- if( *pSttRng == *pRStt )
- pRedl->SetStart( *pEndRng, pRStt );
- else
- {
- if( *pEndRng != *pREnd )
- {
- // split up
- SwRangeRedline* pNew = new SwRangeRedline( *pRedl );
- pNew->SetStart( *pEndRng );
- rArr.Insert( pNew ); ++rPos;
- }
- pRedl->SetEnd( *pSttRng, pREnd );
- bCheck = true;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- pRedl->SetStart( *pEndRng, pRStt );
- bReplace = true;
- break;
-
- case POS_OVERLAP_BEHIND:
- pRedl->SetEnd( *pSttRng, pREnd );
- bCheck = true;
- break;
-
- case POS_OUTSIDE:
- case POS_EQUAL:
- rArr.DeleteAndDestroy( rPos-- );
- break;
-
- default:
- bRet = false;
- }
-
- if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
- {
- // re-insert
- rArr.Remove( pRedl );
- rArr.Insert( pRedl );
- }
- }
- break;
- case nsRedlineType_t::REDLINE_DELETE:
- {
- SwDoc& rDoc = *pRedl->GetDoc();
- const SwPosition *pDelStt = 0, *pDelEnd = 0;
- bool bDelRedl = false;
- switch( eCmp )
- {
- case POS_INSIDE:
- if( bCallDelete )
- {
- pDelStt = pSttRng;
- pDelEnd = pEndRng;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- if( bCallDelete )
- {
- pDelStt = pRStt;
- pDelEnd = pEndRng;
- }
- break;
- case POS_OVERLAP_BEHIND:
- if( bCallDelete )
- {
- pDelStt = pREnd;
- pDelEnd = pSttRng;
- }
- break;
-
- case POS_OUTSIDE:
- case POS_EQUAL:
- {
- rArr.Remove( rPos-- );
- bDelRedl = true;
- if( bCallDelete )
- {
- pDelStt = pRedl->Start();
- pDelEnd = pRedl->End();
- }
- }
- break;
- default:
- bRet = false;
- }
-
- if( pDelStt && pDelEnd )
- {
- SwPaM aPam( *pDelStt, *pDelEnd );
- SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
- SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
-
- if( bDelRedl )
- delete pRedl;
-
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
-
- if( pCSttNd && pCEndNd )
- rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
- else
- {
- rDoc.getIDocumentContentOperations().DeleteRange( aPam );
-
- if( pCSttNd && !pCEndNd )
- {
- aPam.GetBound( true ).nContent.Assign( 0, 0 );
- aPam.GetBound( false ).nContent.Assign( 0, 0 );
- aPam.DeleteMark();
- rDoc.getIDocumentContentOperations().DelFullPara( aPam );
- }
- }
- rDoc.SetRedlineMode_intern( eOld );
- }
- else if( bDelRedl )
- delete pRedl;
- }
- break;
-
- case nsRedlineType_t::REDLINE_FMTCOLL:
- rArr.DeleteAndDestroy( rPos-- );
- break;
-
- default:
- bRet = false;
- }
- return bRet;
-}
-
-static bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
- bool bCallDelete,
- const SwPosition* pSttRng = 0,
- const SwPosition* pEndRng = 0 )
-{
- bool bRet = true;
- SwRangeRedline* pRedl = rArr[ rPos ];
- SwPosition *pRStt = 0, *pREnd = 0;
- SwComparePosition eCmp = POS_OUTSIDE;
- if( pSttRng && pEndRng )
- {
- pRStt = pRedl->Start();
- pREnd = pRedl->End();
- eCmp = ComparePosition( *pSttRng, *pEndRng, *pRStt, *pREnd );
- }
-
- pRedl->InvalidateRange();
-
- switch( pRedl->GetType() )
- {
- case nsRedlineType_t::REDLINE_INSERT:
- {
- SwDoc& rDoc = *pRedl->GetDoc();
- const SwPosition *pDelStt = 0, *pDelEnd = 0;
- bool bDelRedl = false;
- switch( eCmp )
- {
- case POS_INSIDE:
- if( bCallDelete )
- {
- pDelStt = pSttRng;
- pDelEnd = pEndRng;
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- if( bCallDelete )
- {
- pDelStt = pRStt;
- pDelEnd = pEndRng;
- }
- break;
- case POS_OVERLAP_BEHIND:
- if( bCallDelete )
- {
- pDelStt = pREnd;
- pDelEnd = pSttRng;
- }
- break;
- case POS_OUTSIDE:
- case POS_EQUAL:
- {
- // delete the range again
- rArr.Remove( rPos-- );
- bDelRedl = true;
- if( bCallDelete )
- {
- pDelStt = pRedl->Start();
- pDelEnd = pRedl->End();
- }
- }
- break;
-
- default:
- bRet = false;
- }
- if( pDelStt && pDelEnd )
- {
- SwPaM aPam( *pDelStt, *pDelEnd );
-
- SwCntntNode* pCSttNd = pDelStt->nNode.GetNode().GetCntntNode();
- SwCntntNode* pCEndNd = pDelEnd->nNode.GetNode().GetCntntNode();
-
- if( bDelRedl )
- delete pRedl;
-
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern( (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
-
- if( pCSttNd && pCEndNd )
- rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
- else
- {
- rDoc.getIDocumentContentOperations().DeleteRange( aPam );
-
- if( pCSttNd && !pCEndNd )
- {
- aPam.GetBound( true ).nContent.Assign( 0, 0 );
- aPam.GetBound( false ).nContent.Assign( 0, 0 );
- aPam.DeleteMark();
- rDoc.getIDocumentContentOperations().DelFullPara( aPam );
- }
- }
- rDoc.SetRedlineMode_intern( eOld );
- }
- else if( bDelRedl )
- delete pRedl;
- }
- break;
- case nsRedlineType_t::REDLINE_DELETE:
- {
- SwRangeRedline* pNew = 0;
- bool bCheck = false, bReplace = false;
-
- switch( eCmp )
- {
- case POS_INSIDE:
- {
- if( 1 < pRedl->GetStackCount() )
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->PopData();
- }
- if( *pSttRng == *pRStt )
- {
- pRedl->SetStart( *pEndRng, pRStt );
- bReplace = true;
- if( pNew )
- pNew->SetEnd( *pEndRng );
- }
- else
- {
- if( *pEndRng != *pREnd )
- {
- // split up
- SwRangeRedline* pCpy = new SwRangeRedline( *pRedl );
- pCpy->SetStart( *pEndRng );
- rArr.Insert( pCpy ); ++rPos;
- if( pNew )
- pNew->SetEnd( *pEndRng );
- }
-
- pRedl->SetEnd( *pSttRng, pREnd );
- bCheck = true;
- if( pNew )
- pNew->SetStart( *pSttRng );
- }
- }
- break;
-
- case POS_OVERLAP_BEFORE:
- if( 1 < pRedl->GetStackCount() )
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->PopData();
- }
- pRedl->SetStart( *pEndRng, pRStt );
- bReplace = true;
- if( pNew )
- pNew->SetEnd( *pEndRng );
- break;
-
- case POS_OVERLAP_BEHIND:
- if( 1 < pRedl->GetStackCount() )
- {
- pNew = new SwRangeRedline( *pRedl );
- pNew->PopData();
- }
- pRedl->SetEnd( *pSttRng, pREnd );
- bCheck = true;
- if( pNew )
- pNew->SetStart( *pSttRng );
- break;
-
- case POS_OUTSIDE:
- case POS_EQUAL:
- if( !pRedl->PopData() )
- // deleting the RedlineObject is enough
- rArr.DeleteAndDestroy( rPos-- );
- break;
-
- default:
- bRet = false;
- }
-
- if( pNew )
- {
- rArr.Insert( pNew ); ++rPos;
- }
-
- if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
- {
- // re-insert
- rArr.Remove( pRedl );
- rArr.Insert( pRedl );
- }
- }
- break;
-
- case nsRedlineType_t::REDLINE_FORMAT:
- case nsRedlineType_t::REDLINE_FMTCOLL:
- {
- if( pRedl->GetExtraData() )
- pRedl->GetExtraData()->Reject( *pRedl );
- rArr.DeleteAndDestroy( rPos-- );
- }
- break;
-
- default:
- bRet = false;
- }
- return bRet;
-}
-
-static int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
- SwRedlineTbl& rArr, bool bCallDelete,
- const SwPaM& rPam)
-{
- sal_uInt16 n = 0;
- int nCount = 0;
-
- const SwPosition* pStt = rPam.Start(),
- * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
- : rPam.GetPoint();
- const SwRangeRedline* pFnd = rArr.FindAtPosition( *pStt, n, true );
- if( pFnd && // Is new a part of it?
- ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd ))
- {
- // Only revoke the partial selection
- if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
- nCount++;
- ++n;
- }
-
- for( ; n < rArr.size(); ++n )
- {
- SwRangeRedline* pTmp = rArr[ n ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- if( *pTmp->End() <= *pEnd )
- {
- if( (*fn_AcceptReject)( rArr, n, bCallDelete, 0, 0 ))
- nCount++;
- }
- else
- {
- if( *pTmp->Start() < *pEnd )
- {
- // Only revoke the partial selection
- if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
- nCount++;
- }
- break;
- }
- }
- }
- return nCount;
-}
-
-static void lcl_AdjustRedlineRange( SwPaM& rPam )
-{
- // The Selection is only in the ContentSection. If there are Redlines
- // to Non-ContentNodes before or after that, then the Selections
- // expand to them.
- SwPosition* pStt = rPam.Start(),
- * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
- : rPam.GetPoint();
- SwDoc* pDoc = rPam.GetDoc();
- if( !pStt->nContent.GetIndex() &&
- !pDoc->GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsCntntNode() )
- {
- const SwRangeRedline* pRedl = pDoc->GetRedline( *pStt, 0 );
- if( pRedl )
- {
- const SwPosition* pRStt = pRedl->Start();
- if( !pRStt->nContent.GetIndex() && pRStt->nNode.GetIndex() ==
- pStt->nNode.GetIndex() - 1 )
- *pStt = *pRStt;
- }
- }
- if( pEnd->nNode.GetNode().IsCntntNode() &&
- !pDoc->GetNodes()[ pEnd->nNode.GetIndex() + 1 ]->IsCntntNode() &&
- pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
- {
- const SwRangeRedline* pRedl = pDoc->GetRedline( *pEnd, 0 );
- if( pRedl )
- {
- const SwPosition* pREnd = pRedl->End();
- if( !pREnd->nContent.GetIndex() && pREnd->nNode.GetIndex() ==
- pEnd->nNode.GetIndex() + 1 )
- *pEnd = *pREnd;
- }
- }
-}
-
-bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
-{
- bool bRet = false;
-
- // Switch to visible in any case
- if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
- (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
- SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
-
- SwRangeRedline* pTmp = (*mpRedlineTbl)[ nPos ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- SwRewriter aRewriter;
-
- aRewriter.AddRule(UndoArg1, pTmp->GetDescr());
- GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter);
- }
-
- int nLoopCnt = 2;
- sal_uInt16 nSeqNo = pTmp->GetSeqNo();
-
- do {
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) );
- GetIDocumentUndoRedo().AppendUndo(pUndo);
- }
-
- bRet |= lcl_AcceptRedline( *mpRedlineTbl, nPos, bCallDelete );
-
- if( nSeqNo )
- {
- if( USHRT_MAX == nPos )
- nPos = 0;
- sal_uInt16 nFndPos = 2 == nLoopCnt
- ? mpRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
- : mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
- if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
- USHRT_MAX != ( nFndPos =
- mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
- pTmp = (*mpRedlineTbl)[ nPos = nFndPos ];
- else
- nLoopCnt = 0;
- }
- else
- nLoopCnt = 0;
-
- } while( nLoopCnt );
-
- if( bRet )
- {
- CompressRedlines();
- SetModified();
- }
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
- }
- }
- return bRet;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
-{
- // Switch to visible in any case
- if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
- (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
- SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
-
- // The Selection is only in the ContentSection. If there are Redlines
- // to Non-ContentNodes before or after that, then the Selections
- // expand to them.
- SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
- lcl_AdjustRedlineRange( aPam );
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL );
- GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam ));
- }
-
- int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, *mpRedlineTbl,
- bCallDelete, aPam );
- if( nRet > 0 )
- {
- CompressRedlines();
- SetModified();
- }
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- OUString aTmpStr;
-
- {
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, OUString::number(nRet));
- aTmpStr = aRewriter.Apply(OUString(SW_RES(STR_N_REDLINES)));
- }
-
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, aTmpStr);
-
- GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter );
- }
- return nRet != 0;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
-{
- bool bRet = false;
-
- // Switch to visible in any case
- if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
- (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
- SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
-
- SwRangeRedline* pTmp = (*mpRedlineTbl)[ nPos ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- SwRewriter aRewriter;
-
- aRewriter.AddRule(UndoArg1, pTmp->GetDescr());
- GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter);
- }
-
- int nLoopCnt = 2;
- sal_uInt16 nSeqNo = pTmp->GetSeqNo();
-
- do {
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) );
- GetIDocumentUndoRedo().AppendUndo(pUndo);
- }
-
- bRet |= lcl_RejectRedline( *mpRedlineTbl, nPos, bCallDelete );
-
- if( nSeqNo )
- {
- if( USHRT_MAX == nPos )
- nPos = 0;
- sal_uInt16 nFndPos = 2 == nLoopCnt
- ? mpRedlineTbl->FindNextSeqNo( nSeqNo, nPos )
- : mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos );
- if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) &&
- USHRT_MAX != ( nFndPos =
- mpRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ))) )
- pTmp = (*mpRedlineTbl)[ nPos = nFndPos ];
- else
- nLoopCnt = 0;
- }
- else
- nLoopCnt = 0;
-
- } while( nLoopCnt );
-
- if( bRet )
- {
- CompressRedlines();
- SetModified();
- }
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
- }
- }
- return bRet;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete )
-{
- // Switch to visible in any case
- if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) !=
- (nsRedlineMode_t::REDLINE_SHOW_MASK & meRedlineMode) )
- SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE | meRedlineMode));
-
- // The Selection is only in the ContentSection. If there are Redlines
- // to Non-ContentNodes before or after that, then the Selections
- // expand to them.
- SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
- lcl_AdjustRedlineRange( aPam );
-
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL );
- GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) );
- }
-
- int nRet = lcl_AcceptRejectRedl( lcl_RejectRedline, *mpRedlineTbl,
- bCallDelete, aPam );
- if( nRet > 0 )
- {
- CompressRedlines();
- SetModified();
- }
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- OUString aTmpStr;
-
- {
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, OUString::number(nRet));
- aTmpStr = aRewriter.Apply(OUString(SW_RES(STR_N_REDLINES)));
- }
-
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, aTmpStr);
-
- GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter );
- }
-
- return nRet != 0;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-const SwRangeRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
-{
- rPam.DeleteMark();
- rPam.SetMark();
-
- SwPosition& rSttPos = *rPam.GetPoint();
- SwPosition aSavePos( rSttPos );
- bool bRestart;
-
- // If the starting position points to the last valid ContentNode,
- // we take the next Redline in any case.
- sal_uInt16 n = 0;
- const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, true );
- if( pFnd )
- {
- const SwPosition* pEnd = pFnd->End();
- if( !pEnd->nNode.GetNode().IsCntntNode() )
- {
- SwNodeIndex aTmp( pEnd->nNode );
- SwCntntNode* pCNd = GetNodes().GoPrevSection( &aTmp );
- if( !pCNd || ( aTmp == rSttPos.nNode &&
- pCNd->Len() == rSttPos.nContent.GetIndex() ))
- pFnd = 0;
- }
- if( pFnd )
- rSttPos = *pFnd->End();
- }
-
- do {
- bRestart = false;
-
- for( ; !pFnd && n < mpRedlineTbl->size(); ++n )
- {
- pFnd = (*mpRedlineTbl)[ n ];
- if( pFnd->HasMark() && pFnd->IsVisible() )
- {
- *rPam.GetMark() = *pFnd->Start();
- rSttPos = *pFnd->End();
- break;
- }
- else
- pFnd = 0;
- }
-
- if( pFnd )
- {
- // Merge all of the same type and author that are
- // consecutive into one Selection.
- const SwPosition* pPrevEnd = pFnd->End();
- while( ++n < mpRedlineTbl->size() )
- {
- const SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- const SwPosition *pRStt;
- if( pFnd->GetType() == pTmp->GetType() &&
- pFnd->GetAuthor() == pTmp->GetAuthor() &&
- ( *pPrevEnd == *( pRStt = pTmp->Start() ) ||
- IsPrevPos( *pPrevEnd, *pRStt )) )
- {
- pPrevEnd = pTmp->End();
- rSttPos = *pPrevEnd;
- }
- else
- break;
- }
- }
- }
-
- if( pFnd )
- {
- const SwRangeRedline* pSaveFnd = pFnd;
-
- SwCntntNode* pCNd;
- SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
- if( !pIdx->GetNode().IsCntntNode() &&
- 0 != ( pCNd = GetNodes().GoNextSection( pIdx )) )
- {
- if( *pIdx <= rPam.GetPoint()->nNode )
- rPam.GetMark()->nContent.Assign( pCNd, 0 );
- else
- pFnd = 0;
- }
-
- if( pFnd )
- {
- pIdx = &rPam.GetPoint()->nNode;
- if( !pIdx->GetNode().IsCntntNode() &&
- 0 != ( pCNd = GetNodes().GoPrevSection( pIdx )) )
- {
- if( *pIdx >= rPam.GetMark()->nNode )
- rPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
- else
- pFnd = 0;
- }
- }
-
- if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
- {
- if( n < mpRedlineTbl->size() )
- {
- bRestart = true;
- *rPam.GetPoint() = *pSaveFnd->End();
- }
- else
- {
- rPam.DeleteMark();
- *rPam.GetPoint() = aSavePos;
- }
- pFnd = 0;
- }
- }
- } while( bRestart );
-
- return pFnd;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-const SwRangeRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const
-{
- rPam.DeleteMark();
- rPam.SetMark();
-
- SwPosition& rSttPos = *rPam.GetPoint();
- SwPosition aSavePos( rSttPos );
- bool bRestart;
-
- // If the starting position points to the last valid ContentNode,
- // we take the previous Redline in any case.
- sal_uInt16 n = 0;
- const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, false );
- if( pFnd )
- {
- const SwPosition* pStt = pFnd->Start();
- if( !pStt->nNode.GetNode().IsCntntNode() )
- {
- SwNodeIndex aTmp( pStt->nNode );
- SwCntntNode* pCNd = GetNodes().GoNextSection( &aTmp );
- if( !pCNd || ( aTmp == rSttPos.nNode &&
- !rSttPos.nContent.GetIndex() ))
- pFnd = 0;
- }
- if( pFnd )
- rSttPos = *pFnd->Start();
- }
-
- do {
- bRestart = false;
-
- while( !pFnd && 0 < n )
- {
- pFnd = (*mpRedlineTbl)[ --n ];
- if( pFnd->HasMark() && pFnd->IsVisible() )
- {
- *rPam.GetMark() = *pFnd->End();
- rSttPos = *pFnd->Start();
- }
- else
- pFnd = 0;
- }
-
- if( pFnd )
- {
- // Merge all of the same type and author that are
- // consecutive into one Selection.
- const SwPosition* pNextStt = pFnd->Start();
- while( 0 < n )
- {
- const SwRangeRedline* pTmp = (*mpRedlineTbl)[ --n ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- const SwPosition *pREnd;
- if( pFnd->GetType() == pTmp->GetType() &&
- pFnd->GetAuthor() == pTmp->GetAuthor() &&
- ( *pNextStt == *( pREnd = pTmp->End() ) ||
- IsPrevPos( *pREnd, *pNextStt )) )
- {
- pNextStt = pTmp->Start();
- rSttPos = *pNextStt;
- }
- else
- {
- ++n;
- break;
- }
- }
- }
- }
-
- if( pFnd )
- {
- const SwRangeRedline* pSaveFnd = pFnd;
-
- SwCntntNode* pCNd;
- SwNodeIndex* pIdx = &rPam.GetMark()->nNode;
- if( !pIdx->GetNode().IsCntntNode() &&
- 0 != ( pCNd = GetNodes().GoPrevSection( pIdx )) )
- {
- if( *pIdx >= rPam.GetPoint()->nNode )
- rPam.GetMark()->nContent.Assign( pCNd, pCNd->Len() );
- else
- pFnd = 0;
- }
-
- if( pFnd )
- {
- pIdx = &rPam.GetPoint()->nNode;
- if( !pIdx->GetNode().IsCntntNode() &&
- 0 != ( pCNd = GetNodes().GoNextSection( pIdx )) )
- {
- if( *pIdx <= rPam.GetMark()->nNode )
- rPam.GetPoint()->nContent.Assign( pCNd, 0 );
- else
- pFnd = 0;
- }
- }
-
- if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
- {
- if( n )
- {
- bRestart = true;
- *rPam.GetPoint() = *pSaveFnd->Start();
- }
- else
- {
- rPam.DeleteMark();
- *rPam.GetPoint() = aSavePos;
- }
- pFnd = 0;
- }
- }
- } while( bRestart );
-
- return pFnd;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-// Set comment at the Redline
-bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const OUString& rS )
-{
- bool bRet = false;
- const SwPosition* pStt = rPaM.Start(),
- * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
- : rPaM.GetPoint();
- sal_uInt16 n = 0;
- if( GetRedlineTbl().FindAtPosition( *pStt, n, true ) )
- {
- for( ; n < mpRedlineTbl->size(); ++n )
- {
- bRet = true;
- SwRangeRedline* pTmp = (*mpRedlineTbl)[ n ];
- if( pStt != pEnd && *pTmp->Start() > *pEnd )
- break;
-
- pTmp->SetComment( rS );
- if( *pTmp->End() >= *pEnd )
- break;
- }
- }
- if( bRet )
- SetModified();
-
- return bRet;
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-// Create a new author if necessary
-sal_uInt16 SwDoc::GetRedlineAuthor()
-{
- return SW_MOD()->GetRedlineAuthor();
-}
-
-/// Insert new author into the Table for the Readers etc.
-sal_uInt16 SwDoc::InsertRedlineAuthor( const OUString& rNew )
-{
- return SW_MOD()->InsertRedlineAuthor(rNew);
-}
-
-void SwDoc::UpdateRedlineAttr()
-{
- const SwRedlineTbl& rTbl = GetRedlineTbl();
- for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
- {
- SwRangeRedline* pRedl = rTbl[ n ];
- if( pRedl->IsVisible() )
- pRedl->InvalidateRange();
- }
-
- // #TODO - add 'SwExtraRedlineTbl' also ?
-}
-
-/// Set comment text for the Redline, which is inserted later on via
-/// AppendRedline. Is used by Autoformat.
-/// A null pointer resets the mode. The pointer is not copied, so it
-/// needs to stay valid!
-void SwDoc::SetAutoFmtRedlineComment( const OUString* pTxt, sal_uInt16 nSeqNo )
-{
- mbIsAutoFmtRedline = 0 != pTxt;
- if( pTxt )
- {
- if( !mpAutoFmtRedlnComment )
- mpAutoFmtRedlnComment = new OUString( *pTxt );
- else
- *mpAutoFmtRedlnComment = *pTxt;
- }
- else
- delete mpAutoFmtRedlnComment, mpAutoFmtRedlnComment = 0;
-
- mnAutoFmtRedlnCommentNo = nSeqNo;
-}
-
-void SwDoc::SetRedlinePassword(
- /*[in]*/const uno::Sequence <sal_Int8>& rNewPassword)
-{
- maRedlinePasswd = rNewPassword;
- SetModified();
-}
-
bool SwRedlineTbl::Insert( SwRangeRedline* p, bool bIns )
{
bool bRet = false;
@@ -3165,8 +686,8 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
{
SwDoc* pDoc = rPam.GetDoc();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE)));
// Actually we need to reset the Attribute here!
std::vector<sal_uInt16>::const_iterator it;
@@ -3176,7 +697,7 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
nsSetAttrMode::SETATTR_DONTEXPAND );
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
bool SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const
@@ -3310,7 +831,7 @@ OUString SwRedlineData::GetDescr() const
SwRangeRedline::SwRangeRedline(RedlineType_t eTyp, const SwPaM& rPam )
: SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
- pRedlineData( new SwRedlineData( eTyp, GetDoc()->GetRedlineAuthor() ) ),
+ pRedlineData( new SwRedlineData( eTyp, GetDoc()->getIDocumentRedlineAccess().GetRedlineAuthor() ) ),
pCntntSect( 0 )
{
bDelLastPara = bIsLastParaDelete = false;
@@ -3380,7 +901,7 @@ bool SwRangeRedline::HasValidRange() const
void SwRangeRedline::CallDisplayFunc( sal_uInt16 nLoop )
{
- switch( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() )
+ switch( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() )
{
case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE:
Show( nLoop );
@@ -3399,8 +920,8 @@ void SwRangeRedline::Show( sal_uInt16 nLoop )
if( 1 <= nLoop )
{
SwDoc* pDoc = GetDoc();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
switch( GetType() )
@@ -3422,15 +943,15 @@ void SwRangeRedline::Show( sal_uInt16 nLoop )
default:
break;
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
}
void SwRangeRedline::Hide( sal_uInt16 nLoop )
{
SwDoc* pDoc = GetDoc();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
switch( GetType() )
@@ -3459,16 +980,16 @@ void SwRangeRedline::Hide( sal_uInt16 nLoop )
default:
break;
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
void SwRangeRedline::ShowOriginal( sal_uInt16 nLoop )
{
SwDoc* pDoc = GetDoc();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
SwRedlineData* pCur;
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
// Determine the Type, it's the first on Stack
@@ -3501,7 +1022,7 @@ void SwRangeRedline::ShowOriginal( sal_uInt16 nLoop )
default:
break;
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
void SwRangeRedline::InvalidateRange() // trigger the Layout
@@ -3586,7 +1107,7 @@ void SwRangeRedline::MoveToSection()
{
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
SwRangeRedline* pRedl = rTbl[ n ];
@@ -3659,7 +1180,7 @@ void SwRangeRedline::CopyToSection()
SwNodes& rNds = pDoc->GetNodes();
bool bSaveCopyFlag = pDoc->IsCopyIsMove(),
- bSaveRdlMoveFlg = pDoc->IsRedlineMove();
+ bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove();
pDoc->SetCopyIsMove( true );
// The IsRedlineMove() flag causes the behaviour of the
@@ -3667,7 +1188,7 @@ void SwRangeRedline::CopyToSection()
// called by the pDoc->Copy line below (through SwDoc::_Copy,
// SwDoc::CopyWithFlyInFly). This rather obscure bugfix
// apparently never really worked.
- pDoc->SetRedlineMove( pStt->nContent == 0 );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMove( pStt->nContent == 0 );
if( pCSttNd )
{
@@ -3719,7 +1240,7 @@ void SwRangeRedline::CopyToSection()
pCntntSect = new SwNodeIndex( *pSttNd );
pDoc->SetCopyIsMove( bSaveCopyFlag );
- pDoc->SetRedlineMove( bSaveRdlMoveFlg );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg );
}
}
@@ -3739,7 +1260,7 @@ void SwRangeRedline::DelCopyOfSection()
{
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
SwRangeRedline* pRedl = rTbl[ n ];
@@ -3769,7 +1290,7 @@ void SwRangeRedline::DelCopyOfSection()
// table are sorted and the pEnd position is an endnode (see
// bDelLastPara condition above), only redlines before the
// current ones can be affected.
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
sal_uInt16 n = rTbl.GetPos( this );
OSL_ENSURE( n != USHRT_MAX, "How strange. We don't exist!" );
for( bool bBreak = false; !bBreak && n > 0; )
@@ -3816,7 +1337,7 @@ void SwRangeRedline::MoveFromSection()
if( pCntntSect )
{
SwDoc* pDoc = GetDoc();
- const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
std::vector<SwPosition*> aBeforeArr, aBehindArr;
sal_uInt16 nMyPos = rTbl.GetPos( this );
OSL_ENSURE( this, "this is not in the array?" );
@@ -4085,16 +1606,6 @@ OUString SwRangeRedline::GetDescr(sal_uInt16 nPos)
return aResult;
}
-bool SwDoc::IsInRedlines(const SwNode & rNode) const
-{
- SwPosition aPos(rNode);
- SwNode & rEndOfRedlines = GetNodes().GetEndOfRedlines();
- SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),
- SwPosition(rEndOfRedlines));
-
- return aPam.ContainsPosition(aPos);
-}
-
bool SwExtraRedlineTbl::Insert( SwExtraRedline* p )
{
m_aExtraRedlines.push_back( p );
@@ -4142,51 +1653,6 @@ SwTableRowRedline::~SwTableRowRedline()
{
}
-bool SwDoc::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool bCallDelete )
-{
- (void)bCallDelete;
-
- // #TODO - equivelant for 'SwTableRowRedline'
- bool bMerged = false;
- /*
- _CHECK_REDLINE( this )
- */
-
- if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
- {
- // #TODO - equivelant for 'SwTableRowRedline'
- /*
- pNewRedl->InvalidateRange();
- */
-
- // Make equivelant of 'AppendRedline' checks inside here too
-
- mpExtraRedlineTbl->Insert( pNewRedl );
- }
- else
- {
- // TO DO - equivelant for 'SwTableRowRedline'
- /*
- if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
- {
- RedlineMode_t eOld = meRedlineMode;
- // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
- // The ShowMode needs to be retained!
- meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
- DeleteAndJoin( *pNewRedl );
- meRedlineMode = eOld;
- }
- delete pNewRedl, pNewRedl = 0;
- */
- }
- // #TODO - equivelant for 'SwTableRowRedline'
- /*
- _CHECK_REDLINE( this )
- */
-
- return ( 0 != pNewRedl ) || bMerged;
-}
-
SwTableCellRedline::SwTableCellRedline(const SwRedlineData& rData, const SwTableBox& rTableBox)
: m_aRedlineData(rData)
, m_rTableBox(rTableBox)
@@ -4197,50 +1663,5 @@ SwTableCellRedline::~SwTableCellRedline()
{
}
-bool SwDoc::AppendTableCellRedline( SwTableCellRedline* pNewRedl, bool bCallDelete )
-{
- (void)bCallDelete;
-
- // #TODO - equivelant for 'SwTableCellRedline'
- bool bMerged = false;
- /*
- _CHECK_REDLINE( this )
- */
-
- if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
- {
- // #TODO - equivelant for 'SwTableCellRedline'
- /*
- pNewRedl->InvalidateRange();
- */
-
- // Make equivelant of 'AppendRedline' checks inside here too
-
- mpExtraRedlineTbl->Insert( pNewRedl );
- }
- else
- {
- // TO DO - equivelant for 'SwTableCellRedline'
- /*
- if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
- {
- RedlineMode_t eOld = meRedlineMode;
- // Set to NONE, so that the Delete::Redo merges the Redline data correctly!
- // The ShowMode needs to be retained!
- meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
- DeleteAndJoin( *pNewRedl );
- meRedlineMode = eOld;
- }
- delete pNewRedl, pNewRedl = 0;
- */
- }
- // #TODO - equivelant for 'SwTableCellRedline'
- /*
- _CHECK_REDLINE( this )
- */
-
- return ( 0 != pNewRedl ) || bMerged;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index d53c7303747b..687cc7885c17 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -326,14 +326,14 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
SwUndoSort* pUndoSort = 0;
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( IsRedlineOn() || (!IsIgnoreRedline() && !mpRedlineTbl->empty() ))
+ if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, -1, 1 );
SwCntntNode* pCNd = pRedlPam->GetCntntNode( false );
if( pCNd )
pRedlPam->GetMark()->nContent = pCNd->Len();
- if( IsRedlineOn() && !IsShowOriginal( GetRedlineMode() ) )
+ if( getIDocumentRedlineAccess().IsRedlineOn() && !IDocumentRedlineAccess::IsShowOriginal( getIDocumentRedlineAccess().GetRedlineMode() ) )
{
if( bUndo )
{
@@ -346,7 +346,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
GetNodes()._Copy( aRg, aEndIdx );
// range is new from pEnd->nNode+1 to aEndIdx
- DeleteRedline( *pRedlPam, true, USHRT_MAX );
+ getIDocumentRedlineAccess().DeleteRedline( *pRedlPam, true, USHRT_MAX );
pRedlPam->GetMark()->nNode.Assign( pEnd->nNode.GetNode(), 1 );
pCNd = pRedlPam->GetCntntNode( false );
@@ -368,7 +368,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
}
else
{
- DeleteRedline( *pRedlPam, true, USHRT_MAX );
+ getIDocumentRedlineAccess().DeleteRedline( *pRedlPam, true, USHRT_MAX );
delete pRedlPam, pRedlPam = 0;
}
}
@@ -442,10 +442,10 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
SwCntntNode* pCNd = aSttIdx.GetNode().GetCntntNode();
pRedlPam->GetPoint()->nContent.Assign( pCNd, 0 );
- AppendRedline(pDeleteRedline, true);
+ getIDocumentRedlineAccess().AppendRedline(pDeleteRedline, true);
// the sorted range is inserted
- AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true);
+ getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true);
if( pRedlUndo )
{
@@ -492,8 +492,8 @@ bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
if(aFndBox.GetLines().empty())
return false;
- if( !IsIgnoreRedline() && !GetRedlineTbl().empty() )
- DeleteRedline( *pTblNd, true, USHRT_MAX );
+ if( !getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ getIDocumentRedlineAccess().DeleteRedline( *pTblNd, true, USHRT_MAX );
sal_uInt16 nStart = 0;
if( pTblNd->GetTable().GetRowsToRepeat() > 0 && rOpt.eDirection == SRT_ROWS )
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 9a4d68324393..7cb16d3e4c56 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -37,6 +37,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <DocumentSettingManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pagefrm.hxx>
#include <ndtxt.hxx>
#include <swtable.hxx>
@@ -841,7 +842,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
// remove old content an insert one empty textnode (to hold the layout!)
SwTxtNode* pFirstEmptyNd;
{
- pDoc->DeleteRedline( *pSectNd, true, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( *pSectNd, true, USHRT_MAX );
SwNodeIndex aSttIdx( *pSectNd, +1 );
SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 27809b7b6a26..bcf61c1099ac 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -24,6 +24,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <swtable.hxx>
@@ -529,7 +530,7 @@ static void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
if( pUndo )
pUndo->AddBoxBefore( *pDstBox, bDelCntnt );
- bool bUndoRedline = pUndo && pDoc->IsRedlineOn();
+ bool bUndoRedline = pUndo && pDoc->getIDocumentRedlineAccess().IsRedlineOn();
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
SwNodeIndex aSavePos( aInsIdx, -1 );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index fb11fb9c3626..7101be27602f 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -32,6 +32,7 @@
#include <IDocumentSettingAccess.hxx>
#include <IDocumentChartDataProviderAccess.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <cntfrm.hxx>
#include <tabfrm.hxx>
#include <frmtool.hxx>
@@ -758,8 +759,8 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
pShareFmts->RemoveFormat( *rTblBoxes[ nDelPos ]->GetFrmFmt() );
// Before deleting the 'Table Box' from memory - delete any redlines attached to it
- if ( rTbl.GetFrmFmt()->GetDoc()->HasExtraRedlineTbl() )
- rTbl.GetFrmFmt()->GetDoc()->GetExtraRedlineTbl().DeleteTableCellRedline( rTbl.GetFrmFmt()->GetDoc(), *(rTblBoxes[nDelPos]), true, USHRT_MAX );
+ if ( rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().HasExtraRedlineTbl() )
+ rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteTableCellRedline( rTbl.GetFrmFmt()->GetDoc(), *(rTblBoxes[nDelPos]), true, USHRT_MAX );
delete rTblBoxes[nDelPos];
rTblBoxes.erase( rTblBoxes.begin() + nDelPos );
@@ -811,8 +812,8 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
SwTableLine* pTabLineToDelete = rTbl.GetTabLines()[ nDelPos ];
// Before deleting the 'Table Line' from memory - delete any redlines attached to it
- if ( rTbl.GetFrmFmt()->GetDoc()->HasExtraRedlineTbl() )
- rTbl.GetFrmFmt()->GetDoc()->GetExtraRedlineTbl().DeleteTableRowRedline( rTbl.GetFrmFmt()->GetDoc(), *pTabLineToDelete, true, USHRT_MAX );
+ if ( rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().HasExtraRedlineTbl() )
+ rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteTableRowRedline( rTbl.GetFrmFmt()->GetDoc(), *pTabLineToDelete, true, USHRT_MAX );
delete pTabLineToDelete;
rTbl.GetTabLines().erase( rTbl.GetTabLines().begin() + nDelPos );
break; // we cannot delete more
@@ -826,8 +827,8 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
SwTableLine* pTabLineToDelete = pBox->GetTabLines()[ nDelPos ];
// Before deleting the 'Table Line' from memory - delete any redlines attached to it
- if ( rTbl.GetFrmFmt()->GetDoc()->HasExtraRedlineTbl() )
- rTbl.GetFrmFmt()->GetDoc()->GetExtraRedlineTbl().DeleteTableRowRedline( rTbl.GetFrmFmt()->GetDoc(), *pTabLineToDelete, true, USHRT_MAX );
+ if ( rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().HasExtraRedlineTbl() )
+ rTbl.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteTableRowRedline( rTbl.GetFrmFmt()->GetDoc(), *pTabLineToDelete, true, USHRT_MAX );
delete pTabLineToDelete;
pBox->GetTabLines().erase( pBox->GetTabLines().begin() + nDelPos );
} while( pBox->GetTabLines().empty() );
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index e622c4066b8c..5f3312e6ec10 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -194,8 +194,8 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
SwSectionNode* pNewSectNode = 0;
- RedlineMode_t eOld = GetRedlineMode();
- SetRedlineMode_intern( (RedlineMode_t)((eOld & ~nsRedlineMode_t::REDLINE_SHOW_MASK) | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = getIDocumentRedlineAccess().GetRedlineMode();
+ getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)((eOld & ~nsRedlineMode_t::REDLINE_SHOW_MASK) | nsRedlineMode_t::REDLINE_IGNORE));
if( rRange.HasMark() )
{
@@ -316,19 +316,19 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
pNewSectNode->CheckSectionCondColl();
//FEATURE::CONDCOLL
- SetRedlineMode_intern( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( IsRedlineOn() || (!IsIgnoreRedline() && !mpRedlineTbl->empty() ))
+ if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
- if( IsRedlineOn() )
+ if( getIDocumentRedlineAccess().IsRedlineOn() )
{
- AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
}
else
{
- SplitRedline( aPam );
+ getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 0b5476838530..380ba88fd77d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -42,6 +42,7 @@
#include <UndoManager.hxx>
#include <DocumentSettingManager.hxx>
#include <IDocumentChartDataProviderAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <swcrsr.hxx>
@@ -537,13 +538,13 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
pTblNd->MakeFrms( &aNdIdx );
// To-Do - add 'SwExtraRedlineTbl' also ?
- if( IsRedlineOn() || (!IsIgnoreRedline() && !mpRedlineTbl->empty() ))
+ if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( *pTblNd->EndOfSectionNode(), *pTblNd, 1 );
- if( IsRedlineOn() )
- AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
+ if( getIDocumentRedlineAccess().IsRedlineOn() )
+ getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
else
- SplitRedline( aPam );
+ getIDocumentRedlineAccess().SplitRedline( aPam );
}
SetModified();
@@ -2216,8 +2217,8 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
// #i33394#
GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL );
- RedlineMode_t eOld = GetRedlineMode();
- SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = getIDocumentRedlineAccess().GetRedlineMode();
+ getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo())
? new SwUndoTblMerge( rPam )
@@ -2230,7 +2231,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
if( !rTable.PrepareMerge( rPam, aBoxes, aMerged, &pMergeBox, pUndo ) )
{ // No cells found to merge
- SetRedlineMode_intern( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
if( pUndo )
{
delete pUndo;
@@ -2294,7 +2295,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
rPam.Move();
::ClearFEShellTabCols();
- SetRedlineMode_intern( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL );
return nRet;
@@ -2449,8 +2450,8 @@ void SwTableNode::RemoveRedlines()
if (pDoc)
{
SwTable& rTbl = GetTable();
- if ( pDoc->HasExtraRedlineTbl() )
- pDoc->GetExtraRedlineTbl().DeleteAllTableRedlines( pDoc, rTbl, true, USHRT_MAX );
+ if ( pDoc->getIDocumentRedlineAccess().HasExtraRedlineTbl() )
+ pDoc->getIDocumentRedlineAccess().GetExtraRedlineTbl().DeleteAllTableRedlines( pDoc, rTbl, true, USHRT_MAX );
}
}
@@ -4260,9 +4261,9 @@ bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
}
else
{
- RedlineMode_t eOld = GetRedlineMode();
- if( IsRedlineOn() )
- SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
+ RedlineMode_t eOld = getIDocumentRedlineAccess().GetRedlineMode();
+ if( getIDocumentRedlineAccess().IsRedlineOn() )
+ getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON |
nsRedlineMode_t::REDLINE_SHOW_INSERT |
nsRedlineMode_t::REDLINE_SHOW_DELETE));
@@ -4358,7 +4359,7 @@ bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
rInsPos.nNode = *pSttNd;
rInsPos.nContent.Assign( GetNodes().GoNext( &rInsPos.nNode ), 0 );
}
- SetRedlineMode( eOld );
+ getIDocumentRedlineAccess().SetRedlineMode( eOld );
}
if( bRet )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 027a38c63cae..8d31f7f0d3a0 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -62,6 +62,7 @@
#include <IDocumentListItems.hxx>
#include <DocumentSettingManager.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <switerator.hxx>
#include "ndole.hxx"
@@ -1910,7 +1911,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwCntntNode::getSdrAllFil
*/
const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc()->GetDocumentSettingManager(); }
const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return &GetDoc()->getIDocumentDeviceAccess(); }
-const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); }
+const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return &GetDoc()->getIDocumentRedlineAccess(); }
const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); }
const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); }
const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); }
@@ -1932,7 +1933,7 @@ bool SwNode::IsInRedlines() const
bool bResult = false;
if (pDoc != NULL)
- bResult = pDoc->IsInRedlines(*this);
+ bResult = pDoc->getIDocumentRedlineAccess().IsInRedlines(*this);
return bResult;
}
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index e082caffbff4..23f61fb3e24f 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -10,6 +10,7 @@
#include "doc.hxx"
#include "drawdoc.hxx"
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <UndoManager.hxx>
#include "ndtxt.hxx"
#include "MarkManager.hxx"
@@ -190,8 +191,8 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
mpSpzFrmFmtTbl->dumpAsXml( writer, "spzFrmFmtTbl" );
mpSectionFmtTbl->dumpAsXml( writer );
mpNumRuleTbl->dumpAsXml( writer );
- mpRedlineTbl->dumpAsXml( writer );
- mpExtraRedlineTbl->dumpAsXml( writer );
+ getIDocumentRedlineAccess().GetRedlineTbl().dumpAsXml( writer );
+ getIDocumentRedlineAccess().GetExtraRedlineTbl().dumpAsXml( writer );
lcl_dumpSdrModel( writer, getIDocumentDrawModelAccess().GetDrawModel() );
writer.startElement("mbModified");
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 000d2fddcd6d..0e570565dec2 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -35,6 +35,7 @@
#include <IDocumentUndoRedo.hxx>
#include <DocumentLinksAdministrationManager.hxx>
#include <DocumentContentOperationsManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <node.hxx>
#include <pam.hxx>
#include <frmtool.hxx>
@@ -1263,8 +1264,8 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
if( nRet )
{
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
- eOldRedlineMode = pSrcDoc->GetRedlineMode();
- pSrcDoc->SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
+ eOldRedlineMode = pSrcDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pSrcDoc->getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
}
}
@@ -1374,7 +1375,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
if( 2 == nRet )
xDocSh->DoClose();
else if( ((SwDocShell*)&xDocSh)->GetDoc() )
- ((SwDocShell*)&xDocSh)->GetDoc()->SetRedlineMode(
+ ((SwDocShell*)&xDocSh)->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode(
eOldRedlineMode );
}
}
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 4c40b2d51b54..c13e18c34b9f 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -40,6 +40,7 @@
#include <fmtanchr.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <DocumentRedlineManager.hxx>
#include <docary.hxx>
#include <editsh.hxx>
#include <index.hxx>
@@ -221,7 +222,7 @@ class SwAutoFormat
bool SetRedlineTxt( sal_uInt16 nId )
{ if( m_aFlags.bWithRedlining ) _SetRedlineTxt( nId ); return true; }
bool ClearRedlineTxt()
- { if( m_aFlags.bWithRedlining ) m_pDoc->SetAutoFmtRedlineComment(0); return true; }
+ { if( m_aFlags.bWithRedlining ) m_pDoc->GetDocumentRedlineManager().SetAutoFmtRedlineComment(0); return true; }
public:
SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
@@ -284,7 +285,7 @@ void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId )
sTxt = "Action text is missing";
#endif
- m_pDoc->SetAutoFmtRedlineComment( &sTxt, nSeqNo );
+ m_pDoc->GetDocumentRedlineManager().SetAutoFmtRedlineComment( &sTxt, nSeqNo );
}
OUString SwAutoFormat::GoNextPara()
@@ -1749,7 +1750,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
OUString sTxt(SwViewShell::GetShellRes()->GetAutoFmtNameLst()[
STR_AUTOFMTREDL_SET_TMPL_HEADLINE ] );
sTxt = sTxt.replaceAll( "$(ARG1)", OUString::number( nLvl + 1 ) );
- m_pDoc->SetAutoFmtRedlineComment( &sTxt );
+ m_pDoc->GetDocumentRedlineManager().SetAutoFmtRedlineComment( &sTxt );
}
SetColl( static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + nLvl ), true );
@@ -1947,7 +1948,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos )
aFInfo.SetFrm( 0 );
}
//#125102# in case of the mode REDLINE_SHOW_DELETE the ** are still contained in pTxt
- if(0 == (m_pDoc->GetRedlineMode() & nsRedlineMode_t::REDLINE_SHOW_DELETE))
+ if(0 == (m_pDoc->getIDocumentRedlineAccess().GetRedlineMode() & nsRedlineMode_t::REDLINE_SHOW_DELETE))
nPos = m_aDelPam.GetPoint()->nContent.GetIndex() - 1;
// Was a character deleted before starting?
if (cBlank && cBlank != (*pTxt)[nSttPos - 1])
@@ -2120,7 +2121,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
m_nEndNdIdx = m_aEndNdIdx.GetIndex(),
m_pDoc->GetDocShell() );
- RedlineMode_t eRedlMode = m_pDoc->GetRedlineMode(), eOldMode = eRedlMode;
+ RedlineMode_t eRedlMode = m_pDoc->getIDocumentRedlineAccess().GetRedlineMode(), eOldMode = eRedlMode;
if( m_aFlags.bWithRedlining )
{
m_pDoc->SetAutoFmtRedline( true );
@@ -2128,7 +2129,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
}
else
eRedlMode = (RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_IGNORE);
- m_pDoc->SetRedlineMode( eRedlMode );
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode( eRedlMode );
// save undo state (might be turned off)
bool const bUndoState = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
@@ -2505,7 +2506,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
if( m_aFlags.bWithRedlining )
m_pDoc->SetAutoFmtRedline( false );
- m_pDoc->SetRedlineMode( eOldMode );
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode( eOldMode );
// restore undo (in case it has been changed)
m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState);
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index a4f0d5feb84e..e3ab17944f7d 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -22,6 +22,7 @@
#include <hintids.hxx>
#include <svl/urihelper.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pam.hxx>
#include <docary.hxx>
#include <editsh.hxx>
@@ -64,9 +65,9 @@ sal_uInt16 SwEditShell::MakeGlossary( SwTextBlocks& rBlks, const OUString& rName
rBlks.ClearDoc();
if( rBlks.BeginPutDoc( rShortName, rName ) )
{
- rBlks.GetDoc()->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
+ rBlks.GetDoc()->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
_CopySelToDoc( pGDoc );
- rBlks.GetDoc()->SetRedlineMode_intern( (RedlineMode_t)0 );
+ rBlks.GetDoc()->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)0 );
nRet = rBlks.PutDoc();
}
else
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 5b13e2828730..a009f0fef255 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -38,6 +38,7 @@
#include <editsh.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <rootfrm.hxx>
#include <pam.hxx>
#include <swundo.hxx>
@@ -1255,18 +1256,18 @@ static SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell* pSh)
{
SpellContentPositions aRedlines;
SwDoc* pDoc = pSh->GetDoc();
- const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( pDoc->GetRedlineMode() );
+ const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
if ( bShowChg )
{
SwPaM *pCrsr = pSh->GetCrsr();
const SwPosition* pStartPos = pCrsr->Start();
const SwTxtNode* pTxtNode = pCrsr->GetNode().GetTxtNode();
- sal_uInt16 nAct = pDoc->GetRedlinePos( *pTxtNode, USHRT_MAX );
+ sal_uInt16 nAct = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *pTxtNode, USHRT_MAX );
const sal_Int32 nStartIndex = pStartPos->nContent.GetIndex();
- for ( ; nAct < pDoc->GetRedlineTbl().size(); nAct++ )
+ for ( ; nAct < pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); nAct++ )
{
- const SwRangeRedline* pRed = pDoc->GetRedlineTbl()[ nAct ];
+ const SwRangeRedline* pRed = pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ];
if ( pRed->Start()->nNode > pTxtNode->GetIndex() )
break;
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index aff204031f0c..d77f621152b3 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -28,33 +28,33 @@
sal_uInt16 SwEditShell::GetRedlineMode() const
{
- return GetDoc()->GetRedlineMode();
+ return GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
}
void SwEditShell::SetRedlineMode( sal_uInt16 eMode )
{
- if( eMode != GetDoc()->GetRedlineMode() )
+ if( eMode != GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() )
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->SetRedlineMode( (RedlineMode_t)eMode );
+ GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)eMode );
EndAllAction();
}
}
bool SwEditShell::IsRedlineOn() const
{
- return GetDoc()->IsRedlineOn();
+ return GetDoc()->getIDocumentRedlineAccess().IsRedlineOn();
}
sal_uInt16 SwEditShell::GetRedlineCount() const
{
- return GetDoc()->GetRedlineTbl().size();
+ return GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl().size();
}
const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
{
- return *GetDoc()->GetRedlineTbl()[ nPos ];
+ return *GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl()[ nPos ];
}
static void lcl_InvalidateAll( SwViewShell* pSh )
@@ -73,7 +73,7 @@ bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
{
SET_CURR_SHELL( this );
StartAllAction();
- bool bRet = GetDoc()->AcceptRedline( nPos, true );
+ bool bRet = GetDoc()->getIDocumentRedlineAccess().AcceptRedline( nPos, true );
if( !nPos && !::IsExtraData( GetDoc() ) )
lcl_InvalidateAll( this );
EndAllAction();
@@ -84,7 +84,7 @@ bool SwEditShell::RejectRedline( sal_uInt16 nPos )
{
SET_CURR_SHELL( this );
StartAllAction();
- bool bRet = GetDoc()->RejectRedline( nPos, true );
+ bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( nPos, true );
if( !nPos && !::IsExtraData( GetDoc() ) )
lcl_InvalidateAll( this );
EndAllAction();
@@ -95,7 +95,7 @@ bool SwEditShell::AcceptRedlinesInSelection()
{
SET_CURR_SHELL( this );
StartAllAction();
- bool bRet = GetDoc()->AcceptRedline( *GetCrsr(), true );
+ bool bRet = GetDoc()->getIDocumentRedlineAccess().AcceptRedline( *GetCrsr(), true );
EndAllAction();
return bRet;
}
@@ -104,7 +104,7 @@ bool SwEditShell::RejectRedlinesInSelection()
{
SET_CURR_SHELL( this );
StartAllAction();
- bool bRet = GetDoc()->RejectRedline( *GetCrsr(), true );
+ bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( *GetCrsr(), true );
EndAllAction();
return bRet;
}
@@ -114,7 +114,7 @@ bool SwEditShell::SetRedlineComment( const OUString& rS )
{
bool bRet = false;
FOREACHPAM_START(GetCrsr())
- bRet = bRet || GetDoc()->SetRedlineComment( *PCURCRSR, rS );
+ bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( *PCURCRSR, rS );
FOREACHPAM_END()
return bRet;
@@ -122,18 +122,18 @@ bool SwEditShell::SetRedlineComment( const OUString& rS )
const SwRangeRedline* SwEditShell::GetCurrRedline() const
{
- return GetDoc()->GetRedline( *GetCrsr()->GetPoint(), 0 );
+ return GetDoc()->getIDocumentRedlineAccess().GetRedline( *GetCrsr()->GetPoint(), 0 );
}
void SwEditShell::UpdateRedlineAttr()
{
if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) ==
- ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() ))
+ ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() ))
{
SET_CURR_SHELL( this );
StartAllAction();
- GetDoc()->UpdateRedlineAttr();
+ GetDoc()->getIDocumentRedlineAccess().UpdateRedlineAttr();
EndAllAction();
}
@@ -145,7 +145,7 @@ void SwEditShell::UpdateRedlineAttr()
*/
sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
{
- const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
for( sal_uInt16 i = 0, nCnt = rTbl.size(); i < nCnt; ++i )
if( &rTbl[ i ]->GetRedlineData() == &rData )
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index 84539b5b6026..73c98c53482f 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -24,6 +24,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentContentOperations.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pam.hxx>
#include <UndoCore.hxx>
#include <swundo.hxx>
@@ -122,7 +123,7 @@ bool SwEditShell::Undo(sal_uInt16 const nCount)
// Destroy stored TableBoxPtr. A dection is only permitted for the new "Box"!
ClearTblBoxCntnt();
- const RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+ const RedlineMode_t eOld = GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
try {
for (sal_uInt16 i = 0; i < nCount; ++i)
@@ -142,8 +143,8 @@ bool SwEditShell::Undo(sal_uInt16 const nCount)
}
Pop( !bRestoreCrsr );
- GetDoc()->SetRedlineMode( eOld );
- GetDoc()->CompressRedlines();
+ GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( eOld );
+ GetDoc()->getIDocumentRedlineAccess().CompressRedlines();
// automatic detection of the new "Box"
SaveTblBoxCntnt();
@@ -179,7 +180,7 @@ bool SwEditShell::Redo(sal_uInt16 const nCount)
// Destroy stored TableBoxPtr. A dection is only permitted for the new "Box"!
ClearTblBoxCntnt();
- RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+ RedlineMode_t eOld = GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
try {
for (sal_uInt16 i = 0; i < nCount; ++i)
@@ -195,8 +196,8 @@ bool SwEditShell::Redo(sal_uInt16 const nCount)
Pop( !bRestoreCrsr );
- GetDoc()->SetRedlineMode( eOld );
- GetDoc()->CompressRedlines();
+ GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( eOld );
+ GetDoc()->getIDocumentRedlineAccess().CompressRedlines();
// automatic detection of the new "Box"
SaveTblBoxCntnt();
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 5d052c763ed3..d66182b25eb5 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -55,6 +55,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <rootfrm.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
@@ -115,7 +116,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt )
}
pClpDoc->LockExpFlds();
- pClpDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
+ pClpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
bool bRet;
// do we want to copy a FlyFrame?
@@ -214,7 +215,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt )
else
bRet = _CopySelToDoc( pClpDoc, 0 ); // copy the selections
- pClpDoc->SetRedlineMode_intern((RedlineMode_t)0 );
+ pClpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)0 );
pClpDoc->UnlockExpFlds();
if( !pClpDoc->IsExpFldsLocked() )
pClpDoc->UpdateExpFlds(NULL, true);
@@ -456,8 +457,8 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
// set a flag in Doc, handled in TextNodes
mpDoc->SetCopyIsMove( true );
- RedlineMode_t eOldRedlMode = pDestShell->GetDoc()->GetRedlineMode();
- pDestShell->GetDoc()->SetRedlineMode_intern( (RedlineMode_t)(eOldRedlMode | nsRedlineMode_t::REDLINE_DELETE_REDLINES));
+ RedlineMode_t eOldRedlMode = pDestShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
+ pDestShell->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(eOldRedlMode | nsRedlineMode_t::REDLINE_DELETE_REDLINES));
// If there are table formulas in the area, then display the table first
// so that the table formula can calculate a new value first
@@ -638,7 +639,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
bRet = 0 != SwEditShell::Copy( pDestShell );
}
- pDestShell->GetDoc()->SetRedlineMode_intern( eOldRedlMode );
+ pDestShell->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode_intern( eOldRedlMode );
mpDoc->SetCopyIsMove( bCopyIsMove );
// have new table formules been inserted?
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
new file mode 100644
index 000000000000..0c63c493086b
--- /dev/null
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -0,0 +1,144 @@
+/* -*- 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_DOCUMENTREDLINEMANAGER_HXX
+#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTREDLINEMANAGER_HXX
+
+#include <IDocumentRedlineAccess.hxx>
+#include <boost/utility.hpp>
+
+class SwDoc;
+
+namespace sw
+{
+
+class DocumentRedlineManager : public IDocumentRedlineAccess,
+ public ::boost::noncopyable
+{
+public:
+ DocumentRedlineManager( SwDoc& i_rSwdoc );
+
+ virtual RedlineMode_t GetRedlineMode() const SAL_OVERRIDE;
+
+ virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) SAL_OVERRIDE;
+
+ virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) SAL_OVERRIDE;
+
+ virtual bool IsRedlineOn() const SAL_OVERRIDE;
+
+ virtual bool IsIgnoreRedline() const SAL_OVERRIDE;
+
+ virtual const SwRedlineTbl& GetRedlineTbl() const SAL_OVERRIDE;
+ virtual SwRedlineTbl& GetRedlineTbl() SAL_OVERRIDE;
+ virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const SAL_OVERRIDE;
+ virtual SwExtraRedlineTbl& GetExtraRedlineTbl() SAL_OVERRIDE;
+ virtual bool HasExtraRedlineTbl() const SAL_OVERRIDE;
+
+ virtual bool IsInRedlines(const SwNode& rNode) const SAL_OVERRIDE;
+
+ virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+ virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) SAL_OVERRIDE;
+
+ virtual bool DeleteRedline(
+ /*[in]*/const SwPaM& rPam,
+ /*[in]*/bool bSaveInUndo,
+ /*[in]*/sal_uInt16 nDelType) SAL_OVERRIDE;
+
+ virtual bool DeleteRedline(
+ /*[in]*/const SwStartNode& rSection,
+ /*[in]*/bool bSaveInUndo,
+ /*[in]*/sal_uInt16 nDelType) SAL_OVERRIDE;
+
+ virtual sal_uInt16 GetRedlinePos(
+ /*[in]*/const SwNode& rNode,
+ /*[in]*/sal_uInt16 nType) const SAL_OVERRIDE;
+
+ virtual void CompressRedlines() SAL_OVERRIDE;
+
+ virtual const SwRangeRedline* GetRedline(
+ /*[in]*/const SwPosition& rPos,
+ /*[in]*/sal_uInt16* pFndPos) const SAL_OVERRIDE;
+
+ virtual bool IsRedlineMove() const SAL_OVERRIDE;
+
+ virtual void SetRedlineMove(/*[in]*/bool bFlag) SAL_OVERRIDE;
+
+ virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) SAL_OVERRIDE;
+
+ virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const SAL_OVERRIDE;
+
+ virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const SAL_OVERRIDE;
+
+ virtual void UpdateRedlineAttr() SAL_OVERRIDE;
+
+ virtual sal_uInt16 GetRedlineAuthor() SAL_OVERRIDE;
+
+ virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) SAL_OVERRIDE;
+
+ virtual bool SetRedlineComment(
+ /*[in]*/const SwPaM& rPam,
+ /*[in]*/const OUString& rComment) SAL_OVERRIDE;
+
+ virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const SAL_OVERRIDE;
+
+ virtual void SetRedlinePassword(
+ /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) SAL_OVERRIDE;
+
+
+ //Non Interface methods;
+
+ /** Set comment-text for Redline. It then comes in via AppendRedLine.
+ Used by AutoFormat. 0-pointer resets mode.
+ Sequence number is for conjoining of Redlines by the UI. */
+ void SetAutoFmtRedlineComment( const OUString* pTxt, sal_uInt16 nSeqNo = 0 );
+
+ void checkRedlining(RedlineMode_t& _rReadlineMode);
+
+
+ virtual ~DocumentRedlineManager();
+
+private:
+ SwDoc& m_rSwdoc;
+
+ RedlineMode_t meRedlineMode; //< Current Redline Mode.
+ SwRedlineTbl *mpRedlineTbl; //< List of all Ranged Redlines.
+ SwExtraRedlineTbl *mpExtraRedlineTbl; //< List of all Extra Redlines.
+ OUString *mpAutoFmtRedlnComment; //< Comment for Redlines inserted via AutoFormat.
+ bool mbIsRedlineMove; //< True: Redlines are moved into to / out of the section.
+ bool mbReadlineChecked; //< sal_True: if the query was already shown
+ sal_uInt16 mnAutoFmtRedlnCommentNo; /**< SeqNo for conjoining of AutoFmt-Redlines.
+ by the UI. Managed by SwAutoFmt! */
+ ::com::sun::star::uno::Sequence <sal_Int8 > maRedlinePasswd;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 38ca293929c5..965bda821a63 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -63,6 +63,7 @@
#include <switerator.hxx>
#include <DocumentSettingManager.hxx>
#include <IDocumentTimerAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
//UUUU
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
@@ -3322,7 +3323,7 @@ bool IsExtraData( const SwDoc *pDoc )
return rInf.IsPaintLineNumbers() ||
rInf.IsCountInFlys() ||
((sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE &&
- !pDoc->GetRedlineTbl().empty());
+ !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty());
}
// OD 22.09.2003 #110978#
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 9e1e655ab643..0604a623665f 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -35,6 +35,7 @@
#include <frmatr.hxx>
#include <doc.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <frame.hxx>
#include <swtable.hxx>
@@ -2040,10 +2041,10 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rTxt, const Color* pCol,
pTNd->DontExpandFmt( aResetIdx, false, false );
}
- if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
+ if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPaM aTemp(*pTNd, 0, *pTNd, rOrig.getLength());
- pDoc->DeleteRedline(aTemp, true, USHRT_MAX);
+ pDoc->getIDocumentRedlineAccess().DeleteRedline(aTemp, true, USHRT_MAX);
}
pTNd->EraseText( aIdx, n,
@@ -2051,10 +2052,10 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rTxt, const Color* pCol,
pTNd->InsertText( rTxt, aIdx,
IDocumentContentOperations::INS_EMPTYEXPAND );
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
SwPaM aTemp(*pTNd, 0, *pTNd, rTxt.getLength());
- pDoc->AppendRedline(new SwRangeRedline(nsRedlineType_t::REDLINE_INSERT, aTemp), true);
+ pDoc->getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(nsRedlineType_t::REDLINE_INSERT, aTemp), true);
}
}
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 15917b888a6a..b5c686a3d59a 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -28,6 +28,7 @@
#include <itratr.hxx>
#include <ndtxt.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <rootfrm.hxx>
#include <breakit.hxx>
#include <vcl/keycodes.hxx>
@@ -223,16 +224,16 @@ short SwRedlineItr::_Seek(SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld)
nStart = COMPLETE_STRING;
nEnd = COMPLETE_STRING;
- for( ; nAct < (sal_Int32)rDoc.GetRedlineTbl().size() ; ++nAct )
+ for( ; nAct < (sal_Int32)rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size() ; ++nAct )
{
- rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
+ rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
if( nNew < nEnd )
{
if( nNew >= nStart ) // der einzig moegliche Kandidat
{
bOn = true;
- const SwRangeRedline *pRed = rDoc.GetRedlineTbl()[ nAct ];
+ const SwRangeRedline *pRed = rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ];
if (pSet)
pSet->ClearItem();
@@ -344,7 +345,7 @@ sal_Int32 SwRedlineItr::_GetNextRedln( sal_Int32 nNext )
if( COMPLETE_STRING == nAct )
{
nAct = nFirst;
- rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
+ rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
}
if( bOn || !nStart )
{
@@ -382,9 +383,9 @@ bool SwRedlineItr::CheckLine( sal_Int32 nChkStart, sal_Int32 nChkEnd )
sal_Int32 nOldAct = nAct;
bool bRet = false;
- for( nAct = nFirst; nAct < (sal_Int32)rDoc.GetRedlineTbl().size() ; ++nAct )
+ for( nAct = nFirst; nAct < (sal_Int32)rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size() ; ++nAct )
{
- rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
+ rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
if( nChkEnd < nStart )
break;
if( nChkStart <= nEnd && ( nChkEnd > nStart || COMPLETE_STRING == nEnd ) )
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8489f7c8e6d8..cc2c5cd2cd55 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -53,6 +53,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentListsAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <fldbas.hxx>
@@ -1024,7 +1025,7 @@ void SwTxtNode::Update(
SwIndexReg aTmpIdxReg;
if ( !bNegative && !bDelete )
{
- const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
for ( size_t i = 0; i < rTbl.size(); ++i )
{
SwRangeRedline *const pRedl = rTbl[ i ];
@@ -3345,14 +3346,14 @@ OUString SwTxtNode::GetRedlineTxt( sal_Int32 nIdx, sal_Int32 nLen,
{
std::vector<sal_Int32> aRedlArr;
const SwDoc* pDoc = GetDoc();
- sal_uInt16 nRedlPos = pDoc->GetRedlinePos( *this, nsRedlineType_t::REDLINE_DELETE );
+ sal_uInt16 nRedlPos = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *this, nsRedlineType_t::REDLINE_DELETE );
if( USHRT_MAX != nRedlPos )
{
// es existiert fuer den Node irgendein Redline-Delete-Object
const sal_uLong nNdIdx = GetIndex();
- for( ; nRedlPos < pDoc->GetRedlineTbl().size() ; ++nRedlPos )
+ for( ; nRedlPos < pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size() ; ++nRedlPos )
{
- const SwRangeRedline* pTmp = pDoc->GetRedlineTbl()[ nRedlPos ];
+ const SwRangeRedline* pTmp = pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlPos ];
if( nsRedlineType_t::REDLINE_DELETE == pTmp->GetType() )
{
const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 260c697db767..3a02a7ad709f 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -36,6 +36,7 @@
#include <viewopt.hxx>
#include <acmplwrd.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docsh.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
@@ -105,9 +106,9 @@ lcl_MaskRedlines( const SwTxtNode& rNode, OUStringBuffer& rText,
const SwDoc& rDoc = *rNode.GetDoc();
- for ( size_t nAct = rDoc.GetRedlinePos( rNode, USHRT_MAX ); nAct < rDoc.GetRedlineTbl().size(); ++nAct )
+ for ( size_t nAct = rDoc.GetRedlinePos( rNode, USHRT_MAX ); nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nAct )
{
- const SwRangeRedline* pRed = rDoc.GetRedlineTbl()[ nAct ];
+ const SwRangeRedline* pRed = rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[ nAct ];
if ( pRed->Start()->nNode > rNode.GetIndex() )
break;
@@ -150,7 +151,7 @@ lcl_MaskRedlinesAndHiddenText( const SwTxtNode& rNode, OUStringBuffer& rText,
sal_Int32 nHiddenCharsMasked = 0;
const SwDoc& rDoc = *rNode.GetDoc();
- const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
+ const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
// If called from word count or from spell checking, deleted redlines
// should be masked:
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index a8733771ba39..f02a79967e54 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -35,6 +35,7 @@
#include <unobaseclass.hxx>
#include <limits>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
using namespace ::com::sun::star;
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 26e27b6617dd..d582d979eac2 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -35,6 +35,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
#include <docary.hxx>
#include <swundo.hxx>
@@ -774,12 +775,12 @@ SwUndoAttr::~SwUndoAttr()
void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsCntnt )
{
SwDoc* pDoc = rPam.GetDoc();
- if ( pDoc->IsRedlineOn() )
+ if ( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlineData.reset( new SwRedlineData( bIsCntnt
? nsRedlineType_t::REDLINE_INSERT
: nsRedlineType_t::REDLINE_FORMAT,
- pDoc->GetRedlineAuthor() ) );
+ pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
}
m_pRedlineSaveData.reset( new SwRedlineSaveDatas );
@@ -788,7 +789,7 @@ void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsCntnt )
m_pRedlineSaveData.reset(0);
}
- SetRedlineMode( pDoc->GetRedlineMode() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
if ( bIsCntnt )
{
m_nNodeIndex = rPam.GetPoint()->nNode.GetIndex();
@@ -811,13 +812,13 @@ void SwUndoAttr::UndoImpl(::sw::UndoRedoContext & rContext)
aPam.GetPoint()->nContent.Assign( aPam.GetCntntNode(), nSttCntnt );
aPam.SetMark();
aPam.GetPoint()->nContent++;
- pDoc->DeleteRedline(aPam, false, USHRT_MAX);
+ pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, USHRT_MAX);
}
else
{
// remove all format redlines, will be recreated if needed
SetPaM(aPam);
- pDoc->DeleteRedline(aPam, false, nsRedlineType_t::REDLINE_FORMAT);
+ pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, nsRedlineType_t::REDLINE_FORMAT);
if ( m_pRedlineSaveData.get() )
{
SetSaveData( *pDoc, *m_pRedlineSaveData );
@@ -862,8 +863,8 @@ void SwUndoAttr::RedoImpl(::sw::UndoRedoContext & rContext)
if ( m_pRedlineData.get() &&
IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) )
{
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern(static_cast<RedlineMode_t>(
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern(static_cast<RedlineMode_t>(
eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
rDoc.getIDocumentContentOperations().InsertItemSet( rPam, m_AttrSet, m_nInsertFlags );
@@ -872,17 +873,17 @@ void SwUndoAttr::RedoImpl(::sw::UndoRedoContext & rContext)
rPam.SetMark();
if ( rPam.Move( fnMoveBackward ) )
{
- rDoc.AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ),
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ),
true);
}
rPam.DeleteMark();
}
else
{
- rDoc.AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
}
- rDoc.SetRedlineMode_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else
{
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 353b3a9587bf..ceebdc08b202 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -26,6 +26,7 @@
#include <fmtanchr.hxx>
#include <doc.hxx>
#include <UndoManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <swtable.hxx>
#include <swundo.hxx>
#include <pam.hxx>
@@ -124,7 +125,7 @@ SwUndoDelete::SwUndoDelete(
SwDoc * pDoc = rPam.GetDoc();
- if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
+ if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
pRedlSaveData = new SwRedlineSaveDatas;
if( !FillSaveData( rPam, *pRedlSaveData ))
@@ -489,7 +490,7 @@ bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam )
if( !bOk )
return false;
- pDoc->DeleteRedline( rDelPam, false, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( rDelPam, false, USHRT_MAX );
}
// Both 'deletes' can be consolidated, so 'move' the related character
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index ff2a30b72e54..6c94f665abca 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -24,6 +24,7 @@
#include <frmfmt.hxx>
#include <doc.hxx>
#include <UndoManager.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <swundo.hxx>
#include <pam.hxx>
@@ -196,7 +197,7 @@ class UndoRedoRedlineGuard
{
public:
UndoRedoRedlineGuard(::sw::UndoRedoContext & rContext, SwUndo & rUndo)
- : m_rRedlineAccess(rContext.GetDoc())
+ : m_rRedlineAccess(rContext.GetDoc().getIDocumentRedlineAccess())
, m_eMode(m_rRedlineAccess.GetRedlineMode())
{
RedlineMode_t const eTmpMode =
@@ -958,7 +959,7 @@ SwRedlineSaveData::SwRedlineSaveData(
}
#if OSL_DEBUG_LEVEL > 0
- nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl().size();
+ nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl().size();
#endif
}
@@ -983,18 +984,18 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam )
// First, delete the "old" so that in an Append no unexpected things will
// happen, e.g. a delete in an insert. In the latter case the just restored
// content will be deleted and not the one you originally wanted.
- rDoc.DeleteRedline( *pRedl, false, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *pRedl, false, USHRT_MAX );
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES));
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES));
//#i92154# let UI know about a new redline with comment
if (rDoc.GetDocShell() && (!pRedl->GetComment().isEmpty()) )
rDoc.GetDocShell()->Broadcast(SwRedlineHint(pRedl,SWREDLINE_INSERTED));
- bool const bSuccess = rDoc.AppendRedline( pRedl, true );
+ bool const bSuccess = rDoc.getIDocumentRedlineAccess().AppendRedline( pRedl, true );
assert(bSuccess); // SwRedlineSaveData::RedlineToDoc: insert redline failed
(void) bSuccess; // unused in non-debug
- rDoc.SetRedlineMode_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
bool SwUndo::FillSaveData(
@@ -1008,9 +1009,9 @@ bool SwUndo::FillSaveData(
SwRedlineSaveData* pNewData;
const SwPosition* pStt = rRange.Start();
const SwPosition* pEnd = rRange.End();
- const SwRedlineTbl& rTbl = rRange.GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
sal_uInt16 n = 0;
- rRange.GetDoc()->GetRedline( *pStt, &n );
+ rRange.GetDoc()->getIDocumentRedlineAccess().GetRedline( *pStt, &n );
for ( ; n < rTbl.size(); ++n )
{
SwRangeRedline* pRedl = rTbl[n];
@@ -1028,7 +1029,7 @@ bool SwUndo::FillSaveData(
}
if( !rSData.empty() && bDelRange )
{
- rRange.GetDoc()->DeleteRedline( rRange, false, USHRT_MAX );
+ rRange.GetDoc()->getIDocumentRedlineAccess().DeleteRedline( rRange, false, USHRT_MAX );
}
return !rSData.empty();
}
@@ -1041,9 +1042,9 @@ bool SwUndo::FillSaveDataForFmt(
SwRedlineSaveData* pNewData;
const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
- const SwRedlineTbl& rTbl = rRange.GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
sal_uInt16 n = 0;
- rRange.GetDoc()->GetRedline( *pStt, &n );
+ rRange.GetDoc()->getIDocumentRedlineAccess().GetRedline( *pStt, &n );
for ( ; n < rTbl.size(); ++n )
{
SwRangeRedline* pRedl = rTbl[n];
@@ -1067,8 +1068,8 @@ bool SwUndo::FillSaveDataForFmt(
void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData )
{
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
SwPaM aPam( rDoc.GetNodes().GetEndOfContent() );
for( size_t n = rSData.size(); n; )
@@ -1077,11 +1078,11 @@ void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData )
#if OSL_DEBUG_LEVEL > 0
// check redline count against count saved in RedlineSaveData object
assert(rSData.empty() ||
- (rSData[0]->nRedlineCount == rDoc.GetRedlineTbl().size()));
+ (rSData[0]->nRedlineCount == rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size()));
// "redline count not restored properly"
#endif
- rDoc.SetRedlineMode_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
bool SwUndo::HasHiddenRedlines( const SwRedlineSaveDatas& rSData )
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index bf3d63d6fc0c..f3875e07a752 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -32,6 +32,7 @@
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -91,11 +92,11 @@ void SwUndoInsert::Init(const SwNodeIndex & rNd)
{
// consider Redline
pDoc = rNd.GetNode().GetDoc();
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT,
- pDoc->GetRedlineAuthor() );
- SetRedlineMode( pDoc->GetRedlineMode() );
+ pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
}
pUndoTxt = GetTxtFromDoc();
@@ -156,7 +157,7 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
{
// consider Redline
SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
- if( ( ~nsRedlineMode_t::REDLINE_SHOW_MASK & rDoc.GetRedlineMode() ) ==
+ if( ( ~nsRedlineMode_t::REDLINE_SHOW_MASK & rDoc.getIDocumentRedlineAccess().GetRedlineMode() ) ==
( ~nsRedlineMode_t::REDLINE_SHOW_MASK & GetRedlineMode() ) )
{
bRet = true;
@@ -164,10 +165,10 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
// than there is or was still an active Redline:
// Check if there is another Redline at the InsPosition. If the
// same exists only once, it can be combined.
- const SwRedlineTbl& rTbl = rDoc.GetRedlineTbl();
+ const SwRedlineTbl& rTbl = rDoc.getIDocumentRedlineAccess().GetRedlineTbl();
if( !rTbl.empty() )
{
- SwRedlineData aRData( nsRedlineType_t::REDLINE_INSERT, rDoc.GetRedlineAuthor() );
+ SwRedlineData aRData( nsRedlineType_t::REDLINE_INSERT, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
const SwIndexReg* pIReg = rPos.nContent.GetIdxReg();
SwIndex* pIdx;
for( size_t i = 0; i < rTbl.size(); ++i )
@@ -221,7 +222,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
pPam->SetMark();
pPam->Move( fnMoveBackward );
pPam->Exchange();
- pTmpDoc->DeleteRedline( *pPam, true, USHRT_MAX );
+ pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
}
pPam->DeleteMark();
pTmpDoc->getIDocumentContentOperations().DelFullPara( *pPam );
@@ -244,7 +245,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
{
aPaM.GetPoint()->nContent -= nLen;
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
- pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX );
+ pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, USHRT_MAX );
if (m_bWithRsid)
{
// RSID was added: remove any CHARFMT/AUTOFMT that may be
@@ -265,7 +266,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
{
aPaM.Move(fnMoveBackward);
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
- pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX );
+ pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, USHRT_MAX );
RemoveIdxFromRange( aPaM, false );
}
@@ -310,14 +311,14 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
- RedlineMode_t eOld = pTmpDoc->GetRedlineMode();
- pTmpDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- pTmpDoc->AppendRedline( new SwRangeRedline( *pRedlData, *pPam ), true);
- pTmpDoc->SetRedlineMode_intern( eOld );
+ RedlineMode_t eOld = pTmpDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pTmpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ pTmpDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, *pPam ), true);
+ pTmpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !pTmpDoc->GetRedlineTbl().empty() )
- pTmpDoc->SplitRedline( *pPam );
+ !pTmpDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ pTmpDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
pPam->DeleteMark();
}
@@ -361,15 +362,15 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
pPam->Exchange();
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
- RedlineMode_t eOld = pTmpDoc->GetRedlineMode();
- pTmpDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- pTmpDoc->AppendRedline( new SwRangeRedline( *pRedlData,
+ RedlineMode_t eOld = pTmpDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pTmpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ pTmpDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData,
*pPam ), true);
- pTmpDoc->SetRedlineMode_intern( eOld );
+ pTmpDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !pTmpDoc->GetRedlineTbl().empty() )
- pTmpDoc->SplitRedline(*pPam);
+ !pTmpDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ pTmpDoc->getIDocumentRedlineAccess().SplitRedline(*pPam);
}
}
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index a3520b88c1d9..abc29667f548 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -24,6 +24,7 @@
#include <comphelper/processfactory.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
#include <swundo.hxx>
#include <pam.hxx>
@@ -44,7 +45,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos,
: SwUndo(UNDO_OVERWRITE),
pRedlSaveData( 0 ), bGroup( false )
{
- if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
+ if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPaM aPam( rPos.nNode, rPos.nContent.GetIndex(),
rPos.nNode, rPos.nContent.GetIndex()+1 );
@@ -135,7 +136,7 @@ bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos,
if( !bOk )
return false;
- pDoc->DeleteRedline( aPam, false, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( aPam, false, USHRT_MAX );
}
// both 'overwrites' can be combined so 'move' the corresponding character
@@ -268,7 +269,7 @@ void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext)
rIdx.Assign( pTxtNd, nSttCntnt );
pAktPam->SetMark();
pAktPam->GetMark()->nContent += aInsStr.getLength();
- pDoc->DeleteRedline( *pAktPam, false, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( *pAktPam, false, USHRT_MAX );
pAktPam->DeleteMark();
}
rIdx.Assign( pTxtNd, !aDelStr.isEmpty() ? nSttCntnt+1 : nSttCntnt );
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 7aaea3b38827..1f0a49b7af07 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -21,6 +21,7 @@
#include <hintids.hxx>
#include <unotools/charclass.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -39,18 +40,18 @@ SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange )
{
// consider Redline
SwDoc& rDoc = *rRange.GetDoc();
- if( rDoc.IsRedlineOn() )
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
switch( mnUserId )
{
case UNDO_DELETE:
case UNDO_REPLACE:
- mpRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_DELETE, rDoc.GetRedlineAuthor() );
+ mpRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_DELETE, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
break;
default:
;
}
- SetRedlineMode( rDoc.GetRedlineMode() );
+ SetRedlineMode( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
}
sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
@@ -107,8 +108,8 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoRedline::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pDoc = & rContext.GetDoc();
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
SwPaM & rPam( AddUndoRedoPaM(rContext) );
if( mpRedlSaveData && mbHiddenRedlines )
@@ -124,7 +125,7 @@ void SwUndoRedline::RedoImpl(::sw::UndoRedoContext & rContext)
RedoRedlineImpl(*pDoc, rPam);
SetPaM(rPam, true);
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
void SwUndoRedline::UndoRedlineImpl(SwDoc &, SwPaM &)
@@ -134,7 +135,7 @@ void SwUndoRedline::UndoRedlineImpl(SwDoc &, SwPaM &)
// default: remove redlines
void SwUndoRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
{
- rDoc.DeleteRedline(rPam, true, USHRT_MAX);
+ rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX);
}
SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId )
@@ -161,14 +162,14 @@ SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId )
void SwUndoRedlineDelete::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
{
- rDoc.DeleteRedline(rPam, true, USHRT_MAX);
+ rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX);
}
void SwUndoRedlineDelete::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
{
if (rPam.GetPoint() != rPam.GetMark())
{
- rDoc.AppendRedline( new SwRangeRedline(*mpRedlData, rPam), false );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline(*mpRedlData, rPam), false );
}
}
@@ -230,18 +231,18 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
SwNodeIndex aPrevIdx( pStart->nNode, -1 );
sal_uLong nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
- if( 0 == ( nsRedlineMode_t::REDLINE_SHOW_DELETE & rDoc.GetRedlineMode()) )
+ if( 0 == ( nsRedlineMode_t::REDLINE_SHOW_DELETE & rDoc.getIDocumentRedlineAccess().GetRedlineMode()) )
{
// Search both Redline objects and make them visible to make the nodes
// consistent again. The 'delete' one is hidden, thus search for the
// 'insert' Redline object. The former is located directly after the latter.
- sal_uInt16 nFnd = rDoc.GetRedlinePos(
+ sal_uInt16 nFnd = rDoc.getIDocumentRedlineAccess().GetRedlinePos(
*rDoc.GetNodes()[ nSttNode + 1 ],
nsRedlineType_t::REDLINE_INSERT );
- OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < (sal_uInt16)rDoc.GetRedlineTbl().size(),
+ OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < (sal_uInt16)rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size(),
"could not find an Insert object" );
++nFnd;
- rDoc.GetRedlineTbl()[nFnd]->Show( 1 );
+ rDoc.getIDocumentRedlineAccess().GetRedlineTbl()[nFnd]->Show( 1 );
}
{
@@ -250,7 +251,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
aTmp.SetMark();
aTmp.GetPoint()->nNode = nSaveEndNode;
aTmp.GetPoint()->nContent.Assign( aTmp.GetCntntNode(), nSaveEndCntnt );
- rDoc.DeleteRedline( aTmp, true, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( aTmp, true, USHRT_MAX );
}
rDoc.getIDocumentContentOperations().DelFullPara(rPam);
@@ -327,12 +328,12 @@ SwUndoAcceptRedline::SwUndoAcceptRedline( const SwPaM& rRange )
void SwUndoAcceptRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
{
- rDoc.AcceptRedline(rPam, false);
+ rDoc.getIDocumentRedlineAccess().AcceptRedline(rPam, false);
}
void SwUndoAcceptRedline::RepeatImpl(::sw::RepeatContext & rContext)
{
- rContext.GetDoc().AcceptRedline(rContext.GetRepeatPaM(), true);
+ rContext.GetDoc().getIDocumentRedlineAccess().AcceptRedline(rContext.GetRepeatPaM(), true);
}
SwUndoRejectRedline::SwUndoRejectRedline( const SwPaM& rRange )
@@ -342,12 +343,12 @@ SwUndoRejectRedline::SwUndoRejectRedline( const SwPaM& rRange )
void SwUndoRejectRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
{
- rDoc.RejectRedline(rPam, false);
+ rDoc.getIDocumentRedlineAccess().RejectRedline(rPam, false);
}
void SwUndoRejectRedline::RepeatImpl(::sw::RepeatContext & rContext)
{
- rContext.GetDoc().RejectRedline(rContext.GetRepeatPaM(), true);
+ rContext.GetDoc().getIDocumentRedlineAccess().RejectRedline(rContext.GetRepeatPaM(), true);
}
SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns )
@@ -355,11 +356,11 @@ SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns )
pUnDel( 0 ), pUnDel2( 0 ), pRedlSaveData( 0 ), bInsert( bIns )
{
SwDoc* pDoc = (SwDoc*)rRg.GetDoc();
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
RedlineType_t eTyp = bInsert ? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_DELETE;
- pRedlData = new SwRedlineData( eTyp, pDoc->GetRedlineAuthor() );
- SetRedlineMode( pDoc->GetRedlineMode() );
+ pRedlData = new SwRedlineData( eTyp, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
}
}
@@ -370,10 +371,10 @@ SwUndoCompDoc::SwUndoCompDoc( const SwRangeRedline& rRedl )
bInsert( nsRedlineType_t::REDLINE_DELETE == rRedl.GetType() )
{
SwDoc* pDoc = (SwDoc*)rRedl.GetDoc();
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
pRedlData = new SwRedlineData( rRedl.GetRedlineData() );
- SetRedlineMode( pDoc->GetRedlineMode() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
}
pRedlSaveData = new SwRedlineSaveDatas;
@@ -397,12 +398,12 @@ void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
if( !bInsert )
{
// delete Redlines
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON));
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON));
- pDoc->DeleteRedline( *pPam, true, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
// per definition Point is end (in SwUndRng!)
SwCntntNode* pCSttNd = pPam->GetCntntNode( false );
@@ -444,7 +445,7 @@ void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
{
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
- pDoc->DeleteRedline( *pPam, true, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
if( pRedlSaveData )
SetSaveData( *pDoc, *pRedlSaveData );
@@ -463,12 +464,12 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam );
- ((SwRedlineTbl&)pDoc->GetRedlineTbl()).Insert( pTmp );
+ ((SwRedlineTbl&)pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp );
pTmp->InvalidateRange();
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !pDoc->GetRedlineTbl().empty() )
- pDoc->SplitRedline( *pPam );
+ !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ pDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
}
else
{
@@ -483,7 +484,7 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
SetPaM( *pPam );
SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam );
- ((SwRedlineTbl&)pDoc->GetRedlineTbl()).Insert( pTmp );
+ ((SwRedlineTbl&)pDoc->getIDocumentRedlineAccess().GetRedlineTbl()).Insert( pTmp );
pTmp->InvalidateRange();
}
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 0fb81476809d..cd69474fa6d8 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -23,6 +23,7 @@
#include <fmtcntnt.hxx>
#include <doc.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <swundo.hxx>
#include <pam.hxx>
@@ -78,11 +79,11 @@ SwUndoInsSection::SwUndoInsSection(
, m_bUpdateFtn(false)
{
SwDoc& rDoc = *(SwDoc*)rPam.GetDoc();
- if( rDoc.IsRedlineOn() )
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlData.reset(new SwRedlineData( nsRedlineType_t::REDLINE_INSERT,
- rDoc.GetRedlineAuthor() ));
- SetRedlineMode( rDoc.GetRedlineMode() );
+ rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ));
+ SetRedlineMode( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
}
m_pRedlineSaveData.reset( new SwRedlineSaveDatas );
if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
@@ -121,7 +122,7 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext)
OSL_ENSURE( pNd, "wo ist mein SectionNode?" );
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
- rDoc.DeleteRedline( *pNd, true, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, USHRT_MAX );
// no selection?
SwNodeIndex aIdx( *pNd );
@@ -187,18 +188,18 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext)
if (m_pRedlData.get() &&
IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode()))
{
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
- rDoc.AppendRedline( new SwRangeRedline( *m_pRedlData, aPam ), true);
- rDoc.SetRedlineMode_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlData, aPam ), true);
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !rDoc.GetRedlineTbl().empty() )
+ !rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
- rDoc.SplitRedline( aPam );
+ rDoc.getIDocumentRedlineAccess().SplitRedline( aPam );
}
if( pUpdateTOX )
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index 2e8aa3b23797..7aada6f5d2e9 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -19,6 +19,7 @@
#include <UndoSplitMove.hxx>
#include "doc.hxx"
+#include <IDocumentRedlineAccess.hxx>
#include "pam.hxx"
#include "swtable.hxx"
#include "ndtxt.hxx"
@@ -51,10 +52,10 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos,
DELETEZ( pHistory );
}
// consider Redline
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
- pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->GetRedlineAuthor() );
- SetRedlineMode( pDoc->GetRedlineMode() );
+ pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
}
nParRsid = pTxtNd->GetParRsid();
@@ -118,7 +119,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext)
rPam.GetMark()->nNode++;
rPam.GetMark()->nContent.Assign( rPam.GetMark()->
nNode.GetNode().GetCntntNode(), 0 );
- pDoc->DeleteRedline( rPam, true, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( rPam, true, USHRT_MAX );
rPam.DeleteMark();
}
@@ -163,20 +164,20 @@ void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
if( ( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) ||
( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !pDoc->GetRedlineTbl().empty() ))
+ !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
rPam.SetMark();
if( rPam.Move( fnMoveBackward ))
{
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- pDoc->AppendRedline( new SwRangeRedline( *pRedlData, rPam ), true);
- pDoc->SetRedlineMode_intern( eOld );
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, rPam ), true);
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else
- pDoc->SplitRedline( rPam );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( rPam );
rPam.Exchange();
}
rPam.DeleteMark();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 7e4d36b1ece5..9f3d31a0a24b 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -36,6 +36,7 @@
#include <docredln.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentChartDataProviderAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <editsh.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
@@ -236,10 +237,10 @@ SwUndoInsTbl::SwUndoInsTbl( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt16 n
// consider redline
SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
- if( rDoc.IsRedlineOn() )
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
- pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, rDoc.GetRedlineAuthor() );
- SetRedlineMode( rDoc.GetRedlineMode() );
+ pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
+ SetRedlineMode( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
}
sTblNm = rName;
@@ -263,7 +264,7 @@ void SwUndoInsTbl::UndoImpl(::sw::UndoRedoContext & rContext)
pTblNd->DelFrms();
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
- rDoc.DeleteRedline( *pTblNd, true, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *pTblNd, true, USHRT_MAX );
RemoveIdxFromSection( rDoc, nSttNode );
// move hard page breaks into next node
@@ -318,7 +319,7 @@ void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext)
if( (pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) ||
( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !rDoc.GetRedlineTbl().empty() ))
+ !rDoc.getIDocumentRedlineAccess().GetRedlineTbl().empty() ))
{
SwPaM aPam( *pTblNode->EndOfSectionNode(), *pTblNode, 1 );
SwCntntNode* pCNd = aPam.GetCntntNode( false );
@@ -327,14 +328,14 @@ void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext)
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) )
{
- RedlineMode_t eOld = rDoc.GetRedlineMode();
- rDoc.SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
+ RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
- rDoc.AppendRedline( new SwRangeRedline( *pRedlData, aPam ), true);
- rDoc.SetRedlineMode_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, aPam ), true);
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else
- rDoc.SplitRedline( aPam );
+ rDoc.getIDocumentRedlineAccess().SplitRedline( aPam );
}
}
@@ -2248,7 +2249,7 @@ void SwUndoTblNumFmt::UndoImpl(::sw::UndoRedoContext & rContext)
// the same here.
if( pTxtNd->GetTxt() != aStr )
{
- rDoc.DeleteRedline( *( pBox->GetSttNd() ), false, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *( pBox->GetSttNd() ), false, USHRT_MAX );
SwIndex aIdx( pTxtNd, 0 );
if( !aStr.isEmpty() )
@@ -2296,15 +2297,15 @@ RedlineModeInternGuard::RedlineModeInternGuard(
RedlineMode_t eNewRedlineMode,
RedlineMode_t eRedlineModeMask )
: mrDoc( rDoc ),
- meOldRedlineMode( rDoc.GetRedlineMode() )
+ meOldRedlineMode( rDoc.getIDocumentRedlineAccess().GetRedlineMode() )
{
- mrDoc.SetRedlineMode_intern((RedlineMode_t)( ( meOldRedlineMode & ~eRedlineModeMask ) |
+ mrDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( ( meOldRedlineMode & ~eRedlineModeMask ) |
( eNewRedlineMode & eRedlineModeMask ) ));
}
RedlineModeInternGuard::~RedlineModeInternGuard()
{
- mrDoc.SetRedlineMode_intern( meOldRedlineMode );
+ mrDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( meOldRedlineMode );
}
void SwUndoTblNumFmt::RedoImpl(::sw::UndoRedoContext & rContext)
@@ -2501,7 +2502,7 @@ void SwUndoTblCpyTbl::UndoImpl(::sw::UndoRedoContext & rContext)
*aPam.GetPoint() = SwPosition( aTmpIdx );
}
}
- rDoc.DeleteRedline( aPam, true, USHRT_MAX );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( aPam, true, USHRT_MAX );
if( pEntry->pUndo )
{
@@ -2676,7 +2677,7 @@ void SwUndoTblCpyTbl::AddBoxBefore( const SwTableBox& rBox, bool bDelCntnt )
pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode() );
- if( !pDoc->IsRedlineOn() )
+ if( !pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
pEntry->pUndo = new SwUndoDelete( aPam, true );
}
@@ -2699,7 +2700,7 @@ void SwUndoTblCpyTbl::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rI
SwDoc* pDoc = rBox.GetFrmFmt()->GetDoc();
_DEBUG_REDLINE( pDoc )
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
SwPosition aTmpPos( rIdx );
pEntry->pUndo = PrepareRedline( pDoc, rBox, aTmpPos, pEntry->bJoin, false );
@@ -2727,8 +2728,8 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
// Mark the cell content before rIdx as insertion,
// mark the cell content behind rIdx as deletion
// merge text nodes at rIdx if possible
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)( ( eOld | nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES ) &
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( ( eOld | nsRedlineMode_t::REDLINE_DONTCOMBINE_REDLINES ) &
~nsRedlineMode_t::REDLINE_IGNORE ));
SwPosition aInsertEnd( rPos );
SwTxtNode* pTxt;
@@ -2767,7 +2768,7 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
{ // If the old (deleted) part is not empty, here we are...
SwPaM aDeletePam( aDeleteStart, aCellEnd );
pUndo = new SwUndoRedlineDelete( aDeletePam, UNDO_DELETE );
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, aDeletePam ), true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_DELETE, aDeletePam ), true );
}
else if( !rJoin ) // If the old part is empty and joined, we are finished
{ // if it is not joined, we have to delete this empty paragraph
@@ -2783,10 +2784,10 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
if( aCellStart != aInsertEnd ) // An empty insertion will not been marked
{
SwPaM aTmpPam( aCellStart, aInsertEnd );
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aTmpPam ), true );
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, aTmpPam ), true );
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
return pUndo;
}
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 6ef58f56ad32..ab0637c8a2cb 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -22,6 +22,7 @@
#include <frmfmt.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <IShellCursorSupplier.hxx>
#include <docary.hxx>
#include <swundo.hxx>
@@ -68,10 +69,10 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
}
}
// consider Redline
- if( pDoc->IsRedlineOn() )
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
- pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->GetRedlineAuthor() );
- SetRedlineMode( pDoc->GetRedlineMode() );
+ pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() );
+ SetRedlineMode( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
}
}
@@ -149,7 +150,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
SwPaM *const pPam = & AddUndoRedoPaM(rContext);
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
- pDoc->DeleteRedline( *pPam, true, USHRT_MAX );
+ pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
// if Point and Mark are different text nodes so a JoinNext has to be done
bool bJoinNext = nSttNode != nEndNode &&
@@ -292,14 +293,14 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
{
- RedlineMode_t eOld = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode_intern((RedlineMode_t)( eOld & ~nsRedlineMode_t::REDLINE_IGNORE ));
- pDoc->AppendRedline( new SwRangeRedline( *pRedlData, *pPam ), true);
- pDoc->SetRedlineMode_intern( eOld );
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( eOld & ~nsRedlineMode_t::REDLINE_IGNORE ));
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, *pPam ), true);
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- !pDoc->GetRedlineTbl().empty() )
- pDoc->SplitRedline( *pPam );
+ !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
+ pDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
}
void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext)
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0f11fad92743..6c2afc64dc44 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1159,7 +1159,7 @@ void makeRedline( SwPaM& rPaM,
const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- IDocumentRedlineAccess* pRedlineAccess = rPaM.GetDoc();
+ IDocumentRedlineAccess* pRedlineAccess = &rPaM.GetDoc()->getIDocumentRedlineAccess();
RedlineType_t eType;
if ( rRedlineType == "Insert" )
@@ -1282,7 +1282,7 @@ void makeTableRowRedline( SwTableLine& rTableLine,
const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- IDocumentRedlineAccess* pRedlineAccess = rTableLine.GetFrmFmt()->GetDoc();
+ IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess();
RedlineType_t eType;
if ( rRedlineType == "TableRowInsert" )
@@ -1339,7 +1339,7 @@ void makeTableCellRedline( SwTableBox& rTableBox,
const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
- IDocumentRedlineAccess* pRedlineAccess = rTableBox.GetFrmFmt()->GetDoc();
+ IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrmFmt()->GetDoc()->getIDocumentRedlineAccess();
RedlineType_t eType;
if ( rRedlineType == "TableCellInsert" )
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 8057f1de726f..971e1816ca8a 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -22,6 +22,7 @@
#include <crossrefbookmark.hxx>
#include <annotationmark.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <txatbase.hxx>
#include <txtatr.hxx>
#include <ndhints.hxx>
@@ -1031,7 +1032,7 @@ static void lcl_FillRedlineArray(
SwUnoCrsr const & rUnoCrsr,
SwXRedlinePortion_ImplList& rRedArr )
{
- const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = rDoc.getIDocumentRedlineAccess().GetRedlineTbl();
const size_t nRedTblCount = rRedTbl.size();
if ( nRedTblCount > 0 )
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 69434d06d69e..f6f0c401ae49 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -275,7 +275,7 @@ void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
throw uno::RuntimeException();
//search for the redline
SwDoc* pDoc = pUnoCrsr->GetDoc();
- const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
bool bFound = false;
for(size_t nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
bFound = &m_rRedline == rRedTbl[nRed];
diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx
index 22da9bd94adb..639dda3d9343 100644
--- a/sw/source/core/unocore/unoredlines.cxx
+++ b/sw/source/core/unocore/unoredlines.cxx
@@ -49,7 +49,7 @@ sal_Int32 SwXRedlines::getCount( ) throw(uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
if(!IsValid())
throw uno::RuntimeException();
- const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
return rRedTbl.size();
}
@@ -59,7 +59,7 @@ uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
SolarMutexGuard aGuard;
if(!IsValid())
throw uno::RuntimeException();
- const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
uno::Any aRet;
if ((rRedTbl.size() > static_cast<size_t>(nIndex)) && (nIndex >= 0))
{
@@ -90,7 +90,7 @@ sal_Bool SwXRedlines::hasElements( ) throw(uno::RuntimeException, std::exceptio
SolarMutexGuard aGuard;
if(!IsValid())
throw uno::RuntimeException();
- const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
return rRedTbl.size() > 0;
}
@@ -143,7 +143,7 @@ sal_Bool SwXRedlineEnumeration::hasMoreElements(void) throw( uno::RuntimeExcepti
{
if(!pDoc)
throw uno::RuntimeException();
- return pDoc->GetRedlineTbl().size() > nCurrentIndex;
+ return pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size() > nCurrentIndex;
}
uno::Any SwXRedlineEnumeration::nextElement(void)
@@ -151,7 +151,7 @@ uno::Any SwXRedlineEnumeration::nextElement(void)
{
if(!pDoc)
throw uno::RuntimeException();
- const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
if( rRedTbl.size() <= nCurrentIndex )
throw container::NoSuchElementException();
uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl[nCurrentIndex++], *pDoc );
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 89b662d3f843..a47875bfe875 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1134,7 +1134,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
pSectNode = pSectNode->EndOfSectionNode();
}
const SwRedlineTbl& rRedTbl =
- pFmt->GetDoc()->GetRedlineTbl();
+ pFmt->GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
for (size_t nRed = 0; nRed < rRedTbl.size(); ++nRed)
{
const SwRangeRedline* pRedline = rRedTbl[nRed];
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 00aae9721ceb..61d770e51ec7 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -312,7 +312,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
SwNode* pTblNode = pTable->GetTableNode();
if(FN_UNO_REDLINE_NODE_END == pEntry->nWID)
pTblNode = pTblNode->EndOfSectionNode();
- const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
for(size_t nRed = 0; nRed < rRedTbl.size(); ++nRed)
{
const SwRangeRedline* pRedline = rRedTbl[nRed];
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 83a07f341db4..fc0227af1f92 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1154,7 +1154,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
// break;
case FN_UNO_REDLINE_NODE_END:
{
- const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rRedTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
const size_t nRedTblCount = rRedTbl.size();
if (nRedTblCount > 0)
{
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index db4b07cc2280..540224af8696 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2528,8 +2528,8 @@ const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return
IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mpDoc->getIDocumentMarkAccess(); }
const IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() const { return & mpDoc->getIDocumentDrawModelAccess(); }
IDocumentDrawModelAccess* SwViewShell::getIDocumentDrawModelAccess() { return & mpDoc->getIDocumentDrawModelAccess(); }
-const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return mpDoc; }
-IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return mpDoc; }
+const IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() const { return &mpDoc->getIDocumentRedlineAccess(); }
+IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return &mpDoc->getIDocumentRedlineAccess(); }
const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return mpDoc; }
IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return mpDoc; }
IDocumentContentOperations* SwViewShell::getIDocumentContentOperations() { return &mpDoc->getIDocumentContentOperations(); }
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 8a1bb01991f5..322e6092c014 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -40,6 +40,7 @@
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pam.hxx>
#include <editsh.hxx>
#include <undobj.hxx>
@@ -128,7 +129,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
SwNodeIndex aSplitIdx( pDoc->GetNodes() );
- RedlineMode_t eOld = pDoc->GetRedlineMode();
+ RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
RedlineMode_t ePostReadRedlineMode( nsRedlineMode_t::REDLINE_IGNORE );
// Array of FlyFormats
@@ -141,7 +142,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
if( bSaveUndo )
pUndo = new SwUndoInsDoc( *pPam );
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
SwPaM* pUndoPam = 0;
if( bDocUndo || pCrsr )
@@ -165,14 +166,14 @@ sal_uLong SwReader::Read( const Reader& rOptions )
sal_Int32 nEndCntnt = pCNd ? pCNd->Len() - nSttCntnt : 0;
SwNodeIndex aEndPos( pPam->GetPoint()->nNode, 1 );
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
nError = po->Read( *pDoc, GetBaseURL(), *pPam, aFileName );
// an ODF document may contain redline mode in settings.xml; save it!
- ePostReadRedlineMode = pDoc->GetRedlineMode();
+ ePostReadRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
if( !IsError( nError )) // set the End position already
{
@@ -257,13 +258,13 @@ sal_uLong SwReader::Read( const Reader& rOptions )
{
if( bSaveUndo )
{
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
// UGLY: temp. enable undo
pDoc->GetIDocumentUndoRedo().DoUndo(true);
pDoc->GetIDocumentUndoRedo().AppendUndo(
new SwUndoInsLayFmt( pFrmFmt,0,0 ) );
pDoc->GetIDocumentUndoRedo().DoUndo(false);
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
}
if( pFrmFmt->GetDepends() )
{
@@ -291,22 +292,22 @@ sal_uLong SwReader::Read( const Reader& rOptions )
if( !aFlyFrmArr.empty() )
aFlyFrmArr.clear();
- pDoc->SetRedlineMode_intern( eOld );
- if( pDoc->IsRedlineOn() )
- pDoc->AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pUndoPam ), true);
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pUndoPam ), true);
else
- pDoc->SplitRedline( *pUndoPam );
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( *pUndoPam );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
}
if( bSaveUndo )
{
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
pUndo->SetInsertRange( *pUndoPam, false );
// UGLY: temp. enable undo
pDoc->GetIDocumentUndoRedo().DoUndo(true);
pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
pDoc->GetIDocumentUndoRedo().DoUndo(false);
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
}
delete pUndoPam;
@@ -345,9 +346,9 @@ sal_uLong SwReader::Read( const Reader& rOptions )
{
if( bSaveUndo )
{
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSDOKUMENT, NULL );
- pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE );
}
}
@@ -368,7 +369,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
pDoc->SetFieldsDirty(false, NULL, 0);
}
- pDoc->SetRedlineMode_intern( eOld );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
pDoc->SetOle2Link( aOLELink );
if( pCrsr ) // das Doc ist jetzt modifiziert
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 906254b7de8c..e1f8a07c829e 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -80,6 +80,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <mdiexp.hxx>
@@ -521,7 +522,7 @@ SvParserState SwHTMLParser::CallParser()
aInsertionRangePam.SetMark();
*aInsertionRangePam.GetPoint() = *pPam->GetPoint();
aInsertionRangePam.Move( fnMoveBackward );
- pDoc->SplitRedline( aInsertionRangePam );
+ pDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam );
pDoc->SetTxtFmtColl( *pPam,
pCSS1Parser->GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index a84907e1b83a..87df0bd8786a 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -45,6 +45,7 @@
#include <redline.hxx>
#include <pam.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <ndtxt.hxx>
#include <frmatr.hxx>
#include <fldbas.hxx>
@@ -637,7 +638,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
if (rEntry.MakeRegion(pDoc, aRegion, true))
{
- pDoc->SetRedlineMode((RedlineMode_t)( nsRedlineMode_t::REDLINE_ON
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( nsRedlineMode_t::REDLINE_ON
| nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE ));
SwFltRedline& rFltRedline = *((SwFltRedline*)rEntry.pAttr);
@@ -650,7 +651,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
OUString(),
0
);
- pDoc->AppendRedline(new SwRangeRedline(aData, aRegion), true);
+ pDoc->getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(aData, aRegion), true);
}
SwRedlineData aData(rFltRedline.eType,
rFltRedline.nAutorNo,
@@ -658,8 +659,8 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
OUString(),
0
);
- pDoc->AppendRedline( new SwRangeRedline(aData, aRegion), true );
- pDoc->SetRedlineMode((RedlineMode_t)( nsRedlineMode_t::REDLINE_NONE
+ pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline(aData, aRegion), true );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( nsRedlineMode_t::REDLINE_NONE
| nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE ));
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index edd69c254b8f..59dd510b507a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -113,6 +113,7 @@
#include <docsh.hxx>
#include <docary.hxx>
#include <IDocumentSettingAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <osl/file.hxx>
#include <vcl/embeddedfontshelper.hxx>
@@ -3392,7 +3393,7 @@ void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t
const SwTableLine * pTabLine = pTabBox->GetUpper();
// search next Redline
- const SwExtraRedlineTbl& aExtraRedlineTbl = m_rExport.pDoc->GetExtraRedlineTbl();
+ const SwExtraRedlineTbl& aExtraRedlineTbl = m_rExport.pDoc->getIDocumentRedlineAccess().GetExtraRedlineTbl();
for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTbl.GetSize(); ++nCurRedlinePos )
{
SwExtraRedline* pExtraRedline = aExtraRedlineTbl.GetRedline(nCurRedlinePos);
@@ -3438,7 +3439,7 @@ void DocxAttributeOutput::TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
// search next Redline
- const SwExtraRedlineTbl& aExtraRedlineTbl = m_rExport.pDoc->GetExtraRedlineTbl();
+ const SwExtraRedlineTbl& aExtraRedlineTbl = m_rExport.pDoc->getIDocumentRedlineAccess().GetExtraRedlineTbl();
for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTbl.GetSize(); ++nCurRedlinePos )
{
SwExtraRedline* pExtraRedline = aExtraRedlineTbl.GetRedline(nCurRedlinePos);
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 7b0f746b48ea..7a42f441bb6a 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -268,7 +268,7 @@ void RtfExport::WriteNumbering()
void RtfExport::WriteRevTab()
{
- int nRevAuthors = pDoc->GetRedlineTbl().size();
+ int nRevAuthors = pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size();
if (nRevAuthors < 1)
return;
@@ -276,9 +276,9 @@ void RtfExport::WriteRevTab()
// RTF always seems to use Unknown as the default first entry
GetRedline(OUString("Unknown"));
- for (sal_uInt16 i = 0; i < pDoc->GetRedlineTbl().size(); ++i)
+ for (sal_uInt16 i = 0; i < pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); ++i)
{
- const SwRangeRedline* pRedl = pDoc->GetRedlineTbl()[ i ];
+ const SwRangeRedline* pRedl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ i ];
GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor()));
}
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 85891c3d72aa..c4475e6e482b 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -757,7 +757,7 @@ namespace sw
(*aRegion.GetPoint() != *aRegion.GetMark())
)
{
- mrDoc.SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT |
+ mrDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT |
nsRedlineMode_t::REDLINE_SHOW_DELETE));
const SwFltRedline *pFltRedline = static_cast<const SwFltRedline*>
(pEntry->pAttr);
@@ -768,7 +768,7 @@ namespace sw
pFltRedline->nAutorNoPrev, pFltRedline->aStampPrev, OUString(),
0);
- mrDoc.AppendRedline(new SwRangeRedline(aData, aRegion), true);
+ mrDoc.getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(aData, aRegion), true);
}
SwRedlineData aData(pFltRedline->eType, pFltRedline->nAutorNo,
@@ -779,8 +779,8 @@ namespace sw
// the PaM somewhere safe
aRegion.DeleteMark();
*aRegion.GetPoint() = SwPosition(SwNodeIndex(mrDoc.GetNodes()));
- mrDoc.AppendRedline(pNewRedline, true);
- mrDoc.SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_NONE | nsRedlineMode_t::REDLINE_SHOW_INSERT |
+ mrDoc.getIDocumentRedlineAccess().AppendRedline(pNewRedline, true);
+ mrDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_NONE | nsRedlineMode_t::REDLINE_SHOW_INSERT |
nsRedlineMode_t::REDLINE_SHOW_DELETE ));
}
delete pEntry;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index bcb17cdbfa7c..266997bfdf2b 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -216,10 +216,10 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
maFlyIter = maFlyFrms.begin();
- if ( !m_rExport.pDoc->GetRedlineTbl().empty() )
+ if ( !m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
SwPosition aPosition( rNd, SwIndex( (SwTxtNode*)&rNd ) );
- pCurRedline = m_rExport.pDoc->GetRedline( aPosition, &nCurRedlinePos );
+ pCurRedline = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos );
}
nAktSwPos = SearchNext(1);
@@ -264,16 +264,16 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
}
}
- if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size() )
+ if ( nCurRedlinePos < m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size() )
{
// nCurRedlinePos point to the next redline
sal_uInt16 nRedLinePos = nCurRedlinePos;
if( pCurRedline )
++nRedLinePos;
- for ( ; nRedLinePos < m_rExport.pDoc->GetRedlineTbl().size(); ++nRedLinePos )
+ for ( ; nRedLinePos < m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nRedLinePos )
{
- const SwRangeRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nRedLinePos ];
+ const SwRangeRedline* pRedl = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nRedLinePos ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
@@ -1256,9 +1256,9 @@ bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const
{
// search next Redline
for( sal_uInt16 nPos = nCurRedlinePos;
- nPos < m_rExport.pDoc->GetRedlineTbl().size(); ++nPos )
+ nPos < m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nPos )
{
- const SwPosition* pEnd = m_rExport.pDoc->GetRedlineTbl()[ nPos ]->End();
+ const SwPosition* pEnd = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nPos ]->End();
if( pEnd->nNode != rNd )
{
break;
@@ -1277,9 +1277,9 @@ const SwRedlineData* SwWW8AttrIter::GetParagraphLevelRedline( )
pCurRedline = NULL;
// ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos'
- for( sal_uInt16 nRedlinePos = 0; nRedlinePos < m_rExport.pDoc->GetRedlineTbl().size(); ++nRedlinePos )
+ for( sal_uInt16 nRedlinePos = 0; nRedlinePos < m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nRedlinePos )
{
- const SwRangeRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nRedlinePos ];
+ const SwRangeRedline* pRedl = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlinePos ];
const SwPosition* pCheckedStt = pRedl->Start();
@@ -1331,10 +1331,10 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos )
if( !pCurRedline )
{
// search next Redline
- for( ; nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size();
+ for( ; nCurRedlinePos < m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size();
++nCurRedlinePos )
{
- const SwRangeRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nCurRedlinePos ];
+ const SwRangeRedline* pRedl = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nCurRedlinePos ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
@@ -1591,10 +1591,10 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nAktPos,
static SwTxtFmtColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTxtNode* pTxtNode )
{
sal_uInt16 nPos = 0;
- sal_uInt16 nMax = rExport.pDoc->GetRedlineTbl().size();
+ sal_uInt16 nMax = rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size();
while( nPos < nMax )
{
- const SwRangeRedline* pRedl = rExport.pDoc->GetRedlineTbl()[ nPos++ ];
+ const SwRangeRedline* pRedl = rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nPos++ ];
const SwPosition* pStt = pRedl->Start();
const SwPosition* pEnd = pStt == pRedl->GetPoint()
? pRedl->GetMark()
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 3fb650280e6a..6b10c89528df 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3046,10 +3046,10 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
// #i81405# - Collect anchored objects before changing the redline mode.
maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam );
- mnRedlineMode = pDoc->GetRedlineMode();
- if ( !pDoc->GetRedlineTbl().empty() )
+ mnRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ if ( !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
- pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
nsRedlineMode_t::REDLINE_SHOW_INSERT) );
}
@@ -3064,8 +3064,8 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
ExportDocument_Impl();
- if ( mnRedlineMode != pDoc->GetRedlineMode() )
- pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode) );
+ if ( mnRedlineMode != pDoc->getIDocumentRedlineAccess().GetRedlineMode() )
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(mnRedlineMode) );
}
bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec )
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e938acd8d7fb..3568ca7143c6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5578,9 +5578,9 @@ void AttributeOutputBase::FormatCharBorder( const SvxBoxItem& rBox )
const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTxtNode& rNode, RedlineType_t aRedlineType)
{
// ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos'
- for( sal_uInt16 nRedlinePos = 0; nRedlinePos < GetExport().pDoc->GetRedlineTbl().size(); ++nRedlinePos )
+ for( sal_uInt16 nRedlinePos = 0; nRedlinePos < GetExport().pDoc->getIDocumentRedlineAccess().GetRedlineTbl().size(); ++nRedlinePos )
{
- const SwRangeRedline* pRedl = GetExport().pDoc->GetRedlineTbl()[ nRedlinePos ];
+ const SwRangeRedline* pRedl = GetExport().pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[ nRedlinePos ];
// Only check redlines that are of type 'Delete'
if ( pRedl->GetRedlineData().GetType() != aRedlineType )
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index e78c62bdc714..a56a97ea94c7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5341,7 +5341,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
// delete the pam before the call for hide all redlines (Bug 73683)
if (mbNewDoc)
- rDoc.SetRedlineMode((RedlineMode_t)( eMode ));
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( eMode ));
UpdatePageDescs(rDoc, nPageDescOffset);
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 53075c9dcfeb..b09fec67d5bf 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -456,7 +456,7 @@ void SwWW8ImplReader::ReadRevMarkAuthorStrTabl( SvStream& rStrm,
for( sal_uInt16 nAuthor = 0; nAuthor < nCount; ++nAuthor )
{
// Store author in doc
- sal_uInt16 nSWId = rDocOut.InsertRedlineAuthor(aAuthorNames[nAuthor]);
+ sal_uInt16 nSWId = rDocOut.getIDocumentRedlineAccess().InsertRedlineAuthor(aAuthorNames[nAuthor]);
// Store matchpair
m_aAuthorInfos[nAuthor] = nSWId;
}
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index dd34a4063f04..846905b7ff62 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -685,9 +685,9 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
}
// set redline mode (without doing the associated book-keeping)
- pDoc->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
- pDoc->AppendRedline(pRedline, false);
- pDoc->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
+ pDoc->getIDocumentRedlineAccess().AppendRedline(pRedline, false);
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
}
}
@@ -698,7 +698,7 @@ SwRedlineData* XMLRedlineImportHelper::ConvertRedline(
// convert info:
// 1) Author String -> Author ID (default to zero)
sal_uInt16 nAuthorId = (NULL == pDoc) ? 0 :
- pDoc->InsertRedlineAuthor( pRedlineInfo->sAuthor );
+ pDoc->getIDocumentRedlineAccess().InsertRedlineAuthor( pRedlineInfo->sAuthor );
// 2) util::DateTime -> DateTime
DateTime aDT( DateTime::EMPTY );
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 4c0c0089c873..acc6352d8a17 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -52,6 +52,7 @@
#include <doc.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docary.hxx>
#include <docsh.hxx>
#include <unotextrange.hxx>
@@ -786,17 +787,17 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c
const OUString sShowChanges("ShowChanges");
const OUString sRecordChanges("RecordChanges");
const OUString sRedlineProtectionKey("RedlineProtectionKey");
- bTmp = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() );
+ bTmp = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineMode() );
aAny.setValue( &bTmp, ::getBooleanCppuType() );
xInfoSet->setPropertyValue( sShowChanges, aAny );
- bTmp = IDocumentRedlineAccess::IsRedlineOn(rDoc.GetRedlineMode());
+ bTmp = IDocumentRedlineAccess::IsRedlineOn(rDoc.getIDocumentRedlineAccess().GetRedlineMode());
aAny.setValue( &bTmp, ::getBooleanCppuType() );
xInfoSet->setPropertyValue( sRecordChanges, aAny );
- aAny <<= rDoc.GetRedlinePassword();
+ aAny <<= rDoc.getIDocumentRedlineAccess().GetRedlinePassword();
xInfoSet->setPropertyValue( sRedlineProtectionKey, aAny );
// force redline mode to "none"
- rDoc.SetRedlineMode_intern( nsRedlineMode_t::REDLINE_NONE );
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_NONE );
const bool bOASIS = ( SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60 );
// #i28749# - set property <ShapePositionInHoriL2R>
@@ -911,7 +912,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c
aAny = xInfoSet->getPropertyValue( sRedlineProtectionKey );
Sequence<sal_Int8> aKey;
aAny >>= aKey;
- rDoc.SetRedlinePassword( aKey );
+ rDoc.getIDocumentRedlineAccess().SetRedlinePassword( aKey );
// restore redline mode from import info property set
sal_Int16 nRedlineMode = nsRedlineMode_t::REDLINE_SHOW_INSERT;
@@ -925,10 +926,10 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c
nRedlineMode |= nsRedlineMode_t::REDLINE_NONE;
// ... restore redline mode
- // (First set bogus mode to make sure the mode in SetRedlineMode()
+ // (First set bogus mode to make sure the mode in getIDocumentRedlineAccess().SetRedlineMode()
// is different from it's previous mode.)
- rDoc.SetRedlineMode_intern((RedlineMode_t)( ~nRedlineMode ));
- rDoc.SetRedlineMode( (RedlineMode_t)( nRedlineMode ));
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( ~nRedlineMode ));
+ rDoc.getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)( nRedlineMode ));
lcl_EnsureValidPam( rPaM ); // move Pam into valid content
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 9fa3e9178a11..c6f6bba39d80 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -38,6 +38,7 @@
#include <sfx2/docfile.hxx>
#include <pam.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docstat.hxx>
#include <docsh.hxx>
@@ -181,14 +182,14 @@ sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >&
// save show redline mode ...
const OUString sShowChanges("ShowChanges");
- sal_uInt16 nRedlineMode = pDoc->GetRedlineMode();
+ sal_uInt16 nRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
sal_Bool bShowChanges( IDocumentRedlineAccess::IsShowChanges( nRedlineMode ) );
aAny.setValue( &bShowChanges, ::getBooleanCppuType() );
xInfoSet->setPropertyValue( sShowChanges, aAny );
// ... and hide redlines for export
nRedlineMode &= ~nsRedlineMode_t::REDLINE_SHOW_MASK;
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT;
- pDoc->SetRedlineMode((RedlineMode_t)( nRedlineMode ));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( nRedlineMode ));
// Set base URI
xInfoSet->setPropertyValue( "BaseURI", makeAny( GetBaseURL() ) );
@@ -405,12 +406,12 @@ sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >&
// restore redline mode
aAny = xInfoSet->getPropertyValue( sShowChanges );
- nRedlineMode = pDoc->GetRedlineMode();
+ nRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
nRedlineMode &= ~nsRedlineMode_t::REDLINE_SHOW_MASK;
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT;
if ( *(sal_Bool*)aAny.getValue() )
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
- pDoc->SetRedlineMode((RedlineMode_t)( nRedlineMode ));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( nRedlineMode ));
if (xStatusIndicator.is())
{
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 19fabca7d708..90de156fb866 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -61,6 +61,7 @@
#include <osl/mutex.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <pausethreadstarting.hxx>
#include <drawdoc.hxx>
@@ -287,12 +288,12 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
}
}
sal_uInt16 nRedlineMode = 0;
- bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->GetRedlineMode() );
+ bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->getIDocumentRedlineAccess().GetRedlineMode() );
if( bSaveRedline )
{
// now save and switch redline mode
- nRedlineMode = pDoc->GetRedlineMode();
- pDoc->SetRedlineMode(
+ nRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode(
(RedlineMode_t)(( nRedlineMode & nsRedlineMode_t::REDLINE_SHOW_MASK ) | nsRedlineType_t::REDLINE_INSERT ));
}
@@ -301,7 +302,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
// now we can restore the redline mode (if we changed it previously)
if( bSaveRedline )
{
- pDoc->SetRedlineMode( (RedlineMode_t)(nRedlineMode ));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(nRedlineMode ));
}
if( pGraphicResolver )
diff --git a/sw/source/ui/vba/vbarevision.cxx b/sw/source/ui/vba/vbarevision.cxx
index ceac995b5ac7..e1133dd430a4 100644
--- a/sw/source/ui/vba/vbarevision.cxx
+++ b/sw/source/ui/vba/vbarevision.cxx
@@ -23,6 +23,7 @@
#include "wordvbahelper.hxx"
#include <docsh.hxx>
#include <doc.hxx>
+#include <IDocumentRedlineAccess.hxx>
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -62,7 +63,7 @@ SwVbaRevision::Accept() throw ( css::uno::RuntimeException, std::exception )
{
SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
if( pDoc )
- pDoc->AcceptRedline( GetPosition(), true );
+ pDoc->getIDocumentRedlineAccess().AcceptRedline( GetPosition(), true );
}
void SAL_CALL
@@ -70,7 +71,7 @@ SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException, std::exception )
{
SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
if( pDoc )
- pDoc->RejectRedline( GetPosition(), true );
+ pDoc->getIDocumentRedlineAccess().RejectRedline( GetPosition(), true );
}
OUString
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 1227d93a0efd..bf762a47bc10 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -73,6 +73,7 @@
#include <IDocumentLinksAdministration.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docstat.hxx>
#include <pagedesc.hxx>
#include <pview.hxx>
@@ -904,7 +905,7 @@ sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates )
if ( nStates & HIDDENINFORMATION_RECORDEDCHANGES )
{
- if ( !GetDoc()->GetRedlineTbl().empty() )
+ if ( !GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
nState |= HIDDENINFORMATION_RECORDEDCHANGES;
}
if ( nStates & HIDDENINFORMATION_NOTES )
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index fdc8b1d4e565..e41205f4e52b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -682,7 +682,7 @@ void SwView::Execute(SfxRequest &rReq)
// point at the *end* of the redline and the mark at the start (so GetRedline
// would return NULL if called on the point)
sal_uInt16 nRedline = 0;
- const SwRangeRedline *pRedline = pDoc->GetRedline(*pCursor->Start(), &nRedline);
+ const SwRangeRedline *pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline);
assert(pRedline != 0);
if (pRedline)
{
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index 171ee44c355f..0148ffd53318 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -306,7 +306,7 @@ void SwView::GetState(SfxItemSet &rSet)
else if (pCursor->HasMark())
{ // If the selection does not contain redlines, disable accepting/rejecting changes.
sal_uInt16 index = 0;
- const SwRedlineTbl& table = pDoc->GetRedlineTbl();
+ const SwRedlineTbl& table = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
const SwRangeRedline* redline = table.FindAtPosition( *pCursor->Start(), index );
if( redline != NULL && *redline->Start() == *pCursor->End())
redline = NULL;
@@ -331,7 +331,7 @@ void SwView::GetState(SfxItemSet &rSet)
{
// If the cursor position isn't on a redline, disable
// accepting/rejecting changes.
- if (0 == pDoc->GetRedline(*pCursor->Start(), 0))
+ if (0 == pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), 0))
rSet.DisableItem(nWhich);
}
}
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index b515077f484b..c8494ac4a1fe 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -28,6 +28,7 @@
#include <doc.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDeviceAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <docsh.hxx>
#include <fldupde.hxx>
#include <linkenum.hxx>
@@ -594,12 +595,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
Sequence <sal_Int8> aNew;
if(rValue >>= aNew)
{
- mpDoc->SetRedlinePassword(aNew);
+ mpDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew);
if(aNew.getLength())
{
- sal_uInt16 eMode = mpDoc->GetRedlineMode();
+ sal_uInt16 eMode = mpDoc->getIDocumentRedlineAccess().GetRedlineMode();
eMode = eMode|nsRedlineMode_t::REDLINE_ON;
- mpDoc->SetRedlineMode((RedlineMode_t)( eMode ));
+ mpDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( eMode ));
}
}
}
@@ -1041,7 +1042,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_CHANGES_PASSWORD:
{
- rValue <<= mpDoc->GetRedlinePassword();
+ rValue <<= mpDoc->getIDocumentRedlineAccess().GetRedlinePassword();
}
break;
case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 5c640246a362..0c98fc4aafb5 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -40,6 +40,7 @@
#include <unocrsr.hxx>
#include <IMark.hxx>
#include <IDocumentContentOperations.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <unoprnms.hxx>
#include <docsh.hxx>
#include <swmodule.hxx>
@@ -409,9 +410,9 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
pGlosGroup->ClearDoc();
if( pGlosGroup->BeginPutDoc( sShortName, sLongName ) )
{
- pGDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
+ pGDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
lcl_CopySelToDoc( pGDoc, pxCursor, pxRange );
- pGDoc->SetRedlineMode_intern((RedlineMode_t)( 0 ));
+ pGDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( 0 ));
nRet = pGlosGroup->PutDoc();
}
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 1dc5f54656d8..9c78bdc5c014 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -99,6 +99,7 @@
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentChartDataProviderAccess.hxx>
#include <IDocumentLinksAdministration.hxx>
+#include <IDocumentRedlineAccess.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <svl/zforlist.hxx>
#include <drawdoc.hxx>
@@ -1848,7 +1849,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
case WID_DOC_CHANGES_SHOW:
{
bool bSet = *(sal_Bool*)aValue.getValue();
- sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode();
+ sal_uInt16 eMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
{
eMode &= ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE);
@@ -1860,7 +1861,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
{
eMode = bSet ? eMode|nsRedlineMode_t::REDLINE_ON : eMode&~nsRedlineMode_t::REDLINE_ON;
}
- pDocShell->GetDoc()->SetRedlineMode( (RedlineMode_t)(eMode ));
+ pDocShell->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(eMode ));
}
break;
case WID_DOC_CHANGES_PASSWORD:
@@ -1869,12 +1870,12 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
if(aValue >>= aNew)
{
SwDoc* pDoc = pDocShell->GetDoc();
- pDoc->SetRedlinePassword(aNew);
+ pDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew);
if(aNew.getLength())
{
- sal_uInt16 eMode = pDoc->GetRedlineMode();
+ sal_uInt16 eMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
eMode = eMode|nsRedlineMode_t::REDLINE_ON;
- pDoc->SetRedlineMode( (RedlineMode_t)(eMode ));
+ pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(eMode ));
}
}
}
@@ -1891,7 +1892,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
break;
case WID_DOC_REDLINE_DISPLAY:
{
- sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode();
+ sal_Int16 eRedMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
eRedMode = eRedMode & (~nsRedlineMode_t::REDLINE_SHOW_MASK);
sal_Int16 nSet = 0;
aValue >>= nSet;
@@ -1905,7 +1906,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
break;
default: throw IllegalArgumentException();
}
- pDocShell->GetDoc()->SetRedlineMode(eRedMode);
+ pDocShell->GetDoc()->getIDocumentRedlineAccess().SetRedlineMode(eRedMode);
}
break;
case WID_DOC_TWO_DIGIT_YEAR:
@@ -2032,7 +2033,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
case WID_DOC_CHANGES_RECORD:
case WID_DOC_CHANGES_SHOW:
{
- const sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode();
+ const sal_uInt16 eMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
bool bSet = false;
if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
{
@@ -2050,7 +2051,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
case WID_DOC_CHANGES_PASSWORD:
{
SwDoc* pDoc = pDocShell->GetDoc();
- aAny <<= pDoc->GetRedlinePassword();
+ aAny <<= pDoc->getIDocumentRedlineAccess().GetRedlinePassword();
}
break;
case WID_DOC_AUTO_MARK_URL :
@@ -2064,7 +2065,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
break;
case WID_DOC_REDLINE_DISPLAY:
{
- sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode();
+ sal_Int16 eRedMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
eRedMode = eRedMode & nsRedlineMode_t::REDLINE_SHOW_MASK;
sal_Int16 nRet = RedlineDisplayType::NONE;
if(nsRedlineMode_t::REDLINE_SHOW_INSERT == eRedMode)