[Libreoffice-commits] core.git: 2 commits - sc/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 6 09:11:53 UTC 2021


 sc/source/ui/unoobj/docuno.cxx |    8 ++---
 sc/source/ui/view/gridwin4.cxx |   57 +++++++++++++++++++++++++++++++++++------
 2 files changed, 54 insertions(+), 11 deletions(-)

New commits:
commit 0ed940e3eb87c7048a1a8e6cfda14e7cef85d007
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Sep 15 14:37:37 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Oct 6 11:11:30 2021 +0200

    lok json: write correctly formatted array for comments
    
    Change-Id: Ia9a219f867ea00444844f6854f0b6af762d4e0af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122149
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123107
    Tested-by: Jenkins

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7c5eafa81774..d1131d6f967b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1112,10 +1112,10 @@ void ScModelObj::getPostIts(tools::JsonWriter& rJsonWriter)
     std::vector<sc::NoteEntry> aNotes;
     rDoc.GetAllNoteEntries(aNotes);
 
-    auto commentsNode = rJsonWriter.startNode("comments");
+    auto commentsNode = rJsonWriter.startArray("comments");
     for (const sc::NoteEntry& aNote : aNotes)
     {
-        auto commentNode = rJsonWriter.startNode("");
+        auto commentNode = rJsonWriter.startStruct();
 
         rJsonWriter.put("id", aNote.mpNote->GetId());
         rJsonWriter.put("tab", aNote.maPos.Tab());
@@ -1154,10 +1154,10 @@ void ScModelObj::getPostItsPos(tools::JsonWriter& rJsonWriter)
     std::vector<sc::NoteEntry> aNotes;
     rDoc.GetAllNoteEntries(aNotes);
 
-    auto commentsNode = rJsonWriter.startNode("commentsPos");
+    auto commentsNode = rJsonWriter.startArray("commentsPos");
     for (const sc::NoteEntry& aNote : aNotes)
     {
-        auto commentNode = rJsonWriter.startNode("");
+        auto commentNode = rJsonWriter.startStruct();
 
         rJsonWriter.put("id", aNote.mpNote->GetId());
         rJsonWriter.put("tab", aNote.maPos.Tab());
commit 57a628d540287c4bfa8251e50279f4879faa184d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Aug 17 16:56:22 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Oct 6 11:11:14 2021 +0200

    calc: get rects faster for simple selection
    
    In LOK when we select the full row using keyboard shortcut
    Ctrl + Shift + right arrow we need to receive complete selection
    so we will avoid requesting it by chunks, slowly moving the
    view to the right.
    
    So - don't clip the selection rects to the visible area.
    
    It is needed only for simple selections so to avoid performance
    issues - use simpler algorithm without loops checking every cell size.
    
    Change-Id: I6ab975b6c155f3dde3014a52752ffdc79a93844f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120611
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122107
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123099
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f810efbb8c19..e37949f7ef23 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -2115,14 +2115,60 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
                                   ::std::vector< tools::Rectangle >& rRects,
                                   bool bInPrintTwips) const
 {
-    ScMarkData aMultiMark( rMarkData );
-    aMultiMark.SetMarking( false );
-    aMultiMark.MarkToMulti();
     ScDocument& rDoc = mrViewData.GetDocument();
     SCTAB nTab = mrViewData.GetTabNo();
-
+    double nPPTX = mrViewData.GetPPTX();
+    double nPPTY = mrViewData.GetPPTY();
     bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
     tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
+
+    ScMarkData aMultiMark( rMarkData );
+    aMultiMark.SetMarking( false );
+
+    if (!aMultiMark.IsMultiMarked())
+    {
+        // simple range case - simplify calculation
+        ScRange aSimpleRange;
+        aMultiMark.GetMarkArea( aSimpleRange );
+
+        aMultiMark.MarkToMulti();
+        if ( !aMultiMark.IsMultiMarked() )
+            return;
+
+        SCCOL nX1 = aSimpleRange.aStart.Col();
+        SCROW nY1 = aSimpleRange.aStart.Row();
+        SCCOL nX2 = aSimpleRange.aEnd.Col();
+        SCROW nY2 = aSimpleRange.aEnd.Row();
+
+        PutInOrder( nX1, nX2 );
+        PutInOrder( nY1, nY2 );
+
+        Point aScrStartPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
+            mrViewData.GetScrPos(nX1, nY1, eWhich);
+
+        tools::Long nStartX = aScrStartPos.X();
+        tools::Long nStartY = aScrStartPos.Y();
+
+        Point aScrEndPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX2, nY2) :
+            mrViewData.GetScrPos(nX2, nY2, eWhich);
+
+        tools::Long nWidthTwips = rDoc.GetColWidth(nX2, nTab);
+        const tools::Long nWidth = bInPrintTwips ?
+            nWidthTwips : ScViewData::ToPixel(nWidthTwips, nPPTX);
+        tools::Long nEndX = aScrEndPos.X() + (nWidth - 1) * nLayoutSign;
+
+        sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY2, nTab );
+        const tools::Long nHeight = bInPrintTwips ?
+            nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
+        tools::Long nEndY = aScrEndPos.Y() + nHeight - 1;
+
+        ScInvertMerger aInvert( &rRects );
+        aInvert.AddRect( tools::Rectangle( nStartX, nStartY, nEndX, nEndY ) );
+
+        return;
+    }
+
+    aMultiMark.MarkToMulti();
     if ( !aMultiMark.IsMultiMarked() )
         return;
     ScRange aMultiRange;
@@ -2183,9 +2229,6 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
             nY2 = nMaxTiledRow;
     }
 
-    double nPPTX = mrViewData.GetPPTX();
-    double nPPTY = mrViewData.GetPPTY();
-
     ScInvertMerger aInvert( &rRects );
 
     Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :


More information about the Libreoffice-commits mailing list