INTEGRATION: CWS dr51 (1.27.6); FILE MERGED

2006/11/02 19:59:40 er 1.27.6.1: #i70041# add missing arguments support for most obvious functions of Xcl imported files while writing the correct default parameters to OOoXML's plain old formula
This commit is contained in:
Ivo Hinkelmann 2006-12-19 12:16:32 +00:00
parent 4a5d85e8c1
commit b8d983c9b0

View file

@ -4,9 +4,9 @@
* *
* $RCSfile: cell2.cxx,v $ * $RCSfile: cell2.cxx,v $
* *
* $Revision: 1.27 $ * $Revision: 1.28 $
* *
* last change: $Author: ihi $ $Date: 2006-10-18 12:19:08 $ * last change: $Author: ihi $ $Date: 2006-12-19 13:16:32 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@ -245,59 +245,31 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
void ScFormulaCell::GetEnglishFormula( String& rFormula, BOOL bCompileXML, void ScFormulaCell::GetEnglishFormula( String& rFormula, BOOL bCompileXML,
ScAddress::Convention conv ) const ScAddress::Convention conv ) const
{ {
//! mit GetFormula zusammenfassen !!! rtl::OUStringBuffer rBuffer( rFormula );
GetEnglishFormula( rBuffer, bCompileXML, conv );
rFormula = rBuffer;
}
if( pCode->GetError() && !pCode->GetLen() )
void ScFormulaCell::GetEnglishFormulaForPof( rtl::OUStringBuffer &rBuffer,
const ScAddress &rPos, BOOL bCompileXML ) const
{
ScTokenArray *pCompileCode = pCode;
if (bCompileXML)
{ {
rFormula = ScGlobal::GetErrorString( pCode->GetError() ); return; /* Scan pCode [ token array ! ] for missing args &
} re-write if present */
else if( cMatrixFlag == MM_REFERENCE ) if (pCode->NeedsPofRewrite())
{ pCompileCode = pCode->RewriteMissingToPof();
// Referenz auf eine andere Zelle, die eine Matrixformel enthaelt
pCode->Reset();
ScToken* p = pCode->GetNextReferenceRPN();
if( p )
{
ScBaseCell* pCell;
SingleRefData& rRef = p->GetSingleRef();
rRef.CalcAbsIfRel( aPos );
if ( rRef.Valid() )
pCell = pDocument->GetCell( ScAddress( rRef.nCol,
rRef.nRow, rRef.nTab ) );
else
pCell = NULL;
if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
{
((ScFormulaCell*)pCell)->GetEnglishFormula(rFormula, bCompileXML, conv);
return;
}
else
{
ScCompiler aComp( pDocument, aPos, *pCode );
aComp.SetCompileEnglish( TRUE );
aComp.SetCompileXML( bCompileXML );
aComp.CreateStringFromTokenArray( rFormula );
}
}
else
{
DBG_ERROR("ScFormulaCell::GetEnglishFormula: Keine Matrix");
}
}
else
{
ScCompiler aComp( pDocument, aPos, *pCode );
aComp.SetCompileEnglish( TRUE );
aComp.SetCompileXML( bCompileXML );
aComp.CreateStringFromTokenArray( rFormula );
} }
rFormula.Insert( '=',0 ); ScCompiler aComp( pDocument, rPos, *pCompileCode );
if( cMatrixFlag ) aComp.SetCompileEnglish( TRUE );
{ aComp.SetCompileXML( bCompileXML );
rFormula.Insert('{', 0); aComp.CreateStringFromTokenArray( rBuffer );
rFormula += '}';
} if ( pCompileCode != pCode )
delete pCompileCode;
} }
void ScFormulaCell::GetEnglishFormula( rtl::OUStringBuffer& rBuffer, BOOL bCompileXML, void ScFormulaCell::GetEnglishFormula( rtl::OUStringBuffer& rBuffer, BOOL bCompileXML,
@ -307,7 +279,8 @@ void ScFormulaCell::GetEnglishFormula( rtl::OUStringBuffer& rBuffer, BOOL bCompi
if( pCode->GetError() && !pCode->GetLen() ) if( pCode->GetError() && !pCode->GetLen() )
{ {
rBuffer = rtl::OUStringBuffer(ScGlobal::GetErrorString( pCode->GetError() )); return; rBuffer = rtl::OUStringBuffer( ScGlobal::GetErrorString( pCode->GetError()));
return;
} }
else if( cMatrixFlag == MM_REFERENCE ) else if( cMatrixFlag == MM_REFERENCE )
{ {
@ -326,16 +299,11 @@ void ScFormulaCell::GetEnglishFormula( rtl::OUStringBuffer& rBuffer, BOOL bCompi
pCell = NULL; pCell = NULL;
if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
{ {
((ScFormulaCell*)pCell)->GetEnglishFormula(rBuffer, bCompileXML, conv); ((ScFormulaCell*)pCell)->GetEnglishFormula( rBuffer, bCompileXML, conv);
return; return;
} }
else else
{ GetEnglishFormulaForPof( rBuffer, aPos, bCompileXML);
ScCompiler aComp( pDocument, aPos, *pCode );
aComp.SetCompileEnglish( TRUE );
aComp.SetCompileXML( bCompileXML );
aComp.CreateStringFromTokenArray( rBuffer );
}
} }
else else
{ {
@ -343,20 +311,15 @@ void ScFormulaCell::GetEnglishFormula( rtl::OUStringBuffer& rBuffer, BOOL bCompi
} }
} }
else else
{ GetEnglishFormulaForPof( rBuffer, aPos, bCompileXML);
ScCompiler aComp( pDocument, aPos, *pCode );
aComp.SetCompileEnglish( TRUE );
aComp.SetCompileXML( bCompileXML );
aComp.CreateStringFromTokenArray( rBuffer );
}
sal_Unicode ch('='); sal_Unicode ch('=');
rBuffer.insert( 0, &ch, 1 ); rBuffer.insert( 0, &ch, 1 );
if( cMatrixFlag ) if( cMatrixFlag )
{ {
sal_Unicode ch2('{'); sal_Unicode ch2('{');
rBuffer.insert(0, &ch2, 1); rBuffer.insert( 0, &ch2, 1);
rBuffer.append(sal_Unicode('}')); rBuffer.append( sal_Unicode('}'));
} }
} }
@ -1553,8 +1516,3 @@ void ScNoteCell::Save( SvStream& rStream ) const
{ {
rStream << (BYTE) 0x00; rStream << (BYTE) 0x00;
} }