[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - 5 commits - formula/source sc/inc sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Mon Nov 18 09:49:00 PST 2013
Rebased ref, commits from common ancestor:
commit be4d4f4f700bf4265deb16c173f996cba2980f84
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 15 21:52:43 2013 -0500
Try not to pass ScCompiler as a parameter.
Change-Id: I7ef58f0455f11a3eb2ac88ec76e9436fb48a74e2
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index c780cca..b6251f7 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -252,11 +252,11 @@ public:
virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const = 0;
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index dee954b..d3e696e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -857,7 +857,7 @@ struct ConventionOOO_A1 : public Convention_A1
return true;
}
- void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr, bool bODF ) const
{
@@ -865,23 +865,23 @@ struct ConventionOOO_A1 : public Convention_A1
rBuffer.append( '[');
bool bEncodeUrl = bODF;
- makeExternalSingleRefStr(rBuffer, nFileId, rTabName, rRef, rCompiler.GetPos(), pRefMgr, true, bEncodeUrl);
+ makeExternalSingleRefStr(rBuffer, nFileId, rTabName, rRef, rPos, pRefMgr, true, bEncodeUrl);
if (bODF)
rBuffer.append( ']');
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
- makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
+ makeExternalRefStrImpl(rBuffer, rPos, nFileId, rTabName, rRef, pRefMgr, false);
}
- void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr, bool bODF ) const
{
- ScRange aAbsRange = rRef.toAbs(rCompiler.GetPos());
+ ScRange aAbsRange = rRef.toAbs(rPos);
if (bODF)
rBuffer.append( '[');
@@ -890,7 +890,7 @@ struct ConventionOOO_A1 : public Convention_A1
do
{
- if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, rRef.Ref1, rCompiler.GetPos(), pRefMgr, true, bEncodeUrl))
+ if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, rRef.Ref1, rPos, pRefMgr, true, bEncodeUrl))
break;
rBuffer.append(':');
@@ -916,17 +916,17 @@ struct ConventionOOO_A1 : public Convention_A1
else if (bODF)
rBuffer.append( '.'); // need at least the sheet separator in ODF
makeExternalSingleRefStr( rBuffer, nFileId, aLastTabName,
- rRef.Ref2, rCompiler.GetPos(), pRefMgr, bDisplayTabName, bEncodeUrl);
+ rRef.Ref2, rPos, pRefMgr, bDisplayTabName, bEncodeUrl);
} while (0);
if (bODF)
rBuffer.append( ']');
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
- makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
+ makeExternalRefStrImpl(rBuffer, rPos, nFileId, rTabName, rRef, pRefMgr, false);
}
};
@@ -975,18 +975,18 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
return lcl_makeExternalNameStr( rFile, rName, '#', true);
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
- makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
+ makeExternalRefStrImpl(rBuffer, rPos, nFileId, rTabName, rRef, pRefMgr, true);
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
- makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
+ makeExternalRefStrImpl(rBuffer, rPos, nFileId, rTabName, rRef, pRefMgr, true);
}
};
@@ -1277,7 +1277,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
return ConventionXL::makeExternalNameStr(rFile, rName);
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
@@ -1295,10 +1295,10 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append('!');
- makeSingleCellStr(rBuffer, rRef, rRef.toAbs(rCompiler.GetPos()));
+ makeSingleCellStr(rBuffer, rRef, rRef.toAbs(rPos));
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
@@ -1311,7 +1311,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
if (aTabNames.empty())
return;
- ScRange aAbsRef = rRef.toAbs(rCompiler.GetPos());
+ ScRange aAbsRef = rRef.toAbs(rPos);
ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aAbsRef);
@@ -1470,7 +1470,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
return ConventionXL::makeExternalNameStr(rFile, rName);
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
@@ -1484,7 +1484,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
if (!pFullName)
return;
- ScAddress aAbsRef = rRef.toAbs(rCompiler.GetPos());
+ ScAddress aAbsRef = rRef.toAbs(rPos);
ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
@@ -1494,7 +1494,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
r1c1_add_col(rBuffer, rRef, aAbsRef);
}
- virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
+ virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScAddress& rPos,
sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
@@ -1507,7 +1507,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
if (aTabNames.empty())
return;
- ScRange aAbsRef = rRef.toAbs(rCompiler.GetPos());
+ ScRange aAbsRef = rRef.toAbs(rPos);
ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aAbsRef);
@@ -4094,11 +4094,11 @@ void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken*
break;
case svExternalSingleRef:
pConv->makeExternalRefStr(
- rBuffer, *this, t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetSingleRef(), pRefMgr);
+ rBuffer, GetPos(), t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetSingleRef(), pRefMgr);
break;
case svExternalDoubleRef:
pConv->makeExternalRefStr(
- rBuffer, *this, t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetDoubleRef(), pRefMgr);
+ rBuffer, GetPos(), t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetDoubleRef(), pRefMgr);
break;
default:
// warning, not error, otherwise we may end up with a never
commit df49385036fbaf38955652ec205d65720cdf3515
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 15 21:07:09 2013 -0500
EncodeUrlMode always set to "by grammer". Remove it.
Change-Id: I7de308bbdaacc1fc60a142497acc2301c080e5dc
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 0fed5cb..c780cca 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -213,13 +213,6 @@ class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
{
public:
- enum EncodeUrlMode
- {
- ENCODE_BY_GRAMMAR,
- ENCODE_ALWAYS,
- ENCODE_NEVER,
- };
-
enum ExtendedErrorDetection
{
EXTENDED_ERROR_DETECTION_NONE = 0, // no error on unknown symbols, default (interpreter handles it)
@@ -330,7 +323,6 @@ private:
SCsTAB nMaxTab; // last sheet in document
sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol
const Convention *pConv;
- EncodeUrlMode meEncodeUrlMode;
ExtendedErrorDetection meExtendedErrorDetection;
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
@@ -411,7 +403,7 @@ public:
void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
void SetNumberFormatter( SvNumberFormatter* pFormatter );
- EncodeUrlMode GetEncodeUrlMode() const;
+
private:
/** Set grammar and reference convention from within SetFormulaLanguage()
or SetGrammar().
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 39b4987..dee954b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -244,11 +244,6 @@ void ScCompiler::SetNumberFormatter( SvNumberFormatter* pFormatter )
mpFormatter = pFormatter;
}
-ScCompiler::EncodeUrlMode ScCompiler::GetEncodeUrlMode() const
-{
- return meEncodeUrlMode;
-}
-
void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap )
{
if (xMap.get())
@@ -869,21 +864,7 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( '[');
- bool bEncodeUrl = true;
- switch (rCompiler.GetEncodeUrlMode())
- {
- case ScCompiler::ENCODE_BY_GRAMMAR:
- bEncodeUrl = bODF;
- break;
- case ScCompiler::ENCODE_ALWAYS:
- bEncodeUrl = true;
- break;
- case ScCompiler::ENCODE_NEVER:
- bEncodeUrl = false;
- break;
- default:
- ;
- }
+ bool bEncodeUrl = bODF;
makeExternalSingleRefStr(rBuffer, nFileId, rTabName, rRef, rCompiler.GetPos(), pRefMgr, true, bEncodeUrl);
if (bODF)
rBuffer.append( ']');
@@ -905,21 +886,7 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( '[');
// Ensure that there's always a closing bracket, no premature returns.
- bool bEncodeUrl = true;
- switch (rCompiler.GetEncodeUrlMode())
- {
- case ScCompiler::ENCODE_BY_GRAMMAR:
- bEncodeUrl = bODF;
- break;
- case ScCompiler::ENCODE_ALWAYS:
- bEncodeUrl = true;
- break;
- case ScCompiler::ENCODE_NEVER:
- bEncodeUrl = false;
- break;
- default:
- ;
- }
+ bool bEncodeUrl = bODF;
do
{
@@ -1324,8 +1291,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
if (!pFullName)
return;
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append('!');
@@ -1347,8 +1313,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScRange aAbsRef = rRef.toAbs(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aAbsRef);
rBuffer.append('!');
@@ -1521,8 +1486,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScAddress aAbsRef = rRef.toAbs(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append('!');
@@ -1545,8 +1509,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScRange aAbsRef = rRef.toAbs(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName, false);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aAbsRef);
rBuffer.append('!');
@@ -1607,7 +1570,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
- meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
mbCloseBrackets( true ),
mbRewind( false )
@@ -1634,7 +1596,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
- meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
mbCloseBrackets( true ),
mbRewind( false )
commit 2a70a397c54560e46f839a17130c958f8a59d669
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 15 19:41:47 2013 -0500
Handle matrix.
Change-Id: I084b2348b5c52151b0d0ea36d082ec2f2603e0d4
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 91e4594..7ae2554 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -113,7 +113,8 @@ void Test::testFormulaCreateStringFromTokens()
"'Past Data'.B1+'2013'.B2*(1+'Kevin''s Data'.C10)",
"x+y*z", // named ranges
"SUM(sheetx;x;y;z)", // sheet local and global named ranges mixed
- "MAX(Table1)+MIN(Table2)*SUM(Table3)" // database ranges
+ "MAX(Table1)+MIN(Table2)*SUM(Table3)", // database ranges
+ "{1;TRUE;3|FALSE;5;\"Text\"|;;}", // inline matrix
};
boost::scoped_ptr<ScTokenArray> pArray;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 702f3b6..ff7294e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3153,6 +3153,30 @@ void ScTokenArray::CheckRelativeReferenceBounds(
namespace {
+void appendDouble( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, double fVal )
+{
+ if (rCxt.mxOpCodeMap->isEnglish())
+ {
+ rtl::math::doubleToUStringBuffer(
+ rBuf, fVal, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true);
+ }
+ else
+ {
+ SvtSysLocale aSysLocale;
+ rtl::math::doubleToUStringBuffer(
+ rBuf, fVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ aSysLocale.GetLocaleDataPtr()->getNumDecimalSep()[0], true);
+ }
+}
+
+void appendString( OUStringBuffer& rBuf, const OUString& rStr )
+{
+ rBuf.append(sal_Unicode('"'));
+ rBuf.append(rStr.replaceAll("\"", "\"\""));
+ rBuf.append(sal_Unicode('"'));
+}
+
void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, const FormulaToken& rToken, const ScAddress& rPos )
{
if (rToken.IsExternalRef())
@@ -3165,21 +3189,7 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
switch (rToken.GetType())
{
case svDouble:
- {
- if (rCxt.mxOpCodeMap->isEnglish())
- {
- rtl::math::doubleToUStringBuffer(
- rBuf, rToken.GetDouble(), rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true);
- }
- else
- {
- SvtSysLocale aSysLocale;
- rtl::math::doubleToUStringBuffer(
- rBuf, rToken.GetDouble(),
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- aSysLocale.GetLocaleDataPtr()->getNumDecimalSep()[0], true);
- }
- }
+ appendDouble(rCxt, rBuf, rToken.GetDouble());
break;
case svString:
{
@@ -3190,9 +3200,7 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
return;
}
- rBuf.append(sal_Unicode('"'));
- rBuf.append(aStr.replaceAll("\"", "\"\""));
- rBuf.append(sal_Unicode('"'));
+ appendString(rBuf, aStr);
}
break;
case svSingleRef:
@@ -3221,7 +3229,55 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
}
break;
case svMatrix:
- // TODO : Implement this.
+ {
+ const ScMatrix* pMat = static_cast<const ScToken&>(rToken).GetMatrix();
+ if (!pMat)
+ return;
+
+ size_t nC, nMaxC, nR, nMaxR;
+ pMat->GetDimensions(nMaxC, nMaxR);
+
+ rBuf.append(rCxt.mxOpCodeMap->getSymbol(ocArrayOpen));
+ for (nR = 0 ; nR < nMaxR ; ++nR)
+ {
+ if (nR > 0)
+ {
+ rBuf.append(rCxt.mxOpCodeMap->getSymbol(ocArrayRowSep));
+ }
+
+ for (nC = 0 ; nC < nMaxC ; ++nC)
+ {
+ if (nC > 0)
+ {
+ rBuf.append(rCxt.mxOpCodeMap->getSymbol(ocArrayColSep));
+ }
+
+ if (pMat->IsValue(nC, nR))
+ {
+ if (pMat->IsBoolean(nC, nR))
+ {
+ bool bVal = pMat->GetDouble(nC, nR) != 0.0;
+ rBuf.append(rCxt.mxOpCodeMap->getSymbol(bVal ? ocTrue : ocFalse));
+ }
+ else
+ {
+ sal_uInt16 nErr = pMat->GetError(nC, nR);
+ if (nErr)
+ rBuf.append(ScGlobal::GetErrorString(nErr));
+ else
+ appendDouble(rCxt, rBuf, pMat->GetDouble(nC, nR));
+ }
+ }
+ else if (pMat->IsEmpty(nC, nR))
+ {
+ // Skip it.
+ }
+ else if (pMat->IsString(nC, nR))
+ appendString(rBuf, pMat->GetString(nC, nR).getString());
+ }
+ }
+ rBuf.append(rCxt.mxOpCodeMap->getSymbol(ocArrayClose));
+ }
break;
case svIndex:
{
commit 497e7519b2881c9176c47c5f8902db6cb91cbc63
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 15 19:05:48 2013 -0500
Fix indentation.
Change-Id: I260649aca445e03c52423d8f0a63eb4681d2a876
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 480d557..e8c40aa 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1843,9 +1843,9 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuffer, F
}
}
if (!bMapped && !mxSymbols->isEnglish())
- LocalizeString( aAddIn );
- rBuffer.append( aAddIn);
- }
+ LocalizeString( aAddIn );
+ rBuffer.append( aAddIn);
+ }
break;
case svError:
AppendErrorConstant( rBuffer, t->GetError());
commit 0b3034fce476e43d4322f7bfb61fd335cdb15c0f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 15 19:03:56 2013 -0500
Handle external functions (add-ins).
Unfortunately we can't test this piece easily just yet. Enabling add-in
functions would mess up the function list which is unit-tested and thus
fail if we enable add-ins in unit test.
Change-Id: Ieda5e5560d4c7e68d7c6272c5d85f2ac63bd4ee4
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 294dd65..9eef1ee 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2552,7 +2552,7 @@ void Test::testFunctionLists()
for (sal_uInt32 j = 0; j < nFuncCount; ++j)
{
const formula::IFunctionDescription* pFunc = pCat->getFunction(j);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected function name", pFunc->getFunctionName(), OUString::createFromAscii(aTests[i].Functions[j]));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected function name", OUString::createFromAscii(aTests[i].Functions[j]), pFunc->getFunctionName());
}
}
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index b60d77a..702f3b6 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -41,6 +41,7 @@
#include "tokenstringcontext.hxx"
#include "types.hxx"
#include "globstr.hrc"
+#include "addincol.hxx"
#include "svl/sharedstring.hxx"
using ::std::vector;
@@ -3278,7 +3279,26 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
}
break;
case svExternal:
- // TODO : Implement this.
+ {
+ // mapped or translated name of AddIns
+ OUString aAddIn = rToken.GetExternal();
+ bool bMapped = rCxt.mxOpCodeMap->isPODF(); // ODF 1.1 directly uses programmatical name
+ if (!bMapped && rCxt.mxOpCodeMap->hasExternals())
+ {
+ const ExternalHashMap& rExtMap = *rCxt.mxOpCodeMap->getReverseExternalHashMap();
+ ExternalHashMap::const_iterator it = rExtMap.find(aAddIn);
+ if (it != rExtMap.end())
+ {
+ aAddIn = it->second;
+ bMapped = true;
+ }
+ }
+
+ if (!bMapped && !rCxt.mxOpCodeMap->isEnglish())
+ ScGlobal::GetAddInCollection()->LocalizeString(aAddIn);
+
+ rBuf.append(aAddIn);
+ }
break;
case svError:
{
More information about the Libreoffice-commits
mailing list