[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Sat Feb 8 15:16:56 PST 2014
sc/qa/unit/ucalc_formula.cxx | 20 ++++++++++++++++++++
sc/source/core/tool/compiler.cxx | 28 ++++++++--------------------
2 files changed, 28 insertions(+), 20 deletions(-)
New commits:
commit 83cdcdb9f0fe11309939f5dca4fb46e426559896
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Feb 8 18:19:42 2014 -0500
fdo#74512: Generate escaped sheet names after the grammer is set.
Otherwise the single quote characters wouldn't be properly doubled.
Change-Id: I864ca8912a35049905e52e002d92d648e1278015
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 8c6dee9..f8d00f1 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -238,6 +238,14 @@ void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar )
if (eMyGrammar != GetGrammar())
SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
}
+
+ if (pDoc && maTabNames.empty())
+ {
+ maTabNames = pDoc->GetAllTableNames();
+ std::vector<OUString>::iterator it = maTabNames.begin(), itEnd = maTabNames.end();
+ for (; it != itEnd; ++it)
+ ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGrammar));
+ }
}
void ScCompiler::SetNumberFormatter( SvNumberFormatter* pFormatter )
@@ -1546,16 +1554,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
mbRewind( false )
{
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
-
- if (pDoc)
- {
- maTabNames = pDoc->GetAllTableNames();
- {
- std::vector<OUString>::iterator it = maTabNames.begin(), itEnd = maTabNames.end();
- for (; it != itEnd; ++it)
- ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGrammar));
- }
- }
}
ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos ) :
@@ -1589,16 +1587,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
mbRewind( false )
{
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
-
- if (pDoc)
- {
- maTabNames = pDoc->GetAllTableNames();
- {
- std::vector<OUString>::iterator it = maTabNames.begin(), itEnd = maTabNames.end();
- for (; it != itEnd; ++it)
- ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGrammar));
- }
- }
}
ScCompiler::~ScCompiler()
commit c4987cd730be2d4aa7c76e69fad4e3195413fb0c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Feb 8 18:01:08 2014 -0500
fdo#74512: Add test for this.
Change-Id: I472a91375c6408761d9c300b3575cfe101649fca
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 411ed9e..05ff6b6 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -217,6 +217,26 @@ void Test::testFormulaParseReference()
m_pDoc->GetName(4, aTabName);
CPPUNIT_ASSERT_EQUAL(aTab4, aTabName);
+ // Make sure the formula input and output match.
+ {
+ const char* aChecks[] = {
+ "'90''s Music'.B12",
+ "'90''s and 70''s'.$AB$100",
+ "'All Others'.Z$100",
+ "NoQuote.$C111"
+ };
+
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ // Use the 'Dummy' sheet for this.
+ OUString aInput("=");
+ aInput += OUString::createFromAscii(aChecks[i]);
+ m_pDoc->SetString(ScAddress(0,0,0), aInput);
+ if (!checkFormula(*m_pDoc, ScAddress(0,0,0), aChecks[i]))
+ CPPUNIT_FAIL("Wrong formula");
+ }
+ }
+
ScAddress aPos;
ScAddress::ExternalInfo aExtInfo;
sal_uInt16 nRes = aPos.Parse("'90''s Music'.D10", m_pDoc, formula::FormulaGrammar::CONV_OOO, &aExtInfo);
More information about the Libreoffice-commits
mailing list