summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-03-21 10:25:45 +0100
committerMichael Stahl <mstahl@redhat.com>2012-03-21 12:08:33 +0100
commit082906e1f4cf58fdfab1a4064e2b7955fcdaeb8a (patch)
tree0719ac93a46758ef7ea744838d88a4da9bd10206
parent176ba743c12ecbfdda71522062f6d1a5749f3756 (diff)
rhbz#789022: SwNodes: fix inconsistent outline check:
SwNodes::UpdateOutlineNode will add/remove the node from SwNodes::pOutlineNds depending on IsOutline(), while various SwNodes methods that move and delete nodes check GetAttrOutlineLevel() != 0, which may be false even if IsOutline() is true.
-rw-r--r--sw/source/core/docnode/nodes.cxx34
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx6
2 files changed, 23 insertions, 17 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 518de823fd08..ab1243093d23 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -175,3 +175,3 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
- if ( pTxtNode->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei
+ if (pTxtNode->IsOutline())
{
@@ -190,4 +190,3 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
- if( bInsOutlineIdx &&
- 0 != rTxtNd.GetAttrOutlineLevel() )//<-end,zhaojianwei
+ if (bInsOutlineIdx && rTxtNd.IsOutline())
{
@@ -234,5 +233,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
- // loesche die Gliederungs-Indizies aus dem alten Nodes-Array
- if( 0 != pTxtNd->GetAttrOutlineLevel() )//<-end,zhaojianwei
+ // remove outline index from old nodes array
+ if (pTxtNd->IsOutline())
+ {
pOutlineNds->Remove( pNd );
+ }
@@ -271,4 +272,3 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
// OultineNodes set the new nodes in the array
- if( bInsOutlineIdx &&
- 0 != pTxtNd->GetAttrOutlineLevel() ) //#outline level,added by zhaojianwei
+ if (bInsOutlineIdx && pTxtNd->IsOutline())
{
@@ -539,8 +539,8 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
- // setze bei Start/EndNodes die richtigen Indizies
- // loesche die Gliederungs-Indizies aus
- // dem alten Nodes-Array
- if( pCNd->IsTxtNode() && 0 !=
- ((SwTxtNode*)pCNd)->GetAttrOutlineLevel() )//<-end,by zhaojianwei
+ // remove outline index from old nodes array
+ if (pCNd->IsTxtNode() &&
+ static_cast<SwTxtNode*>(pCNd)->IsOutline())
+ {
pOutlineNds->Remove( pCNd );
+ }
else
@@ -574,3 +574,3 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
const bool bOutlNd = pNd->IsTxtNode() &&
- 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//<-end,zhaojianwei
+ static_cast<SwTxtNode*>(pNd)->IsOutline();
// loesche die Gliederungs-Indizies aus
@@ -1223,3 +1223,4 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
{
- if( 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() &&//<-end,zhaojianwei
+ SwTxtNode *const pTxtNode(static_cast<SwTxtNode*>(pNd));
+ if (pTxtNode->IsOutline() &&
pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
@@ -1230,3 +1231,3 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
}
- ((SwTxtNode*)pNd)->InvalidateNumRule();
+ pTxtNode->InvalidateNumRule();
}
@@ -1524,4 +1525,3 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
- if( pNd->IsTxtNode() &&
- 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() ) //<-end,zhaojianwei
+ if (pNd->IsTxtNode() && static_cast<SwTxtNode*>(pNd)->IsOutline())
{ // loesche die Gliederungs-Indizies.
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 2691f28adf97..fa6f3b0f0b4c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -263,2 +263,8 @@ SwTxtNode::~SwTxtNode()
+ // must be removed from outline nodes by now
+#if OSL_DEBUG_LEVEL > 0
+ sal_uInt16 foo;
+ assert(!GetNodes().GetOutLineNds().Seek_Entry(this, &foo));
+#endif
+
RemoveFromList();