oox/source/vml/vmlshape.cxx | 9 +++++++++ sw/qa/extras/ooxmlexport/data/tdf135660.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 20 ++++++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++++ 4 files changed, 33 insertions(+)
New commits: commit 8ee88230c110ae90b439a52bc2906d6c5383967f Author: Daniel Arato (NISZ) <[email protected]> AuthorDate: Mon Sep 7 11:50:53 2020 +0200 Commit: László Németh <[email protected]> CommitDate: Fri Sep 11 10:19:18 2020 +0200 tdf#135660 DOCX import: fix OLE icon wrap distance The text wrap distance (also sometimes called "margin") of OLE VML icons used to be thrown away when a .docx file is opened. Change-Id: I79837421470dde5e68e916f87924b170ebf1d734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102159 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index f8a4c9000e66..905548bafb9e 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -911,6 +911,15 @@ Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper); + const sal_Int32 nWrapDistanceLeft = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceLeft, 0, true, true); + const sal_Int32 nWrapDistanceRight = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceRight, 0, true, true); + const sal_Int32 nWrapDistanceTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceTop, 0, false, true); + const sal_Int32 nWrapDistanceBottom = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maWrapDistanceBottom, 0, false, true); + aPropSet.setProperty(PROP_LeftMargin, uno::makeAny(nWrapDistanceLeft)); + aPropSet.setProperty(PROP_RightMargin, uno::makeAny(nWrapDistanceRight)); + aPropSet.setProperty(PROP_TopMargin, uno::makeAny(nWrapDistanceTop)); + aPropSet.setProperty(PROP_BottomMargin, uno::makeAny(nWrapDistanceBottom)); + if (maTypeModel.moCropBottom.has() || maTypeModel.moCropLeft.has() || maTypeModel.moCropRight.has() || maTypeModel.moCropTop.has()) { text::GraphicCrop aGraphicCrop; diff --git a/sw/qa/extras/ooxmlexport/data/tdf135660.docx b/sw/qa/extras/ooxmlexport/data/tdf135660.docx new file mode 100644 index 000000000000..2309c9b0ac09 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135660.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 104e867a33ba..5aad7cc44f0e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -674,6 +674,26 @@ DECLARE_OOXMLEXPORT_TEST(testImageSpaceSettings, "tdf135047_ImageSpaceSettings.f assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distR", "90170"); } +// TODO: change this to an export test once wrap distance export (TDF#135663) is implemented +DECLARE_OOXMLIMPORT_TEST(testTdf13660, "tdf135660.docx") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + const uno::Reference<drawing::XShape> xShape = getShape(1); + const uno::Reference<beans::XPropertySet> xOLEProps(xShape, uno::UNO_QUERY_THROW); + sal_Int32 nWrapDistanceLeft = -1; + sal_Int32 nWrapDistanceRight = -1; + sal_Int32 nWrapDistanceTop = -1; + sal_Int32 nWrapDistanceBottom = -1; + xOLEProps->getPropertyValue("LeftMargin") >>= nWrapDistanceLeft; + xOLEProps->getPropertyValue("RightMargin") >>= nWrapDistanceRight; + xOLEProps->getPropertyValue("TopMargin") >>= nWrapDistanceTop; + xOLEProps->getPropertyValue("BottomMargin") >>= nWrapDistanceBottom; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Left wrap distance is wrong", static_cast<sal_Int32>(0), nWrapDistanceLeft); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Right wrap distance is wrong", static_cast<sal_Int32>(400), nWrapDistanceRight); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Top wrap distance is wrong", static_cast<sal_Int32>(300), nWrapDistanceTop); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bottom wrap distance is wrong", static_cast<sal_Int32>(199), nWrapDistanceBottom); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6387d22b12a3..fc9c13e9c562 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2271,6 +2271,10 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, const std::share "VertOrientPosition", "VertOrientRelation", "HoriOrientRelation", + "LeftMargin", + "RightMargin", + "TopMargin", + "BottomMargin", "FillStyle", "FillColor", "FillColor2", _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
