summaryrefslogtreecommitdiff
path: root/writerfilter/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-11 09:04:23 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-11 14:10:13 +0200
commit6f9f9491bdef676f969898bd653db9905d14f5e8 (patch)
treeb0962fbec2172518069362c6332ac06d53f16d3f /writerfilter/inc
parent2a22696546ace75c38a72ad13f7383aedd00e06a (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. Change-Id: I8c0d2f49cac76589fe269230698b203b5ca6996c Reviewed-on: https://gerrit.libreoffice.org/39798 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/inc')
-rw-r--r--writerfilter/inc/ooxml/OOXMLDocument.hxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index c7241f946311..8f0a12d3189c 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -221,6 +221,10 @@ public:
virtual const OUString & getTarget() const = 0;
virtual css::uno::Reference<css::xml::sax::XFastShapeContextHandler> getShapeContext( ) = 0;
virtual void setShapeContext( css::uno::Reference<css::xml::sax::XFastShapeContextHandler> xContext ) = 0;
+ /// Push context of drawingML shapes, so nested shapes are handled separately.
+ virtual void pushShapeContext() = 0;
+ /// Pop context of a previously pushed drawingML shape.
+ virtual void popShapeContext() = 0;
virtual css::uno::Reference<css::xml::dom::XDocument> getThemeDom( ) = 0;
virtual css::uno::Reference<css::xml::dom::XDocument> getGlossaryDocDom( ) = 0;
virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() = 0;