diff options
author | Justin Luth <justin_luth@sil.org> | 2019-01-08 18:14:52 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-01-11 04:08:46 +0100 |
commit | 8d4a7b17e60aa889d1a78da47630aae2d1c1513c (patch) | |
tree | 8f49b9cc7537aac12eef4fc42c547078ea6b3756 /sw | |
parent | a2d2f0b30b75093b6ab517349f6db0649314495f (diff) |
writerfilter: import section margins and writingMode
Previously, only page styles got these values. But if the
section is continuous, then these properties should
be transferred to the section itself.
This patch relies on the commit for tdf#122456. It confirms
that it is a good idea for the last section to ignore
the "fake" section and keep the real section properties.
Otherwise these margins would be lost on export.
Change-Id: I45efb0d80fb9307a57ff560b2e1a26899155f827
Reviewed-on: https://gerrit.libreoffice.org/65975
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/endingSectionProps.docx | bin | 0 -> 6506 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/endingSectionProps.docx b/sw/qa/extras/ooxmlexport/data/endingSectionProps.docx Binary files differnew file mode 100644 index 000000000000..e5dee2f60d51 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/endingSectionProps.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 6d7a3a2b618e..b22c5cd96083 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> @@ -50,6 +51,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF2, "tdf121374_sectionHF2.doc") CPPUNIT_ASSERT( xHeaderText->getString().startsWith("virkamatka-anomus") ); } +DECLARE_OOXMLEXPORT_TEST(testendingSectionProps, "endingSectionProps.docx") +{ + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xHeaderText = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, "HeaderText"); + CPPUNIT_ASSERT_EQUAL( OUString("General header"), xHeaderText->getString()); + + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xSect(xSections->getByIndex(0), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of paragraphs", 2, getParagraphs()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section is RightToLeft", text::WritingMode2::RL_TB, getProperty<sal_Int16>(xSect, "WritingMode")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(2540), getProperty<sal_Int32>(xSect, "SectionLeftMargin")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |