sw/qa/extras/uiwriter/uiwriter2.cxx |   22 +---------------------
 sw/source/core/docnode/nodes.cxx    |    1 -
 sw/source/core/edit/edatmisc.cxx    |   34 ++--------------------------------
 sw/source/core/edit/edfcol.cxx      |   15 ---------------
 4 files changed, 3 insertions(+), 69 deletions(-)

New commits:
commit 81273c65dd9cec5acd9464b9041f452a5481e10e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jun 16 19:38:43 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jun 22 18:01:36 2022 +0200

    tdf#134759 sw: do CopyToModify() for both start and end node
    
    ... in SwNodes::MoveRange().
    
    SwRangeRedline::Hide() does CopyToSection()/DelCopyOfSection() so the
    previous commit fixed it, and SwRangeRedline::Show() does
    MoveFromSection() so hopefully this should fix it to restore the
    situation before hiding.
    
    This caused several tests to fail, and the reason appears to be that
    they pretty much tested exactly the problem that's being fixed with this
    commit, but the pre-existing fixes and the new one cancel each other
    out.
    
    In all cases the pre-exising fix moves all redlines and moves them back
    again, which is the sort of thing that sw_redlinehide wanted to get rid
    of; not sure why i didn't notice this earlier.
    
    The check for the 3rd paragraph where the style was applied still
    succeeds with the new bugfix, but the one for the 1st paragraph fails;
    it is unclear why applying a style to the 3rd paragraph should have an
    effect on the 1st one.
    
    Hence:
    
    Revert code changes of commit 1d65ffc5a37be21e0316019b1c96eb9a1c871ac0
    "tdf#105413 track changes: keep paragraph styles"
    
    Revert code changes of commit d97fc64a819f834302e384792668507df4cc412c
    "tdf#122893 track changes: keep paragraph alignment"
    
    Revert code changes of commit 6a54dd844d1821165642bbcc16bd12a01a23393d
    "tdf#122901 track changes: keep paragraph top and bottom borders"
    
    Change-Id: I0b70134902a7993c7bb11a3c619e45742764c8ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136056
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0ff16f74e59d..8e78a70f97c1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2147,9 +2147,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413)
         
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
 
     // Set Heading 1 paragraph style in the 3th paragraph.
-    // Because of the tracked deleted region between them,
-    // this sets also the same style in the first paragraph automatically
-    // to keep the changed paragraph style at hiding tracked changes or saving 
the document
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     pWrtShell->Down(/*bSelect=*/false);
@@ -2165,9 +2162,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413)
                          getProperty<OUString>(getParagraph(3), 
"ParaStyleName"));
     CPPUNIT_ASSERT_EQUAL(OUString("Standard"),
                          getProperty<OUString>(getParagraph(2), 
"ParaStyleName"));
-    // first paragraph gets the same heading style
-    CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
-                         getProperty<OUString>(getParagraph(1), 
"ParaStyleName"));
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817)
@@ -2589,9 +2583,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893)
         
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
 
     // Set center-aligned paragraph with preset double line spacing in the 3th 
paragraph.
-    // Because of the tracked deleted region between them,
-    // this sets also the same formatting in the first paragraph automatically
-    // to keep the changed paragraph formatting at hiding tracked changes or 
saving the document
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     pWrtShell->Down(/*bSelect=*/false);
@@ -2610,10 +2601,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893)
     CPPUNIT_ASSERT_EQUAL(sal_Int16(100),
                          getProperty<style::LineSpacing>(getParagraph(2), 
"ParaLineSpacing")
                              .Height); // single line spacing
-    // first paragraph is also center-aligned with double line spacing
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty<sal_Int32>(getParagraph(1), 
"ParaAdjust"));
-    CPPUNIT_ASSERT_EQUAL(
-        sal_Int16(200), getProperty<style::LineSpacing>(getParagraph(1), 
"ParaLineSpacing").Height);
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901)
@@ -2639,9 +2626,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901)
         
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
 
     // Increase paragraph borders in the 3th paragraph, similar to the default 
icon of the UI
-    // "Increase Paragraph Spacing". Because of the tracked deleted region 
between them,
-    // this sets also the same formatting in the first paragraph automatically
-    // to keep the changed paragraph formatting at hiding tracked changes or 
saving the document
+    // "Increase Paragraph Spacing".
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Down(/*bSelect=*/false);
     pWrtShell->Down(/*bSelect=*/false);
@@ -2654,11 +2639,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901)
                          getProperty<sal_Int32>(getParagraph(3), 
"ParaBottomMargin"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(2), 
"ParaTopMargin"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(2), 
"ParaBottomMargin"));
-
-    // first paragraph is also center-aligned with double line spacing
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(101), 
getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(101),
-                         getProperty<sal_Int32>(getParagraph(1), 
"ParaBottomMargin"));
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942)
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index d352cfb41057..85f01cea7e1c 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1526,7 +1526,6 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, 
SwNodes& rNodes )
             SwDoc& rInsDoc = pDestNd->GetDoc();
             ::sw::UndoGuard const undoGuard(rInsDoc.GetIDocumentUndoRedo());
             pSrcNd->CopyCollFormat( *pDestNd );
-            bCopyCollFormat = false;
         }
 
         if( bOneNd )
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index b3556a0494e2..12abec2503db 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -95,25 +95,10 @@ const SfxPoolItem& SwEditShell::GetDefault( sal_uInt16 
nFormatHint ) const
     return GetDoc()->GetDefault( nFormatHint );
 }
 
