oox/source/token/properties.txt                   |    1 +
 oox/source/vml/vmlshape.cxx                       |    1 +
 sw/qa/extras/ooxmlexport/data/tdf135665.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx        |   13 +++++++++++++
 sw/source/core/unocore/unoframe.cxx               |    8 ++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    1 +
 6 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 4b7ee7bd61f78be60211cc72ba36da987191266e
Author:     Daniel Arato (NISZ) <arato.dan...@nisz.hu>
AuthorDate: Wed Sep 2 15:46:56 2020 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Sep 7 13:11:44 2020 +0200

    tdf#135665 DOCX: import tight wrap setting of VML shapes
    
    The wrap setting that OOXML calls "tight" and LibreOffice calls
    "contour" (== true) was not supported by the import code, only
    the export.
    
    Change-Id: I48739ffaad48e28df05fd87a9b51a14238dc47e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101932
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 46200bf221ff..d50cd4bb124d 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -509,6 +509,7 @@ SubViewSize
 Subtotals
 Suffix
 Surround
+SurroundContour
 SwapXAndYAxis
 Symbol
 SymbolColor
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 85ad112bcfae..f8a4c9000e66 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -588,6 +588,7 @@ static void lcl_setSurround(PropertySet& rPropSet, const 
ShapeTypeModel& rTypeMo
         nSurround = css::text::WrapTextMode_NONE;
 
     rPropSet.setProperty(PROP_Surround, static_cast<sal_Int32>(nSurround));
+    rPropSet.setProperty(PROP_SurroundContour, aWrapType == "tight");
 }
 
 static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& 
rTypeModel, const GraphicHelper& rGraphicHelper)
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135665.docx 
b/sw/qa/extras/ooxmlexport/data/tdf135665.docx
new file mode 100644
index 000000000000..2400a1c1a46c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135665.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 4e39a5af0297..95770433a6ab 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -513,6 +513,19 @@ DECLARE_OOXMLIMPORT_TEST(TestTdf135653, "tdf135653.docx")
     CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE bg color does not match!", 
aExpectedColor, aFillColor);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf135665, "tdf135665.docx")
+{
+    uno::Reference<beans::XPropertySet> xOLEProps1(getShape(1), 
uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xOLEProps2(getShape(2), 
uno::UNO_QUERY_THROW);
+    bool bSurroundContour1 = false;
+    bool bSurroundContour2 = false;
+    xOLEProps1->getPropertyValue("SurroundContour") >>= bSurroundContour1;
+    xOLEProps2->getPropertyValue("SurroundContour") >>= bSurroundContour2;
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported 
correctly", true, bSurroundContour1);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported 
correctly", false, bSurroundContour2);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAtPageShapeRelOrientation, 
"rotated_shape.fodt")
 {
     // invalid combination of at-page anchor and horizontal-rel="paragraph"
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index 2d122992d840..5d7b86fc37e0 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -752,15 +752,19 @@ bool 
BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
         bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE);
         rToSet.Put(aSh);
     }
-    const ::uno::Any* pSur      = nullptr;
+    const ::uno::Any* pSur     = nullptr;
     GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
+    const ::uno::Any* pSurCont = nullptr;
+    GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurCont);
     const ::uno::Any* pSurAnch = nullptr;
     GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
     if(pSur || pSurAnch)
     {
         SwFormatSurround aSrnd ( rFromSet.Get ( RES_SURROUND ) );
         if(pSur)
-            bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, 
MID_SURROUND_SURROUNDTYPE );
+            bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, 
MID_SURROUND_SURROUNDTYPE);
+        if(pSurCont)
+            bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurCont, 
MID_SURROUND_CONTOUR);
         if(pSurAnch)
             bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurAnch, 
MID_SURROUND_ANCHORONLY);
         rToSet.Put(aSrnd);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0347453d6704..ec83a7c2d5f9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2258,6 +2258,7 @@ void DomainMapper_Impl::appendOLE( const OUString& 
rStreamName, const std::share
             OUString pProperties[] = {
                 "AnchorType",
                 "Surround",
+                "SurroundContour",
                 "HoriOrient",
                 "HoriOrientPosition",
                 "VertOrient",
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to