sc/qa/unit/data/xls/chartx.xls |binary sc/qa/unit/subsequent_filters-test.cxx | 20 ++++++++++++++++++++ sc/source/filter/inc/xlescher.hxx | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+)
New commits: commit 6b5481c0260343800518192918ddf932ee5ae527 Author: Noel Grandin <n...@peralex.com> Date: Thu Nov 27 14:58:39 2014 +0200 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.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/qa/unit/data/xls/chartx.xls b/sc/qa/unit/data/xls/chartx.xls new file mode 100644 index 0000000..2294c15 Binary files /dev/null and b/sc/qa/unit/data/xls/chartx.xls differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index be1955d..39a75c1 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 a97882d..90ef41c 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 ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits