diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-11 09:04:23 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-07-18 15:26:33 +0200 |
commit | 2cd91d79b90316f6a21db64bd944cb828b345a78 (patch) | |
tree | 5ebefe4619cd27ce74f41d19d9106623e2b05915 /sw | |
parent | 9b6542dbeea01aedd3570d84231383c0dc34812f (diff) |
tdf#106132 DOCX import: fix handling of nested textbox margins
drawingML shapes are independent, and having a separate parser for each
shape is a good thing, so that when we have an XML fragment like this:
<wps:wsp>
<wps:txbx>
...
</wps:txbx>
<wps:bodyPr .../>
</wps:wsp>
where <wps:txbx> may contain nested <wps:wsp> tags, we apply the
properties specified in <wps:bodyPr> to the correct shape.
In contrast, doing the same for VML is not a good idea, see commit
476316bfc9dd36c0613327c20822a193b5ca8d9b (do reuse shape context,
2012-05-22).
So conditionally (for DML) maintain a stack of shape parsers, this way
the outer <wps:bodyPr> is parsed and the result is applied to the
correct shape, at the end resulting in correct inner margin for the outer
shape in the bugdoc.
This requires moving the context setup code from
the OOXMLFastContextHandlerShape ctor to setToken(), as only then we
know if this shape context will be used for VML or DML purposes. This
should be OK, given that
writerfilter::ooxml::OOXMLFastHelper::createAndSetParentAndDefine()
calls setToken() right after allocating the context.
(cherry picked from commit 6f9f9491bdef676f969898bd653db9905d14f5e8)
Change-Id: I8c0d2f49cac76589fe269230698b203b5ca6996c
Reviewed-on: https://gerrit.libreoffice.org/39830
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf106132.docx | bin | 0 -> 5851 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 7 |
2 files changed, 7 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf106132.docx b/sw/qa/extras/ooxmlexport/data/tdf106132.docx Binary files differnew file mode 100644 index 000000000000..e342898141b1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf106132.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 81692f745778..b2ab8fdea9ed 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -363,6 +363,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103573, "tdf103573.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to right page border", text::RelOrientation::PAGE_RIGHT, nValue); } +DECLARE_OOXMLEXPORT_TEST(testTdf106132, "tdf106132.docx") +{ + uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); + // This was 250, <wps:bodyPr ... rIns="0" ...> was ignored for an outer shape. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xShape, "TextRightDistance")); +} + DECLARE_OOXMLEXPORT_TEST(testBnc519228OddBreaks, "bnc519228_odd-breaksB.docx") { // Check that all the normal styles are not set as right-only, those should be only those used after odd page breaks. |