sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |    3 +--
 sw/source/filter/ww8/docxattributeoutput.cxx |   11 +++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 17984bf6a57b2c445c2fb9a748e90a74981fcdc8
Author:     Daniel Arato (NISZ) <arato.dan...@nisz.hu>
AuthorDate: Wed Sep 9 13:37:03 2020 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Sep 16 15:16:53 2020 +0200

    tdf#135663 DOCX export: fix OLE distance from text
    
    Implements the export of the "mso-wrap-distance-*" properties of
    VML icons of OLE objects to the "style" property of the "object" XML
    tag. These properties are variously referred to as "wrap distance",
    "margin" or "spacing" and they control the amount of blank space to
    be left on each side of the object before text can appear.
    
    Follow-up of commit 8ee88230c110ae90b439a52bc2906d6c5383967f
    (tdf#135660 DOCX import: fix OLE icon wrap distance).
    
    Change-Id: I576b876d2dca133b0ff593ff301519c17d2a348f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102323
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 667695b96f70..682343c782af 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -945,7 +945,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf122563, 
"tdf122563.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 1);
     // Size of the embedded OLE spreadsheet was the bad 
"width:28.35pt;height:28.35pt"
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:object/v:shape", 
"style",
-                "width:255.75pt;height:63.75pt");
+                "width:255.75pt;height:63.75pt;mso-wrap-distance-right:0pt");
 }
 
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf94628, "tdf94628.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 902d1c9df6a2..39a9b103308a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -691,8 +691,7 @@ 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")
+DECLARE_OOXMLEXPORT_TEST(testTdf135660, "tdf135660.docx")
 {
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     const uno::Reference<drawing::XShape> xShape = getShape(1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 54cae24fe730..caaaf440ddc3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5825,6 +5825,17 @@ OString DocxAttributeOutput::GetOLEStyle(const 
SwFlyFrameFormat& rFormat, const
                         "pt;height:" + OString::number( double( rSize.Height() 
) / 20 ) +
                         "pt"; //from VMLExport::AddRectangleDimensions(), it 
does: value/20
 
+    const SvxLRSpaceItem& rLRSpace = rFormat.GetLRSpace();
+    if (rLRSpace.IsExplicitZeroMarginValLeft() || rLRSpace.GetLeft())
+        sShapeStyle += ";mso-wrap-distance-left:" + 
OString::number(double(rLRSpace.GetLeft()) / 20) + "pt";
+    if (rLRSpace.IsExplicitZeroMarginValRight() || rLRSpace.GetRight())
+        sShapeStyle += ";mso-wrap-distance-right:" + 
OString::number(double(rLRSpace.GetRight()) / 20) + "pt";
+    const SvxULSpaceItem& rULSpace = rFormat.GetULSpace();
+    if (rULSpace.GetUpper())
+        sShapeStyle += ";mso-wrap-distance-top:" + 
OString::number(double(rULSpace.GetUpper()) / 20) + "pt";
+    if (rULSpace.GetLower())
+        sShapeStyle += ";mso-wrap-distance-bottom:" + 
OString::number(double(rULSpace.GetLower()) / 20) + "pt";
+
     //Export anchor setting, if it exists
     if (!aPos.isEmpty() && !aAnch.isEmpty())
         sShapeStyle = aPos + sShapeStyle  + aAnch;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to