[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 6 12:54:17 UTC 2019


 sc/source/ui/app/inputhdl.cxx  |   13 +++++++------
 sc/source/ui/inc/inputhdl.hxx  |    5 +++++
 sc/source/ui/inc/output.hxx    |    2 +-
 sc/source/ui/view/output.cxx   |    6 +-----
 sc/source/ui/view/tabview3.cxx |   38 +++++++++++++++++++++++++++++++++++---
 5 files changed, 49 insertions(+), 15 deletions(-)

New commits:
commit 44018db0eefa707e2c56de40f46b7ce42d05172d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 17 20:13:36 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Nov 6 13:53:15 2019 +0100

    Show highlight ranges when chart is selected
    
    Change-Id: Ibb9a085699065869a7f122f37a36c5873b934271
    Reviewed-on: https://gerrit.libreoffice.org/82138
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4396d3381b0b..1bda18ad5b60 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -430,9 +430,9 @@ handle_r1c1:
     }
 }
 
-static ReferenceMark lcl_GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh,
-                                           long nX1, long nX2, long nY1, long nY2,
-                                           long nTab, const Color& rColor )
+ReferenceMark ScInputHandler::GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh,
+                                    long nX1, long nX2, long nY1, long nY2,
+                                    long nTab, const Color& rColor )
 {
     ScSplitPos eWhich = rViewData.GetActivePart();
 
@@ -491,7 +491,7 @@ void ScInputHandler::UpdateLokReferenceMarks()
         PutInOrder(nX1, nX2);
         PutInOrder(nY1, nY2);
 
-        aReferenceMarks[0] = lcl_GetReferenceMark( rViewData, pDocSh,
+        aReferenceMarks[0] = ScInputHandler::GetReferenceMark( rViewData, pDocSh,
                                                    nX1, nX2, nY1, nY2,
                                                    nTab, aRefColor );
     }
@@ -515,8 +515,9 @@ void ScInputHandler::UpdateLokReferenceMarks()
             long nY2 = aRef.aEnd.Row();
             long nTab = aRef.aStart.Tab();
 
-            aReferenceMarks[i + nAdditionalMarks] = lcl_GetReferenceMark(
-                rViewData, pDocSh, nX1, nX2, nY1, nY2, nTab, rData.nColor );
+            aReferenceMarks[i + nAdditionalMarks] = ScInputHandler::GetReferenceMark( rViewData, pDocSh,
+                                                                          nX1, nX2, nY1, nY2,
+                                                                          nTab, Color( rData.nColor ) );
 
             ScInputHandler::SendReferenceMarks( pActiveViewSh, aReferenceMarks );
         }
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index ecb394b5f809..8c31e46c246a 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -30,6 +30,7 @@
 #include <tools/link.hxx>
 #include <vcl/vclptr.hxx>
 #include <editeng/svxenum.hxx>
+#include <viewdata.hxx>
 
 #include <set>
 #include <memory>
@@ -282,6 +283,10 @@ public:
     void SetDocumentDisposing( bool b );
 
     static void     SetAutoComplete(bool bSet)  { bAutoComplete = bSet; }
+
+    static ReferenceMark GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh,
+                                    long nX1, long nX2, long nY1, long nY2,
+                                    long nTab, const Color& rColor );
 };
 
 //  ScInputHdlState
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index fed50cb1916d..128b61fe4439 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -369,7 +369,7 @@ public:
     void    FindChanged();
     void    SetPagebreakMode( ScPageBreakData* pPageData );
     /// Draws reference mark and returns its properties
-    ReferenceMark DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
+    void    DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
                          SCCOL nRefEndX, SCROW nRefEndY,
                          const Color& rColor, bool bHandle );
     ReferenceMark FillReferenceMark( SCCOL nRefStartX, SCROW nRefStartY,
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 536be2f2c2c1..54e2dfa7613c 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1943,12 +1943,10 @@ ReferenceMark ScOutputData::FillReferenceMark( SCCOL nRefStartX, SCROW nRefStart
     return aResult;
 }
 
-ReferenceMark ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
+void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
                                 SCCOL nRefEndX, SCROW nRefEndY,
                                 const Color& rColor, bool bHandle )
 {
-    ReferenceMark aResult;
-
     PutInOrder( nRefStartX, nRefEndX );
     PutInOrder( nRefStartY, nRefEndY );
 
@@ -2071,8 +2069,6 @@ ReferenceMark ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
             }
         }
     }
-
-    return aResult;
 }
 
 void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1f1ed36388ba..07f644d7dd5a 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -69,6 +69,7 @@
 #include <formula/FormulaCompiler.hxx>
 #include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <output.hxx>
 
 #include <com/sun/star/chart2/data/HighlightedRange.hpp>
 
@@ -2513,6 +2514,9 @@ void ScTabView::DoChartSelection(
 {
     ClearHighlightRanges();
     const sal_Unicode sep = ::formula::FormulaCompiler::GetNativeSymbolChar(ocSep);
+    size_t nSize = 0;
+    size_t nIndex = 0;
+    std::vector<ReferenceMark> aReferenceMarks( nSize );
 
     for (chart2::data::HighlightedRange const & rHighlightedRange : rHilightRanges)
     {
@@ -2523,16 +2527,44 @@ void ScTabView::DoChartSelection(
                 aRangeList, rHighlightedRange.RangeRepresentation, &rDoc, rDoc.GetAddressConvention(), sep ))
         {
             size_t nListSize = aRangeList.size();
+            nSize += nListSize;
+            aReferenceMarks.resize(nSize);
+
             for ( size_t j = 0; j < nListSize; ++j )
             {
-                ScRange const & r = aRangeList[j];
+                ScRange& p = aRangeList[j];
+                ScRange aTargetRange;
                 if( rHighlightedRange.Index == - 1 )
-                    AddHighlightRange( r, aSelColor );
+                {
+                    aTargetRange = p;
+                    AddHighlightRange( aTargetRange, aSelColor );
+                }
                 else
-                    AddHighlightRange( lcl_getSubRangeByIndex( r, rHighlightedRange.Index ), aSelColor );
+                {
+                    aTargetRange = lcl_getSubRangeByIndex( p, rHighlightedRange.Index );
+                    AddHighlightRange( aTargetRange, aSelColor );
+                }
+
+                if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
+                {
+                    aTargetRange.PutInOrder();
+
+                    long nX1 = aTargetRange.aStart.Col();
+                    long nX2 = aTargetRange.aEnd.Col();
+                    long nY1 = aTargetRange.aStart.Row();
+                    long nY2 = aTargetRange.aEnd.Row();
+                    long nTab = aTargetRange.aStart.Tab();
+
+                    aReferenceMarks[nIndex++] = ScInputHandler::GetReferenceMark( aViewData, aViewData.GetDocShell(),
+                                                                            nX1, nX2, nY1, nY2,
+                                                                            nTab, aSelColor );
+                }
             }
         }
     }
+
+    if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
+        ScInputHandler::SendReferenceMarks( aViewData.GetViewShell(), aReferenceMarks );
 }
 
 void ScTabView::DoDPFieldPopup(OUString const & rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)


More information about the Libreoffice-commits mailing list