[PATCH] Replace std::pair with more descriptive names in SwUndoDelNum

Nigel Hawkins n.hawkins at gmx.com
Mon Feb 7 08:19:59 PST 2011


---
 sw/inc/undobj.hxx             |   10 +++++++---
 sw/source/core/undo/unnum.cxx |   10 +++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index e6ea274..ae86015 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -1371,9 +1371,13 @@ public:
 
 class SwUndoDelNum : public SwUndo, private SwUndRng
 {
-    typedef std::vector< std::pair< ULONG, int > > SvNode;
-    SvNode aNodes;
-    SvBools aRstLRSpaces;
+    struct NodeLevel
+    {
+        ULONG index;
+        int level;
+        inline NodeLevel(ULONG idx, int lvl) : index(idx), level(lvl) {};
+    };
+    std::vector<NodeLevel> aNodes;
     SwHistory* pHistory;
 public:
     SwUndoDelNum( const SwPaM& rPam );
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index d5afd1f..f13f94c 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -214,11 +214,11 @@ void SwUndoDelNum::Undo( SwUndoIter& rUndoIter )
     pHistory->TmpRollback( &rDoc, 0 );
     pHistory->SetTmpEnd( pHistory->Count() );
 
-    for( SvNode::const_iterator i = aNodes.begin(); i != aNodes.end(); ++i )
+    for( std::vector<NodeLevel>::const_iterator i = aNodes.begin(); i != aNodes.end(); ++i )
     {
-        SwTxtNode* pNd = rDoc.GetNodes()[ i->first ]->GetTxtNode();
-        OSL_ENSURE( pNd, "wo ist der TextNode geblieben?" );
-        pNd->SetAttrListLevel( i->second );
+        SwTxtNode* pNd = rDoc.GetNodes()[ i->index ]->GetTxtNode();
+        OSL_ENSURE( pNd, "Where has the TextNode gone?" );
+        pNd->SetAttrListLevel( i->level );
 
         if( pNd->GetCondFmtColl() )
             pNd->ChkCondColl();
@@ -246,7 +246,7 @@ void SwUndoDelNum::AddNode( const SwTxtNode& rNd, BOOL )
 {
     if( rNd.GetNumRule() )
     {
-        aNodes.push_back( SvNode::value_type( rNd.GetIndex(), rNd.GetActualListLevel() ) );
+        aNodes.push_back( NodeLevel( rNd.GetIndex(), rNd.GetActualListLevel() ) );
     }
 }
 
-- 
1.7.0.4


--=-I+d3rLOmCfAdYc+SodvW--



More information about the LibreOffice mailing list