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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 29 20:18:25 UTC 2020


 sw/qa/extras/ooxmlexport/data/page-content-bottom.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx             |   11 +++++++++++
 sw/source/filter/ww8/docxsdrexport.cxx                 |    3 +++
 writerfilter/source/dmapper/GraphicHelpers.cxx         |    4 ++++
 4 files changed, 18 insertions(+)

New commits:
commit fc620901ddd134f644a56ed4ea4a9b5446cc5675
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Apr 29 19:19:37 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Apr 29 22:17:52 2020 +0200

    sw from-bottom relative orientation: add DOCX filter
    
    The OOXML equivalent is <wp:positionV relativeFrom="bottomMargin">, and
    the position is typically a negative number (i.e. the position is the
    offset between the top of the shape and the top of the top or bottom
    margin; not the distance and it's always the top of some margin).
    
    Change-Id: Ia979bc8bfaa37d29b0947c4408335e0a80c05880
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93172
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/page-content-bottom.docx b/sw/qa/extras/ooxmlexport/data/page-content-bottom.docx
new file mode 100644
index 000000000000..f955586f3916
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/page-content-bottom.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 6e605844809b..d751393800ec 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -418,6 +418,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123116_oversizedRowSplit, "tdf123116_oversizedRo
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 4 pages", 4, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testPageContentBottom, "page-content-bottom.docx")
+{
+    uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+    sal_Int16 nExpected = text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 10 (PAGE_PRINT_AREA_BOTTOM)
+    // - Actual  : 0 (FRAME)
+    // i.e. the bottom-of-body relation was lost.
+    CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt")
 {
     uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 66ab33a15ac9..2ae2ab3bd748 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -511,6 +511,9 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
             case text::RelOrientation::PAGE_PRINT_AREA:
                 relativeFromV = "margin";
                 break;
+            case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM:
+                relativeFromV = "bottomMargin";
+                break;
             case text::RelOrientation::PAGE_FRAME:
                 relativeFromV = "page";
                 break;
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 95873b512d26..a2275d95be4a 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -71,6 +71,10 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal )
                         m_nRelation =  text::RelOrientation::PAGE_FRAME;
                         break;
 
+                    case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_bottomMargin:
+                        m_nRelation = text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
+                        break;
+
                     case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph:
                         m_nRelation = text::RelOrientation::FRAME;
                         break;


More information about the Libreoffice-commits mailing list