[Libreoffice-commits] .: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 1 10:37:32 PDT 2012


 sw/source/core/docnode/node.cxx |   46 ++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 6f79559e1f91b4738f5227651eb1c6c23a14cd19
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Thu Nov 1 17:42:28 2012 +0100

    Better way to initialize SwNode
    
    Change-Id: I6bc397d9ecd44975ebfa58014c6fe7cd470e4ada
    Reviewed-on: https://gerrit.libreoffice.org/960
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 2da1706..98afd80 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -305,17 +305,20 @@ long SwNode::s_nSerial = 0;
 #endif
 
 SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType )
-    : nNodeType( nNdType ), pStartOfSection( 0 )
+    : nNodeType( nNdType )
+    , nAFmtNumLvl( 0 )
+    , bSetNumLSpace( false )
+    , bIgnoreDontExpand( false)
+    , pStartOfSection( 0 )
+#ifdef DBG_UTIL
+    , m_nSerial( s_nSerial++)
+#endif
 {
-    bSetNumLSpace = bIgnoreDontExpand = false;
-    nAFmtNumLvl = 0;
-
-    SwNodes& rNodes = (SwNodes&)rWhere.GetNodes();
-    SwNode* pInsNd = this;      // The MAC cannot insert anything!
+    SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
     if( rWhere.GetIndex() )
     {
         SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
-        rNodes.InsertNode( pInsNd, rWhere );
+        rNodes.InsertNode( this, rWhere );
         if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
         {
             pStartOfSection = pNd->pStartOfSection;
@@ -328,27 +331,25 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType )
     }
     else
     {
-        rNodes.InsertNode( pInsNd, rWhere );
+        rNodes.InsertNode( this, rWhere );
         pStartOfSection = (SwStartNode*)this;
     }
-
-#ifdef DBG_UTIL
-    m_nSerial = s_nSerial;
-    s_nSerial++;
-#endif
 }
 
 SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType )
-    : nNodeType( nNdType ), pStartOfSection( 0 )
+    : nNodeType( nNdType )
+    , nAFmtNumLvl( 0 )
+    , bSetNumLSpace( false )
+    , bIgnoreDontExpand( false)
+    , pStartOfSection( 0 )
+#ifdef DBG_UTIL
+    ,m_nSerial( s_nSerial++)
+#endif
 {
-    bSetNumLSpace = bIgnoreDontExpand = false;
-    nAFmtNumLvl = 0;
-
-    SwNode* pInsNd = this;      // The  MAC cannot insert anything!
     if( nPos )
     {
         SwNode* pNd = rNodes[ nPos - 1 ];
-        rNodes.InsertNode( pInsNd, nPos );
+        rNodes.InsertNode( this, nPos );
         if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
         {
             pStartOfSection = pNd->pStartOfSection;
@@ -361,14 +362,9 @@ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType )
     }
     else
     {
-        rNodes.InsertNode( pInsNd, nPos );
+        rNodes.InsertNode( this, nPos );
         pStartOfSection = (SwStartNode*)this;
     }
-
-#ifdef DBG_UTIL
-    m_nSerial = s_nSerial;
-    s_nSerial++;
-#endif
 }
 
 SwNode::~SwNode()


More information about the Libreoffice-commits mailing list