summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-02 14:22:23 +0100
committerEike Rathke <erack@redhat.com>2014-12-02 15:37:06 +0100
commit7e12f98fc05c6828ca0823cbaf45670073778c8a (patch)
tree677f87b7764b5f12fbb7932c8b0904ad25808b17
parent4c254a6d2532460351180c071fabf44129e8885d (diff)
fdo#86762 broadcast also empty cells after sort
Change-Id: Ie275a754c530d6039ed14304900dd71416f36e46 (cherry picked from commit 08793e08c7e9cefe594c49130f782725e386c463)
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/column.cxx19
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx2
7 files changed, 25 insertions, 10 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 7f883a63ed76..bfe3fb84b42d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -361,7 +361,7 @@ public:
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
- void SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast = true );
+ void SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast = true, bool bIncludeEmptyCells = false );
void SetDirtyVar();
void SetDirtyAfterLoad();
void SetTableOpDirty( const ScRange& );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 31fde4db04c5..afa215d3fc9f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1012,7 +1012,7 @@ public:
void ResetChanged( const ScRange& rRange );
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
- void SetDirty( const ScRange& );
+ void SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
void InterpretDirtyCells( const ScRangeList& rRanges );
SC_DLLPUBLIC void CalcAll();
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index df3372ecef3f..78ca0d82aba1 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -532,7 +532,7 @@ public:
void ResetChanged( const ScRange& rRange );
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
- void SetDirty( const ScRange& );
+ void SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
void SetDirtyAfterLoad();
void SetDirtyVar();
void SetTableOpDirty( const ScRange& );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index d9532307409e..5185c3aa450f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3055,7 +3055,7 @@ void ScColumn::SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rB
aHdl.fillBroadcastSpans(rBroadcastSpans);
}
-void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast )
+void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast, bool bIncludeEmptyCells )
{
// broadcasts everything within the range, with FormulaTracking
sc::AutoCalcSwitch aSwitch(*pDocument, false);
@@ -3063,7 +3063,22 @@ void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bBroadcast )
SetDirtyOnRangeHandler aHdl(*this);
sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aHdl, aHdl);
if (bBroadcast)
- aHdl.broadcast();
+ {
+ if (bIncludeEmptyCells)
+ {
+ // Broadcast the changes.
+ ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, 0, nTab));
+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+ {
+ aHint.GetAddress().SetRow(nRow);
+ pDocument->Broadcast(aHint);
+ }
+ }
+ else
+ {
+ aHdl.broadcast();
+ }
+ }
}
void ScColumn::SetTableOpDirty( const ScRange& rRange )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 660b39469133..820870bf4242 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3618,7 +3618,7 @@ void ScDocument::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
SetAutoCalc( bOldAutoCalc );
}
-void ScDocument::SetDirty( const ScRange& rRange )
+void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
{
bool bOldAutoCalc = GetAutoCalc();
bAutoCalc = false; // keine Mehrfachberechnung
@@ -3626,7 +3626,7 @@ void ScDocument::SetDirty( const ScRange& rRange )
ScBulkBroadcast aBulkBroadcast( GetBASM());
SCTAB nTab2 = rRange.aEnd.Tab();
for (SCTAB i=rRange.aStart.Tab(); i<=nTab2 && i < static_cast<SCTAB>(maTabs.size()); i++)
- if (maTabs[i]) maTabs[i]->SetDirty( rRange );
+ if (maTabs[i]) maTabs[i]->SetDirty( rRange, bIncludeEmptyCells );
}
SetAutoCalc( bOldAutoCalc );
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 608ec13014a4..fad5443badce 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1684,13 +1684,13 @@ void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
aCol[i].SetAllFormulasDirty(rCxt);
}
-void ScTable::SetDirty( const ScRange& rRange )
+void ScTable::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
{
bool bOldAutoCalc = pDocument->GetAutoCalc();
pDocument->SetAutoCalc( false ); // Mehrfachberechnungen vermeiden
SCCOL nCol2 = rRange.aEnd.Col();
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
- aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row());
+ aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), true, bIncludeEmptyCells);
pDocument->SetAutoCalc( bOldAutoCalc );
}
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index bed565a34524..72a11a3d243d 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -571,7 +571,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScRange aDirtyRange(
aLocalParam.nCol1, nStartRow, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab);
- rDoc.SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange, true );
if (bPaint)
{