[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - 2 commits - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 30 09:31:17 UTC 2020


 sw/source/core/doc/DocumentRedlineManager.cxx |   22 ----------------------
 sw/source/core/inc/UndoDelete.hxx             |    2 --
 sw/source/core/text/txtfrm.cxx                |    5 +++++
 sw/source/core/undo/undel.cxx                 |   26 +++-----------------------
 4 files changed, 8 insertions(+), 47 deletions(-)

New commits:
commit e7e268d0709df6dffa20fb254522f916069262b2
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 27 18:12:19 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 30 11:30:51 2020 +0200

    tdf#133967 sw_redlinehide: fix assert on undo-redo-undo
    
    Assertion `pNode->GetRedlineMergeFlag() != SwNode::Merge::Hidden' failed.
    
    4  IsAnchoredObjShown(SwTextFrame const&, SwFormatAnchor const&) (rFrame=..., rAnchor=...) at sw/source/core/layout/frmtool.cxx:1284
    5  SwFlyFrameFormat::MakeFrames() (this=0x7a97860) at sw/source/core/layout/atrfrm.cxx:3001
    6  AppendAllObjs(SwFrameFormats const*, SwFrame const*) (pTable=0x72457e0, pSib=0x4002800) at sw/source/core/layout/frmtool.cxx:1337
    7  InsertCnt_(SwLayoutFrame*, SwDoc*, unsigned long, bool, unsigned long, SwFrame*, sw::FrameMode) (pLay=0x8e86ce0, pDoc=0x7242220, nIndex=854, bPages=true, nEndIndex=854, pPrv=0x7a79850, eMode=sw::FrameMode::Existing) at sw/source/core/layout/frmtool.cxx:1892
    8  MakeFrames(SwDoc*, SwNodeIndex const&, SwNodeIndex const&) (pDoc=0x7242220, rSttIdx=SwNodeIndex (node 372), rEndIdx=SwNodeIndex (node 854)) at sw/source/core/layout/frmtool.cxx:2055
    9  sw::UpdateFramesForRemoveDeleteRedline(SwDoc&, SwPaM const&) (rDoc=..., rPam=SwPaM = {...}) at sw/source/core/doc/DocumentRedlineManager.cxx:292
    
    because this added an extent for the node but it still had its flag set
    to Hidden:
    
    11 sw::UpdateMergedParaForInsert(sw::MergedPara&, bool, SwTextNode const&, sal_Int32, sal_Int32) (rMerged=..., isRealInsert=false, rNode=..., nIndex=0, nLen=279) at sw/source/core/text/txtfrm.cxx:1002
    12 SwTextFrame::SwClientNotify(SwModify const&, SfxHint const&) (this=0x7337940, rModify=..., rHint=...) at sw/source/core/text/txtfrm.cxx:2076
    17 SwRangeRedline::InvalidateRange(SwRangeRedline::Invalidation) (this=0x8b3a120, eWhy=SwRangeRedline::Invalidation::Remove) at sw/source/core/doc/docredln.cxx:1261
    18 sw::DocumentRedlineManager::DeleteRedline(SwPaM const&, bool, RedlineType) (this=0x7250b60, rRange=SwPaM = {...}, bSaveInUndo=true, nDelType=-1) at sw/source/core/doc/DocumentRedlineManager.cxx:2386
    19 SwUndoRedlineDelete::UndoRedlineImpl(SwDoc&, SwPaM&) (this=0x8a65a00, rDoc=..., rPam=SwPaM = {...}) at sw/source/core/undo/unredln.cxx:198
    
    Change-Id: I7f36705f1abb2df97a00b359e40534aef0e10d93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99524
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit b33034e7faee2cb8a602ed3342803bf731da8a8b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99665
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6d86d2253631..f6927730edc6 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1023,6 +1023,11 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged,
             rMerged.pParaPropsNode = &const_cast<SwTextNode&>(rNode);
             rMerged.pParaPropsNode->AddToListRLHidden();
         }
+        // called from SwRangeRedline::InvalidateRange()
+        if (rNode.GetRedlineMergeFlag() == SwNode::Merge::Hidden)
+        {
+            const_cast<SwTextNode&>(rNode).SetRedlineMergeFlag(SwNode::Merge::NonFirst);
+        }
     }
     rMerged.mergedText = text.makeStringAndClear();
     return TextFrameIndex(nInserted);
commit 1cd0c57875c892bf2f53e0bbd6586cf4cb760cea
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 27 16:33:06 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 30 11:30:39 2020 +0200

    Revert "tdf#132944 sw_redlinehide: delete of insert redline"
    
    This reverts commit ad0351b84926075297fb74abbe9b31a0455782af.
    
    It turns out that this conflicts with commit
    14e87a4b15d31a34e6053f6194688f3aa23af991 "tdf#133967 sw_redlinehide: fix
    redline deletion of table containing redlines"
    but oddly enough that fix fixes tdf#132944 as well, but both commmits
    combined don't work e.g. on node 1083/1084 in the tdf#133967 bugdoc we
    got no text frame because SwUndoDelete has deleted it, but since it's
    not merged it would be left alone by the new fix anyway.
    
    This fix was quite hacky anyway, so just revert it.
    
    Change-Id: Id17f3575c742b8761a8458914a28ae8047360fff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99522
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 4c9b292bb4ff3ad516dad37e2e0dd0ac8bbb4aa0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99580
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 3c12f166f96f5f6472457b7fa63effb6a6c6d847)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99663

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 5ce6584e44d2..d933de736cb1 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -25,8 +25,6 @@
 #include <fmtfld.hxx>
 #include <frmtool.hxx>
 #include <IDocumentUndoRedo.hxx>
-#include <UndoManager.hxx>
-#include <UndoDelete.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <IDocumentLayoutAccess.hxx>
 #include <IDocumentState.hxx>
@@ -935,21 +933,6 @@ namespace
             static_cast<SwPaM&>(m_rRedline) = *m_pCursor;
         }
     };
-
-    auto UndoDeleteDisableFrames(SwDoc & rDoc) -> void
-    {
-        // inside AppendRedline(), a SwUndoDelete was created;
-        // prevent it from creating duplicate layout frames on Undo
-        auto & rUndo(rDoc.GetUndoManager());
-        if (rUndo.DoesUndo())
-        {
-            SwUndo *const pUndo(rUndo.GetLastUndo());
-            assert(pUndo);
-            SwUndoDelete *const pUndoDel(dynamic_cast<SwUndoDelete*>(pUndo));
-            assert(pUndoDel);
-            pUndoDel->DisableMakeFrames(); // tdf#132944
-        }
-    }
 }
 
 namespace sw
@@ -1625,14 +1608,12 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 }
                                 else
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
-                                UndoDeleteDisableFrames(m_rDoc); // tdf#132944
 
                                 bCompress = true;
                             }
                             if( !bCallDelete && !bDec && *pEnd == *pREnd )
                             {
                                 m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
-                                UndoDeleteDisableFrames(m_rDoc);
                                 bCompress = true;
                             }
                             else if ( bCallDelete || !bDec )
@@ -1652,7 +1633,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
-                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                 }
                                 delete pRedl;
@@ -1677,7 +1657,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
-                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                 }
                                 bDec = true;
@@ -1700,7 +1679,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
-                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                     bDec = true;
                                 }
diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx
index a0ff970661f0..a4eb066581c9 100644
--- a/sw/source/core/inc/UndoDelete.hxx
+++ b/sw/source/core/inc/UndoDelete.hxx
@@ -59,7 +59,6 @@ class SwUndoDelete
     bool m_bResetPgDesc : 1;   // TRUE: reset PgDsc on following node
     bool m_bResetPgBrk : 1;    // TRUE: reset PgBreak on following node
     bool const m_bFromTableCopy : 1; // TRUE: called by SwUndoTableCpyTable
-    bool m_bDisableMakeFrames : 1;
 
     bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
                     SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
@@ -100,7 +99,6 @@ public:
     // SwUndoTableCpyTable needs this information:
     bool IsDelFullPara() const { return m_bDelFullPara; }
 
-    void DisableMakeFrames() { m_bDisableMakeFrames = true; };
 };
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 504bfee25164..0750062cfb47 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -190,7 +190,6 @@ SwUndoDelete::SwUndoDelete(
     m_bResetPgDesc( false ),
     m_bResetPgBrk( false ),
     m_bFromTableCopy( bCalledByTableCpy )
-    , m_bDisableMakeFrames(false)
 {
 
     m_bCacheComment = false;
@@ -1056,26 +1055,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         SetSaveData(rDoc, *m_pRedlSaveData);
 
     sal_uLong delFullParaEndNode(m_nEndNode);
-    if (m_bDisableMakeFrames) // tdf#132944
-    {
-        assert(!m_bDelFullPara);
-        SwTextNode *const pEndNode(aIdx.GetNodes()[m_nEndNode]->GetTextNode());
-        SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
-        for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
-        {
-            o3tl::sorted_vector<SwRootFrame *> layouts;
-            if (pFrame->getRootFrame()->IsHideRedlines())
-            {
-                assert(pFrame->GetTextNodeFirst() == pEndNode); // can't be merged with previous
-                layouts.insert(pFrame->getRootFrame());
-            }
-            for (SwRootFrame const*const pLayout : layouts)
-            {
-                pEndNode->DelFrames(pLayout); // SwUndoRedlineDelete will create it
-            }
-        }
-    }
-    else if (m_bDelFullPara && m_pRedlSaveData)
+    if (m_bDelFullPara && m_pRedlSaveData)
     {
         SwTextNode * pFirstMergedDeletedTextNode(nullptr);
         SwTextNode *const pNextNode = FindFirstAndNextNode(rDoc, *this,
@@ -1122,7 +1102,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
     }
 
     // create frames after SetSaveData has recreated redlines
-    if (0 != m_nNode && !m_bDisableMakeFrames)
+    if (0 != m_nNode)
     {
         // tdf#121031 if the start node is a text node, it already has a frame;
         // if it's a table, it does not
@@ -1138,7 +1118,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         ::MakeFrames(&rDoc, start, end);
     }
 
-    if (pMovedNode && !m_bDisableMakeFrames)
+    if (pMovedNode)
     {   // probably better do this after creating all frames
         lcl_MakeAutoFrames(*rDoc.GetSpzFrameFormats(), pMovedNode->GetIndex());
     }


More information about the Libreoffice-commits mailing list