[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Feb 4 12:34:32 PST 2014
sc/inc/column.hxx | 10 ++++----
sc/inc/formulacell.hxx | 6 ++--
sc/inc/rangenam.hxx | 15 +++++++-----
sc/inc/table.hxx | 10 ++++----
sc/inc/tokenstringcontext.hxx | 2 -
sc/source/core/data/column.cxx | 36 ++++++++++++++++-------------
sc/source/core/data/column2.cxx | 24 +++++++++++++------
sc/source/core/data/documen2.cxx | 4 ++-
sc/source/core/data/documen4.cxx | 10 ++++----
sc/source/core/data/document.cxx | 14 +++++++----
sc/source/core/data/formulacell.cxx | 14 +++++------
sc/source/core/data/table2.cxx | 15 ++++++------
sc/source/core/data/table4.cxx | 10 ++++----
sc/source/core/tool/rangenam.cxx | 11 ++++----
sc/source/core/tool/tokenstringcontext.cxx | 4 +--
15 files changed, 108 insertions(+), 77 deletions(-)
New commits:
commit 01a55d560509d9fb8027a330040510e767f895a2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Feb 4 15:36:35 2014 -0500
Cover all the other "compile all formula cells" methods.
Change-Id: I434aeb97a32d4b70846c7b3a7c701f90f43bad8a
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 3c8a641..ee73c3f 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -336,10 +336,10 @@ public:
void SetTableOpDirty( const ScRange& );
void CalcAll();
void CalcAfterLoad( sc::CompileFormulaContext& rCxt );
- void CompileAll();
- void CompileXML( ScProgress& rProgress );
+ void CompileAll( sc::CompileFormulaContext& rCxt );
+ void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
- bool CompileErrorCells(sal_uInt16 nErrCode);
+ bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode );
void ResetChanged( SCROW nStartRow, SCROW nEndRow );
@@ -462,10 +462,10 @@ public:
void SetDirtyIfPostponed();
void BroadcastRecalcOnRefMove();
- void CompileDBFormula();
+ void CompileDBFormula( sc::CompileFormulaContext& rCxt );
void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
void CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
- void CompileColRowNameFormula();
+ void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index bd4f128..e901c6e 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -229,7 +229,7 @@ public:
void CompileTokenArray( bool bNoListening = false );
void CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNoListening = false );
- void CompileXML( ScProgress& rProgress ); // compile temporary string tokens
+ void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens
void CalcAfterLoad( sc::CompileFormulaContext& rCxt );
bool MarkUsedExternalReferences();
void Interpret();
@@ -292,10 +292,10 @@ public:
bool IsRunning() const;
void SetRunning( bool bVal );
- void CompileDBFormula();
+ void CompileDBFormula( sc::CompileFormulaContext& rCxt );
void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
void CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
- void CompileColRowNameFormula();
+ void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
ScFormulaCell* GetPrevious() const;
ScFormulaCell* GetNext() const;
void SetPrevious( ScFormulaCell* pF );
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 6113709..5d4aebe 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -35,10 +35,13 @@ class ScDocument;
class ScTokenArray;
namespace sc {
- struct RefUpdateContext;
- struct RefUpdateInsertTabContext;
- struct RefUpdateDeleteTabContext;
- struct RefUpdateMoveTabContext;
+
+struct RefUpdateContext;
+struct RefUpdateInsertTabContext;
+struct RefUpdateDeleteTabContext;
+struct RefUpdateMoveTabContext;
+class CompileFormulaContext;
+
}
typedef sal_uInt16 RangeType;
@@ -151,7 +154,7 @@ public:
SCROW GetMaxRow() const;
SCCOL GetMaxCol() const;
- void CompileUnresolvedXML();
+ void CompileUnresolvedXML( sc::CompileFormulaContext& rCxt );
#if DEBUG_FORMULA_COMPILER
void Dump() const;
@@ -201,7 +204,7 @@ public:
/** Compile those names that couldn't be resolved during loading and
inserting because they may have referred a name that was inserted later.
*/
- void CompileUnresolvedXML();
+ void CompileUnresolvedXML( sc::CompileFormulaContext& rCxt );
SC_DLLPUBLIC const_iterator begin() const;
SC_DLLPUBLIC const_iterator end() const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 330ca2c..522fde8 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -521,10 +521,10 @@ public:
void SetTableOpDirty( const ScRange& );
void CalcAll();
void CalcAfterLoad( sc::CompileFormulaContext& rCxt );
- void CompileAll();
- void CompileXML( ScProgress& rProgress );
+ void CompileAll( sc::CompileFormulaContext& rCxt );
+ void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
- bool CompileErrorCells(sal_uInt16 nErrCode);
+ bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode );
void UpdateReference(
sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL,
@@ -1012,10 +1012,10 @@ private:
const ScMarkData& rMark) const;
bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
bool TestTabRefAbs(SCTAB nTable) const;
- void CompileDBFormula();
+ void CompileDBFormula( sc::CompileFormulaContext& rCxt );
void CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
void CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString );
- void CompileColRowNameFormula();
+ void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
void RebuildFormulaGroups();
void StartListening( const ScAddress& rAddress, SvtListener* pListener );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ba0e72d..e358588 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2836,24 +2836,30 @@ struct CalcAllHandler
}
};
-struct CompileAllHandler
+class CompileAllHandler
{
+ sc::CompileFormulaContext& mrCxt;
+public:
+ CompileAllHandler( sc::CompileFormulaContext& rCxt ) : mrCxt(rCxt) {}
+
void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
{
// for unconditional compilation
// bCompile=true and pCode->nError=0
pCell->GetCode()->SetCodeError(0);
pCell->SetCompile(true);
- pCell->CompileTokenArray();
+ pCell->CompileTokenArray(mrCxt);
}
};
class CompileXMLHandler
{
+ sc::CompileFormulaContext& mrCxt;
ScProgress& mrProgress;
const ScColumn& mrCol;
public:
- CompileXMLHandler(ScProgress& rProgress, const ScColumn& rCol) :
+ CompileXMLHandler( sc::CompileFormulaContext& rCxt, ScProgress& rProgress, const ScColumn& rCol) :
+ mrCxt(rCxt),
mrProgress(rProgress),
mrCol(rCol) {}
@@ -2865,23 +2871,24 @@ public:
else
pCell->SetDirtyVar();
- pCell->CompileXML(mrProgress);
+ pCell->CompileXML(mrCxt, mrProgress);
}
};
class CompileErrorCellsHandler
{
+ sc::CompileFormulaContext& mrCxt;
ScColumn& mrColumn;
sc::CellStoreType::iterator miPos;
sal_uInt16 mnErrCode;
FormulaGrammar::Grammar meGram;
bool mbCompiled;
public:
- CompileErrorCellsHandler(ScColumn& rColumn, sal_uInt16 nErrCode, FormulaGrammar::Grammar eGram) :
+ CompileErrorCellsHandler( sc::CompileFormulaContext& rCxt, ScColumn& rColumn, sal_uInt16 nErrCode ) :
+ mrCxt(rCxt),
mrColumn(rColumn),
miPos(mrColumn.GetCellStore().begin()),
mnErrCode(nErrCode),
- meGram(eGram),
mbCompiled(false)
{
}
@@ -2901,9 +2908,8 @@ public:
miPos = aPos.first;
sc::SharedFormulaUtil::unshareFormulaCell(aPos, *pCell);
pCell->GetCode()->SetCodeError(0);
- OUStringBuffer aBuf;
- pCell->GetFormula(aBuf, meGram);
- pCell->Compile(aBuf.makeStringAndClear(), false, meGram);
+ OUString aFormula = pCell->GetFormula(mrCxt);
+ pCell->Compile(mrCxt, aFormula, false);
mrColumn.JoinNewFormulaCell(aPos, *pCell);
mbCompiled = true;
@@ -3169,22 +3175,22 @@ void ScColumn::CalcAll()
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::CompileAll()
+void ScColumn::CompileAll( sc::CompileFormulaContext& rCxt )
{
- CompileAllHandler aFunc;
+ CompileAllHandler aFunc(rCxt);
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::CompileXML( ScProgress& rProgress )
+void ScColumn::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress )
{
- CompileXMLHandler aFunc(rProgress, *this);
+ CompileXMLHandler aFunc(rCxt, rProgress, *this);
sc::ProcessFormula(maCells, aFunc);
RegroupFormulaCells();
}
-bool ScColumn::CompileErrorCells(sal_uInt16 nErrCode)
+bool ScColumn::CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode )
{
- CompileErrorCellsHandler aHdl(*this, nErrCode, pDocument->GetGrammar());
+ CompileErrorCellsHandler aHdl(rCxt, *this, nErrCode);
sc::ProcessFormula(maCells, aHdl);
return aHdl.isCompiled();
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 2d69ae4..5a1e19d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -3194,11 +3194,17 @@ void ScColumn::EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListe
namespace {
-struct CompileDBFormulaHandler
+class CompileDBFormulaHandler
{
+ sc::CompileFormulaContext& mrCxt;
+
+public:
+ CompileDBFormulaHandler( sc::CompileFormulaContext& rCxt ) :
+ mrCxt(rCxt) {}
+
void operator() (size_t, ScFormulaCell* p)
{
- p->CompileDBFormula();
+ p->CompileDBFormula(mrCxt);
}
};
@@ -3234,17 +3240,21 @@ public:
struct CompileColRowNameFormulaHandler
{
+ sc::CompileFormulaContext& mrCxt;
+public:
+ CompileColRowNameFormulaHandler( sc::CompileFormulaContext& rCxt ) : mrCxt(rCxt) {}
+
void operator() (size_t, ScFormulaCell* p)
{
- p->CompileColRowNameFormula();
+ p->CompileColRowNameFormula(mrCxt);
}
};
}
-void ScColumn::CompileDBFormula()
+void ScColumn::CompileDBFormula( sc::CompileFormulaContext& rCxt )
{
- CompileDBFormulaHandler aFunc;
+ CompileDBFormulaHandler aFunc(rCxt);
sc::ProcessFormula(maCells, aFunc);
RegroupFormulaCells();
}
@@ -3262,9 +3272,9 @@ void ScColumn::CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bCreate
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::CompileColRowNameFormula()
+void ScColumn::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
{
- CompileColRowNameFormulaHandler aFunc;
+ CompileColRowNameFormulaHandler aFunc(rCxt);
sc::ProcessFormula(maCells, aFunc);
RegroupFormulaCells();
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 45ea69b..e1f6ab5 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -96,6 +96,7 @@
#include "scopetools.hxx"
#include "formulagroup.hxx"
#include "documentlinkmgr.hxx"
+#include <tokenstringcontext.hxx>
using namespace com::sun::star;
@@ -1002,7 +1003,8 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
// Readjust self-contained absolute references to this sheet
maTabs[nDestPos]->TestTabRefAbs(nSrcPos);
- maTabs[nDestPos]->CompileAll();
+ sc::CompileFormulaContext aFormulaCxt(this);
+ maTabs[nDestPos]->CompileAll(aFormulaCxt);
}
SetNoListening( false );
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 67327f9..1087b3f 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -539,11 +539,12 @@ bool ScDocument::ReplaceStyle(const SvxSearchItem& rSearchItem,
void ScDocument::CompileDBFormula()
{
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
{
if (*it)
- (*it)->CompileDBFormula();
+ (*it)->CompileDBFormula(aCxt);
}
}
@@ -571,11 +572,12 @@ void ScDocument::CompileNameFormula( bool bCreateFormulaString )
void ScDocument::CompileColRowNameFormula()
{
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
{
if (*it)
- (*it)->CompileColRowNameFormula();
+ (*it)->CompileColRowNameFormula(aCxt);
}
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 4b8f9d3..1fb89cc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3698,10 +3698,11 @@ void ScDocument::CalcAll()
void ScDocument::CompileAll()
{
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin();
for (; it != maTabs.end(); ++it)
if (*it)
- (*it)->CompileAll();
+ (*it)->CompileAll(aCxt);
SetDirty();
}
@@ -3713,17 +3714,19 @@ void ScDocument::CompileXML()
ScProgress aProgress( GetDocumentShell(), ScGlobal::GetRscString(
STR_PROGRESS_CALCULATING ), GetXMLImportedFormulaCount() );
+ sc::CompileFormulaContext aCxt(this);
+
// set AutoNameCache to speed up automatic name lookup
OSL_ENSURE( !pAutoNameCache, "AutoNameCache already set" );
pAutoNameCache = new ScAutoNameCache( this );
if (pRangeName)
- pRangeName->CompileUnresolvedXML();
+ pRangeName->CompileUnresolvedXML(aCxt);
TableContainer::iterator it = maTabs.begin();
for (; it != maTabs.end(); ++it)
if (*it)
- (*it)->CompileXML( aProgress );
+ (*it)->CompileXML(aCxt, aProgress);
DELETEZ( pAutoNameCache ); // valid only during CompileXML, where cell contents don't change
@@ -3736,6 +3739,7 @@ void ScDocument::CompileXML()
bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode)
{
bool bCompiled = false;
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
for (; it != itEnd; ++it)
{
@@ -3743,7 +3747,7 @@ bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode)
if (!pTab)
continue;
- if (pTab->CompileErrorCells(nErrCode))
+ if (pTab->CompileErrorCells(aCxt, nErrCode))
bCompiled = true;
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 939b6f8..a1e9ec1 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1111,7 +1111,7 @@ void ScFormulaCell::CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNo
}
}
-void ScFormulaCell::CompileXML( ScProgress& rProgress )
+void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress )
{
if ( cMatrixFlag == MM_REFERENCE )
{ // is already token code via ScDocFunc::EnterMatrix, ScDocument::InsertMatrixFormula
@@ -1125,8 +1125,8 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress )
bool bWasInFormulaTree = pDocument->IsInFormulaTree( this);
if (bWasInFormulaTree)
pDocument->RemoveFromFormulaTree( this);
- ScCompiler aComp( pDocument, aPos, *pCode);
- aComp.SetGrammar(eTempGrammar);
+ rCxt.setGrammar(eTempGrammar);
+ ScCompiler aComp(rCxt, aPos, *pCode);
OUString aFormula, aFormulaNmsp;
aComp.CreateStringFromXMLTokenArray( aFormula, aFormulaNmsp );
pDocument->DecXMLImportedFormulaCount( aFormula.getLength() );
@@ -3342,7 +3342,7 @@ void ScFormulaCell::SetRunning( bool bVal )
bRunning = bVal;
}
-void ScFormulaCell::CompileDBFormula()
+void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt )
{
for( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
{
@@ -3350,7 +3350,7 @@ void ScFormulaCell::CompileDBFormula()
|| (p->GetOpCode() == ocName && p->GetIndex() >= SC_START_INDEX_DB_COLL) )
{
bCompile = true;
- CompileTokenArray();
+ CompileTokenArray(rCxt);
SetDirty();
break;
}
@@ -3455,7 +3455,7 @@ void ScFormulaCell::CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bC
}
}
-void ScFormulaCell::CompileColRowNameFormula()
+void ScFormulaCell::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
{
pCode->Reset();
for ( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
@@ -3463,7 +3463,7 @@ void ScFormulaCell::CompileColRowNameFormula()
if ( p->GetOpCode() == ocColRowName )
{
bCompile = true;
- CompileTokenArray();
+ CompileTokenArray(rCxt);
SetDirty();
break;
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index eb11a5d..d566e91 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1731,35 +1731,36 @@ void ScTable::CalcAll()
}
-void ScTable::CompileAll()
+void ScTable::CompileAll( sc::CompileFormulaContext& rCxt )
{
- for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].CompileAll();
+ for (SCCOL i = 0; i <= MAXCOL; ++i)
+ aCol[i].CompileAll(rCxt);
if(mpCondFormatList)
mpCondFormatList->CompileAll();
}
-void ScTable::CompileXML( ScProgress& rProgress )
+void ScTable::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress )
{
if (mpRangeName)
- mpRangeName->CompileUnresolvedXML();
+ mpRangeName->CompileUnresolvedXML(rCxt);
for (SCCOL i=0; i <= MAXCOL; i++)
{
- aCol[i].CompileXML( rProgress );
+ aCol[i].CompileXML(rCxt, rProgress);
}
if(mpCondFormatList)
mpCondFormatList->CompileXML();
}
-bool ScTable::CompileErrorCells(sal_uInt16 nErrCode)
+bool ScTable::CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode )
{
bool bCompiled = false;
for (SCCOL i = 0; i <= MAXCOL; ++i)
{
- if (aCol[i].CompileErrorCells(nErrCode))
+ if (aCol[i].CompileErrorCells(rCxt, nErrCode))
bCompiled = true;
}
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 610103e..d37620a 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -2176,9 +2176,10 @@ bool ScTable::TestTabRefAbs(SCTAB nTable) const
return false;
}
-void ScTable::CompileDBFormula()
+void ScTable::CompileDBFormula( sc::CompileFormulaContext& rCxt )
{
- for (SCCOL i=0; i<=MAXCOL; i++) aCol[i].CompileDBFormula();
+ for (SCCOL i = 0; i <= MAXCOL; ++i)
+ aCol[i].CompileDBFormula(rCxt);
}
void ScTable::CompileDBFormula( sc::CompileFormulaContext& rCxt, bool bCreateFormulaString )
@@ -2193,9 +2194,10 @@ void ScTable::CompileNameFormula( sc::CompileFormulaContext& rCxt, bool bCreateF
aCol[i].CompileNameFormula(rCxt, bCreateFormulaString);
}
-void ScTable::CompileColRowNameFormula()
+void ScTable::CompileColRowNameFormula( sc::CompileFormulaContext& rCxt )
{
- for (SCCOL i=0; i<=MAXCOL; i++) aCol[i].CompileColRowNameFormula();
+ for (SCCOL i = 0; i <= MAXCOL; ++i)
+ aCol[i].CompileColRowNameFormula(rCxt);
}
SCSIZE ScTable::GetPatternCount( SCCOL nCol ) const
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index d5b576f..2c82e85 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -34,6 +34,7 @@
#include "refupdat.hxx"
#include "document.hxx"
#include "refupdatecontext.hxx"
+#include <tokenstringcontext.hxx>
#include "formula/errorcodes.hxx"
@@ -181,14 +182,14 @@ void ScRangeData::CompileRangeData( const OUString& rSymbol, bool bSetError )
}
}
-void ScRangeData::CompileUnresolvedXML()
+void ScRangeData::CompileUnresolvedXML( sc::CompileFormulaContext& rCxt )
{
if (pCode->GetCodeError() == errNoName)
{
// Reconstruct the symbol/formula and then recompile.
OUString aSymbol;
- ScCompiler aComp( pDoc, aPos, *pCode);
- aComp.SetGrammar( eTempGrammar);
+ rCxt.setGrammar(eTempGrammar);
+ ScCompiler aComp(rCxt, aPos, *pCode);
aComp.CreateStringFromTokenArray( aSymbol);
// Don't let the compiler set an error for unknown names on final
// compile, errors are handled by the interpreter thereafter.
@@ -764,11 +765,11 @@ void ScRangeName::UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY)
itr->second->UpdateGrow(rArea, nGrowX, nGrowY);
}
-void ScRangeName::CompileUnresolvedXML()
+void ScRangeName::CompileUnresolvedXML( sc::CompileFormulaContext& rCxt )
{
DataType::iterator itr = maData.begin(), itrEnd = maData.end();
for (; itr != itrEnd; ++itr)
- itr->second->CompileUnresolvedXML();
+ itr->second->CompileUnresolvedXML(rCxt);
}
ScRangeName::const_iterator ScRangeName::begin() const
commit b2f55245376ef4da079d4d2336c1bef701894009
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Feb 4 14:27:51 2014 -0500
We can infer current grammar from the document.
Change-Id: Ia44bc612e9128adfc9be0d44ea8368215de950ba
diff --git a/sc/inc/tokenstringcontext.hxx b/sc/inc/tokenstringcontext.hxx
index af97d99..3740f60 100644
--- a/sc/inc/tokenstringcontext.hxx
+++ b/sc/inc/tokenstringcontext.hxx
@@ -55,7 +55,7 @@ class CompileFormulaContext
void updateTabNames();
public:
- CompileFormulaContext( ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram );
+ CompileFormulaContext( ScDocument* pDoc );
formula::FormulaGrammar::Grammar getGrammar() const;
void setGrammar( formula::FormulaGrammar::Grammar eGram );
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 64c8718..67327f9 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -549,7 +549,7 @@ void ScDocument::CompileDBFormula()
void ScDocument::CompileDBFormula( bool bCreateFormulaString )
{
- sc::CompileFormulaContext aCxt(this, eGrammar);
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
{
@@ -560,7 +560,7 @@ void ScDocument::CompileDBFormula( bool bCreateFormulaString )
void ScDocument::CompileNameFormula( bool bCreateFormulaString )
{
- sc::CompileFormulaContext aCxt(this, eGrammar);
+ sc::CompileFormulaContext aCxt(this);
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
{
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1ad8620..4b8f9d3 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3756,7 +3756,7 @@ void ScDocument::CalcAfterLoad()
return; // dann wird erst beim Einfuegen in das richtige Doc berechnet
bCalcingAfterLoad = true;
- sc::CompileFormulaContext aCxt(this, eGrammar);
+ sc::CompileFormulaContext aCxt(this);
{
TableContainer::iterator it = maTabs.begin();
for (; it != maTabs.end(); ++it)
diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx
index 96865fc..203d36a 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -105,8 +105,8 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
}
}
-CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram ) :
- mpDoc(pDoc), meGram(eGram)
+CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc ) :
+ mpDoc(pDoc), meGram(pDoc->GetGrammar())
{
if (!pDoc)
return;
More information about the Libreoffice-commits
mailing list