summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-03 23:20:44 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-11-05 18:13:36 +0000
commit0a296eee23380275ec7bad1dff8d81b75d98429f (patch)
treead48afefa9d4522d4b6776e6d960d4df133942de
parent92d0b2bc79033e8f2cd70c298ad746b38b4eea03 (diff)
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@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/inc/markdata.hxx13
-rw-r--r--sc/source/core/data/markdata.cxx25
-rw-r--r--sc/source/core/data/table3.cxx2
-rw-r--r--sc/source/ui/view/tabcont.cxx3
4 files changed, 37 insertions, 6 deletions
diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx
index 60c04d076bb8..d11173c301fd 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 defbef2778e5..49072528411a 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 d0f4e099e521..5bf37f7d62c4 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 9322520e1607..b9c837c400c2 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