-// tdf#122893 turn off ShowChanges mode to apply paragraph formatting 
permanently with redlining
-// ie. in all directly preceding deleted paragraphs at the actual cursor 
positions
-static void lcl_disableShowChangesIfNeeded( SwDoc *const pDoc, const SwNode& 
rNode, RedlineFlags &eRedlMode )
-{
-    if ( IDocumentRedlineAccess::IsShowChanges(eRedlMode) &&
-        // is there redlining at beginning of the position (possible redline 
block before the modified node)
-        pDoc->getIDocumentRedlineAccess().GetRedlinePos( rNode, 
RedlineType::Any ) <
-                   pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() )
-    {
-        eRedlMode = RedlineFlags::ShowInsert | RedlineFlags::Ignore;
-        pDoc->getIDocumentRedlineAccess().SetRedlineFlags( eRedlMode );
-    }
-}
-
-void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags, 
const bool bParagraphSetting )
+void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, SetAttrMode nFlags, 
const bool /*bParagraphSetting*/ )
 {
     CurrShell aCurr( this );
     StartAllAction();
-    RedlineFlags eRedlMode = 
GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
     SwPaM* pCursor = GetCursor();
     if( pCursor->GetNext() != pCursor )     // Ring of Cursors
     {
@@ -125,9 +110,6 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, 
SetAttrMode nFlags, con
             if( rPaM.HasMark() && ( bIsTableMode ||
                 *rPaM.GetPoint() != *rPaM.GetMark() ))
             {
-                if (bParagraphSetting)
-                    lcl_disableShowChangesIfNeeded( GetDoc(), 
(*rPaM.Start()).nNode.GetNode(), eRedlMode);
-
                 GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, 
rHint, nFlags, GetLayout());
             }
         }
@@ -139,21 +121,16 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, 
SetAttrMode nFlags, con
         if( !HasSelection() )
             UpdateAttr();
 
-        if (bParagraphSetting)
-            lcl_disableShowChangesIfNeeded( GetDoc(), 
(*pCursor->Start()).nNode.GetNode(), eRedlMode);
-
         GetDoc()->getIDocumentContentOperations().InsertPoolItem(*pCursor, 
rHint, nFlags, GetLayout());
     }
     EndAllAction();
-    GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOldMode );
 }
 
-void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, 
SwPaM* pPaM, const bool bParagraphSetting )
+void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, 
SwPaM* pPaM, const bool /*bParagraphSetting*/ )
 {
     CurrShell aCurr( this );
     SwPaM* pCursor = pPaM ? pPaM : GetCursor();
     StartAllAction();
-    RedlineFlags eRedlMode = 
GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
     if( pCursor->GetNext() != pCursor )     // Ring of Cursors
     {
         bool bIsTableMode = IsTableMode();
@@ -164,9 +141,6 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, 
SetAttrMode nFlags, SwPaM*
             if( rTmpCursor.HasMark() && ( bIsTableMode ||
                 *rTmpCursor.GetPoint() != *rTmpCursor.GetMark() ))
             {
-                if (bParagraphSetting)
-                    lcl_disableShowChangesIfNeeded( GetDoc(), 
(*rTmpCursor.Start()).nNode.GetNode(), eRedlMode);
-
                 
GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCursor, rSet, 
nFlags, GetLayout());
             }
         }
@@ -178,12 +152,8 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, 
SetAttrMode nFlags, SwPaM*
         if( !HasSelection() )
             UpdateAttr();
 
-        if (bParagraphSetting)
-            lcl_disableShowChangesIfNeeded( GetDoc(), 
(*pCursor->Start()).nNode.GetNode(), eRedlMode);
-
         GetDoc()->getIDocumentContentOperations().InsertItemSet(*pCursor, 
rSet, nFlags, GetLayout());
     }
-    GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOldMode );
     EndAllAction();
 }
 
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index ff29c1f10c83..1d480f293fc5 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2192,8 +2192,6 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl 
*pFormat,
     SwTextFormatColl *pLocal = pFormat? pFormat: 
(*GetDoc()->GetTextFormatColls())[0];
     StartAllAction();
 
-    RedlineFlags eRedlMode = 
GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode;
-
     SwRewriter aRewriter;
 
     aRewriter.AddRule(UndoArg1, pLocal->GetName());
@@ -2207,17 +2205,6 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl 
*pFormat,
 
         if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) )
         {
-            // tdf#105413 turn off ShowChanges mode for the next loops to 
apply styles permanently with redlining,
-            // ie. in all directly preceding deleted paragraphs at the actual 
cursor positions
-            if ( IDocumentRedlineAccess::IsShowChanges(eRedlMode) &&
-               // is there redlining at beginning of the position (possible 
redline block before the modified node)
-               GetDoc()->getIDocumentRedlineAccess().GetRedlinePos( 
(*rPaM.Start()).nNode.GetNode(), RedlineType::Any ) <
-                   
GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size() )
-            {
-                eRedlMode = RedlineFlags::ShowInsert | RedlineFlags::Ignore;
-                GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( 
eRedlMode );
-            }
-
             // store previous paragraph style for track changes
             OUString sParaStyleName;
             sal_uInt16 nPoolId = USHRT_MAX;
@@ -2270,8 +2257,6 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl 
*pFormat,
     }
     GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::SETFMTCOLL, &aRewriter);
     EndAllAction();
-
-    GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOldMode );
 }
 
 SwTextFormatColl* SwEditShell::MakeTextFormatColl(const OUString& 
rFormatCollName,

Reply via email to