diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-07-18 23:02:32 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-07-20 22:51:22 +0200 |
commit | 748941df6d4d1e441c7996043ca2fef5cf706442 (patch) | |
tree | d38227af5da8c9a5a08987d79677199a170cd8df /writerfilter/source | |
parent | sd pptm: Preserve the VBA stream on export. (diff) | |
download | core-748941df6d4d1e441c7996043ca2fef5cf706442.tar.gz core-748941df6d4d1e441c7996043ca2fef5cf706442.zip |
tdf#108849: allow out-of-order sectPr
According to ISO/IEC 29500-1:2016(E) 17.6.17), the final <w:sectPr>
must be the last child element of the body element. Also, this is
enforced in schema for CT_Body complex type (Annex A. (normative)
Schemas – W3C XML Schema, A.1 WordprocessingML, page 3866), where
sectPr is a part of <xsd:sequence>, and thus *must* stay at specific
place in sequence, namely being the last element, and be at most one
instance.
However, real-life documents (generated by some third-party software)
have sectPr before other body contents. Unfortunately, MS Word seems
to allow this standards-violating content, and thus encourages
creation of non-standard documents by third-party generators.
This patch doesn't assume that current final (body-level) sectPr is
the last body element, and does not mark current paragraph as last
section's paragraph. Thus, current section (possibly started after
previous paragraph-level sectPr) is continued after final sectPr is
closed.
Change-Id: I8e88288bc6659d77d17986514b3b4fe16a5b45d9
Reviewed-on: https://gerrit.libreoffice.org/40161
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 4b4cd502806cfc9c9cc9754b8aae18a2c2632cdc)
Reviewed-on: https://gerrit.libreoffice.org/40216
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index a5c9a8afabc9..05a7ff6d2a70 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -13194,6 +13194,14 @@ </element> <ref name="AG_SectPrAttributes"/> </define> + <define name="CT_finalSectPr"> + <ref name="EG_HdrFtrReferences"/> + <ref name="EG_SectPrContents"/> + <element name="sectPrChange"> + <ref name="CT_SectPrChange"/> + </element> + <ref name="AG_SectPrAttributes"/> + </define> <define name="ST_BrType"> <choice> <!-- Page Break --> @@ -16322,7 +16330,7 @@ <define name="CT_Body"> <ref name="EG_BlockLevelElts"/> <element name="sectPr"> - <ref name="CT_SectPr"/> + <ref name="CT_finalSectPr"/> </element> </define> <define name="CT_ShapeDefaults"> @@ -17859,6 +17867,10 @@ <element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/> <action name="start" action="setLastParagraphInSection"/> </resource> + <resource name="CT_finalSectPr" resource="Properties"> + <action name="start" action="handleLastParagraphInSection"/> + <element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/> + </resource> <resource name="ST_BrType" resource="List"> <value tokenid="ooxml:Value_ST_BrType_column">column</value> <value tokenid="ooxml:Value_ST_BrType_page">page</value> |