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 <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 46200bf..d50cd4b 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 85ad112..f8a4c90 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 0000000..2400a1c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135665.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 4e39a5a..9577043 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 2d12299..5d7b86f 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 0347453..ec83a7c 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",