summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-05-17 14:16:27 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-06-12 18:55:49 +0200
commit6279efd17bf5a7559bfd4ca22134f34ca944f530 (patch)
tree60630578e984f1725737ded4cef8988f6b1f5bc7
parentsw_redlinehide: trivial conversions in lcl_DrawLineForWrongListData (diff)
downloadcore-6279efd17bf5a7559bfd4ca22134f34ca944f530.tar.gz
core-6279efd17bf5a7559bfd4ca22134f34ca944f530.zip
sw_redlinehide: very incomplete impl. of SwRootFrame::SetHideRedlines()
Change-Id: Icff1b1aac20a0a6d3f957e7025f6a08a6d0edbee
-rw-r--r--sw/source/core/layout/wsfrm.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index a25bb8d7bb9f..cdce7870a536 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4171,6 +4171,53 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
return;
}
mbHideRedlines = bHideRedlines;
+ SwNodes const& rNodes(GetFormat()->GetDoc()->GetNodes());
+ // Hide->Show: clear MergedPara, create frames
+ // Show->Hide: call CheckParaRedlineMerge, delete frames
+ // TODO how to traverse
+ // * via layout
+ // - but that won't find nodes that don't have frames in ->Show case
+ // * via nodes
+ // - what about special sections before content? flys? footnotes?
+ // is order of these predictable? flys not anchored in content?
+ // * ideally should call something existing that tries to create everything?
+ // - is that done automatically somewhere already?
+ // * other direction ->Hide - delete frames!
+ // in-order traversal should init flags in nodes *before* the nodes are found
+ for (sal_uLong i = 0; i < rNodes.Count(); ++i)
+ {
+ SwNode *const pNode(rNodes[i]);
+ if (pNode->IsTextNode())
+ {
+ SwTextNode & rTextNode(*pNode->GetTextNode());
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(rTextNode);
+ std::vector<SwTextFrame*> frames;
+ for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+ {
+ if (pFrame->getRootFrame() == this)
+ {
+ frames.push_back(pFrame);
+ }
+ }
+ // this messes with pRegisteredIn so do it outside SwIterator
+ for (SwTextFrame * pFrame : frames)
+ {
+ if (mbHideRedlines && pNode->IsCreateFrameWhenHidingRedlines())
+ {
+ pFrame->SetMergedPara(CheckParaRedlineMerge(*pFrame, rTextNode));
+ }
+ else
+ {
+ if (pFrame->GetMergedPara())
+ {
+ pFrame->SetMergedPara(nullptr);
+ rTextNode.DelFrames(); // FIXME only those in this layout?
+ }
+ }
+ }
+ }
+ }
+ InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate?
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */