summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@erack.de>2012-02-08 10:42:04 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-02-08 10:42:28 -0500
commite8a321db4419be43c693d5b5d06bfda25709d2f5 (patch)
tree63e1d5fc181c21572a621019a6410f16399ee6cf
parentf270d113e354aa608a2efa641691167a504c6539 (diff)
fix fdo#40590 stop abusing regular string token for XML import
During XML import formulas of defined names and conditional formatting were remembered as regular svString tokens that then later were retrieved without quotes for compilation. This didn't go along with the new ScRangeData::CompileUnresolvedXML() that recreates the formula string from an already tokenized form of the formula. Introduced FormulaToken::AddStringXML() with ocStringXML to sort those out and removed the IsImportingXML() hack from FormulaCompiler::AppendString(), the ocStringXML case is handled in FormulaCompiler::CreateStringFromToken(). Signed-off-by: Kohei Yoshida <kohei.yoshida@suse.com>
-rw-r--r--sc/inc/compiler.hxx1
-rw-r--r--sc/source/core/data/conditio.cxx12
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx4
4 files changed, 8 insertions, 13 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 69474604e..d3171505d 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -542,7 +542,6 @@ private:
virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP);
virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
virtual void LocalizeString( String& rName ); // modify rName - input: exact name
- virtual sal_Bool IsImportingXML() const;
/// Access the CharTable flags
inline sal_uLong GetCharTableFlags( sal_Unicode c, sal_Unicode cLast )
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 642c39b22..f3571c567 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -316,10 +316,10 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
aComp.SetGrammar( eGrammar1 );
if ( pDoc->IsImportingXML() && !bTextToReal )
{
- // temporary formula string as string tokens
- //! merge with lcl_ScDocFunc_CreateTokenArrayXML
+ // temporary formula string as string tokens
+ //! merge with lcl_ScDocFunc_CreateTokenArrayXML
pFormula1 = new ScTokenArray;
- pFormula1->AddString( rExpr1 );
+ pFormula1->AddStringXML( rExpr1 );
// bRelRef1 is set when the formula is compiled again (CompileXML)
}
else
@@ -353,10 +353,10 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
aComp.SetGrammar( eGrammar2 );
if ( pDoc->IsImportingXML() && !bTextToReal )
{
- // temporary formula string as string tokens
- //! merge with lcl_ScDocFunc_CreateTokenArrayXML
+ // temporary formula string as string tokens
+ //! merge with lcl_ScDocFunc_CreateTokenArrayXML
pFormula2 = new ScTokenArray;
- pFormula2->AddString( rExpr2 );
+ pFormula2->AddStringXML( rExpr2 );
// bRelRef2 is set when the formula is compiled again (CompileXML)
}
else
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a4938f17f..542b1d0bf 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5123,10 +5123,6 @@ void ScCompiler::LocalizeString( String& rName )
ScGlobal::GetAddInCollection()->LocalizeString( rName );
}
// -----------------------------------------------------------------------------
-sal_Bool ScCompiler::IsImportingXML() const
-{
- return pDoc->IsImportingXML();
-}
// Put quotes around string if non-alphanumeric characters are contained,
// quote characters contained within are escaped by '\\'.
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index c4df591b2..9349da807 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1008,9 +1008,9 @@ sal_Bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngi
ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScTokenArray* pCode = new ScTokenArray;
- pCode->AddString( rText );
+ pCode->AddStringXML( rText );
if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && (rFormulaNmsp.Len() > 0) )
- pCode->AddString( rFormulaNmsp );
+ pCode->AddStringXML( rFormulaNmsp );
return pCode;
}