diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-27 19:43:08 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-27 19:44:31 -0500 |
commit | be877a9fafc799e6d21f56f3b0b727b344a37eaf (patch) | |
tree | b9cfbd841b63c07c2c6aaf167b49d605e8cc1602 | |
parent | 0fb33f60ac08c853f14d19e6158994d092a82670 (diff) |
Clear column data array cache when the document content changes.
Change-Id: I09ffa455e79199e37ca6168753ec9ef4d5aa33dc
-rw-r--r-- | sc/inc/document.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 14 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 1 |
4 files changed, 25 insertions, 0 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0546ef0d376e..e283b3d2f8c3 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2018,6 +2018,11 @@ public: formula::VectorRefArray FetchVectorRefArray( const ScAddress& rPos, SCROW nLength ); + /** + * Called whenever the value of a cell inside the document is modified. + */ + void CellContentModified(); + SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ); const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 8759c513210c..a39016abf8b2 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2862,6 +2862,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe rCell.ResetDirty(); rCell.SetChanged(true); } + + std::vector<SCROW> aRows; + aRows.reserve(nLen); + for (size_t i = 0; i < nLen; ++i) + aRows.push_back(nRow+i); + + BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen ) @@ -2888,6 +2895,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pR rCell.ResetDirty(); rCell.SetChanged(true); } + + std::vector<SCROW> aRows; + aRows.reserve(nLen); + for (size_t i = 0; i < nLen; ++i) + aRows.push_back(nRow+i); + + BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 931994a0a3fd..2fa2b0e5b781 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2313,6 +2313,11 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler() mpDoc->pFormatExchangeList = NULL; } +void ScDocument::CellContentModified() +{ + mpFormulaGroupCxt.reset(); +} + SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress& rPos ) { ScTable* pTab = FetchTable(rPos.Tab()); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 98b6be62473d..0760425ab6b0 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -3047,6 +3047,7 @@ ScDocShellModificator::~ScDocShellModificator() void ScDocShellModificator::SetDocumentModified() { ScDocument* pDoc = rDocShell.GetDocument(); + pDoc->CellContentModified(); if ( !pDoc->IsImportingXML() ) { // AutoCalcShellDisabled temporaer restaurieren |