diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-18 19:19:37 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-19 14:32:55 +0100 |
commit | 88d24094200b032cde6eb16b6415b004781e937b (patch) | |
tree | ad4c3cd41d7cf777e959a5859b6b5e7dd1aa14da /sw/source/core/layout/wsfrm.cxx | |
parent | 1520eef33db2d8217c54feb9a9e5174f7ad397d2 (diff) |
sw_redlinehide_4b: visibility of flys anchored at empty nodes
The new mode would consider a fly anchored at a node that contains the
start or end of a redline but has no visible text displayed to be
hidden, while the old move-code would move it to the merged SwTextNode
and therefore keep it visible.
Change this to give the same result both on layout creation
AppendObjs() and switching AddRemoveFlysAnchoredToFrameStartingAtNode().
Reproduces with ooo108073-2.odt, tdf104735-1.odt
Change-Id: Ibac795dcf7848d78e8a2200124bc2557f35ba434
Reviewed-on: https://gerrit.libreoffice.org/65366
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 6aaae44da382f4bc3eafc287b4a21734b740cf21)
Reviewed-on: https://gerrit.libreoffice.org/65385
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/core/layout/wsfrm.cxx')
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 03997c7b7e81..a5a589bae4a0 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4157,6 +4157,42 @@ void SwRootFrame::InvalidateAllObjPos() } } +static void AddRemoveFlysForNode( + SwTextFrame & rFrame, SwTextNode & rTextNode, + std::set<sal_uLong> *const pSkipped, + SwFrameFormats & rTable, + SwPageFrame *const pPage, + SwTextNode const*const pNode, + std::vector<sw::Extent>::const_iterator & rIterFirst, + std::vector<sw::Extent>::const_iterator const& rIterEnd) +{ + if (pNode == &rTextNode) + { // remove existing hidden at-char anchored flys + RemoveHiddenObjsOfNode(rTextNode, &rIterFirst, &rIterEnd); + } + else if (rTextNode.GetIndex() < pNode->GetIndex()) + { + // pNode's frame has been deleted by CheckParaRedlineMerge() + AppendObjsOfNode(&rTable, + pNode->GetIndex(), &rFrame, pPage, rTextNode.GetDoc(), + &rIterFirst, &rIterEnd); + if (pSkipped) + { + // if a fly has been added by AppendObjsOfNode, it must be skipped; if not, then it doesn't matter if it's skipped or not because it has no frames and because of that it would be skipped anyway + if (auto const pFlys = pNode->GetAnchoredFlys()) + { + for (auto const pFly : *pFlys) + { + if (pFly->Which() != RES_DRAWFRMFMT) + { + pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex()); + } + } + } + } + } +} + namespace sw { /// rTextNode is the first one of the "new" merge - if rTextNode isn't the same @@ -4186,30 +4222,20 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode( if (iter == pMerged->extents.end() || iter->pNode != pNode) { - if (pNode == &rTextNode) - { // remove existing hidden at-char anchored flys - RemoveHiddenObjsOfNode( - rTextNode, &iterFirst, &iter); - } - else if (rTextNode.GetIndex() < pNode->GetIndex()) + AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, rTable, pPage, + pNode, iterFirst, iter); + sal_uLong const until = iter == pMerged->extents.end() + ? pMerged->pLastNode->GetIndex() + 1 + : iter->pNode->GetIndex(); + for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i) { - // pNode's frame has been deleted by CheckParaRedlineMerge() - AppendObjsOfNode(&rTable, - pNode->GetIndex(), &rFrame, pPage, rTextNode.GetDoc(), - &iterFirst, &iter); - if (pSkipped) + // let's show at-para flys on nodes that contain start/end of + // redline too, even if there's no text there + SwNode const*const pTmp(pNode->GetNodes()[i]); + if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst) { - // if a fly has been added by AppendObjsOfNode, it must be skipped; if not, then it doesn't matter if it's skipped or not because it has no frames and because of that it would be skipped anyway - if (auto const pFlys = pNode->GetAnchoredFlys()) - { - for (auto const pFly : *pFlys) - { - if (pFly->Which() != RES_DRAWFRMFMT) - { - pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex()); - } - } - } + AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, + rTable, pPage, pTmp->GetTextNode(), iter, iter); } } if (iter == pMerged->extents.end()) |