[ooo-build-commit] .: formula/inc formula/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Oct 5 15:17:07 PDT 2010
formula/inc/formula/token.hxx | 1 +
formula/inc/formula/tokenarray.hxx | 1 +
formula/source/core/api/FormulaCompiler.cxx | 6 +++---
formula/source/core/api/token.cxx | 22 ++++++++++++++++++++++
4 files changed, 27 insertions(+), 3 deletions(-)
New commits:
commit 8c2dbf6048cfe7f6e53f5953ede7e263e0d94ced
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Oct 5 18:11:52 2010 -0400
Ported calc-extref-interpreter-rework-*.diff from ooo-build.
Re-structured the interpreter code to handle external references with
ocPush, instead of ocExternalRef. This is necessary in order to
support shifting of references in the same way you can with internal
references.
In addition, this change allows re-using of document instances already
loaded when accessing external references that point to one of already
loaded documents. Previously, Calc would load the same document from
disk even when the document was already loaded.
(n#628876)
diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx
index be1b2f6..8b4f53a 100644
--- a/formula/inc/formula/token.hxx
+++ b/formula/inc/formula/token.hxx
@@ -113,6 +113,7 @@ public:
inline StackVar GetType() const { return eType; }
BOOL IsFunction() const; // pure functions, no operators
BOOL IsMatrixFunction() const; // if a function _always_ returns a Matrix
+ bool IsExternalRef() const;
BYTE GetParamCount() const;
inline void IncRef() const { nRefCnt++; }
inline void DecRef() const
diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx
index 54e8179..ff1cabb 100644
--- a/formula/inc/formula/tokenarray.hxx
+++ b/formula/inc/formula/tokenarray.hxx
@@ -125,6 +125,7 @@ public:
FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
FormulaToken* PrevRPN();
+ bool HasExternalRef() const;
BOOL HasOpCode( OpCode ) const;
BOOL HasOpCodeRPN( OpCode ) const;
/// Token of type svIndex or opcode ocColRowName
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 2cd662d..3c87ce3 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -881,7 +881,7 @@ BOOL FormulaCompiler::GetToken()
}
if( pToken->GetOpCode() == ocSubTotal )
glSubTotal = TRUE;
- else if ( pToken->GetOpCode() == ocExternalRef )
+ else if ( pToken->IsExternalRef() )
{
return HandleExternalReference(*pToken);
}
@@ -1175,7 +1175,7 @@ void FormulaCompiler::Factor()
bCorrected = TRUE;
}
}
- else if ( eOp == ocExternalRef )
+ else if ( pToken->IsExternalRef() )
{
PutCode(pToken);
eOp = NextToken();
@@ -1595,7 +1595,7 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuff
}
if( bNext )
{
- if (eOp == ocExternalRef)
+ if (t->IsExternalRef())
{
CreateStringFromExternal(rBuffer, pTokenP);
}
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index ccc7406..028197c 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -145,6 +145,18 @@ BOOL FormulaToken::IsMatrixFunction() const
return formula::FormulaCompiler::IsMatrixFunction(GetOpCode());
}
+bool FormulaToken::IsExternalRef() const
+{
+ switch (eType)
+ {
+ case svExternalSingleRef:
+ case svExternalDoubleRef:
+ case svExternalName:
+ return true;
+ }
+ return false;
+}
+
BOOL FormulaToken::operator==( const FormulaToken& rToken ) const
{
// don't compare reference count!
@@ -550,6 +562,16 @@ FormulaToken* FormulaTokenArray::PeekPrevNoSpaces()
return NULL;
}
+bool FormulaTokenArray::HasExternalRef() const
+{
+ for ( USHORT j=0; j < nLen; j++ )
+ {
+ if (pCode[j]->IsExternalRef())
+ return true;
+ }
+ return false;
+}
+
BOOL FormulaTokenArray::HasOpCode( OpCode eOp ) const
{
for ( USHORT j=0; j < nLen; j++ )
More information about the ooo-build-commit
mailing list