summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2012-11-01 17:42:28 +0100
committerMichael Stahl <mstahl@redhat.com>2012-11-01 17:37:11 +0000
commit6f79559e1f91b4738f5227651eb1c6c23a14cd19 (patch)
tree6aa1d142870f1993e7e60dc8e5b4b45435b6a20f /sw
parente269e30a8bcbbe254e2819ac16ef8681fee0dbf5 (diff)
Better way to initialize SwNode
Change-Id: I6bc397d9ecd44975ebfa58014c6fe7cd470e4ada Reviewed-on: https://gerrit.libreoffice.org/960 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/node.cxx46
1 files changed, 21 insertions, 25 deletions
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 2da1706d31c1..98afd80ecc7b 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()