Add new paragraph justification option "Split compound words" for
custom compound-based "smart" hyphenation. Add compound-based "smart"
hyphenation support for Danish, Dutch, Esperanto, Estonian, German,
Norwegian, Swedish (and potentially, Icelandic, Finnish and
Latvian) languages by fixing Hunspell morphological analysis and the
associated lingucomponent code. (Previously compound-based "smart"
hyphenation was enabled only for Hungarian.)
With the new option it's possible to keep MSO/MS-DOCX interoperability,
also introducing a better hyphenation algorithm for several languages.
Details:
* Add check box to Alignment in paragraph formatting dialog window;
* Store properties in paragraph model:
css::style::ParagraphProperties::ParaIsCompoundBased
* Implement it by checking the new option in the previously
added commit f9f694f5d9f39c5801bc5fec45867252c293bbcb;
* Add ODF import/export (loext:compound-based);
* Add ODF unit tests by the new tdf173389_smart_hyphenation_nl.odt
and tdf173389_smart_hyphenation_hu.odt. Now use the previous
tdf119908_smart_hyphenation_hu for disabled compound-based "smart"
hyphenation, also the new tdf119908_smart_hyphenation_nl.odt.
Note: the Dutch test document results better compound-based
hyphenation in two positions.
* Add Hunspell patch to fix Danish, Dutch, Esperanto, Estonian,
German, Norwegian, Swedish (and future Icelandic, Latvian,
Finnish) morphological analysis for compound word constituents;
* hyphenimp.cxx hyphenate(): fix tokenization for consecutive
pa: elements, like resulted in the fixed Hunspell dictionaries.
Follow-up to commit f9f694f5d9
"tdf#173389 sw: add compound-based “smart” hyphenation for readability".
Change-Id: I4414bd588646ecf6dc86b77642833ac9c7820a98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211341
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
63 lines
3.2 KiB
Python
63 lines
3.2 KiB
Python
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||
#
|
||
# This file is part of the LibreOffice project.
|
||
#
|
||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
#
|
||
|
||
from uitest.framework import UITestCase
|
||
from libreoffice.uno.propertyvalue import mkPropertyValues
|
||
from uitest.uihelper.common import get_state_as_dict, type_text
|
||
|
||
class tdf137513(UITestCase):
|
||
|
||
def test_tdf137513(self):
|
||
with self.ui_test.create_doc_in_start_center("writer"):
|
||
|
||
self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2")
|
||
|
||
xWriterDoc = self.xUITest.getTopFocusWindow()
|
||
xWriterEdit = xWriterDoc.getChild("writer_edit")
|
||
type_text(xWriterEdit, "test")
|
||
|
||
self.xUITest.executeCommand(".uno:SelectAll")
|
||
|
||
self.xUITest.executeCommand(".uno:Bold")
|
||
|
||
self.xUITest.executeCommand(".uno:Sidebar")
|
||
xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
|
||
|
||
xListBox = xWriterEdit.getChild('listbox_fonts')
|
||
|
||
# The cursor is on text inside the table with direct formatting
|
||
self.assertEqual(2, len(xListBox.getChild('0').getChildren()))
|
||
self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
|
||
self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text'])
|
||
self.assertEqual(161, len(xListBox.getChild('0').getChild('0').getChildren()))
|
||
|
||
xTableContent = xListBox.getChild('0').getChild('1')
|
||
self.assertEqual(5, len(xTableContent.getChildren()))
|
||
self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text'])
|
||
self.assertEqual("Para Don’t split at beginning (lines)\t0", get_state_as_dict(xTableContent.getChild('1'))['Text'])
|
||
self.assertEqual("Para Don’t split at end (lines)\t0", get_state_as_dict(xTableContent.getChild('2'))['Text'])
|
||
self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('3'))['Text'])
|
||
self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('4'))['Text'])
|
||
|
||
xParDirFormatting = xListBox.getChild('1')
|
||
|
||
# Without the fix in place, this test would have failed here with
|
||
# AssertionError: 3 != 0
|
||
self.assertEqual(3, len(xParDirFormatting.getChildren()))
|
||
self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
|
||
self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
|
||
self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
|
||
self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
|
||
self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
|
||
|
||
self.xUITest.executeCommand(".uno:Sidebar")
|
||
|
||
|
||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|