diff options
author | yogesh.bharate001 <yogesh.bharate@synerzip.com> | 2015-03-26 10:48:15 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-21 22:42:18 +0000 |
commit | 636c5a63d67b52b0d2f9f21a863c45eca6ac9ff7 (patch) | |
tree | c06912f8dc29b453fd80212e2c80147e684f33a7 /sd | |
parent | da36fc8c9564199b8c2f8f28c2e4d04d9862a2d4 (diff) |
tdf#90223:PPTX table cell left and right margin is not exported.
Problem Description :
- After roundtripping, when we open .pptx in MSO2010 or LibreOffice,
tcPr marL & marR values doesnot exported.
- Due to this cell text formatting changes.
XML difference:
Original :
<a:tcPr marL="45720" marR="45720">
After RT :
<a:tcPr/>
Solution : Added support for table cell left and right margin.
Conflicts:
sd/qa/unit/export-tests.cxx
Change-Id: I45f7b796155fd4445acbf19133954aadaf70890d
Reviewed-on: https://gerrit.libreoffice.org/15015
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rwxr-xr-x | sd/qa/unit/data/pptx/n90223.pptx | bin | 0 -> 83910 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 46 |
2 files changed, 46 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/n90223.pptx b/sd/qa/unit/data/pptx/n90223.pptx Binary files differnew file mode 100755 index 000000000000..0a9ee82d8e59 --- /dev/null +++ b/sd/qa/unit/data/pptx/n90223.pptx diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 60a209b84676..8472ce189c19 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -24,6 +24,8 @@ #include <editeng/postitem.hxx> #include <editeng/bulletitem.hxx> +#include <oox/drawingml/drawingmltypes.hxx> + #include <rsc/rscsfx.hxx> #include <svx/svdoutl.hxx> @@ -57,6 +59,8 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <svx/svdotable.hxx> +#include <com/sun/star/table/XTable.hpp> +#include <com/sun/star/table/XMergeableCell.hpp> #include <config_features.h> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -86,6 +90,8 @@ public: void testTableCellFillProperties(); void testBulletStartNumber(); void testLineStyle(); + void testCellLeftAndRightMargin(); + #if !defined WNT void testBnc822341(); #endif @@ -111,6 +117,7 @@ public: CPPUNIT_TEST(testTableCellFillProperties); CPPUNIT_TEST(testBulletStartNumber); CPPUNIT_TEST(testLineStyle); + CPPUNIT_TEST(testCellLeftAndRightMargin); #if !defined WNT CPPUNIT_TEST(testBnc822341); #endif @@ -868,6 +875,45 @@ void SdExportTest::testBnc822341() #endif +void SdExportTest::testCellLeftAndRightMargin() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + sal_Int32 nLeftMargin, nRightMargin; + + 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 ); + + uno::Reference< com::sun::star::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); + + uno::Any aLeftMargin = xCellPropSet->getPropertyValue("TextLeftDistance"); + aLeftMargin >>= nLeftMargin ; + + uno::Any aRightMargin = xCellPropSet->getPropertyValue("TextRightDistance"); + aRightMargin >>= nRightMargin ; + + // Convert values to EMU + nLeftMargin = oox::drawingml::convertHmmToEmu( nLeftMargin ); + nRightMargin = oox::drawingml::convertHmmToEmu( nRightMargin ); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nLeftMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nRightMargin); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |