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

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 14:23:24 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf123621.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |   11 +++++++++++
 sw/source/core/layout/anchoreddrawobject.cxx |    4 +++-
 4 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit ee6cd34eb3a2bd1f1340063ee4b90a72ff0c9532
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Thu Jul 9 09:54:15 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jul 15 16:22:38 2020 +0200

    tdf#123621 sw: fix textbox position according to DOCX
    
    i.e. when spAutoFit is present in DOCX, and size of
    the textbox is relative.
    
    See also commit cab956c480eb4f619580285c7b9a15b9e6d9b780
    (tdf#112312 DOCX legacy shape export: keep fixed size).
    
    Co-authored-by: Attila Szűcs (NISZ)
    
    Change-Id: I29af97001954ad353a386164b68cd22f6230e3e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98401
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf123621.docx b/sw/qa/extras/ooxmlexport/data/tdf123621.docx
new file mode 100644
index 000000000000..471b6ef71e95
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123621.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 4c2027a8b6c7..259ac71cd4c7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -236,7 +236,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx")
     // Vertical position of the shape was incorrect due to incorrect nested mce handling.
     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
     // positionV's posOffset from the bugdoc, was 0.
-    CPPUNIT_ASSERT(6985 <= getProperty<sal_Int32>(xShape, "VertOrientPosition"));
+    CPPUNIT_ASSERT(6879 <= getProperty<sal_Int32>(xShape, "VertOrientPosition"));
     // This was -1 (default), make sure the background color is set.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape, "FillColor"));
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 6168211ce34e..f3d2df38cb3d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -29,6 +29,17 @@ protected:
     }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123621, "tdf123621.docx")
+{
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+
+    assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+        "/wp:positionV/wp:posOffset", "1080135");
+}
+
+
 DECLARE_OOXMLEXPORT_TEST(testTdf133334_followPgStyle, "tdf133334_followPgStyle.odt")
 {
     CPPUNIT_ASSERT_EQUAL(2, getPages());
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 1ea69271f202..cc84e0bc4597 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -34,6 +34,7 @@
 #include <viewimp.hxx>
 #include <textboxhelper.hxx>
 #include <unomid.h>
+#include <svx/svdoashp.hxx>
 
 using namespace ::com::sun::star;
 
@@ -681,8 +682,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const
             nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth());
         }
 
+        auto pObjCustomShape = dynamic_cast<const SdrObjCustomShape*>(GetDrawObj());
         long nTargetHeight = aCurrObjRect.GetHeight( );
-        if ( GetDrawObj( )->GetRelativeHeight( ) )
+        if ( GetDrawObj( )->GetRelativeHeight( ) && (!pObjCustomShape || !pObjCustomShape->IsAutoGrowHeight()) )
         {
             long nHeight = 0;
             if (GetDrawObj()->GetRelativeHeightRelation() == text::RelOrientation::FRAME)


More information about the Libreoffice-commits mailing list