summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-04-29 19:19:37 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-04-29 22:17:52 +0200
commitfc620901ddd134f644a56ed4ea4a9b5446cc5675 (patch)
treeac169f0828ddb5463cf1c1103732d766308cc1ba
parent72ceb3ebb76cbb2888b413464730c15adc4f504b (diff)
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@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/qa/extras/ooxmlexport/data/page-content-bottom.docxbin0 -> 5007 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx11
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx3
-rw-r--r--writerfilter/source/dmapper/GraphicHelpers.cxx4
4 files changed, 18 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/page-content-bottom.docx
Binary files 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;