[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sun Dec 28 21:27:28 PST 2014
sc/qa/unit/data/xls/shared-formula/relative-refs.xls |binary
sc/qa/unit/subsequent_filters-test.cxx | 23 +++++++++++++++++++
sc/source/filter/excel/excform8.cxx | 7 ++++-
3 files changed, 28 insertions(+), 2 deletions(-)
New commits:
commit 0c24686c3970bac7e9a4e214fccfdfffd742149e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Dec 29 06:23:53 2014 +0100
add test for fdo#80091
Change-Id: I8b62c0980275537adea7a4de44d4fe86995da92f
diff --git a/sc/qa/unit/data/xls/shared-formula/relative-refs.xls b/sc/qa/unit/data/xls/shared-formula/relative-refs.xls
new file mode 100644
index 0000000..88678b4
Binary files /dev/null and b/sc/qa/unit/data/xls/shared-formula/relative-refs.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 2ba0050..529486d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -174,6 +174,7 @@ public:
void testSharedFormulaWrappedRefsXLS();
void testSharedFormulaBIFF5();
void testSharedFormulaXLSB();
+ void testSharedFormulaXLS();
void testExternalRefCacheXLSX();
void testExternalRefCacheODS();
void testHybridSharedStringODS();
@@ -257,6 +258,7 @@ public:
CPPUNIT_TEST(testSharedFormulaWrappedRefsXLS);
CPPUNIT_TEST(testSharedFormulaBIFF5);
CPPUNIT_TEST(testSharedFormulaXLSB);
+ CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testExternalRefCacheXLSX);
CPPUNIT_TEST(testExternalRefCacheODS);
CPPUNIT_TEST(testHybridSharedStringODS);
@@ -2579,6 +2581,27 @@ void ScFiltersTest::testSharedFormulaXLSB()
xDocSh->DoClose();
}
+void ScFiltersTest::testSharedFormulaXLS()
+{
+ ScDocShellRef xDocSh = loadDoc("shared-formula/relative-refs.", XLS);
+ CPPUNIT_ASSERT(xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
+
+ // A1:A30 should be all formulas, and they should belong to the same group.
+ const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,1,0));
+ CPPUNIT_ASSERT(pFC);
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(29), pFC->GetSharedLength());
+
+ for(SCROW nRow = 0; nRow < 30; ++nRow)
+ {
+ ASSERT_DOUBLES_EQUAL(double(nRow+1), rDoc.GetValue(0, nRow, 0));
+ }
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testExternalRefCacheXLSX()
{
ScDocShellRef xDocSh = loadDoc("external-refs.", XLSX);
commit 16bfddca6187a426523bbe187db4506a34b5511c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Dec 29 06:01:27 2014 +0100
handle relative refs correctly in xls import, fdo#80091
Change-Id: Ia70f96e1d31e71c56f03c828be0a4e49fff4b198
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index f206804..042d79b 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -631,9 +631,12 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
ExcRelToScRel8( nRowFirst, nColFirst, aCRD.Ref1, bRNorSF );
ExcRelToScRel8( nRowLast, nColLast, aCRD.Ref2, bRNorSF );
- if( IsComplColRange( nColFirst, nColLast ) )
+ bool bColRel = aCRD.Ref1.IsColRel() || aCRD.Ref2.IsColRel();
+ bool bRowRel = aCRD.Ref1.IsRowRel() || aCRD.Ref2.IsRowRel();
+
+ if( !bColRel && IsComplColRange( nColFirst, nColLast ) )
SetComplCol( aCRD );
- else if( IsComplRowRange( nRowFirst, nRowLast ) )
+ else if( !bRowRel && IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
aStack << aPool.Store( aCRD );
More information about the Libreoffice-commits
mailing list