Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi

I converted the SV PTRARR_DEL to boost::ptr_vector in sw component.
Could you please check and push this path?
This and later contributions is licensed under MPL 1.1 / GPL v3+ / LGPL v3+.

Best Regards
Bartosz
From 0af592927b760e31ed23e4c6bcedc58d29cb4a9d Mon Sep 17 00:00:00 2001
From: Bartosz Kosiorek <gang65@poczta.onet.pl>
Date: Sun, 25 Mar 2012 23:46:01 +0200
Subject: [PATCH] Convert SV_PTRARR_DEL to boost::ptr_vector

---
 sw/source/core/doc/docedt.cxx |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 6c73ba1..2573d7e 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -161,9 +161,7 @@ struct _SaveRedline
     }
 };
 
-SV_DECL_PTRARR_DEL( _SaveRedlines, _SaveRedline*, 0 )
-
-SV_IMPL_PTRARR( _SaveRedlines, _SaveRedline* )
+typedef boost::ptr_vector< _SaveRedline > _SaveRedlines;
 
 bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos )
 {
@@ -532,7 +530,7 @@ void lcl_SaveRedlines( const SwPaM& aPam, _SaveRedlines& rArr )
 
             // save the current redline
             _SaveRedline* pSave = new _SaveRedline( pCurrent, *pStart );
-            rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+            rArr.push_back( pSave );
         }
     }
 
@@ -545,11 +543,11 @@ void lcl_RestoreRedlines( SwDoc* pDoc, const SwPosition& rPos, _SaveRedlines& 
rA
     RedlineMode_t eOld = pDoc->GetRedlineMode();
     pDoc->SetRedlineMode_intern( (RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | 
nsRedlineMode_t::REDLINE_ON ));
 
-    for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+    for( size_t n = 0; n < rArr.size(); ++n )
     {
-        _SaveRedline* pSave = rArr[ n ];
-        pSave->SetPos( rPos );
-        pDoc->AppendRedline( pSave->pRedl, true );
+        //_SaveRedline* pSave = rArr[ n ];
+        rArr[ n ].SetPos( rPos );
+        pDoc->AppendRedline( rArr[ n ].pRedl, true );
     }
 
     pDoc->SetRedlineMode_intern( eOld );
@@ -590,7 +588,7 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
                             pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
 
                 _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
-                rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+                rArr.push_back( pSave );
 
                 pTmpPos = pTmp->End();
                 pTmpPos->nNode = rRg.aEnd;
@@ -613,7 +611,7 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
             {
                 // move everything
                 _SaveRedline* pSave = new _SaveRedline( pTmp, rRg.aStart );
-                rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+                rArr.push_back( pSave );
             }
             else
             {
@@ -625,7 +623,7 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
                             pTmpPos->nNode.GetNode().GetCntntNode(), 0 );
 
                 _SaveRedline* pSave = new _SaveRedline( pNewRedl, rRg.aStart );
-                rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
+                rArr.push_back( pSave );
 
                 pTmpPos = pTmp->Start();
                 pTmpPos->nNode = rRg.aEnd;
@@ -646,11 +644,11 @@ 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 ));
 
-    for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+    for( size_t n = 0; n < rArr.size(); ++n )
     {
-        _SaveRedline* pSave = rArr[ n ];
-        pSave->SetPos( nInsPos );
-        pDoc->AppendRedline( pSave->pRedl, true );
+        //_SaveRedline* pSave = rArr[ n ];
+        rArr[ n ].SetPos( nInsPos );
+        pDoc->AppendRedline( rArr[ n ].pRedl, true );
     }
 
     pDoc->SetRedlineMode_intern( eOld );
@@ -880,7 +878,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
     _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, 0 != ( DOC_MOVEALLFLYS & eMvFlags ) );
 
     // save redlines (if DOC_MOVEREDLINES is used)
-    _SaveRedlines aSaveRedl( 0 );
+    _SaveRedlines aSaveRedl;
     if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
     {
         lcl_SaveRedlines( rPaM, aSaveRedl );
@@ -1084,7 +1082,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
     _RestFlyInRange( aSaveFlyArr, rPaM.Start()->nNode, &(rPos.nNode) );
 
     // restore redlines (if DOC_MOVEREDLINES is used)
-    if( aSaveRedl.Count() )
+    if( !aSaveRedl.empty() )
     {
         lcl_RestoreRedlines( this, *aSavePam.Start(), aSaveRedl );
     }
@@ -1129,7 +1127,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
                                     GetFtnIdxs(), aTmpFntIdx );
     }
 
-    _SaveRedlines aSaveRedl( 0 );
+    _SaveRedlines aSaveRedl;
     SvPtrarr aSavRedlInsPosArr( 0 );
     if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
     {
@@ -1212,7 +1210,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
         }
     }
 
-    if( aSaveRedl.Count() )
+    if( !aSaveRedl.empty() )
         lcl_RestoreRedlines( this, aIdx.GetIndex(), aSaveRedl );
 
     if( pUndo )
-- 
1.7.5.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.