summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docnum.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-12-06 12:32:20 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-12-06 19:04:15 +0100
commita696e85ca462b157033855e24db3f4ce912ebb7a (patch)
tree210ce906c341d6ad1c6aa856a2210e487a894788 /sw/source/core/doc/docnum.cxx
parent4f37f275015ee0c433efc09d8615d997f91d8a92 (diff)
sw_redlinehide_4b: fix some problems with pathological table redlines
As seen in ooo95711-1.odt, the ODF import may create a redline that starts on a SwTableNode - though i haven't been able to figure out how such an odd creature might arise from UI actions. Try to fix the obvious places so we don't crash easily; there might be more trouble elsewhere though with code that assumes that a redline starts on a SwTextNode. Change-Id: I8431c1416ac4503ff0209a946398656f1c28366d
Diffstat (limited to 'sw/source/core/doc/docnum.cxx')
-rw-r--r--sw/source/core/doc/docnum.cxx39
1 files changed, 31 insertions, 8 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 852cd0c8ff48..63be0e158b7d 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1440,11 +1440,23 @@ namespace sw {
void
GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout)
{
- if (pLayout && pLayout->IsHideRedlines()
- && rIndex.GetNode().IsTextNode()
- && rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ if (pLayout && pLayout->IsHideRedlines())
{
- rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode;
+ if (rIndex.GetNode().IsTextNode())
+ {
+ if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ {
+ rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode;
+ }
+ }
+ else if (rIndex.GetNode().IsEndNode())
+ {
+ if (rIndex.GetNode().GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ rIndex = *rIndex.GetNode().StartOfSectionNode();
+ assert(rIndex.GetNode().IsTableNode());
+ }
+ }
}
--rIndex;
if (pLayout && rIndex.GetNode().IsTextNode())
@@ -1456,11 +1468,22 @@ GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout)
void
GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout)
{
- if (pLayout && pLayout->IsHideRedlines()
- && rIndex.GetNode().IsTextNode()
- && rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ if (pLayout && pLayout->IsHideRedlines())
{
- rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pLastNode;
+ if (rIndex.GetNode().IsTextNode())
+ {
+ if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+ {
+ rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pLastNode;
+ }
+ }
+ else if (rIndex.GetNode().IsTableNode())
+ {
+ if (rIndex.GetNode().GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+ {
+ rIndex = *rIndex.GetNode().EndOfSectionNode();
+ }
+ }
}
++rIndex;
if (pLayout && rIndex.GetNode().IsTextNode())