oox/source/vml/vmlshape.cxx                       |    2 -
 sw/qa/extras/layout/data/tdf138465min.docx        |binary
 sw/qa/extras/layout/layout2.cxx                   |   16 ++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   29 ++++++++++++++--------
 4 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit 2b20826a6a5d06a9e47c90918375a40465567716
Author:     Attila Bakos (NISZ) <bakos.attilakar...@nisz.hu>
AuthorDate: Thu Feb 18 13:42:00 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Mar 1 12:58:04 2021 +0100

    tdf#136570 OOXML import: fix height of OLE objects
    
    e.g. OLE icons or math formulas by skipping unset
    border properties.
    
    Regression from 636d16efe45a55c1a5a7a451c46fbb8618bf0393
    (tdf#135653 OOXML import: fix OLE background color).
    
    Change-Id: I64bd68037d063de81fbb302b90d65b77af50a622
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111119
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit ca7855c24af858f52a11a593761ee9e6b9d6ba79)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111581
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 7ee10203341e..5bceff932a24 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1454,7 +1454,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( 
const Reference< XShapes
         oox::drawingml::ShapePropertyMap 
aPropMap(mrDrawing.getFilter().getModelObjectHelper());
         const GraphicHelper& rGraphicHelper = 
mrDrawing.getFilter().getGraphicHelper();
         maTypeModel.maStrokeModel.pushToPropMap(aPropMap, rGraphicHelper);
-        //And, fill-color properties as well...
+        // And, fill-color properties as well...
         maTypeModel.maFillModel.pushToPropMap(aPropMap, rGraphicHelper);
         PropertySet(xShape).setProperties(aPropMap);
 
diff --git a/sw/qa/extras/layout/data/tdf138465min.docx 
b/sw/qa/extras/layout/data/tdf138465min.docx
new file mode 100755
index 000000000000..d576a54f281f
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf138465min.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 46ce68a04572..ff07375bfabb 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -488,6 +488,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425)
     assertXPath(pXmlDoc, "//textarray", 14);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUnusedOLEprops)
+{
+    CPPUNIT_ASSERT(createDoc("tdf138465min.docx"));
+
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    CPPUNIT_ASSERT(pXmlDoc);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: >300
+    // - Actual  : 142
+    // i.e. the formula squashed
+    CPPUNIT_ASSERT_GREATEREQUAL(
+        double(300),
+        getXPath(pXmlDoc, 
"/root/page/body/txt[2]/anchored/fly/notxt/infos/bounds", "height")
+            .toDouble());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268)
 {
     SwDoc* pDoc = createDoc("tdf123268.odt");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2d79c618b8a1..ee7cf88dfbc8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2303,11 +2303,13 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
             xReplacementProperties->getPropertyValue("LineWidth") >>= 
aBorderProps.LineWidth;
             xReplacementProperties->getPropertyValue("LineStyle") >>= 
aBorderProps.LineStyle;
 
-            xOLEProperties->setPropertyValue("RightBorder", 
uno::Any(aBorderProps));
-            xOLEProperties->setPropertyValue("TopBorder", 
uno::Any(aBorderProps));
-            xOLEProperties->setPropertyValue("LeftBorder", 
uno::Any(aBorderProps));
-            xOLEProperties->setPropertyValue("BottomBorder", 
uno::Any(aBorderProps));
-
+            if (aBorderProps.LineStyle) // Set line props only if LineStyle is 
set
+            {
+                xOLEProperties->setPropertyValue("RightBorder", 
uno::Any(aBorderProps));
+                xOLEProperties->setPropertyValue("TopBorder", 
uno::Any(aBorderProps));
+                xOLEProperties->setPropertyValue("LeftBorder", 
uno::Any(aBorderProps));
+                xOLEProperties->setPropertyValue("BottomBorder", 
uno::Any(aBorderProps));
+            }
             OUString pProperties[] = {
                 "AnchorType",
                 "Surround",
@@ -2321,17 +2323,24 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
                 "LeftMargin",
                 "RightMargin",
                 "TopMargin",
-                "BottomMargin",
-                "FillStyle",
-                "FillColor",
-                "FillColor2",
-                "LineStyle",
+                "BottomMargin"
             };
             for (const OUString& s : pProperties)
             {
                 const uno::Any aVal = 
xReplacementProperties->getPropertyValue(s);
                 xOLEProperties->setPropertyValue(s, aVal);
             }
+
+            if 
(xReplacementProperties->getPropertyValue("FillStyle").get<css::drawing::FillStyle>()
+                != css::drawing::FillStyle::FillStyle_NONE) // Apply fill 
props if style is set
+            {
+                xOLEProperties->setPropertyValue(
+                    "FillStyle", 
xReplacementProperties->getPropertyValue("FillStyle"));
+                xOLEProperties->setPropertyValue(
+                    "FillColor", 
xReplacementProperties->getPropertyValue("FillColor"));
+                xOLEProperties->setPropertyValue(
+                    "FillColor2", 
xReplacementProperties->getPropertyValue("FillColor2"));
+            }
         }
         else
             // mimic the treatment of graphics here... it seems anchoring as 
character
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to