summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-08-06 18:06:20 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-08-06 18:14:00 +0200
commitb75e052d31ec8854cad3bda7d372dcfcd50c9609 (patch)
tree1561090816a0ebad59c80b41e356b61c008b9b07
parent48c90eb75f4610480be28ecad48953143c7f297a (diff)
Call SwTxtNode-specific part of DelFrms while SwTxtNode is still SwTxtNode
...when SwCntntNode::DelFrms is called from ~SwTxtNode -> ~SwCntntNode. * SwCntntNode::DelFrms now needs a flag to distinguish calls from inside ~SwCntntNode from other calls. bIsDisposeAccTable happens to already serve that purpose, so I reused it, but that may be a bad idea from a semantic point of view? * ~SwTxtNode is careful to mimic old behavior and only calls DelFrms_TxtNodePart if GetDepends() is true; no idea whether that's really necessary, though. * Shifting the work done by DelFrms_TxtNodePart from within ~SwCntntNode to before ~SwTxtNode calls ~SwCntntNode hopefully has no negative consequences. Change-Id: I1532b4cfef7fbf9ba82e64b919a08cbefa335421
-rw-r--r--sw/inc/ndtxt.hxx4
-rw-r--r--sw/source/core/docnode/node.cxx14
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx20
3 files changed, 25 insertions, 13 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index dfefc4792349..a46e8bc57cb1 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -72,7 +72,7 @@ typedef std::set< sal_Int32 > SwSoftPageBreakList;
/// SwTxtNode is a paragraph in the document model.
class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
{
-
+ friend class SwCntntNode;
/// For creating the first TextNode.
friend class SwDoc; ///< CTOR and AppendTxtNode()
friend class SwNodes;
@@ -181,6 +181,8 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
const SwTxtInputFld* GetOverlappingInputFld( const SwTxtAttr& rTxtAttr ) const;
+ void DelFrms_TxtNodePart();
+
public:
bool IsWordCountDirty() const;
bool IsWrongDirty() const;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 93386082e24b..e7c8c6bf85ee 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1284,19 +1284,9 @@ void SwCntntNode::DelFrms( bool bIsDisposeAccTable )
delete pFrm;
}
- if( IsTxtNode() )
+ if( bIsDisposeAccTable && IsTxtNode() )
{
- ((SwTxtNode*)this)->SetWrong( NULL );
- ((SwTxtNode*)this)->SetWrongDirty( true );
-
- ((SwTxtNode*)this)->SetGrammarCheck( NULL );
- ((SwTxtNode*)this)->SetGrammarCheckDirty( true );
-
- ((SwTxtNode*)this)->SetSmartTags( NULL );
- ((SwTxtNode*)this)->SetSmartTagDirty( true );
-
- ((SwTxtNode*)this)->SetWordCountDirty( true );
- ((SwTxtNode*)this)->SetAutoCompleteWordDirty( true );
+ static_cast<SwTxtNode *>(this)->DelFrms_TxtNodePart();
}
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index b9c08211203c..8489f7c8e6d8 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -262,6 +262,11 @@ SwTxtNode::~SwTxtNode()
RemoveFromList();
InitSwParaStatistics( false );
+
+ if (GetDepends())
+ {
+ DelFrms_TxtNodePart();
+ }
}
void SwTxtNode::FileLoadedInitHints()
@@ -1309,6 +1314,21 @@ const SwTxtInputFld* SwTxtNode::GetOverlappingInputFld( const SwTxtAttr& rTxtAtt
return pTxtInputFld;
}
+void SwTxtNode::DelFrms_TxtNodePart()
+{
+ SetWrong( NULL );
+ SetWrongDirty( true );
+
+ SetGrammarCheck( NULL );
+ SetGrammarCheckDirty( true );
+
+ SetSmartTags( NULL );
+ SetSmartTagDirty( true );
+
+ SetWordCountDirty( true );
+ SetAutoCompleteWordDirty( true );
+}
+
SwTxtFld* SwTxtNode::GetFldTxtAttrAt(
const sal_Int32 nIndex,
const bool bIncludeInputFldAtStart ) const