From 239ec7e6a514d75fcfd8964b5f1cecae5a8c7591 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 1 Nov 2000 16:28:31 +0000 Subject: [PATCH] allow XML style references in formulas --- sc/inc/conditio.hxx | 15 ++++++++------- sc/inc/validat.hxx | 6 +++--- sc/source/core/data/conditio.cxx | 21 +++++++++++++-------- sc/source/core/data/validat.cxx | 8 ++++---- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index b1e86e832706..eb8d17d03e61 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -2,9 +2,9 @@ * * $RCSfile: conditio.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:48 $ + * last change: $Author: nn $ $Date: 2000-11-01 17:27:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -131,7 +131,7 @@ class ScConditionEntry BOOL bFirstRun; void MakeCells( const ScAddress& rPos ); - void Compile( const String& rExpr1, const String& rExpr2, BOOL bEnglish ); + void Compile( const String& rExpr1, const String& rExpr2, BOOL bEnglish, BOOL bCompileXML ); void Interpret( const ScAddress& rPos ); BOOL IsValid( double nArg ) const; @@ -146,7 +146,7 @@ public: ScConditionEntry( ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - BOOL bCompileEnglish ); + BOOL bCompileEnglish, BOOL bCompileXML ); ScConditionEntry( ScConditionMode eOper, const ScTokenArray* pArr1, const ScTokenArray* pArr2, ScDocument* pDocument, const ScAddress& rPos ); @@ -164,8 +164,8 @@ public: void SetIgnoreBlank(BOOL bSet); ScAddress GetSrcPos() const { return aSrcPos; } - String GetExpression( const ScAddress& rCursor, USHORT nPos, - ULONG nNumFmt = 0, BOOL bEnglish = FALSE ) const; + String GetExpression( const ScAddress& rCursor, USHORT nPos, ULONG nNumFmt = 0, + BOOL bEnglish = FALSE, BOOL bCompileXML = FALSE ) const; ScTokenArray* CreateTokenArry( USHORT nPos ) const; @@ -196,7 +196,8 @@ public: ScCondFormatEntry( ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - const String& rStyle, BOOL bCompileEnglish = FALSE ); + const String& rStyle, + BOOL bCompileEnglish = FALSE, BOOL bCompileXML = FALSE ); ScCondFormatEntry( ScConditionMode eOper, const ScTokenArray* pArr1, const ScTokenArray* pArr2, ScDocument* pDocument, const ScAddress& rPos, diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index d4f9b65032c9..08329e251855 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -2,9 +2,9 @@ * * $RCSfile: validat.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:50 $ + * last change: $Author: nn $ $Date: 2000-11-01 17:24:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,7 @@ public: ScValidationData( ScValidationMode eMode, ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - BOOL bCompileEnglish = FALSE ); + BOOL bCompileEnglish = FALSE, BOOL bCompileXML = FALSE ); ScValidationData( const ScValidationData& r ); ScValidationData( ScDocument* pDocument, const ScValidationData& r ); ScValidationData( SvStream& rStream, ScMultipleReadHeader& rHdr, diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index df3b387d0d75..51758b82bb4a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -2,9 +2,9 @@ * * $RCSfile: conditio.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:16:14 $ + * last change: $Author: nn $ $Date: 2000-11-01 17:28:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -168,7 +168,7 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr ScConditionEntry::ScConditionEntry( ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - BOOL bCompileEnglish ) : + BOOL bCompileEnglish, BOOL bCompileXML ) : eOp(eOper), nOptions(0), // spaeter... nVal1(0.0), @@ -185,7 +185,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper, aSrcPos(rPos), bFirstRun(TRUE) { - Compile( rExpr1, rExpr2, bCompileEnglish ); + Compile( rExpr1, rExpr2, bCompileEnglish, bCompileXML ); // Formelzellen werden erst bei IsValid angelegt } @@ -383,12 +383,14 @@ void ScConditionEntry::StoreCondition(SvStream& rStream, ScMultipleWriteHeader& rHdr.EndEntry(); } -void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2, BOOL bEnglish ) +void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2, + BOOL bEnglish, BOOL bCompileXML ) { if ( rExpr1.Len() || rExpr2.Len() ) { ScCompiler aComp( pDoc, aSrcPos ); aComp.SetCompileEnglish( bEnglish ); + aComp.SetCompileXML( bCompileXML ); if ( rExpr1.Len() ) { @@ -842,7 +844,7 @@ BOOL ScConditionEntry::IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) c } String ScConditionEntry::GetExpression( const ScAddress& rCursor, USHORT nIndex, - ULONG nNumFmt, BOOL bEnglish ) const + ULONG nNumFmt, BOOL bEnglish, BOOL bCompileXML ) const { String aRet; @@ -855,6 +857,7 @@ String ScConditionEntry::GetExpression( const ScAddress& rCursor, USHORT nIndex, { ScCompiler aComp(pDoc, rCursor, *pFormula1); aComp.SetCompileEnglish( bEnglish ); + aComp.SetCompileXML( bCompileXML ); aComp.CreateStringFromTokenArray( aRet ); } else if (bIsStr1) @@ -872,6 +875,7 @@ String ScConditionEntry::GetExpression( const ScAddress& rCursor, USHORT nIndex, { ScCompiler aComp(pDoc, rCursor, *pFormula2); aComp.SetCompileEnglish( bEnglish ); + aComp.SetCompileXML( bCompileXML ); aComp.CreateStringFromTokenArray( aRet ); } else if (bIsStr2) @@ -1016,8 +1020,9 @@ void ScConditionEntry::DataChanged( const ScRange* pModified ) const ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - const String& rStyle, BOOL bCompileEnglish ) : - ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, bCompileEnglish ), + const String& rStyle, + BOOL bCompileEnglish, BOOL bCompileXML ) : + ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, bCompileEnglish, bCompileXML ), aStyleName( rStyle ), pParent( NULL ) { diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index ad653b9496d8..5c4bff946550 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -2,9 +2,9 @@ * * $RCSfile: validat.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $ + * last change: $Author: nn $ $Date: 2000-11-01 17:28:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,8 +103,8 @@ SV_IMPL_OP_PTRARR_SORT( ScValidationEntries_Impl, ScValidationDataPtr ); ScValidationData::ScValidationData( ScValidationMode eMode, ScConditionMode eOper, const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - BOOL bCompileEnglish ) : - ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, bCompileEnglish ), + BOOL bCompileEnglish, BOOL bCompileXML ) : + ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, bCompileEnglish, bCompileXML ), nKey( 0 ), eDataMode( eMode ) {