[Libreoffice-commits] core.git: sw/qa sw/source

Attila Bakos (NISZ) (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 20 11:19:18 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf131540.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    8 +++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit eedf45f6b18e3466caf72f7ee56856e4aae11cf6
Author:     Attila Bakos (NISZ) <bakos.attilakaroly at nisz.hu>
AuthorDate: Thu Jan 7 13:46:43 2021 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jan 20 12:18:36 2021 +0100

    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 at nisz.hu>
    Reviewed-by: László Németh <nemeth at 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 000000000000..541ab2093156
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131540.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index b363d261fbf7..997bf888e403 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 991f6335539b..1808db7a3369 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());
 


More information about the Libreoffice-commits mailing list