diff options
author | yogesh.bharate001 <yogesh.bharate@synerzip.com> | 2015-04-16 19:24:37 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-09 19:55:31 +0000 |
commit | 3e4d2043e99201ec542186039e3be34d3c226111 (patch) | |
tree | f0d9070c2fd0ae282ad118a05d2c7be737ae79d4 /sd/qa/unit | |
parent | 3acb1d4b28944de908ffb3d0b756725ae015214f (diff) |
tdf#90190 PPTX table cell border width is not exported.
Problem:
- Table cell border width is not exported.
i.e lnL, lnR, lnT, LnB are not exported inside the tcPr.
XML Difference:
Original :
<a:lnT w = "76200">
After RT : tag is missing.
Solution : Added solution for Table cell border width.
Change-Id: I19185f2ad176325bf7990c9da6becc66557c717b
Reviewed-on: https://gerrit.libreoffice.org/15350
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/data/pptx/n90190.pptx | bin | 0 -> 32349 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 61 |
2 files changed, 59 insertions, 2 deletions
diff --git a/sd/qa/unit/data/pptx/n90190.pptx b/sd/qa/unit/data/pptx/n90190.pptx Binary files differnew file mode 100644 index 000000000000..ae83eb64f18f --- /dev/null +++ b/sd/qa/unit/data/pptx/n90190.pptx diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 56e4c6bc1c2f..78fce6b322d1 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -28,6 +28,7 @@ #include <rsc/rscsfx.hxx> + #include <svx/svdoutl.hxx> #include <svx/svdotext.hxx> #include <svx/svdoashp.hxx> @@ -59,6 +60,10 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/table/BorderLine2.hpp> +#include <com/sun/star/table/XTable.hpp> +#include <com/sun/star/table/XMergeableCell.hpp> + #include <svx/svdotable.hxx> #include <com/sun/star/table/XTable.hpp> #include <com/sun/star/table/XMergeableCell.hpp> @@ -93,6 +98,7 @@ public: void testLineStyle(); void testCellLeftAndRightMargin(); void testRightToLeftParaghraph(); + void testTableCellBorder(); #if !defined WNT void testBnc822341(); @@ -121,6 +127,7 @@ public: CPPUNIT_TEST(testLineStyle); CPPUNIT_TEST(testCellLeftAndRightMargin); CPPUNIT_TEST(testRightToLeftParaghraph); + CPPUNIT_TEST(testTableCellBorder); #if !defined WNT CPPUNIT_TEST(testBnc822341); @@ -837,7 +844,6 @@ void SdExportTest::testLineStyle() CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style",drawing::LineStyle_SOLID, rStyleItem.GetValue()); xDocShRef->DoClose(); - } void SdExportTest::testRightToLeftParaghraph() @@ -872,7 +878,6 @@ void SdExportTest::testRightToLeftParaghraph() xDocShRef->DoClose(); } - #if !defined WNT void SdExportTest::testBnc822341() @@ -951,6 +956,58 @@ void SdExportTest::testCellLeftAndRightMargin() xDocShRef->DoClose(); } +void SdExportTest::testTableCellBorder() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + + uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + + uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW ); + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + + const SdrPage *pPage = pDoc->GetPage(1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); + CPPUNIT_ASSERT( pTableObj ); + + table::BorderLine2 aBorderLine; + + uno::Reference< table::XTable > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference< com::sun::star::table::XMergeableCell > xCell(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xCellPropSet (xCell, uno::UNO_QUERY_THROW); + + xCellPropSet->getPropertyValue("LeftBorder") >>= aBorderLine; + sal_Int32 nLeftBorder = aBorderLine.LineWidth ; +// While importing the table cell border line width, it converts EMU->Hmm then divided result by 2. +// To get original value of LineWidth need to multiple by 2. + nLeftBorder = nLeftBorder * 2 ; + nLeftBorder = oox::drawingml::convertHmmToEmu( nLeftBorder ); + CPPUNIT_ASSERT(nLeftBorder); + + xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine; + sal_Int32 nRightBorder = aBorderLine.LineWidth ; + nRightBorder = nRightBorder * 2 ; + nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder ); + CPPUNIT_ASSERT(nRightBorder); + + xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine; + sal_Int32 nTopBorder = aBorderLine.LineWidth ; + nTopBorder = nTopBorder * 2 ; + nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder ); + CPPUNIT_ASSERT(nTopBorder); + + xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine; + sal_Int32 nBottomBorder = aBorderLine.LineWidth ; + nBottomBorder = nBottomBorder * 2 ; + nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder ); + CPPUNIT_ASSERT(nBottomBorder); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |