Kaydet (Commit) 6825f691 authored tarafından Michael Stahl's avatar Michael Stahl

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
üst b294d613
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment