sw/source/core/crsr/bookmrk.cxx   |    6 +++---
 sw/source/core/layout/frmtool.cxx |    5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 359deaee45fd4a2bfe7aae255e6da38a9e1931ff
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jan 13 14:35:24 2021 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jan 15 13:36:23 2021 +0100

    tdf#135014 sw_fieldmarkhide: allow section overlap with fieldmark
    
    In this bugdoc it happens that the field with instruction
    "\aINDEX \\c \"2\"\\h \"A\" \\e \"\t\"\003\063  "
    result end is on a node following the start of a section,
    so sw::mark::FindFieldSep() asserts.
    
    In this case it looks like the section was wrongly set by the import,
    but experimenting with Word reveals that it will respect sectPr on a
    paragraph inside a field, so i guess we need to cope with that.
    
    Also adapt InsertCnt_() to skip the section end node.
    
    Change-Id: I5517d463de43b04bf773528a28de12123e534069
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109305
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 18cdae33edfd..167aaf37f625 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -102,15 +102,15 @@ namespace sw::mark
                     }
                 }
             }
-            else if (pNode->IsEndNode())
+            else if (pNode->IsEndNode() && 
!pNode->StartOfSectionNode()->IsSectionNode())
             {
                 assert(nStartNode <= pNode->StartOfSectionIndex());
-                // fieldmark cannot overlap node section
+                // fieldmark cannot overlap node section, unless it's a section
                 n = pNode->StartOfSectionIndex();
             }
             else
             {
-                assert(pNode->IsNoTextNode());
+                assert(pNode->IsNoTextNode() || pNode->IsSectionNode());
             }
         }
         assert(ret); // must have found it
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 8590af6aa2a4..9228b4a8b68e 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1811,6 +1811,11 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                 assert(pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden);
                 continue; // skip it
             }
+            if (pLayout->HasMergedParas() && 
!pNd->StartOfSectionNode()->IsCreateFrameWhenHidingRedlines())
+            {   // tdf#135014 section break in fieldmark (start inside, end 
outside)
+                assert(pNd->StartOfSectionNode()->GetRedlineMergeFlag() == 
SwNode::Merge::Hidden);
+                continue; // skip it
+            }
             assert(pActualSection && "Section end without section start?");
             assert(pActualSection->GetSectionNode() == 
pNd->StartOfSectionNode());
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to