tdf#132483: DOCX import: fix OLE anchoring position

The relative orientation of OLE objects was
not copied from the replacement object to
OLE, resulting bad position.

Co-authored-by: Attila Bánhegyi (NISZ)

Change-Id: If62124e5a40218a224e047efbe86a09606b44af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102565
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf132483.docx b/sw/qa/extras/ooxmlexport/data/tdf132483.docx
new file mode 100644
index 0000000..e4ebf4b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf132483.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index f17d9ad..792e919 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -11,6 +11,7 @@

#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/RelOrientation.hpp>

char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";

@@ -178,6 +179,19 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1147), nAnchoredHeight);
}

DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
{
    uno::Reference<beans::XPropertySet> xOLEProps(getShape(1), uno::UNO_QUERY_THROW);
    sal_Int16 nVRelPos = -1;
    sal_Int16 nHRelPos = -1;
    xOLEProps->getPropertyValue("VertOrientRelation") >>= nVRelPos;
    xOLEProps->getPropertyValue("HoriOrientRelation") >>= nHRelPos;
    CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted vertically",
        text::RelOrientation::PAGE_FRAME , nVRelPos);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted horizontally",
        text::RelOrientation::PAGE_FRAME , nHRelPos);
}

DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
                         "tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx")
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0f468e4..3c6d165 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2228,7 +2228,9 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, const std::share
                OUString("HoriOrient"),
                OUString("HoriOrientPosition"),
                OUString("VertOrient"),
                OUString("VertOrientPosition")
                OUString("VertOrientPosition"),
                OUString("VertOrientRelation"),
                OUString("HoriOrientRelation")
            };
            for (const OUString & s : pProperties)
                xOLEProperties->setPropertyValue(s, xReplacementProperties->getPropertyValue(s));