summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-09 12:57:43 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-09 12:57:43 +0000
commit7a0f18cb256b468ba85acb41445b3f09d2e7ce8a (patch)
treea82e82cea8dbcfdbd7fd64a4a8f6d45247c16fd2 /formula
parent61f243fdab3b0981fefc290a5c24d2f2b26340e6 (diff)
#i1000#: resolve merge conflicts from CWS frmdlg
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx134
1 files changed, 81 insertions, 53 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 49b60c663d0e..bd70a2f1c9bb 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -346,8 +346,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
{ FormulaMapGroupSpecialOffset::MAT_REF , ocMatRef } ,
{ FormulaMapGroupSpecialOffset::DB_AREA , ocDBArea } ,
{ FormulaMapGroupSpecialOffset::MACRO , ocMacro } ,
- { FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName } ,
- { FormulaMapGroupSpecialOffset::COL_ROW_NAME_AUTO , ocColRowNameAuto }
+ { FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName }
};
const size_t nCount = sizeof(aMap)/sizeof(aMap[0]);
// Preallocate vector elements.
@@ -833,9 +832,9 @@ BOOL FormulaCompiler::GetToken()
else
{
if ( nWasColRowName >= 2 && pToken->GetOpCode() == ocColRowName )
- { // aus einem ocSpaces ein ocIntersect im RPN machen
+ { // convert an ocSpaces to ocIntersect in RPN
pToken = new FormulaByteToken( ocIntersect );
- pArr->nIndex--; // ganz schweinisch..
+ pArr->nIndex--; // we advanced to the second ocColRowName, step back
}
}
}
@@ -846,6 +845,10 @@ BOOL FormulaCompiler::GetToken()
}
if( pToken->GetOpCode() == ocSubTotal )
glSubTotal = TRUE;
+ else if ( pToken->GetOpCode() == ocExternalRef )
+ {
+ return HandleExternalReference(*pToken);
+ }
else if( pToken->GetOpCode() == ocName )
{
return HandleRange();
@@ -1136,6 +1139,11 @@ void FormulaCompiler::Factor()
bCorrected = TRUE;
}
}
+ else if ( eOp == ocExternalRef )
+ {
+ PutCode(pToken);
+ eOp = NextToken();
+ }
else
{
SetError( errUnknownToken );
@@ -1462,11 +1470,13 @@ void FormulaCompiler::CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer )
return;
FormulaTokenArray* pSaveArr = pArr;
- if (formula::FormulaGrammar::isPODF( meGrammar))
+ bool bODFF = FormulaGrammar::isODFF( meGrammar);
+ if (bODFF || FormulaGrammar::isPODF( meGrammar) )
{
// Scan token array for missing args and re-write if present.
- if (pArr->NeedsPofRewrite())
- pArr = pArr->RewriteMissingToPof();
+ MissingConvention aConv( bODFF);
+ if (pArr->NeedsPofRewrite( aConv))
+ pArr = pArr->RewriteMissingToPof( aConv);
}
// At least one character per token, plus some are references, some are
@@ -1548,59 +1558,68 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuff
rBuffer.append(GetNativeSymbol( ocErrName ));
}
if( bNext )
- switch( t->GetType() )
{
- case svDouble:
- AppendDouble( rBuffer, t->GetDouble() );
- break;
-
- case svString:
- if( eOp == ocBad )
- rBuffer.append(t->GetString());
- else
- AppendString( rBuffer, t->GetString() );
- break;
- case svSingleRef:
- CreateStringFromSingleRef(rBuffer,t);
- break;
- case svDoubleRef:
- CreateStringFromDoubleRef(rBuffer,t);
- break;
- case svMatrix:
- CreateStringFromMatrix( rBuffer, t );
+ if (eOp == ocExternalRef)
+ {
+ CreateStringFromExternal(rBuffer, pTokenP);
+ }
+ else
+ {
+ switch( t->GetType() )
+ {
+ case svDouble:
+ AppendDouble( rBuffer, t->GetDouble() );
break;
- case svIndex:
- CreateStringFromIndex( rBuffer, t );
- break;
- case svExternal:
- {
- // mapped or translated name of AddIns
- String aAddIn( t->GetExternal() );
- bool bMapped = mxSymbols->isPODF(); // ODF 1.1 directly uses programmatical name
- if (!bMapped && mxSymbols->hasExternals())
+ case svString:
+ if( eOp == ocBad )
+ rBuffer.append(t->GetString());
+ else
+ AppendString( rBuffer, t->GetString() );
+ break;
+ case svSingleRef:
+ CreateStringFromSingleRef(rBuffer,t);
+ break;
+ case svDoubleRef:
+ CreateStringFromDoubleRef(rBuffer,t);
+ break;
+ case svMatrix:
+ CreateStringFromMatrix( rBuffer, t );
+ break;
+
+ case svIndex:
+ CreateStringFromIndex( rBuffer, t );
+ break;
+ case svExternal:
{
- ExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap()->find( aAddIn);
- if (iLook != mxSymbols->getReverseExternalHashMap()->end())
+ // mapped or translated name of AddIns
+ String aAddIn( t->GetExternal() );
+ bool bMapped = mxSymbols->isPODF(); // ODF 1.1 directly uses programmatical name
+ if (!bMapped && mxSymbols->hasExternals())
{
- aAddIn = (*iLook).second;
- bMapped = true;
+ ExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap()->find( aAddIn);
+ if (iLook != mxSymbols->getReverseExternalHashMap()->end())
+ {
+ aAddIn = (*iLook).second;
+ bMapped = true;
+ }
+ }
+ if (!bMapped && !mxSymbols->isEnglish())
+ LocalizeString( aAddIn );
+ rBuffer.append(aAddIn);
}
- }
- if (!bMapped && !mxSymbols->isEnglish())
- LocalizeString( aAddIn );
- rBuffer.append(aAddIn);
- }
break;
- case svByte:
- case svJump:
- case svFAP:
- case svMissing:
- case svSep:
- break; // Opcodes
- default:
- DBG_ERROR("FormulaCompiler:: GetStringFromToken errUnknownVariable");
- } // of switch
+ case svByte:
+ case svJump:
+ case svFAP:
+ case svMissing:
+ case svSep:
+ break; // Opcodes
+ default:
+ DBG_ERROR("FormulaCompiler:: GetStringFromToken errUnknownVariable");
+ } // of switch
+ }
+ }
if( bSpaces )
rBuffer.append(sal_Unicode(' '));
if ( bAllowArrAdvance )
@@ -1783,6 +1802,11 @@ void FormulaCompiler::PutCode( FormulaTokenRef& p )
}
// -----------------------------------------------------------------------------
+BOOL FormulaCompiler::HandleExternalReference(const FormulaToken& /*_aToken*/)
+{
+ return TRUE;
+}
+// -----------------------------------------------------------------------------
BOOL FormulaCompiler::HandleRange()
{
return TRUE;
@@ -1814,6 +1838,10 @@ void FormulaCompiler::CreateStringFromMatrix(rtl::OUStringBuffer& /*rBuffer*/,Fo
{
}
// -----------------------------------------------------------------------------
+void FormulaCompiler::CreateStringFromExternal(rtl::OUStringBuffer& /*rBuffer*/,FormulaToken* /*pTokenP*/)
+{
+}
+// -----------------------------------------------------------------------------
void FormulaCompiler::LocalizeString( String& /*rName*/ )
{
}