• Miklos Vajna's avatar
    tdf#106132 DOCX import: fix handling of nested textbox margins · 6f9f9491
    Miklos Vajna yazdı
    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
    476316bf (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/39798Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
    6f9f9491
OOXMLDocumentImpl.hxx 7.46 KB