office-gobmx/schema
László Németh 6e8819f29b tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type
Support XSL attribute "column" and CSS 4 attribute "spread",
stored in loext:hyphenation-keep-type, to give better control
over hyphenation-keep. E.g. spread: both parts of a hyphenated
word shall lie within a single spread, i.e. when the next page
is not visible at the same time (e.g. the next page is not a
right page of a book).

– css::style::ParaHyphenationKeep is a boolean property now,
  importing hyphenation-keep = "page" as true.

– type of ParaHyphenationKeep, including the new non-ODF types
  is stored in the new ParagraphProperties::ParaHyphenationKeepType.

– default value of ParaHyphenationKeepType is COLUMN for
  interoperability.

– Add checkboxes to Text Flow -> Hyphenation Across in
  paragraph dialog:

  * Column (previously: Hyphenate across column and page)
  * Page
  * Spread

  – enabling/disabling them follows XSL/CSS 4/loext, i.e.
    possible combinations:

  * No Hyphenation across
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "column")

  * Hyphenation across [x] Column
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "page")

  * Hyphenation across [x] Column [x] Page
    (hyphenation-keep = "page" and loext:hyphenation-keep-type = "spread")

  * Hyphenation across [x] Column [x] Page [x] Spread
    (hyphenation-keep = "auto")

– Add ODF import/export

– Update DOCX import

– Add ODF unit tests

Note: recent implementation depends on widow settings: disabling widow
handling allows hyphenation across columns and pages not only in table
cells.

Note: RTF import-only, but not used bPageEnd has been renamed to bKeep.
Depending on the RTF test results, likely it will need to disable
the layout change, e.g. GetKeepType()=ParagraphHyphenationKeepType::AUTO,
if PageEnd uses obsolete hyphenation rule, i.e. shifting only the
hyphenated word to the next page, not the full line.

More information:

– COLUMN (standard XSL value, defined in
  https://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#hyphenation-keep)

– SPREAD and ALWAYS (CSS 4 values of hyphenate-limit-last,
  equivalent of hyphenation-keep, defined in
  https://www.w3.org/TR/css-text-4/#hyphenate-line-limits).

Follow-up to commit 9574a62add
"tdf#132599 cui offapi sw xmloff: implement hyphenate-keep" and
commit c8ee0e8f58
"tdf160518 DOCX: import hyphenation-keep to fix layout".

Change-Id: I3ac6d9e86d0ed1646f105de8607c0e8ebc534eaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165954
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-04-11 10:20:41 +02:00
..
libreoffice tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type 2024-04-11 10:20:41 +02:00
mathml2
odf1.0
odf1.1
odf1.2
odf1.3
README.md

Schemas for Validating ODF Files

Schemas that can be used for validating ODF files

subdirs:

  • mathml2: W3C MathML 2.0 XML Schema (needed for Math embedded objects)
  • odf1.0, odf1.1, odf1.2: official OASIS RelaxNG schemas
  • odf1.3: current OASIS draft ODF 1.3 RelaxNG schema
  • libreoffice: draft ODF schema, with additional LO extensions

The extension schema in libreoffice/ is used by all unit tests if --with-export-validation is given, which is the default.

Notably this means that if you add a new feature to the ODF filters and you add the required unit test for the new feature, then most likely the test will fail with a complaint from the validator; in this case the schema needs to be updated to contain the new elements and attributes.

The extension schema uses the RelaxNG "include" feature to refer to the ODF schema; this means that it only contains those parts of the schema that actually need to be changed - this works well in many cases because the ODF schema is quite well structured with many named patterns, but unfortunately there are a few places where that isn't the case and large chunks needed to be copied to override them.

In the easy case, to add an attribute you just want to search for the corresponding element, which will have a "foo-attlist" named pattern, and then add another attribute like this:

<rng:define name="draw-enhanced-geometry-attlist" combine="interleave"> rng:optional <rng:attribute name="drawooo:sub-view-size"> <rng:ref name="string"/> </rng:attribute> </rng:optional> </rng:define>

Currently only the features that are actually exported in the unit tests have been added to the schema; there is still some work to do here to add everything; the crashtesting script also does ODF validation of all files and now also uses the custom schema.

Unfortunately it turned out that there are a lot of extensions already for which no proposal exists [1], and in many cases not even an entry on the Wiki [2], so clearly something like this extension schema is needed.

[1] git grep TODO schema/libreoffice

[2] https://wiki.documentfoundation.org/Development/ODF_Implementer_Notes/List_of_LibreOffice_ODF_Extensions