summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-06-04 20:36:53 +0000
committerKurt Zenker <kz@openoffice.org>2009-06-04 20:36:53 +0000
commitadc000a73c3699f4d1d53ba7151eadd2ea5f8940 (patch)
tree62dafeef94488ac30450e312bdcce36c668a96cc /sc/source/ui
parent7470d7bd81ab783f5d46cfc8391a9b8c301d6aff (diff)
CWS-TOOLING: integrate CWS calclinkfixes
2009-04-27 11:47:56 +0200 nn r271258 : #i101273# Uno broadcasts in DoRecalc/DoHardRecalc 2009-04-24 17:20:19 +0200 nn r271226 : #i101304# don't load source file of external ref for empty cells in the cached data 2009-04-24 14:15:43 +0200 nn r271212 : #i101319# handle merged cells and row groups when loading cached data for external refs
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx8
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx31
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx8
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx10
5 files changed, 53 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index af68160ebae8..e360e93bae5d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -283,6 +283,7 @@ void ScDocShell::BeforeXMLLoading()
pModificator = new ScDocShellModificator( *this );
aDocument.SetImportingXML( TRUE );
+ aDocument.EnableExecuteLink( false ); // #i101304# to be safe, prevent nested loading from external references
aDocument.EnableUndo( FALSE );
// prevent unnecessary broadcasts and "half way listeners"
aDocument.SetInsertingFromOtherDoc( TRUE );
@@ -363,6 +364,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
aDocument.SetInsertingFromOtherDoc( FALSE );
aDocument.SetImportingXML( FALSE );
+ aDocument.EnableExecuteLink( true );
aDocument.EnableUndo( TRUE );
bIsEmpty = FALSE;
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 036efee976f7..f73389cb866f 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1267,6 +1267,8 @@ void ScDocShell::DoRecalc( BOOL bApi )
if ( pSh )
pSh->UpdateCharts(TRUE);
+ aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
// #47939# Wenn es Charts gibt, dann alles painten, damit nicht
// PostDataChanged und die Charts nacheinander kommen und Teile
// doppelt gepainted werden.
@@ -1292,6 +1294,12 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ )
GetDocFunc().DetectiveRefresh(); // erzeugt eigenes Undo
if ( pSh )
pSh->UpdateCharts(TRUE);
+
+ // CalcAll doesn't broadcast value changes, so SC_HINT_CALCALL is broadcasted globally
+ // in addition to SFX_HINT_DATACHANGED.
+ aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) );
+ aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
PostPaintGridAll();
}
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index d78aa6fe3d84..637093275bad 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -328,7 +328,7 @@ const String* ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const Str
ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow,
- bool bEmptyCellOnNull, sal_uInt32* pnFmtIndex)
+ bool bEmptyCellOnNull, bool bWriteEmpty, sal_uInt32* pnFmtIndex)
{
DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
if (itrDoc == maDocs.end())
@@ -355,12 +355,16 @@ ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
TokenRef pToken = pTableData->getCell(nCol, nRow, pnFmtIndex);
if (!pToken && bEmptyCellOnNull)
+ {
pToken.reset(new ScEmptyCellToken(false, false));
+ if (bWriteEmpty)
+ pTableData->setCell(nCol, nRow, pToken);
+ }
return pToken;
}
ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
- sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull)
+ sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull, bool bWriteEmpty)
{
DocDataType::iterator itrDoc = maDocs.find(nFileId);
if (itrDoc == maDocs.end())
@@ -413,7 +417,11 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
if (!pToken)
{
if (bEmptyCellOnNull)
+ {
pToken.reset(new ScEmptyCellToken(false, false));
+ if (bWriteEmpty)
+ pTab->setCell(nCol, nRow, pToken);
+ }
else
return TokenArrayRef();
}
@@ -1504,10 +1512,18 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
if (pFmt)
pFmt->mbIsSet = false;
+ bool bLoading = mpDoc->IsImportingXML();
+
// Check if the given table name and the cell position is cached.
+ // #i101304# When loading a file, the saved cache (hidden sheet)
+ // is assumed to contain all data for the loaded formulas.
+ // No cache entries are created from empty cells in the saved sheet,
+ // so they have to be created here (bWriteEmpty parameter).
+ // Otherwise, later interpretation of the loaded formulas would
+ // load the source document even if the user didn't want to update.
sal_uInt32 nFmtIndex = 0;
ScExternalRefCache::TokenRef pToken = maRefCache.getCellData(
- nFileId, rTabName, rCell.Col(), rCell.Row(), false, &nFmtIndex);
+ nFileId, rTabName, rCell.Col(), rCell.Row(), bLoading, bLoading, &nFmtIndex);
if (pToken)
{
if (pFmt)
@@ -1531,7 +1547,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
// once again, but this time treat a non-cached cell as an empty cell
// as long as the table itself is cached.
pToken = maRefCache.getCellData(
- nFileId, rTabName, rCell.Col(), rCell.Row(), true, &nFmtIndex);
+ nFileId, rTabName, rCell.Col(), rCell.Row(), true, false, &nFmtIndex);
return pToken;
}
@@ -1580,8 +1596,11 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_u
maybeLinkExternalFile(nFileId);
+ bool bLoading = mpDoc->IsImportingXML();
+
// Check if the given table name and the cell position is cached.
- ScExternalRefCache::TokenArrayRef p = maRefCache.getCellRangeData(nFileId, rTabName, rRange, false);
+ // #i101304# When loading, put empty cells into cache, see getSingleRefToken.
+ ScExternalRefCache::TokenArrayRef p = maRefCache.getCellRangeData(nFileId, rTabName, rRange, bLoading, bLoading);
if (p.get())
return p;
@@ -1591,7 +1610,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_u
// Source document is not reachable. Try to get data from the cache
// once again, but this time treat non-cached cells as empty cells as
// long as the table itself is cached.
- return maRefCache.getCellRangeData(nFileId, rTabName, rRange, true);
+ return maRefCache.getCellRangeData(nFileId, rTabName, rRange, true, false);
}
SCTAB nTab1;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 17c10f63319e..c73f56dc55a4 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1572,6 +1572,14 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
bGotDataChangedHint = FALSE;
}
}
+ else if ( nId == SC_HINT_CALCALL )
+ {
+ // broadcast from DoHardRecalc - set bGotDataChangedHint
+ // (SFX_HINT_DATACHANGED follows separately)
+
+ if ( aValueListeners.Count() )
+ bGotDataChangedHint = TRUE;
+ }
}
else if ( rHint.ISA( ScUnoRefUndoHint ) )
{
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index fbdf0706bf78..083dfc3f9374 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2931,8 +2931,10 @@ void ScChart2DataSequence::BuildDataCache()
break;
if (pFCell->HasValueData())
+ {
rItem.mfValue = pFCell->GetValue();
rItem.mbIsValue = true;
+ }
}
break;
#if DBG_UTIL
@@ -3163,6 +3165,14 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
m_bGotDataChangedHint = false;
}
}
+ else if ( nId == SC_HINT_CALCALL )
+ {
+ // broadcast from DoHardRecalc - set m_bGotDataChangedHint
+ // (SFX_HINT_DATACHANGED follows separately)
+
+ if ( m_aValueListeners.Count() )
+ m_bGotDataChangedHint = true;
+ }
}
else if ( rHint.ISA( ScUpdateRefHint ) )
{