From c2a20af2c12bf75e7378a3a9dbc50a4dddabdebc Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 22 Dec 2016 13:50:17 +0300 Subject: [PATCH] tdf#66405: imported formulas should have all margins set to 0 Currently, imported formulas use default Math object's margins, that are 2 mm left & right for embedded object and 1 mm left & right for its model. Before commit eae2331f83bd58bacccd898d60f6c5f54856c036, there was also 3.5 mm bottom margin for embedded object. This commit sets all margins to 0. Unit test is included. Change-Id: I23c78d4cedaeba8f2a70a000dca8e31de20bcab2 Reviewed-on: https://gerrit.libreoffice.org/32334 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/qa/extras/uiwriter/data/tdf66405.docx | Bin 0 -> 13857 bytes sw/qa/extras/uiwriter/uiwriter.cxx | 35 ++++++++++++++++++ .../source/dmapper/DomainMapper_Impl.cxx | 19 ++++++++++ 3 files changed, 54 insertions(+) create mode 100644 sw/qa/extras/uiwriter/data/tdf66405.docx diff --git a/sw/qa/extras/uiwriter/data/tdf66405.docx b/sw/qa/extras/uiwriter/data/tdf66405.docx new file mode 100644 index 0000000000000000000000000000000000000000..398b0ce77a1153993481c2e0ca9ab07e73be9d31 GIT binary patch literal 13857 zcmeHuWmsIF(9^u6M6py=v84((+PZ;OGEI05kvqAOXOTe+Uc!0RW;Q001-qG^m!4ovpKpt+Sr8 zhrNlD4!ygLHE}LDC}lPP6nOrBkN?FQs7sKM3wn%@Bl;r0rP#$V4#W^`oT2L~Z!ckh2%5MYr zNg~+6L&6pa`PK-7qP-)L-OeWfveI|SHKgEf1DwO4bzNV%7@a?9Rf=S5@o&oxA~Ava zt{$!0TgU*=w&X3UHa9>VnHYpvb*HvdzY2xZwp8kUX;XZgPLqfpApX!}yso`fE+m+k z=2j(-SP30;q59!)r>eW*G$r?fI>?;V+Z{EP@qYTpM>ExNwwqY|&la0?9u?%QH;JiN zs-UDM6(jkaQ-Uc3uL6khN2up#RFFvocUW5X4HFJ%xq6N!)=mucKcD|=vHy$B^iQ|`@zb&-m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iwriter/uiwriter.cxx @@ -220,6 +220,7 @@ public: void testTdf104440(); void testTdf104425(); void testTdf104814(); + void testTdf66405(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -336,6 +337,7 @@ public: CPPUNIT_TEST(testTdf104440); CPPUNIT_TEST(testTdf104425); CPPUNIT_TEST(testTdf104814); + CPPUNIT_TEST(testTdf66405); CPPUNIT_TEST_SUITE_END(); private: @@ -4159,6 +4161,39 @@ void SwUiWriterTest::testTdf104814() pEditShell->AcceptRedline(0); } +void SwUiWriterTest::testTdf66405() +{ + // Imported formula should have zero margins + createDoc("tdf66405.docx"); + uno::Reference xEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xEmbeddedObjects = xEmbeddedObjectsSupplier->getEmbeddedObjects(); + uno::Reference xFormula; + xEmbeddedObjects->getByName(xEmbeddedObjects->getElementNames()[0]) >>= xFormula; + uno::Reference xComponent; + xFormula->getPropertyValue("Component") >>= xComponent; + + // Test embedded object's margins + sal_Int32 nLeftMargin, nRightMargin, nTopMargin, nBottomMargin; + xFormula->getPropertyValue("LeftMargin") >>= nLeftMargin; + xFormula->getPropertyValue("RightMargin") >>= nRightMargin; + xFormula->getPropertyValue("TopMargin") >>= nTopMargin; + xFormula->getPropertyValue("BottomMargin") >>= nBottomMargin; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nLeftMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nRightMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin); + + // Test embedded object component's margins + xComponent->getPropertyValue("LeftMargin") >>= nLeftMargin; + xComponent->getPropertyValue("RightMargin") >>= nRightMargin; + xComponent->getPropertyValue("TopMargin") >>= nTopMargin; + xComponent->getPropertyValue("BottomMargin") >>= nBottomMargin; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nLeftMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nRightMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 07e008feb32e..3278f9237538 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1424,8 +1424,27 @@ void DomainMapper_Impl::appendStarMath( const Value& val ) xStarMathProperties->setPropertyValue(getPropertyName( PROP_EMBEDDED_OBJECT ), val.getAny()); + // tdf#66405: set zero margins for embedded object + xStarMathProperties->setPropertyValue(getPropertyName( PROP_LEFT_MARGIN ), + uno::makeAny(sal_Int32(0))); + xStarMathProperties->setPropertyValue(getPropertyName( PROP_RIGHT_MARGIN ), + uno::makeAny(sal_Int32(0))); + xStarMathProperties->setPropertyValue(getPropertyName( PROP_TOP_MARGIN ), + uno::makeAny(sal_Int32(0))); + xStarMathProperties->setPropertyValue(getPropertyName( PROP_BOTTOM_MARGIN ), + uno::makeAny(sal_Int32(0))); uno::Reference< uno::XInterface > xInterface( formula->getComponent(), uno::UNO_QUERY ); + // set zero margins for object's component + uno::Reference< beans::XPropertySet > xComponentProperties( xInterface, uno::UNO_QUERY_THROW ); + xComponentProperties->setPropertyValue(getPropertyName( PROP_LEFT_MARGIN ), + uno::makeAny(sal_Int32(0))); + xComponentProperties->setPropertyValue(getPropertyName( PROP_RIGHT_MARGIN ), + uno::makeAny(sal_Int32(0))); + xComponentProperties->setPropertyValue(getPropertyName( PROP_TOP_MARGIN ), + uno::makeAny(sal_Int32(0))); + xComponentProperties->setPropertyValue(getPropertyName( PROP_BOTTOM_MARGIN ), + uno::makeAny(sal_Int32(0))); Size size( 1000, 1000 ); if( oox::FormulaImportBase* formulaimport = dynamic_cast< oox::FormulaImportBase* >( xInterface.get())) size = formulaimport->getFormulaSize();