summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-03-03 17:55:55 +0100
committerEike Rathke <erack@redhat.com>2015-03-05 11:44:57 +0100
commit40a3cec85f91709e302c08626b59fee0381ef261 (patch)
tree05d72a03370ee99f6cb50bb84c9fcbccb1161a5b
parent8ee20e2691aa6f67c67d40c61a8cd1569458b5a8 (diff)
handle ocTableRef same as ocDBArea
Change-Id: Id64556850ef0d44db1ff4dedb41e0e1cb9735b76
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx9
-rw-r--r--formula/source/core/api/token.cxx3
-rw-r--r--sc/source/core/data/column4.cxx1
-rw-r--r--sc/source/core/data/formulacell.cxx5
-rw-r--r--sc/source/core/data/validat.cxx5
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rw-r--r--sc/source/core/tool/token.cxx3
7 files changed, 23 insertions, 7 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 37231a82686d..e0bed7fa03f9 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -359,6 +359,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
{ FormulaMapGroupSpecialOffset::SPACES , ocSpaces } ,
{ FormulaMapGroupSpecialOffset::MAT_REF , ocMatRef } ,
{ FormulaMapGroupSpecialOffset::DB_AREA , ocDBArea } ,
+ /* TODO: { FormulaMapGroupSpecialOffset::TABLE_REF , ocTableRef } , */
{ FormulaMapGroupSpecialOffset::MACRO , ocMacro } ,
{ FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName }
};
@@ -1109,6 +1110,10 @@ bool FormulaCompiler::GetToken()
{
return HandleDbData();
}
+ else if( mpToken->GetOpCode() == ocTableRef )
+ {
+ /* TODO: return HandleTableRef() */ ;
+ }
return true;
}
@@ -1123,9 +1128,9 @@ void FormulaCompiler::Factor()
OpCode eOp = mpToken->GetOpCode();
if( eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef ||
- eOp == ocDBArea
+ eOp == ocDBArea || eOp == ocTableRef
|| (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocDBArea)
- || (eOp == ocColRowName) || (eOp == ocBad)))
+ || (eOp == ocTableRef) || (eOp == ocColRowName) || (eOp == ocBad)))
)
{
PutCode( mpToken );
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index f81b9e7f54b5..180ba0f1af86 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -79,6 +79,7 @@ bool FormulaToken::IsFunction() const
{
return (eOp != ocPush && eOp != ocBad && eOp != ocColRowName &&
eOp != ocColRowNameAuto && eOp != ocName && eOp != ocDBArea &&
+ eOp != ocTableRef &&
(GetByte() != 0 // x parameters
|| (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR) // no parameter
|| (ocIf == eOp || ocIfError == eOp || ocIfNA == eOp || ocChoose == eOp ) // @ jump commands
@@ -388,6 +389,8 @@ bool FormulaTokenArray::AddFormulaToken(
sal_Int32 nValue = rToken.Data.get<sal_Int32>();
if ( eOpCode == ocDBArea )
AddToken( formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) ) );
+ else if ( eOpCode == ocTableRef )
+ /* TODO: implementation */ ;
else if ( eOpCode == ocSpaces )
AddToken( formula::FormulaByteToken( ocSpaces, static_cast<sal_uInt8>(nValue) ) );
else
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index a162ca7c3cda..ee64aa0add97 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -867,6 +867,7 @@ void ScColumn::PreprocessDBDataUpdate(
aOps.insert(ocBad);
aOps.insert(ocColRowName);
aOps.insert(ocDBArea);
+ aOps.insert(ocTableRef);
RecompileByOpcodeHandler aFunc(pDocument, aOps, rEndListenCxt, rCompileCxt);
std::for_each(aGroups.begin(), aGroups.end(), aFunc);
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 1d6ee1e346ea..2f7af3d49a08 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -830,7 +830,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
OpCode eOpCode = pToken->GetOpCode();
if (eOpCode == ocName)
adjustRangeName(pToken, rDoc, rCell.pDocument, aPos, rCell.aPos);
- else if (eOpCode == ocDBArea)
+ else if (eOpCode == ocDBArea || eOpCode == ocTableRef)
adjustDBRange(pToken, rDoc, rCell.pDocument);
}
}
@@ -3568,7 +3568,8 @@ void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt )
{
for( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
{
- if ( p->GetOpCode() == ocDBArea )
+ OpCode eOp = p->GetOpCode();
+ if ( eOp == ocDBArea || eOp == ocTableRef )
{
bCompile = true;
CompileTokenArray(rCxt);
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 7efcab2af57a..59821687478d 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -685,7 +685,8 @@ bool ScValidationData::GetSelectionFromFormula(
formula::FormulaToken* t = NULL;
if (pArr->GetLen() == 1 && (t = pArr->GetNextReferenceOrName()) != NULL)
{
- if (t->GetOpCode() == ocDBArea)
+ OpCode eOpCode = t->GetOpCode();
+ if (eOpCode == ocDBArea || eOpCode == ocTableRef)
{
if (const ScDBData* pDBData = pDocument->GetDBCollection()->getNamedDBs().findByIndex(t->GetIndex()))
{
@@ -693,7 +694,7 @@ bool ScValidationData::GetSelectionFromFormula(
bRef = true;
}
}
- else if (t->GetOpCode() == ocName)
+ else if (eOpCode == ocName)
{
ScRangeData* pName = pDocument->GetRangeName()->findByIndex( t->GetIndex() );
if (pName && pName->IsReference(aRange))
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 8d32278d13da..8a33babd3697 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2962,7 +2962,8 @@ bool ScCompiler::IsDBRange( const OUString& rName )
{
if (rName == "[]")
{
- if (maRawToken.GetOpCode() == ocDBArea)
+ OpCode eOp = maRawToken.GetOpCode();
+ if (eOp == ocDBArea || eOp == ocTableRef)
{
// In OOXML, a database range is named Table1[], Table2[] etc.
// Skip the [] part if the previous token is a valid db range.
@@ -4289,6 +4290,7 @@ void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pT
}
break;
case ocDBArea:
+ case ocTableRef:
{
const ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(_pTokenP->GetIndex());
if (pDBData)
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ce101fca8b44..298451b61786 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1044,6 +1044,8 @@ bool ScTokenArray::AddFormulaToken(
AddRangeName(aTokenData.Index, aTokenData.Global);
else if (eOpCode == ocDBArea)
AddDBRange(aTokenData.Index);
+ else if (eOpCode == ocTableRef)
+ /* TODO: AddTableRef(aTokenData.Index) */ ;
else
bError = true;
}
@@ -4008,6 +4010,7 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
}
break;
case ocDBArea:
+ case ocTableRef:
{
NameType::const_iterator it = rCxt.maNamedDBs.find(nIndex);
if (it != rCxt.maNamedDBs.end())