summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-27 14:58:39 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-12-09 12:45:19 +0000
commit6b5481c0260343800518192918ddf932ee5ae527 (patch)
tree673876344f0287e30de25ebe34913b37f744028f
parent64f45731a7ec8b5220649a387d2c26d27c912dd5 (diff)
fdo#82312 - Excel chart has a wrong size
bug introduced in commit 0c7f35277575fee8594737f5b2842dfac2c6d04f "remove SvStream::operator>> methods" Change-Id: I72a1c05b3a4a3f3a250055775eb2d35b3114406d Reviewed-on: https://gerrit.libreoffice.org/13151 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/data/xls/chartx.xlsbin0 -> 14848 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx20
-rw-r--r--sc/source/filter/inc/xlescher.hxx20
3 files changed, 40 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/chartx.xls b/sc/qa/unit/data/xls/chartx.xls
new file mode 100644
index 000000000000..2294c15f7b6f
--- /dev/null
+++ b/sc/qa/unit/data/xls/chartx.xls
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index be1955da0295..39a75c1ca8d9 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -146,6 +146,7 @@ public:
//test shape import
void testControlImport();
void testChartImportODS();
+ void testChartImportXLS();
void testNumberFormatHTML();
void testNumberFormatCSV();
@@ -215,6 +216,7 @@ public:
CPPUNIT_TEST(testRowIndex1BasedXLSX);
CPPUNIT_TEST(testControlImport);
CPPUNIT_TEST(testChartImportODS);
+ CPPUNIT_TEST(testChartImportXLS);
CPPUNIT_TEST(testDataBarODS);
CPPUNIT_TEST(testDataBarXLSX);
@@ -1503,6 +1505,23 @@ void ScFiltersTest::testChartImportODS()
xDocSh->DoClose();
}
+void ScFiltersTest::testChartImportXLS()
+{
+ ScDocShellRef xDocSh = loadDoc("chartx.", XLS);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load chartx.xls.", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ // Retrieve the chart object instance from the 2nd page (for the 2nd sheet).
+ const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 0);
+ CPPUNIT_ASSERT_MESSAGE("Failed to retrieve a chart object from the 2nd sheet.", pOleObj);
+
+ CPPUNIT_ASSERT_EQUAL(11148L, pOleObj->GetLogicRect().getWidth());
+ CPPUNIT_ASSERT_EQUAL(8635L, pOleObj->GetLogicRect().getHeight());
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testNumberFormatHTML()
{
ScDocShellRef xDocSh = loadDoc("numberformat.", HTML);
@@ -2679,3 +2698,4 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/sc/source/filter/inc/xlescher.hxx b/sc/source/filter/inc/xlescher.hxx
index a97882d5be40..90ef41c29e9e 100644
--- a/sc/source/filter/inc/xlescher.hxx
+++ b/sc/source/filter/inc/xlescher.hxx
@@ -321,6 +321,26 @@ inline SvStream& operator>>( SvStream& rStrm, XclObjAnchor& rAnchor )
return rStrm;
}
+// creates read method for XclImpStream
+template< typename StreamType >
+StreamType& operator>>( StreamType& rStrm, XclObjAnchor& rAnchor )
+{
+ sal_uInt16 tmpFirstRow, tmpTY, tmpLastRow, tmpBY;
+
+ rStrm
+ >> rAnchor.maFirst.mnCol >> rAnchor.mnLX
+ >> tmpFirstRow >> tmpTY
+ >> rAnchor.maLast.mnCol >> rAnchor.mnRX
+ >> tmpLastRow >> tmpBY;
+
+ rAnchor.maFirst.mnRow = static_cast<sal_uInt32> (tmpFirstRow);
+ rAnchor.mnTY = static_cast<sal_uInt32> (tmpTY);
+ rAnchor.maLast.mnRow = static_cast<sal_uInt32> (tmpLastRow);
+ rAnchor.mnBY = static_cast<sal_uInt32> (tmpBY);
+
+ return rStrm;
+}
+
template< typename StreamType >
StreamType& operator<<( StreamType& rStrm, const XclObjAnchor& rAnchor )
{