[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_2' - 5 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 13:25:47 UTC 2018


 sw/source/core/text/redlnitr.cxx |   16 +++++++++++++---
 sw/source/core/text/txtfrm.cxx   |    3 ++-
 sw/source/core/txtnode/ndtxt.cxx |   10 ++++++++++
 sw/source/core/undo/undobj.cxx   |   16 ++++++++++------
 4 files changed, 35 insertions(+), 10 deletions(-)

New commits:
commit 1fc23737110d2d019a7d1daf9236e703c8a27f60
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 16 15:17:50 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 16 15:17:50 2018 +0200

    sw_redlinehide_2: annoying fixup in CheckParaRedlineMerge()
    
    If the document is edited while redlines are shown, the node merge flags
    aren't updated because only CheckParaRedlineMerge() really updates the
    flags.
    
    But CheckParaRedlineMerge() knows what the last node of a merge is,
    so we can conclude that the next node then isn't merged and needs to
    have frames created for it.
    
    Change-Id: Ie9e189a2d9251910c3f5ac98a46867bbe1d91c10

diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index d3b485dc0b94..cd847938b2a3 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -121,6 +121,13 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
             rTextNode.SetRedlineMergeFlag(SwNode::Merge::None);
         }
     }
+    {
+        SwNode *const pNextNode(pNode->GetNodes()[pNode->GetIndex() + 1]);
+        if (!pNextNode->IsCreateFrameWhenHidingRedlines())
+        {   // clear stale flag caused by editing with redlines shown
+            pNextNode->SetRedlineMergeFlag(SwNode::Merge::None);
+        }
+    }
     if (!bHaveRedlines)
     {
         return nullptr;
commit 65bca2ebe49ef06ce93e792ece9e806141787209
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 16 12:55:59 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 16 15:13:58 2018 +0200

    sw: fix 0-length delete redlines in SwUndoSaveSection::SaveSection
    
    The delete redlines aren't restored properly on Undo because they are
    squashed into a point by DelBookmarks.
    
    (regression from 6af2caab7271e11d9501fd6a597e05194d33fd10)
    
    Change-Id: I34ea66b5ab0d441c42570e25ea374cb2d0cfc780

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 74b2f7c7bb27..5afbde167ad2 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1212,6 +1212,16 @@ void SwUndoSaveSection::SaveSection(
 
     // delete all footnotes, fly frames, bookmarks
     DelContentIndex( *aPam.GetMark(), *aPam.GetPoint() );
+
+    // redlines *before* CorrAbs, because DelBookmarks will make them 0-length
+    // but *after* DelContentIndex because that also may use FillSaveData (in
+    // flys) and that will be restored *after* this one...
+    pRedlSaveData.reset( new SwRedlineSaveDatas );
+    if (!SwUndo::FillSaveData( aPam, *pRedlSaveData ))
+    {
+        pRedlSaveData.reset();
+    }
+
     {
         // move certain indexes out of deleted range
         SwNodeIndex aSttIdx( aPam.Start()->nNode.GetNode() );
@@ -1220,12 +1230,6 @@ void SwUndoSaveSection::SaveSection(
         SwDoc::CorrAbs( aSttIdx, aEndIdx, SwPosition( aMvStt ), true );
     }
 
-    pRedlSaveData.reset( new SwRedlineSaveDatas );
-    if( !SwUndo::FillSaveData( aPam, *pRedlSaveData ))
-    {
-        pRedlSaveData.reset();
-    }
-
     nStartPos = rRange.aStart.GetIndex();
 
     --aPam.GetPoint()->nNode;
commit b642ed8fb3151e0dd3c9320ddcb65fa665512f8d
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 16 11:36:50 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 16 11:36:50 2018 +0200

    sqush into fix SplitNode handling of merged frames
    
    Change-Id: Ied95c545cb062432703404401cf1bd3a194028aa

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 00df05638c78..8313a8498219 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -427,6 +427,7 @@ void MoveMergedFlysAndFootnotes(std::vector<SwTextFrame*> const& rFrames,
 SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
         std::function<void (SwTextNode *, sw::mark::RestoreMode)> const*const pContentIndexRestore)
 {
+    bool isHide(false);
     SwNode::Merge const eOldMergeFlag(GetRedlineMergeFlag());
     bool parentIsOutline = IsOutline();
 
@@ -551,6 +552,10 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
         for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
         {
             frames.push_back(pFrame);
+            if (pFrame->getRootFrame()->IsHideRedlines())
+            {
+                isHide = true;
+            }
         }
         for (SwTextFrame * pFrame : frames)
         {
@@ -669,6 +674,10 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
         for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
         {
             frames.push_back(pFrame);
+            if (pFrame->getRootFrame()->IsHideRedlines())
+            {
+                isHide = true;
+            }
         }
         bool bNonMerged(false);
         bool bRecreateThis(false);
@@ -726,6 +735,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
         }
     }
 
+    if (isHide) // otherwise flags won't be set anyway
     {
         // First
         // -> First,NonFirst
commit dbf24d4f5f15a11bbc34f633088dabdff54d9c10
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 16 11:35:05 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 16 11:35:05 2018 +0200

    sw_redlinehide_2: CheckParaRedlineMerge must also mark...
    
    ... first node as not merged when there are redlines but not spanning
    nodes.
    
    Change-Id: Ieb6a5775a1f6a22874e622b10b245b7e8d61a62c

diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 58e42190f278..d3b485dc0b94 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -114,12 +114,15 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
         }
         nLastEnd = pEnd->nContent.GetIndex();
     }
-    if (!bHaveRedlines)
+    if (pNode == &rTextNode)
     {
-        if (pNode->GetRedlineMergeFlag() != SwNode::Merge::None)
+        if (rTextNode.GetRedlineMergeFlag() != SwNode::Merge::None)
         {
-            pNode->SetRedlineMergeFlag(SwNode::Merge::None);
+            rTextNode.SetRedlineMergeFlag(SwNode::Merge::None);
         }
+    }
+    if (!bHaveRedlines)
+    {
         return nullptr;
     }
     if (nLastEnd != pNode->Len())
commit 5d1e83f9ab593402d121a56cecd79b456053e31c
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 16 11:34:10 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 16 11:34:10 2018 +0200

    sw_redlinehide_2: fix bug in UpdateMergedParaForDelete
    
    Change-Id: I818a22f286f08a842295e362fa3e10fbcb37c728

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index eba5ec65b400..c38af1cfa2ba 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -847,9 +847,10 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
                             }
                             else
                             {
+                                sal_Int32 const nOldEnd(it->nEnd);
                                 it->nEnd = nIndex;
                                 it = rMerged.extents.emplace(it+1,
-                                    it->pNode, nIndex + nDeleteHere, it->nEnd);
+                                    it->pNode, nIndex + nDeleteHere, nOldEnd);
                             }
                             assert(nDeleteHere == nToDelete);
                         }


More information about the Libreoffice-commits mailing list