[Libreoffice-commits] core.git: 2 commits - sd/source sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 17 19:37:29 UTC 2020


 sd/source/ui/slidesorter/view/SlideSorterView.cxx |    8 ++++
 sw/qa/extras/uiwriter/uiwriter2.cxx               |   41 ++++++++++++++++++++++
 sw/source/core/undo/unredln.cxx                   |    4 +-
 3 files changed, 51 insertions(+), 2 deletions(-)

New commits:
commit 172373c4a2c4a66b8abbe26dbe07fd621c971ed0
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Dec 16 12:23:22 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Dec 17 20:36:56 2020 +0100

    sw ChangesInMargin: fix crash at Undo of deletion of paragraph break
    
    Deletion of the paragraph break by pressing Delete results
    an empty hidden redline, too, which caused a problem during Undo
    (if there were other tracked redlines, too).
    
    Change-Id: I64968688688be72d4e501631244b4c57ab634585
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107830
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index c3d4d71d6b5c..496b9b8602bc 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2084,6 +2084,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771)
     CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin)
+{
+    load(DATA_DIRECTORY, "tdf54819.fodt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    // switch on "Show changes in margin" mode
+    dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {});
+
+    SwWrtShell* const pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin());
+
+    // turn on red-lining and show changes
+    SwDoc* pDoc = pWrtShell->GetDoc();
+    pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert
+                                                      | RedlineFlags::ShowDelete);
+    CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+                           pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+    CPPUNIT_ASSERT_MESSAGE(
+        "redlines should be visible",
+        IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+    // delete a character and the paragraph break at the end of the paragraph
+    dispatchCommand(mxComponent, ".uno:GotoEndOfPara", {});
+    pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
+    dispatchCommand(mxComponent, ".uno:Delete", {});
+    dispatchCommand(mxComponent, ".uno:Delete", {});
+    CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsudolor sit amet."), getParagraph(1)->getString());
+
+    // Undo
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    // this would crash due to bad redline range
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum"), getParagraph(1)->getString());
+
+    // switch off "Show changes in margin" mode
+    dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {});
+    CPPUNIT_ASSERT(!pWrtShell->GetViewOptions()->IsShowChangesInMargin());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138479)
 {
     SwDoc* const pDoc = createDoc();
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index a737863c3835..38caba313d8d 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -108,7 +108,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
             for( SwRedlineTable::size_type n = 1; n < rTable.size(); ++n )
             {
                 SwRangeRedline *pRed(rTable[n]);
-                if ( pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId )
+                if ( !pRed->HasMark() && pRedline->GetId() < pRed->GetId() && pRed->GetId() < nMaxId )
                 {
                     nCurRedlinePos = n;
                     pRedline = pRed;
@@ -117,7 +117,7 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
 
             nMaxId = pRedline->GetId();
 
-            if ( !pRedline->IsVisible() )
+            if ( !pRedline->IsVisible() && !pRedline->HasMark() )
             {
                 // set it visible
                 pRedline->Show(0, rTable.GetPos(pRedline), /*bForced=*/true);
commit a66a6f4cc8efbca282d39e8dd48709ec82bbc26b
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Dec 16 11:07:02 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Dec 17 20:36:43 2020 +0100

    prefetch graphics also for page before and after in slidesorter
    
    The idea is that this will make them preloaded for when the user
    scrolls e.g. using PageDown.
    
    Change-Id: Icac9b6e88b25e9b0434c5ab7a152f47866dfadc5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107823
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index a531943096f1..f13aa1b7eb09 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -654,6 +654,14 @@ void SlideSorterView::Paint (
             continue;
         pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
     }
+    // Handle also one page before and after to have those in advance on scrolling.
+    for (::tools::Long nIndex : { aRange.Min() - 1, aRange.Max() + 1 })
+    {
+        model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
+        if (!pDescriptor)
+            continue;
+        pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
+    }
     if(graphics.size() > 1) // threading does not help with loading just one
         GraphicFilter::GetGraphicFilter().MakeGraphicsAvailableThreaded(graphics);
 


More information about the Libreoffice-commits mailing list