summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-11-05 15:50:43 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commit739006a68f4bd19abcf47bce11e9e191906b6423 (patch)
tree482967cec189c4b87a9c3423e9fa06bdec1797d9 /sw
parent211052a5182674606e32ca89efdbe6f2216d0c9d (diff)
sw_redlinehide_3: fix footnotes not being removed when deleted
If there already is a merged SwTextFrame and a footnote is being deleted in a non-first node hence UpdateFramesForAddDeleteRedline() is called, the SwFootnoteFrame isn't removed unless by some accident. Just let CheckParaRedlineMerge iterate all top-level nodes. Change-Id: I65ac90636a283d5178b4c0323bcc0ae28b3f1196
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/redlnitr.cxx37
1 files changed, 22 insertions, 15 deletions
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 598c0bc321da..ecdd22eff44b 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -216,29 +216,36 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
if (eMode == FrameMode::Existing)
{
// remove existing footnote frames for first node;
- // for non-first notes, DelFrames will remove all
+ // for non-first nodes with own frames, DelFrames will remove all
// (could possibly call lcl_ChangeFootnoteRef, not sure if worth it)
// note: must be done *before* changing listeners!
- sal_Int32 nLast(0);
- std::vector<std::pair<sal_Int32, sal_Int32>> hidden;
- for (auto const& rExtent : extents)
+ // for non-first nodes that are already merged with this frame,
+ // need to remove here too, otherwise footnotes can be removed only
+ // by lucky accident, e.g. TruncLines().
+ auto itExtent(extents.begin());
+ for (auto const pTextNode : nodes)
{
- if (rExtent.pNode != &rTextNode)
+ sal_Int32 nLast(0);
+ std::vector<std::pair<sal_Int32, sal_Int32>> hidden;
+ for ( ; itExtent != extents.end(); ++itExtent)
{
- break;
+ if (itExtent->pNode != pTextNode)
+ {
+ break;
+ }
+ if (itExtent->nStart != 0)
+ {
+ assert(itExtent->nStart != nLast);
+ hidden.emplace_back(nLast, itExtent->nStart);
+ }
+ nLast = itExtent->nEnd;
}
- if (rExtent.nStart != 0)
+ if (nLast != pTextNode->Len())
{
- assert(rExtent.nStart != nLast);
- hidden.emplace_back(nLast, rExtent.nStart);
+ hidden.emplace_back(nLast, pTextNode->Len());
}
- nLast = rExtent.nEnd;
- }
- if (nLast != rTextNode.Len())
- {
- hidden.emplace_back(nLast, rTextNode.Len());
+ sw::RemoveFootnotesForNode(rFrame, *pTextNode, &hidden);
}
- sw::RemoveFootnotesForNode(rFrame, rTextNode, &hidden);
// unfortunately DelFrames() must be done before StartListening too,
// otherwise footnotes cannot be deleted by SwTextFootnote::DelFrames!
for (auto iter = ++nodes.begin(); iter != nodes.end(); ++iter)