summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/txtfrm.hxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-08-09 16:03:44 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-08-13 10:09:12 +0200
commitf3c60c60d03947961d893e23c0e4baf20fb0107b (patch)
tree429bfbd6375d6dc45e9ff6d8e1af7a43bda62406 /sw/source/core/inc/txtfrm.hxx
parentdf28caa1fc24c6288f4c10854b03612c929ee676 (diff)
tdf#126627 sw_redlinehide: fix corner case in SwUndoDelete::UndoImpl()
The assumption that the merge by the moved nodes would be sufficient to handle the end node's frames is wrong: the MakeFrames() uses FrameMode::New, so the frames on the end node are not deleted, even if a previous node is merged with the end node, so the end node has 2 frames in the same layout, which will cause all sorts of problems. Ensure that the ::MakeFrames() that is called from SwUndoDelete will *once* use FrameMode::Existing, which will delete the existing frames on the end node *iff* it is merged. Subsequent SwTextNode::MakeFrames() calls on the nodes must use FrameMode::New of course, to prevent deleting the newly created frames immediately. Hopefully the SwUndoDelete is the only caller of MakeFrames() that will run into this corner case, as the others typically operate on a nodes-array section... (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48) Reviewed-on: https://gerrit.libreoffice.org/77211 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit f6a7dee56c984f36261c75a1056cc3a5bf43b2f1) Reviewed-on: https://gerrit.libreoffice.org/77220 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 4093811d1327e83edf216639d7b1173d8ebf7165) Backport needs some tweak to includes to avoid cyclic headers. Change-Id: I829c1e7a92434f93d56e3c88a4ba4a55bab818d4 Reviewed-on: https://gerrit.libreoffice.org/77340 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/core/inc/txtfrm.hxx')
-rw-r--r--sw/source/core/inc/txtfrm.hxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index bf4c0ad8a316..8b3d6a8c8575 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -101,8 +101,10 @@ struct MergedPara;
std::pair<SwTextNode*, sal_Int32> MapViewToModel(MergedPara const&, TextFrameIndex nIndex);
TextFrameIndex MapModelToView(MergedPara const&, SwTextNode const* pNode, sal_Int32 nIndex);
+// warning: Existing must be used only once; a second use would delete the frame created by the first one...
enum class FrameMode { New, Existing };
std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode);
+SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, sw::FrameMode eMode);
bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
@@ -450,7 +452,7 @@ public:
{ return const_cast<SwDoc &>(const_cast<SwTextFrame const*>(this)->GetDoc()); }
SwDoc const& GetDoc() const;
- SwTextFrame(SwTextNode * const, SwFrame* );
+ SwTextFrame(SwTextNode * const, SwFrame*, sw::FrameMode eMode);
/**
* SwContentFrame: the shortcut for the Frames