diff options
author | Michael Stahl <mst@openoffice.org> | 2010-12-21 16:48:30 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-12-21 16:48:30 +0100 |
commit | f9ab560c8b9bb08d3ad7e6b72ea8a8ecbedcdf47 (patch) | |
tree | 7b0e30f5f3e8d37aedf937195a56744d6fc5fa5d /sw/inc/txtatr.hxx | |
parent | c6d658988ed10b4bdfe4d66b4deb4e1f79df33ff (diff) |
sw34bf03: #i115315#: refactor the copying of meta/meta-field:
no longer delay the call to DoCopy() until after the new hint is inserted,
but do it before; this fixes a crash on drag&drop in the same text node.
this is also quite a bit less ugly, but there are still some hacks required:
DoCopy() is now called by a new factory CreateTxtMeta().
DoCopy() needs to know the text node where the hint will be inserted.
so the MakeTxtAttr() function needs to know whether it should insert a copy,
and the target text node.
this requires a new bit in the SetAttrMode enum: SETATTR_IS_COPY.
also, sw::Meta can no longer get the text node from SwTxtMeta, because it is
copied before the SwTxtMeta is inserted, so it now has a SwTxtNode* member.
furthermore the notification stuff is refactored a bit.
Diffstat (limited to 'sw/inc/txtatr.hxx')
-rw-r--r-- | sw/inc/txtatr.hxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index 65ecd951868c..75be35e44821 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -34,6 +34,11 @@ class SwTxtNode; // fuer SwTxtFld class SwCharFmt; +namespace sw { + class MetaFieldManager; +} + + // ATT_CHARFMT ********************************************* class SwTxtCharFmt : public SwTxtAttrEnd @@ -61,7 +66,7 @@ public: class SwTxtAttrNesting : public SwTxtAttrEnd { -public: +protected: SwTxtAttrNesting( SfxPoolItem & i_rAttr, const xub_StrLen i_nStart, const xub_StrLen i_nEnd ); virtual ~SwTxtAttrNesting(); @@ -70,16 +75,20 @@ public: class SwTxtMeta : public SwTxtAttrNesting { private: - SwTxtNode * m_pTxtNode; - -public: SwTxtMeta( SwFmtMeta & i_rAttr, const xub_StrLen i_nStart, const xub_StrLen i_nEnd ); + +public: + static SwTxtMeta * CreateTxtMeta( + ::sw::MetaFieldManager & i_rTargetDocManager, + SwTxtNode *const i_pTargetTxtNode, + SwFmtMeta & i_rAttr, + xub_StrLen const i_nStart, xub_StrLen const i_nEnd, + bool const i_bIsCopy); + virtual ~SwTxtMeta(); void ChgTxtNode(SwTxtNode * const pNode); - SwTxtNode * GetTxtNode() const { return m_pTxtNode; } - }; |