diff options
-rw-r--r-- | sw/inc/ndarr.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/docnode/node.cxx | 23 |
2 files changed, 13 insertions, 11 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 7d65a951592b..26fee7e73fd1 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -90,6 +90,7 @@ class SW_DLLPUBLIC SwNodes friend class SwDoc; friend class SwNode; friend class SwNodeIndex; + friend class SwStartNode; friend class ::sw::DocumentContentOperationsManager; SwNodeIndex* pRoot; ///< List of all indices on nodes. diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 399bfc47199e..e315529821e3 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -289,9 +289,9 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType ) #endif , pStartOfSection( 0 ) { - SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes()); if( rWhere.GetIndex() ) { + SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes()); SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ]; rNodes.InsertNode( this, rWhere ); if( 0 == ( pStartOfSection = pNd->GetStartNode()) ) @@ -304,11 +304,6 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType ) } } } - else - { - rNodes.InsertNode( this, rWhere ); - pStartOfSection = (SwStartNode*)this; - } } /** Inserts a node into the rNodes array at the rWhere position @@ -341,11 +336,6 @@ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType ) } } } - else - { - rNodes.InsertNode( this, nPos ); - pStartOfSection = (SwStartNode*)this; - } } SwNode::~SwNode() @@ -851,6 +841,12 @@ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, SwStartNodeType eSttNd ) : SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd ) { + if( !rWhere.GetIndex() ) + { + SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes()); + rNodes.InsertNode( this, rWhere ); + pStartOfSection = this; + } // Just do this temporarily until the EndNode is inserted pEndOfSection = (SwEndNode*)this; } @@ -858,6 +854,11 @@ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos ) : SwNode( rNodes, nPos, ND_STARTNODE ), eSttNdTyp( SwNormalStartNode ) { + if( !nPos ) + { + rNodes.InsertNode( this, nPos ); + pStartOfSection = this; + } // Just do this temporarily until the EndNode is inserted pEndOfSection = (SwEndNode*)this; } |