diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-10-29 15:49:18 +0000 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-10-29 16:43:27 +0000 |
commit | 24e522f723569b53d9a830166b3825292bcd7527 (patch) | |
tree | 70e0de676d70739b45fcf6ba9a5428952b28f633 /sw | |
parent | f351b3624de79b5806a066202a3a0d6fa59c8469 (diff) |
tdf#103753: DOCX: Handle relative positions to left or right margin
Positioning relative to left or right margin in MS Word
works the same as the positioning relative to left or right
page border in LO Writer.
Change-Id: I476a5e9e76f766b7fb7f1c7f4a068af8bb3c8813
Reviewed-on: https://gerrit.libreoffice.org/30376
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf103573.docx | bin | 0 -> 16155 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103573.docx b/sw/qa/extras/ooxmlexport/data/tdf103573.docx Binary files differnew file mode 100644 index 000000000000..34d7e3367d9e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf103573.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 5ee0ff47884f..a580bc99bc49 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -18,6 +18,8 @@ #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> class Test : public SwModelTestBase { @@ -85,6 +87,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103544, "tdf103544.docx") CPPUNIT_ASSERT(xGraphic.is()); } +DECLARE_OOXMLEXPORT_TEST(testTdf103573, "tdf103573.docx") +{ + // Relative positions to the left or right margin (MS Word naming) was not handled. + uno::Reference<beans::XPropertySet> xShapeProperties( getShape(1), uno::UNO_QUERY ); + sal_Int16 nValue; + xShapeProperties->getPropertyValue("HoriOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER, nValue); + xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to left page border", text::RelOrientation::PAGE_LEFT, nValue); + + xShapeProperties.set( getShape(2), uno::UNO_QUERY ); + xShapeProperties->getPropertyValue("HoriOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER, nValue); + xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to right page border", text::RelOrientation::PAGE_RIGHT, nValue); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 163f45c145d9..0fe507fd39a1 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -444,8 +444,10 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons relativeFromH = "character"; break; case text::RelOrientation::PAGE_RIGHT: - relativeFromH = "page"; - alignH = "right"; + relativeFromH = "rightMargin"; + break; + case text::RelOrientation::PAGE_LEFT: + relativeFromH = "leftMargin"; break; case text::RelOrientation::FRAME: default: |