summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-05-17 14:16:27 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-06-08 21:51:37 +0200
commit6adea27650b58fff16e838260f53675c9b8a5c5b (patch)
tree541ad90fe032aa431b5906ae51e94f46aefbbf43 /sw
parent4216fbc7503f1bb95d9a27d6195cec239eb47576 (diff)
sw_redlinehide: very incomplete impl. of SwRootFrame::SetHideRedlines()
Change-Id: Icff1b1aac20a0a6d3f957e7025f6a08a6d0edbee
Diffstat (limited to 'sw')
-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: */