Kaydet (Commit) 9d2642d2 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

use a std::list<> instead of a Ring<>

Change-Id: Ibc1d2deae5b0c7841ec83de880380170eadbd509
üst 29a4edae
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
#include <vector> #include <vector>
#include <set> #include <list>
#include <deque>
#include <cctype> #include <cctype>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
...@@ -1839,7 +1840,7 @@ public: ...@@ -1839,7 +1840,7 @@ public:
{ return GetNextInRing(); } { return GetNextInRing(); }
_SaveMergeRedlines* GetPrev() _SaveMergeRedlines* GetPrev()
{ return GetPrevInRing(); } { return GetPrevInRing(); }
static sal_uInt16 InsertRedline(_SaveMergeRedlines* pRing, const SwRangeRedline* pSrcRedl, SwRangeRedline* pDestRedl); static sal_uInt16 InsertRedline(_SaveMergeRedlines* pRing, const SwRangeRedline* pSrcRedl, SwRangeRedline* pDestRedl, SwPaM* pLastDestRedline);
}; };
_SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd, _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
...@@ -1868,7 +1869,7 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd, ...@@ -1868,7 +1869,7 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
} }
} }
sal_uInt16 _SaveMergeRedlines::InsertRedline(_SaveMergeRedlines* pRing, const SwRangeRedline* pSrcRedl, SwRangeRedline* pDestRedl) sal_uInt16 _SaveMergeRedlines::InsertRedline(_SaveMergeRedlines* pRing, const SwRangeRedline* pSrcRedl, SwRangeRedline* pDestRedl, SwPaM* pLastDestRedline)
{ {
sal_uInt16 nIns = 0; sal_uInt16 nIns = 0;
SwDoc* pDoc = pDestRedl->GetDoc(); SwDoc* pDoc = pDestRedl->GetDoc();
...@@ -1896,12 +1897,8 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline(_SaveMergeRedlines* pRing, const Sw ...@@ -1896,12 +1897,8 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline(_SaveMergeRedlines* pRing, const Sw
pDestRedl->GetMark()->nContent.Assign( aSaveNd.GetNode().GetCntntNode(), pDestRedl->GetMark()->nContent.Assign( aSaveNd.GetNode().GetCntntNode(),
nSaveCnt ); nSaveCnt );
if( !pRing->unique() ) if( pLastDestRedline && *pLastDestRedline->GetPoint() == *pDestRedl->GetPoint() )
{ *pLastDestRedline->GetPoint() = *pDestRedl->GetMark();
SwPaM* pTmpPrev = pRing->GetPrev()->pDestRedl;
if( pTmpPrev && *pTmpPrev->GetPoint() == *pDestRedl->GetPoint() )
*pTmpPrev->GetPoint() = *pDestRedl->GetMark();
}
} }
else else
{ {
...@@ -2031,7 +2028,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) ...@@ -2031,7 +2028,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
// we want to get all redlines from the SourceDoc // we want to get all redlines from the SourceDoc
// look for all insert redlines from the SourceDoc and determine their position in the DestDoc // look for all insert redlines from the SourceDoc and determine their position in the DestDoc
_SaveMergeRedlines* pRing = 0; std::list<_SaveMergeRedlines> vRedlines;
const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTbl(); const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTbl();
sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex(); sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex(); sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
...@@ -2048,32 +2045,26 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) ...@@ -2048,32 +2045,26 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
// Found the position. // Found the position.
// Then we also have to insert the redline to the line in the DestDoc. // Then we also have to insert the redline to the line in the DestDoc.
_SaveMergeRedlines* pTmp = new _SaveMergeRedlines( vRedlines.push_back(_SaveMergeRedlines(*pDstNd, *pRedl, nullptr));
*pDstNd, *pRedl, pRing );
if( !pRing )
pRing = pTmp;
} }
} }
if( pRing ) if( !vRedlines.empty() )
{ {
// Carry over all into DestDoc // Carry over all into DestDoc
rSrcDoc.getIDocumentRedlineAccess().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));
getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)(
nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_ON |
nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_INSERT |
nsRedlineMode_t::REDLINE_SHOW_DELETE)); nsRedlineMode_t::REDLINE_SHOW_DELETE));
_SaveMergeRedlines* pTmp = pRing; SwPaM* pLastDestRedline(nullptr);
for(_SaveMergeRedlines& rRedline: vRedlines)
do { {
nRet += pTmp->InsertRedline(pTmp, pTmp->pSrcRedl, pTmp->pDestRedl); nRet += _SaveMergeRedlines::InsertRedline(&rRedline, rRedline.pSrcRedl, rRedline.pDestRedl, pLastDestRedline);
} while( pRing != ( pTmp = pTmp->GetNext()) ); pLastDestRedline = rRedline.pDestRedl;
}
while( pRing != pRing->GetNext() )
delete pRing->GetNext();
delete pRing;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment