[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Mon Dec 29 21:35:06 PST 2014
sc/qa/unit/data/xls/named-ranges-local.xls |binary
sc/qa/unit/subsequent_filters-test.cxx | 23 +++++++++++++++++++++++
sc/source/filter/excel/xeformula.cxx | 4 ++--
3 files changed, 25 insertions(+), 2 deletions(-)
New commits:
commit 339521b5448ae3f63b790f144976e78c9941ed33
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Dec 30 06:30:30 2014 +0100
add test for fdo#81195
Change-Id: If19f4067d53c2c614f6afcc0d6349db6ec2fd602
diff --git a/sc/qa/unit/data/xls/named-ranges-local.xls b/sc/qa/unit/data/xls/named-ranges-local.xls
new file mode 100644
index 0000000..7c39d20
Binary files /dev/null and b/sc/qa/unit/data/xls/named-ranges-local.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 703f905..bafe992 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -88,6 +88,7 @@ public:
//ods, xls, xlsx filter tests
void testBasicCellContentODS();
void testRangeNameXLS();
+ void testRangeNameLocalXLS();
void testRangeNameXLSX();
void testHyperlinksXLSX();
void testHardRecalcODS();
@@ -185,6 +186,7 @@ public:
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBasicCellContentODS);
CPPUNIT_TEST(testRangeNameXLS);
+ CPPUNIT_TEST(testRangeNameLocalXLS);
CPPUNIT_TEST(testRangeNameXLSX);
CPPUNIT_TEST(testHyperlinksXLSX);
CPPUNIT_TEST(testHardRecalcODS);
@@ -363,6 +365,27 @@ void ScFiltersTest::testRangeNameXLS()
xDocSh->DoClose();
}
+void ScFiltersTest::testRangeNameLocalXLS()
+{
+ ScDocShellRef xDocSh = loadDoc("named-ranges-local.", XLS);
+ xDocSh->DoHardRecalc(true);
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScRangeName* pRangeName = rDoc.GetRangeName(0);
+ CPPUNIT_ASSERT(pRangeName);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), pRangeName->size());
+
+ OUString aFormula;
+ rDoc.GetFormula(3, 11, 0, aFormula);
+ CPPUNIT_ASSERT_EQUAL(OUString("=SUM(local_name2)"), aFormula);
+ ASSERT_DOUBLES_EQUAL(14.0, rDoc.GetValue(3, 11, 0));
+
+ rDoc.GetFormula(6, 4, 0, aFormula);
+ CPPUNIT_ASSERT_EQUAL(OUString("=local_name1"), aFormula);
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testRangeNameXLSX()
{
ScDocShellRef xDocSh = loadDoc("named-ranges-global.", XLSX);
commit 4ebdadfda60f108556ea9cc4436dd440bf122ca4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Dec 30 06:16:45 2014 +0100
use the correct tab for sheet local names, fdo#81195
Change-Id: I7e8b7ed552a37c6d9c6ce7c75765267b343d508c
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 214d979..145aaf3 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -2078,8 +2078,8 @@ void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpScToken& rTokData )
{
SCTAB nTab = SCTAB_GLOBAL;
bool bGlobal = rTokData.mpScToken->IsGlobal();
- if (!bGlobal && mxData->mpScBasePos)
- nTab = mxData->mpScBasePos->Tab();
+ if (!bGlobal)
+ nTab = GetCurrScTab();
XclExpNameManager& rNameMgr = GetNameManager();
sal_uInt16 nNameIdx = rNameMgr.InsertName(nTab, rTokData.mpScToken->GetIndex());
More information about the Libreoffice-commits
mailing list