diff options
author | Michaël Lefèvre <lefevre00@yahoo.fr> | 2014-10-13 11:41:46 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-15 19:41:20 +0000 |
commit | a1a33bc181f058bef98a9a47dde3e77a3d8fb086 (patch) | |
tree | 389cc05ff4e48c6ec6a1b8f27d6233bb67b7cdd3 /sw/source/core/undo | |
parent | 07f9ccf99c6746351dfdd26a046c788693632dfb (diff) |
fdo#75757: remove inheritance to std::vector
from SwRedlineSaveDatas
Change-Id: Ie178983496891c8bd964b37536058d2e6b310c29
Reviewed-on: https://gerrit.libreoffice.org/11947
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core/undo')
-rw-r--r-- | sw/source/core/undo/undobj.cxx | 51 | ||||
-rw-r--r-- | sw/source/core/undo/unredln.cxx | 2 |
2 files changed, 11 insertions, 42 deletions
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index c85e74af48fb..5e1bb0b618b9 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -41,30 +41,6 @@ #include <comcore.hrc> #include <docsh.hxx> -class SwRedlineSaveData: public SwUndRng, public SwRedlineData, private SwUndoSaveSection -{ -public: - SwRedlineSaveData( - SwComparePosition eCmpPos, - const SwPosition& rSttPos, - const SwPosition& rEndPos, - SwRangeRedline& rRedl, - bool bCopyNext ); - - ~SwRedlineSaveData(); - - void RedlineToDoc( SwPaM& rPam ); - - SwNodeIndex* GetMvSttIdx() const - { - return SwUndoSaveSection::GetMvSttIdx(); - } - -#if OSL_DEBUG_LEVEL > 0 - sal_uInt16 nRedlineCount; -#endif -}; - // This class saves the Pam as integers and can recompose those into a PaM SwUndRng::SwUndRng() : nSttNode( 0 ), nEndNode( 0 ), nSttCntnt( 0 ), nEndCntnt( 0 ) @@ -1004,7 +980,7 @@ bool SwUndo::FillSaveData( bool bDelRange, bool bCopyNext ) { - rSData.DeleteAndDestroyAll(); + rSData.clear(); SwRedlineSaveData* pNewData; const SwPosition* pStt = rRange.Start(); @@ -1038,7 +1014,7 @@ bool SwUndo::FillSaveDataForFmt( const SwPaM& rRange, SwRedlineSaveDatas& rSData ) { - rSData.DeleteAndDestroyAll(); + rSData.clear(); SwRedlineSaveData* pNewData; const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End(); @@ -1066,19 +1042,19 @@ bool SwUndo::FillSaveDataForFmt( } -void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData ) +void SwUndo::SetSaveData( SwDoc& rDoc, SwRedlineSaveDatas& rSData ) { 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; ) - rSData[ --n ]->RedlineToDoc( aPam ); + rSData[ --n ].RedlineToDoc( aPam ); #if OSL_DEBUG_LEVEL > 0 // check redline count against count saved in RedlineSaveData object assert(rSData.empty() || - (rSData[0]->nRedlineCount == rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size())); + (rSData[0].nRedlineCount == rDoc.getIDocumentRedlineAccess().GetRedlineTbl().size())); // "redline count not restored properly" #endif @@ -1088,7 +1064,7 @@ void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData ) bool SwUndo::HasHiddenRedlines( const SwRedlineSaveDatas& rSData ) { for( size_t n = rSData.size(); n; ) - if( rSData[ --n ]->GetMvSttIdx() ) + if( rSData[ --n ].GetMvSttIdx() ) return true; return false; } @@ -1101,8 +1077,8 @@ bool SwUndo::CanRedlineGroup( SwRedlineSaveDatas& rCurr, for( size_t n = 0; n < rCurr.size(); ++n ) { - const SwRedlineSaveData& rSet = *rCurr[ n ]; - const SwRedlineSaveData& rGet = *rCheck[ n ]; + const SwRedlineSaveData& rSet = rCurr[ n ]; + const SwRedlineSaveData& rGet = rCheck[ n ]; if( rSet.nSttNode != rGet.nSttNode || rSet.GetMvSttIdx() || rGet.GetMvSttIdx() || ( bCurrIsEnd ? rSet.nSttCntnt != rGet.nEndCntnt @@ -1115,8 +1091,8 @@ bool SwUndo::CanRedlineGroup( SwRedlineSaveDatas& rCurr, for( size_t n = 0; n < rCurr.size(); ++n ) { - SwRedlineSaveData& rSet = *rCurr[ n ]; - const SwRedlineSaveData& rGet = *rCheck[ n ]; + SwRedlineSaveData& rSet = rCurr[ n ]; + const SwRedlineSaveData& rGet = rCheck[ n ]; if( bCurrIsEnd ) rSet.nSttCntnt = rGet.nSttCntnt; else @@ -1173,11 +1149,4 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, ); } -void SwRedlineSaveDatas::DeleteAndDestroyAll() -{ - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; - clear(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 1f0a49b7af07..621454ea01dc 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -95,7 +95,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) SetSaveData( *pDoc, *mpRedlSaveData ); if( mbHiddenRedlines ) { - mpRedlSaveData->DeleteAndDestroyAll(); + mpRedlSaveData->clear(); nEndExtra = pDoc->GetNodes().GetEndOfExtras().GetIndex() - nEndExtra; nSttNode += nEndExtra; |