[Libreoffice-commits] core.git: 3 commits - sw/inc sw/source
Stephan Bergmann
sbergman at redhat.com
Wed Aug 6 09:14:27 PDT 2014
sw/inc/ndtxt.hxx | 4 +++-
sw/inc/node.hxx | 2 +-
sw/source/core/docnode/node.cxx | 23 +++++------------------
sw/source/core/docnode/nodes.cxx | 2 +-
sw/source/core/txtnode/ndtxt.cxx | 20 ++++++++++++++++++++
5 files changed, 30 insertions(+), 21 deletions(-)
New commits:
commit b75e052d31ec8854cad3bda7d372dcfcd50c9609
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 6 18:06:20 2014 +0200
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
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index dfefc47..a46e8bc 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 9338608..e7c8c6b 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 b9c0821..8489f7c 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
commit 48c90eb75f4610480be28ecad48953143c7f297a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 6 17:36:25 2014 +0200
SwCntntNode::DelFrms already checks for GetDepends()
Change-Id: I9f7ccd372a570dc4dea98983c51419dce83f8be8
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 1628967..9338608 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -912,8 +912,7 @@ SwCntntNode::~SwCntntNode()
{
// The base class SwClient of SwFrm excludes itself from the dependency list!
// Thus, we need to delete all Frames in the dependency list.
- if( GetDepends() )
- DelFrms(false);
+ DelFrms(false);
delete pCondColl;
commit 02e462f5b15ff5ca00992349fdbc79689ccb3863
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Aug 6 17:35:26 2014 +0200
Remove unused bNeedDel parameter to SwCntntNode::DelFrms
Change-Id: Iedc5e8caafda868db853fdf328fbdc99bbf28e20
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 4de9d18..d58da5c 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -427,7 +427,7 @@ public:
Add an input param to identify if acc table should be disposed
*/
- void DelFrms( bool bNeedDel = false, bool bIsAccTableDispose = true );
+ void DelFrms( bool bIsAccTableDispose = true );
/** @return count of elements of node content. Default is 1.
There are differences between text node and formula node. */
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index e315529..1628967 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -913,7 +913,7 @@ SwCntntNode::~SwCntntNode()
// The base class SwClient of SwFrm excludes itself from the dependency list!
// Thus, we need to delete all Frames in the dependency list.
if( GetDepends() )
- DelFrms(true, false);
+ DelFrms(false);
delete pCondColl;
@@ -1224,11 +1224,9 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode )
* Deletes all Views from the Doc for this Node.
* The ContentFrames are removed from the corresponding Layout.
*
- * An input param to identify if the acc table should be disposed. and a
- * flag(bNeedDel) to indicate whether to del corresponding frm even in doc
- * loading process,
+ * An input param to identify if the acc table should be disposed.
*/
-void SwCntntNode::DelFrms( bool /*bNeedDel*/, bool bIsDisposeAccTable )
+void SwCntntNode::DelFrms( bool bIsDisposeAccTable )
{
if( !GetDepends() )
return;
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 169c78f..06375d9 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -799,7 +799,7 @@ bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
//Add special function to text node.
{
if( bNewFrms && pAktNode->GetCntntNode() )
- ((SwCntntNode*)pAktNode)->DelFrms( false );
+ ((SwCntntNode*)pAktNode)->DelFrms();
pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
nInsPos++;
aRg.aEnd--;
More information about the Libreoffice-commits
mailing list