diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-11-01 14:45:53 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-11-01 14:45:53 +0100 |
commit | f79522f0366fc57aba70cc134749836be0f714ea (patch) | |
tree | bf8f4ad00d632d0450252364659527388b14c739 /sc/source/core/data | |
parent | 956a6b2d748327d8252caa9ca64d31cd307b411a (diff) | |
parent | 17afeb05f38050f8e93b59279e67a0860b2b760b (diff) |
merge commit for DEV300_m63
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/bcaslot.cxx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index ac15d611d..f18c0476b 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) { |