summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-10-21 13:32:17 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-10-21 13:32:17 +0000
commit61dec8ceed38588d3a2d2d5a91e501791b2e73c7 (patch)
treef94f40c20e2add521393a7a8e25650dd15878f2f /sc
parent458b43715fe289804a0bd8889e8709a72a8ac90e (diff)
CWS-TOOLING: integrate CWS calc32stopper3
2009-10-12 14:26:09 +0200 er r276833 : disable dump again 2009-10-12 13:46:57 +0200 er r276832 : #i102294# setValue: yet another DST glitch 2009-10-12 13:21:48 +0200 iha r276828 : #i105767# Y axis vanishes in case of zero rotated axis title 2009-10-08 01:49:20 +0200 er r276772 : NextSymbol: actually do reset ODF reference detection on file/sheet separator 2009-10-08 00:18:58 +0200 er r276771 : #i101639# use TabIDs in cached RangeArrays, not RefData Tabs 2009-10-07 19:25:47 +0200 er r276767 : #i105200# UpdateBroadcastAreas: hash key changes, remove area from all slots and reinsert 2009-10-05 17:20:44 +0200 er r276690 : #i105365# SI prefixes for ang, ang3, m/h, m/hr 2009-10-05 16:21:29 +0200 er r276686 : #i105161 intersection has higher precedence than union
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/bcaslot.cxx59
-rw-r--r--sc/source/core/inc/bcaslot.hxx1
-rw-r--r--sc/source/core/tool/compiler.cxx34
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx22
4 files changed, 94 insertions, 22 deletions
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 85f8a4921242..d3d86be58440 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -353,6 +353,21 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
}
+void ScBroadcastAreaSlot::UpdateRemoveArea( ScBroadcastArea* pArea )
+{
+ ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.find( pArea));
+ if (aIter == aBroadcastAreaTbl.end())
+ return;
+ if (*aIter != pArea)
+ DBG_ERRORFILE( "UpdateRemoveArea: area pointer mismatch");
+ else
+ {
+ aBroadcastAreaTbl.erase( aIter);
+ pArea->DecRef();
+ }
+}
+
+
void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea )
{
::std::pair< ScBroadcastAreas::iterator, bool > aPair =
@@ -732,6 +747,50 @@ void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas(
}
}
+ // Updating an area's range will modify the hash key, remove areas from all
+ // affected slots. Will be reinserted later with the updated range.
+ ScBroadcastArea* pChain = pUpdateChain;
+ while (pChain)
+ {
+ ScBroadcastArea* pArea = pChain;
+ pChain = pArea->GetUpdateChainNext();
+ ScRange aRange( pArea->GetRange());
+ // remove from slots
+ for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab() && pArea->GetRef(); ++nTab)
+ {
+ TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+ if (iTab == aTableSlotsMap.end())
+ {
+ DBG_ERRORFILE( "UpdateBroadcastAreas: Where's the TableSlot?!?");
+ continue; // for
+ }
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ while ( nOff <= nEnd && pArea->GetRef() )
+ {
+ if (*pp)
+ (*pp)->UpdateRemoveArea( pArea);
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
+ }
+ }
+
+ }
+
// shift sheets
if (nDz)
{
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index ef2f77b55684..79335a35fa7e 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -192,6 +192,7 @@ public:
void UpdateRemove( UpdateRefMode eUpdateRefMode,
const ScRange& rRange,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ void UpdateRemoveArea( ScBroadcastArea* pArea );
void UpdateInsert( ScBroadcastArea* pArea );
};
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a8ca4be2b5b6..df7131397aef 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2278,14 +2278,16 @@ Label_MaskStateMachine:
static const int kQuote = (1 << 4);
// Past ' closing quote.
static const int kClose = (1 << 5);
+ // Encountered # file/sheet separator.
+ static const int kFileSep = (1 << 6);
// Past . sheet name separator.
- static const int kPast = (1 << 6);
+ static const int kPast = (1 << 7);
// Marked name $$ follows sheet name separator, detected
// while we're still on the separator. Will be cleared when
// entering the name.
- static const int kMarkAhead = (1 << 7);
+ static const int kMarkAhead = (1 << 8);
// In marked defined name.
- static const int kDefName = (1 << 8);
+ static const int kDefName = (1 << 9);
bool bAddToSymbol = true;
if ((nMask & SC_COMPILER_C_ODF_RBRACKET) && !(nRefInName & kOpen))
@@ -2309,7 +2311,9 @@ Label_MaskStateMachine:
{
// Not in col/row yet.
- if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
+ if (SC_COMPILER_FILE_TAB_SEP == c && (nRefInName & kFileSep))
+ nRefInName = 0;
+ else if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
{
nRefInName &= ~kMarkAhead;
if (!(nRefInName & kDefName))
@@ -2356,16 +2360,20 @@ Label_MaskStateMachine:
}
else
{
- if ('\'' == pSrc[0])
- {
- // escapes embedded quote
- nRefInName |= kQuote;
- }
- else
+ switch (pSrc[0])
{
- // quote not followed by quote => close
- nRefInName |= kClose;
- nRefInName &= ~kOpen;
+ case '\'':
+ // escapes embedded quote
+ nRefInName |= kQuote;
+ break;
+ case SC_COMPILER_FILE_TAB_SEP:
+ // sheet name should follow
+ nRefInName |= kFileSep;
+ // fallthru
+ default:
+ // quote not followed by quote => close
+ nRefInName |= kClose;
+ nRefInName &= ~kOpen;
}
bAddToSymbol = !(nRefInName & kDefName);
}
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 5cfc833be5dd..f74e8c519fb6 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -384,11 +384,6 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
return TokenArrayRef();
DocItem& rDoc = itrDoc->second;
- RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange);
- if (itrRange != rDoc.maRangeArrays.end())
- {
- return itrRange->second;
- }
TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(
ScGlobal::pCharClass->upper(rTabName));
@@ -410,6 +405,13 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
// not all tables are cached.
return TokenArrayRef();
+ ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+ RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange);
+ if (itrRange != rDoc.maRangeArrays.end())
+ {
+ return itrRange->second;
+ }
+
TokenArrayRef pArray(new ScTokenArray);
bool bFirstTab = true;
for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
@@ -462,7 +464,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
bFirstTab = false;
}
- rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+ rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
return pArray;
}
@@ -545,13 +547,13 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa
return;
}
- size_t nTab1 = itrTabName->second;
+ size_t nTabFirstId = itrTabName->second;
SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
{
- size_t i = nTab1 + ::std::distance(itrDataBeg, itrData);
+ size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData);
TableTypeRef& pTabData = rDoc.maTables[i];
if (!pTabData.get())
pTabData.reset(new Table);
@@ -575,7 +577,9 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa
}
}
- rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+ size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab();
+ ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+ rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
}
bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)