From b8d4d3a59d022ee56b37a835ddb3a282344814e6 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 15 Nov 2013 10:37:26 -0500 Subject: Handle global range names and use CreateString() during xlsx import. This makes the load speed slightly faster. Change-Id: I64e4d4b8c42a68577350539f3812cafdc0433f96 --- sc/source/filter/oox/formulabuffer.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sc/source/filter/oox/formulabuffer.cxx') diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 7472d3d78255..d1cf118d13d2 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -25,6 +25,7 @@ #include "tokenarray.hxx" #include "sharedformulagroups.hxx" #include "externalrefmgr.hxx" +#include "tokenstringcontext.hxx" #include "oox/token/tokens.hxx" using namespace com::sun::star; @@ -56,7 +57,8 @@ public: Item() : mnRow(-1), mpCell(NULL) {} }; - CachedTokenArray( ScDocument& rDoc ) : mrDoc(rDoc) {} + CachedTokenArray( ScDocument& rDoc ) : + mrDoc(rDoc), maCxt(&rDoc, formula::FormulaGrammar::GRAM_OOXML) {} ~CachedTokenArray() { @@ -73,11 +75,8 @@ public: return NULL; Item& rCached = *it->second; - ScCompiler aComp(&mrDoc, rPos, *rCached.mpCell->GetCode()); - aComp.SetGrammar(formula::FormulaGrammar::GRAM_OOXML); - OUStringBuffer aBuf; - aComp.CreateStringFromTokenArray(aBuf); - OUString aPredicted = aBuf.makeStringAndClear(); + const ScTokenArray& rCode = *rCached.mpCell->GetCode(); + OUString aPredicted = rCode.CreateString(maCxt, rPos); if (rFormula == aPredicted) return &rCached; @@ -108,6 +107,7 @@ private: typedef boost::unordered_map ColCacheType; ColCacheType maCache; ScDocument& mrDoc; + sc::TokenStringContext maCxt; }; void applySharedFormulas( -- cgit