[Libreoffice-commits] .: sc/inc sc/source
Joseph Powers
jpowers at kemper.freedesktop.org
Thu Dec 2 20:00:36 PST 2010
sc/inc/document.hxx | 3 ++-
sc/source/core/data/cell.cxx | 2 +-
sc/source/core/data/document.cxx | 25 +++++++++++++++----------
sc/source/core/tool/interpr4.cxx | 33 +++++++++++++++++++++------------
4 files changed, 39 insertions(+), 24 deletions(-)
New commits:
commit a8caaa5b0db0e4a5dac31d7be918e44b81e07c81
Author: Joseph Powers <jpowers27 at cox.net>
Date: Thu Dec 2 19:56:32 2010 -0800
Fix "Remove DECLARE_LIST() from class ScDocument"
Fixes some issues with commit 95b419dfeea83549ed021d9b1ccc0da0649779ab.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 7b7785a..c9bc655 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -47,6 +47,7 @@
#include <map>
#include <set>
#include <list>
+#include <boost/ptr_container/ptr_vector.hpp>
class KeyEvent;
class OutputDevice;
@@ -315,7 +316,7 @@ private:
mxVbaEvents;
public:
- ScInterpreterTableOpParams* aTableOpList; // ScInterpreterTableOpParams currently in use
+ boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use
ScInterpreterTableOpParams aLastTableOpParams; // remember last params
private:
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 7405666..d437593 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a4df4d0..5b2a821 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3081,23 +3081,28 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges )
}
}
+
void ScDocument::AddTableOpFormulaCell( ScFormulaCell* pCell )
{
- ScInterpreterTableOpParams* p = aTableOpList;
- if ( p && p->bCollectNotifications )
+ if ( !aTableOpList.empty() )
{
- if ( p->bRefresh )
- { // refresh pointers only
- p->aNotifiedFormulaCells.push_back( pCell );
- }
- else
- { // init both, address and pointer
- p->aNotifiedFormulaCells.push_back( pCell );
- p->aNotifiedFormulaPos.push_back( pCell->aPos );
+ ScInterpreterTableOpParams* p = &aTableOpList.back();
+ if ( p->bCollectNotifications )
+ {
+ if ( p->bRefresh )
+ { // refresh pointers only
+ p->aNotifiedFormulaCells.push_back( pCell );
+ }
+ else
+ { // init both, address and pointer
+ p->aNotifiedFormulaCells.push_back( pCell );
+ p->aNotifiedFormulaPos.push_back( pCell->aPos );
+ }
}
}
}
+
void ScDocument::CalcAll()
{
ClearLookupCaches(); // Ensure we don't deliver zombie data.
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 84e4986..5ffc89f 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -97,19 +97,23 @@ using ::std::auto_ptr;
// Funktionen fuer den Zugriff auf das Document
//-------------------------------------------------------------------------
+
void ScInterpreter::ReplaceCell( ScAddress& rPos )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" );
- ScInterpreterTableOpParams* pTOp = pDok->aTableOpList;
- if ( pTOp )
+ size_t ListSize = pDok->aTableOpList.size();
+ for ( size_t i = 0; i < ListSize; ++i )
{
+ ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
if ( rPos == pTOp->aOld1 )
{
rPos = pTOp->aNew1;
+ return ;
}
else if ( rPos == pTOp->aOld2 )
{
rPos = pTOp->aNew2;
+ return ;
}
}
}
@@ -119,24 +123,28 @@ void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" );
ScAddress aCellPos( rCol, rRow, rTab );
- ScInterpreterTableOpParams* pTOp = pDok->aTableOpList;
- if ( pTOp )
+ size_t ListSize = pDok->aTableOpList.size();
+ for ( size_t i = 0; i < ListSize; ++i )
{
+ ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
if ( aCellPos == pTOp->aOld1 )
{
rCol = pTOp->aNew1.Col();
rRow = pTOp->aNew1.Row();
rTab = pTOp->aNew1.Tab();
+ return ;
}
else if ( aCellPos == pTOp->aOld2 )
{
rCol = pTOp->aNew2.Col();
rRow = pTOp->aNew2.Row();
rTab = pTOp->aNew2.Tab();
+ return ;
}
}
}
+
BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsTableOpInRange" );
@@ -144,9 +152,10 @@ BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange )
return FALSE; // not considered to be a range in TableOp sense
// we can't replace a single cell in a range
- ScInterpreterTableOpParams* pTOp = pDok->aTableOpList;
- if ( pTOp )
+ size_t ListSize = pDok->aTableOpList.size();
+ for ( size_t i = 0; i < ListSize; ++i )
{
+ ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
if ( rRange.In( pTOp->aOld1 ) )
return TRUE;
if ( rRange.In( pTOp->aOld2 ) )
@@ -1172,7 +1181,7 @@ void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab)
break;
case svSingleRef:
SingleRefToVars( static_cast<ScToken*>(p)->GetSingleRef(), rCol, rRow, rTab);
- if ( pDok->aTableOpList )
+ if ( !pDok->aTableOpList.empty() )
ReplaceCell( rCol, rRow, rTab );
break;
default:
@@ -1203,7 +1212,7 @@ void ScInterpreter::PopSingleRef( ScAddress& rAdr )
SCTAB nTab;
SingleRefToVars( static_cast<ScToken*>(p)->GetSingleRef(), nCol, nRow, nTab);
rAdr.Set( nCol, nRow, nTab );
- if ( pDok->aTableOpList )
+ if ( !pDok->aTableOpList.empty() )
ReplaceCell( rAdr );
}
break;
@@ -1225,7 +1234,7 @@ void ScInterpreter::DoubleRefToVars( const ScToken* p,
const ScComplexRefData& rCRef = p->GetDoubleRef();
SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1);
SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2);
- if ( pDok->aTableOpList && !bDontCheckForTableOp )
+ if ( !pDok->aTableOpList.empty() > 0 && !bDontCheckForTableOp )
{
ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 );
if ( IsTableOpInRange( aRange ) )
@@ -1310,7 +1319,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef,
rRange.aStart.Set( nCol, nRow, nTab );
SingleRefToVars( rCRef.Ref2, nCol, nRow, nTab);
rRange.aEnd.Set( nCol, nRow, nTab );
- if ( pDok->aTableOpList && !bDontCheckForTableOp )
+ if (! pDok->aTableOpList.empty() > 0 && !bDontCheckForTableOp )
{
if ( IsTableOpInRange( rRange ) )
SetError( errIllegalParameter );
@@ -3359,7 +3368,7 @@ void ScInterpreter::ScTableOp()
PopSingleRef( pTableOp->aFormulaPos );
pTableOp->bValid = TRUE;
- pDok->aTableOpList = pTableOp;
+ pDok->aTableOpList.push_back( pTableOp );
pDok->IncInterpreterTableOpLevel();
BOOL bReuseLastParams = (pDok->aLastTableOpParams == *pTableOp);
@@ -3396,8 +3405,8 @@ void ScInterpreter::ScTableOp()
GetCellString( aCellString, pFCell );
PushString( aCellString );
}
- pDok->aTableOpList = NULL;
+ pTableOp = pDok->aTableOpList.release( pDok->aTableOpList.end() ).release();
// set dirty again once more to be able to recalculate original
for ( ::std::vector< ScFormulaCell* >::const_iterator iBroadcast(
pTableOp->aNotifiedFormulaCells.begin() );
More information about the Libreoffice-commits
mailing list