• Mike Kaganski's avatar
    tdf#108714: allow <w:br> as direct child of <w:body> · a4a1467b
    Mike Kaganski yazdı
    LibreOffice doesn't accept <w:br> element as a child of <w:body>.
    
    ECMA-376-1:2016 17.3.3.1 describes br as element of a run content,
    and points to CT_Br in §A.1.
    CT_Br may appear only as part of EG_RunInnerContent.
    In turn, EG_RunInnerContent may appear only inside CT_R.
    
    So, using <w:br> outside of <w:r> produces ill-formed OOXML.
    Open XML SDK 2.5 Productivity Tool for Microsoft Office confirms that,
    showing OpenXmlUnknownElement error.
    However, Word accepts it as direct child of <w:body>. It behaves as if
    the <w:br> were used as first element in first run of the following
    <w:p> (thus creating page break after next paragraph).
    Another Word bug that provokes third-parties to create ill-formed
    documents, and requires LibreOffice to be bug-to-bug compatible.
    
    This commit makes the following changes:
    1. Registers a dedicated complex type CT_Br_OutOfOrder to handle those
    unusual breaks, with corresponding handler function.
    2. In the handler function, saves the gathered property set to parser
    state to use later in next paragraph group handler.
    
    This reproduces Word behaviour.
    
    Change-Id: I5df6927e2de9266b58f87807319ad1c4977e45a7
    Reviewed-on: https://gerrit.libreoffice.org/39168Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
    a4a1467b
factoryimpl_ns.py 28.7 KB