[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/inc sc/source

Eike Rathke erack at redhat.com
Sat Nov 5 18:13:56 UTC 2016


 sc/inc/markdata.hxx              |   13 ++++++++++++-
 sc/source/core/data/markdata.cxx |   25 +++++++++++++++++++++----
 sc/source/core/data/table3.cxx   |    2 +-
 sc/source/ui/view/tabcont.cxx    |    3 +++
 4 files changed, 37 insertions(+), 6 deletions(-)

New commits:
commit 0a296eee23380275ec7bad1dff8d81b75d98429f
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Nov 3 23:20:44 2016 +0100

    Resolves: tdf#103684 calculate status bar functions across sheets
    
    Also trigger recalculation when additional sheets are selected or deselected.
    
    Change-Id: I259396a3e30c5653ac252b7bb2eb6a0a9405d6cc
    (cherry picked from commit 8d777f85eaff6af8896942590316b7cd9f2c3e75)
    Reviewed-on: https://gerrit.libreoffice.org/30546
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx
index 60c04d0..d11173c 100644
--- a/sc/inc/markdata.hxx
+++ b/sc/inc/markdata.hxx
@@ -108,10 +108,21 @@ public:
     ScMarkArray GetMarkArray( SCCOL nCol ) const;
 
     bool        IsCellMarked( SCCOL nCol, SCROW nRow, bool bNoSimple = false ) const;
-    void        FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const;
+
+    /** Create a range list of marks.
+        @param  nForTab
+                If -1, use start-sheet-tab of the multi-area in ranges.
+                If >= 0, use given sheet-tab in ranges.
+     */
+    void        FillRangeListWithMarks( ScRangeList* pList, bool bClear, SCTAB nForTab = -1 ) const;
     void        ExtendRangeListTables( ScRangeList* pList ) const;
 
     ScRangeList GetMarkedRanges() const;
+    /** Get marked ranges with sheet-tab set to nTab.
+        Marks are stored for the currently active sheet respectively the
+        multi-area start-sheet-tab, update ranges with the sheet for which this
+        is called. */
+    ScRangeList GetMarkedRangesForTab( SCTAB nTab ) const;
 
     void        MarkFromRangeList( const ScRangeList& rList, bool bReset );
 
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index defbef2..4907252 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -355,7 +355,7 @@ void ScMarkData::MarkFromRangeList( const ScRangeList& rList, bool bReset )
     }
 }
 
-void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const
+void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, bool bClear, SCTAB nForTab ) const
 {
     if (!pList)
         return;
@@ -367,7 +367,7 @@ void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const
 
     if ( bMultiMarked )
     {
-        SCTAB nTab = aMultiRange.aStart.Tab();
+        SCTAB nTab = (nForTab < 0 ? aMultiRange.aStart.Tab() : nForTab);
 
         SCCOL nStartCol = aMultiRange.aStart.Col();
         SCCOL nEndCol = aMultiRange.aEnd.Col();
@@ -402,7 +402,17 @@ void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const
     }
 
     if ( bMarked )
-        pList->Append( aMarkRange );
+    {
+        if (nForTab < 0)
+            pList->Append( aMarkRange );
+        else
+        {
+            ScRange aRange( aMarkRange );
+            aRange.aStart.SetTab( nForTab );
+            aRange.aEnd.SetTab( nForTab );
+            pList->Append( aRange );
+        }
+    }
 }
 
 void ScMarkData::ExtendRangeListTables( ScRangeList* pList ) const
@@ -427,7 +437,14 @@ void ScMarkData::ExtendRangeListTables( ScRangeList* pList ) const
 ScRangeList ScMarkData::GetMarkedRanges() const
 {
     ScRangeList aRet;
-    FillRangeListWithMarks(&aRet, false);
+    FillRangeListWithMarks(&aRet, false, -1);
+    return aRet;
+}
+
+ScRangeList ScMarkData::GetMarkedRangesForTab( SCTAB nTab ) const
+{
+    ScRangeList aRet;
+    FillRangeListWithMarks(&aRet, false, nTab);
     return aRet;
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d0f4e09..5bf37f7 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3374,7 +3374,7 @@ sal_Int32 ScTable::GetMaxNumberStringLen(
 
 void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark )
 {
-    ScRangeList aRanges = rMark.GetMarkedRanges();
+    ScRangeList aRanges = rMark.GetMarkedRangesForTab( nTab );
     for (SCCOL nCol = 0; nCol <= MAXCOL && !rData.bError; ++nCol)
     {
         if (pColFlags && ColHidden(nCol))
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 9322520..b9c837c 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -287,6 +287,9 @@ void ScTabControl::Select()
     rBind.Invalidate( FID_TABLE_HIDE );
     rBind.Invalidate( FID_TAB_SET_TAB_BG_COLOR );
 
+    // Recalculate status bar functions.
+    rBind.Invalidate( SID_TABLE_CELL );
+
         // SetReference onlw when the consolidate dialog is open
         // (for referenzes over multiple sheets)
         // for others this is only needed fidgeting


More information about the Libreoffice-commits mailing list