To solve the trade-off between better spacing and less hyphenation, support hyphenation level and its user interface, the hyphenation slider, like DTP software do. Add new paragraph property com::sun::star::text::ParaHyphenationLevel The hyphenation slider is the basic interface of DTP software to adjust single (or all) paragraphs using better word spacing (i.e. more hyphenation) or less hyphenation (i.e. worse word spacing). It allows 1) to choose the best from the near equally good layouts and 2) to solve an extreme bad layout (caused by words without hyphenation or other corner cases). – 50% hyphenation level means disabled hyphenation, if minimum and maximum word spacing settings allow to break the line within words (default interoperability value). – 100% hyphenation level means using extra hyphenation only if that results better word spacing in the line, than breaking within words. – Between 50% and 100% hyphenation level, use extra hyphenation only if its weighted word spacing is better, than breaking the line between words (weighting grows with the hyphenation level). – Between 0% and 50% hyphenation level it means disabled hyphenation with increased desired and maximum word spacing, depending on the hyphenation level. At %0, the desired word spacing is enlarged to the original maximum word spacing, while maximum word spacing is enlarged by a single space. For example, the original 4-page unit test document with the default 50% hyphenation level contains 14 hyphenations. 100% hyphenation level results in 22 hyphenations, while 0% only results in 8 hyphenations. – sw/qa/extras/layout/data/tdf167648_minimum.fodt, sw/qa/extras/layout/data/tdf169168_minimum.fodt: set maximum word-spacing to 100% from 101% to limit the original unit test only for minimum letter spacing. More information: LO/COOL Book & Typography projects: https://www.numbertext.org/typography/ https://www.numbertext.org/book/ Follow-up to commitcf104be5cb"tdf#119908 tdf#166113 cool#15973 sw smart justify: fix DOCX hyphenation", commitd572576dd6"tdf#119908 cool#15973 sw smart justify: fix "smart" hyphenation", commit529755f091"tdf#166113 sw smart justify: adjust algorithm for interoperability" and commit7d08767b89"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt." Change-Id: I84b3893ea6c5cd4eff74a73514722285e7071392 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207545 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins
ODF Import and Export Filter Logic
The main library "xo" contains the basic ODF import/export filter
implementation for most applications. The document is accessed
via its UNO API, which has the advantage that the same import/export
code can be used for text in all applications (from/to Writer/EditEngine).
The filter consumes/produces via SAX UNO API interface (implemented in
"sax"). Various bits of the ODF filters are also implemented in
applications, for example [git:sw/source/filter/xml].
There is a central list of all element or attribute names in
[git:include/xmloff/xmltoken.hxx]. The main class of the import filter
is SvXMLImport, and of the export filter SvXMLExport.
The Import filter maintains a stack of contexts for each element being read. There are many classes specific to particular elements, derived from SvXMLImportContext.
Note that for export several different versions of ODF are supported, with the default being the latest ODF version with "extensions", which means it may contain elements and attributes that are only in drafts of the specification or are not yet submitted for specification. Documents produced in the other (non-extended) ODF modes are supposed to be strictly conforming to the respective specification, i.e., only markup defined by the ODF specification is allowed.
There is another library "xof" built from the source/transform directory, which is the filter for the OpenOffice.org XML format. This legacy format is a predecessor of ODF and was the default in OpenOffice.org 1.x versions, which did not support ODF. This filter works as a SAX transformation from/to ODF, i.e., when importing a document the transform library reads the SAX events from the file and generates SAX events that are then consumed by the ODF import filter.
OpenOffice.org XML File Format
There is some stuff in the "dtd" directory which is most likely related to the OpenOffice.org XML format but is possibly outdated and obsolete.
Add New XML Tokens
When adding a new XML token, you need to add its entry in the following three files:
[git:include/xmloff/xmltoken.hxx][git:xmloff/source/core/xmltoken.cxx][git:xmloff/source/token/tokens.txt]