tdf#131540 DOCX export: fix OLE position in v:shape
If the OLE icon was anchored to page, it moved a bit,
because exporting mso-position-horizontal-relative:text
instead of mso-position-horizontal-relative:page in v:shape.
Change-Id: I4eb7bdd648a9b9b6aee48782a0086e82cfc55107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108938
Tested-by: Jenkins
Reviewed-by: Balazs Varga <varga.balazs3@nisz.hu>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131540.odt b/sw/qa/extras/ooxmlexport/data/tdf131540.odt
new file mode 100755
index 0000000..541ab20
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf131540.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index b363d26..997bf88 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -46,6 +46,15 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123621, "tdf123621.docx")
"/wp:positionV/wp:posOffset", "1080135");
}
DECLARE_OOXMLEXPORT_TEST(testTdf131540, "tdf131540.odt")
{
// There are 2 OLEs test if one of them moved on save:
CPPUNIT_ASSERT_EQUAL_MESSAGE("The shape1 moved on saving!", text::RelOrientation::PAGE_FRAME,
getProperty<sal_Int16>(getShape(1), "HoriOrientRelation"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("The shape2 moved on saving!", text::RelOrientation::PAGE_FRAME,
getProperty<sal_Int16>(getShape(2), "HoriOrientRelation"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf131801, "tdf131801.docx")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 991f633..1808db7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5848,8 +5848,14 @@ OString DocxAttributeOutput::GetOLEStyle(const SwFlyFrameFormat& rFormat, const
//Get the vertical alignment of the OLE via the frame format to aVAlign
OString aVAlign = convertToOOXMLVertOrient(rFormat.GetVertOrient().GetVertOrient());
// Check if the OLE anchored to page:
const bool bIsPageAnchor = rFormat.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE;
//Get the relative horizontal positions for the anchors
OString aHAnch = convertToOOXMLHoriOrientRel(rFormat.GetHoriOrient().GetRelationOrient());
OString aHAnch
= bIsPageAnchor
? OString("page")
: convertToOOXMLHoriOrientRel(rFormat.GetHoriOrient().GetRelationOrient());
//Get the relative vertical positions for the anchors
OString aVAnch = convertToOOXMLVertOrientRel(rFormat.GetVertOrient().GetRelationOrient());