875 Commits
Author SHA1 Message Date
László Németh e668dc84eb tdf#173389 cui offapi sw xmloff: add custom compound-based hyphenation
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>
2026-09-23 14:38:07 +02:00
Andrea Gelmini eeb4290b30 Fix typos
Change-Id: I53571976c4e045a5a09f1adc4425b41d96b0e6a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210565
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 21:26:38 +02:00
László Németh f9f694f5d9 tdf#173389 sw: add compound-based “smart” hyphenation for readability
As a natural extension of the "smart" hyphenation, following
traditional typography, prefer readability of the hyphenated
compound words and better word spacing in the following way:

* when it's possible to hyphenate the same compound word within
  the custom word spacing range, choose compound splitting or
  hyphenate just before the suffix or inside the suffix, not
  inside a compound constituent.

* limit plain, i.e. non-compound-based smart hyphenation, when
  it can results in better word spacing without losing readability:
  do not disable hyphenation within the custom word spacing range, if
  the hyphenation splits the compound word between its constituents;

* if also shrinking results in a non-compound splitting hyphenation
  inside the second or third etc. constituent of a compound word,
  always shrink the line to show bigger part of that non-first
  constituent (within the custom word spacing range).

For these, extend lingucomponent HYPH_COMPOUND_MIN_LEADING and
HYPH_COMPOUND_MIN_TRAILING API to support disabling hyphenation of
non-compound words, also disabling hyphenation inside the first
constituent (but not inside the suffix or just before the suffix).
This allows to recognize compound words during line breaking.
Details: Hyphenator::hyphenate().

The initial development enables compound-based "smart" hyphenation
only for the Hungarian language, yet. The patch contains minor
fixes of the compound-based Hungarian hyphenation, resulting
better compound-based "smart" hyphenation with recognition of
verb prefixes and leg-/legesleg- superlative prefixes. (Note:
this fixed also COMPOUND_MIN_LEADING/TRAILING settings for the
hyphenation of the compound words with dictionary-based hyphenation
(only hy:, without pa: Hunspell dictionary fields, i.e. without
compound splitting heuristics of Hunspell).

Change-Id: I26f31329cdea20f03dbde7742587089eb5df5ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210423
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2026-09-04 09:40:40 +02:00
Xisco Fauli 667fe200a9 Revert "[API CHANGE] remove deprecated XSpell1 and XSupportedLanguages"
This reverts commit bce4b4af9d.

Reason for revert: Revert it for now until there is a policy
for removal of published APIs

Change-Id: Ia1cbcfcd6b953be48a60d8ef67333b1e3265e563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207150
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-23 10:58:29 +02:00
Noel Grandin bce4b4af9d [API CHANGE] remove deprecated XSpell1 and XSupportedLanguages
in favour of their replacements XSpell and XSupportedLocales

Change-Id: I3ad20d0c6c3bf0a00d7ef3947705059027a1ff6f
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4228
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 35842d441f2e82204ce77ba8c53735be3f18dc78)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206467
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-16 14:55:20 +02:00
Rafał Dobrakowski 6c88e551e3 Migration to C++ 20 std::ranges::find from the standard library.
Change-Id: I62a7c34dadfe6601ee50cafdeb3e18047a43e131
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203337
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-04-12 22:04:09 +02:00
Andrea Gelmini 7ddf75c171 Fix typo
Change-Id: Iffb54d05c801c67a4e33ae86086e10f12086b07d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196406
Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
Tested-by: Jenkins
2026-01-04 10:18:55 +01:00
László Németh 391ea3bcb5 tdf#170177 cui offapi sw xmloff: hyphenate at constituent boundaries
Add new minimum character limit paragraph property to limit
hyphenation left to the compound constituent boundaries:

  com::sun::star::text::ParaHyphenationCompoundMinTrailingChars

– With the previous option for the hyphenation right to the
  constituent boundary, this new option allow to limit or disable
  hyphenation completely inside the compound constituents, or
  hyphenate only at constituent boundaries, with or without
  inside the suffix of the word or constituents;

– xmloff: add "no-limit" to loext:hyphenation-compound-push-char-count
  and loext:hyphenation-compound-push-char-count;

– "no-limit" values of this and the *LeadingChars option mean
  a maximum value. When both *LeadingChars and *TrailingChars
  got "no-limit", hyphenation before and inside the suffixes are
  forbidden, i.e. it is allowed only at constituent boundaries;

– textflowpage.ui: set max character count to 99, in both options;

– fix ParaHyphenationCompoundMinLeadingChars implementation for
  compound words with multiple constituents, when the middle word(s)
  are shorter, than the limit (e.g. Hungarian "tűz|kő|pattintás"
  wasn't hyphenated as "tűzkő-pattintás", only as "tűz-kőpattintás").

Follow-up to commit 3a332d9f1c
"tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary"
and commit c899d3608d
"tdf#158885 sw: don't hyphenate right after a stem boundary".

Change-Id: I0b71562727332217364f9ace85e8ac6ea3abc8b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196345
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-31 22:54:05 +01:00
László Németh c1702ddc2e tdf#170140 lingucomponent: check words with non-ASCII apostrophe
If the spelling dictionary contains them with non-ASCII apostrophe.

Previously the words were checked only with apostrophes converted
to their ASCII version, resulting continuous false alarms, despite
the correct orthography in the document and in the spelling
dictionary.

Now the words are checked both with ASCII conversion and with
the original non-ASCII apostrophes (because still there are
UTF-8 dictionaries with ASCII apostrophes, moreover, dictionaries
containing mixed apostrophes in the same dic file).

Example words for the Hungarian dictionary: d’Arc, d’Alembert,
McDonald’s (and their several recognized suffixed forms: d’Arcért,
d’Arckal, d’Arcként, d’Arcnak, d’Arcot etc. etc.)

Add unit tests for 1) break iterator and 2) spell checking with
non-ASCII apostrophes.

Change-Id: I24a570df41fa5aba2e7b67dde0db33377717dc2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196248
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-12-28 06:17:07 +01:00
Mike Kaganski b280efcb9b Drop some uses Sequence::getConstArray
Replace by operator[], begin() and end(), which don't have overhead
since commit 2484de6728 (Remove non-
const Sequence::begin()/end() in internal code, 2021-10-15)
and commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: I221470b3439bb0dc6e7705b0d99deb3cd2063484
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195176
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-12-07 12:54:23 +01:00
Vaibhav Kumar Singh b29cb6524b tdf#147021 Use std::size() in place of SAL_N_ELEMENTS() macro
Change-Id: I15f604da81408e74b4f78d03e99726da45f94677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191931
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2025-10-06 11:22:30 +02:00
Caolán McNamara b1ec05b4b1 cid#1662031 Variable copied when it could be moved
and

cid#1660225 Variable copied when it could be moved
cid#1660211 Variable copied when it could be moved
cid#1660185 Variable copied when it could be moved
cid#1660173 Variable copied when it could be moved
cid#1660168 Variable copied when it could be moved
cid#1660166 Variable copied when it could be moved
cid#1660165 Variable copied when it could be moved
cid#1660163 Variable copied when it could be moved
cid#1660152 Variable copied when it could be moved
cid#1660149 Variable copied when it could be moved
cid#1660147 Variable copied when it could be moved
cid#1660145 Variable copied when it could be moved
cid#1660142 Variable copied when it could be moved
cid#1660140 Variable copied when it could be moved
cid#1660137 Variable copied when it could be moved
cid#1660136 Variable copied when it could be moved
cid#1660135 Variable copied when it could be moved
cid#1660128 Variable copied when it could be moved
cid#1660124 Variable copied when it could be moved
cid#1660122 Variable copied when it could be moved
cid#1660117 Variable copied when it could be moved
cid#1660114 Variable copied when it could be moved
cid#1660110 Variable copied when it could be moved
cid#1660109 Variable copied when it could be moved
cid#1660105 Variable copied when it could be moved
cid#1660104 Variable copied when it could be moved
cid#1660102 Variable copied when it could be moved
cid#1660100 Variable copied when it could be moved
cid#1660098 Variable copied when it could be moved
cid#1660080 Variable copied when it could be moved
cid#1660079 Variable copied when it could be moved
cid#1660078 Variable copied when it could be moved
cid#1660075 Variable copied when it could be moved
cid#1660071 Variable copied when it could be moved
cid#1660070 Variable copied when it could be moved
cid#1660064 Variable copied when it could be moved
cid#1660063 Variable copied when it could be moved
cid#1660060 Variable copied when it could be moved
cid#1660058 Variable copied when it could be moved
cid#1660053 Variable copied when it could be moved
cid#1660050 Variable copied when it could be moved
cid#1660049 Variable copied when it could be moved
cid#1660046 Variable copied when it could be moved
cid#1660042 Variable copied when it could be moved
cid#1660028 Variable copied when it could be moved
cid#1660023 Variable copied when it could be moved
cid#1660022 Variable copied when it could be moved
cid#1660021 Variable copied when it could be moved
cid#1660020 Variable copied when it could be moved
cid#1660017 Variable copied when it could be moved
cid#1660013 Variable copied when it could be moved
cid#1660005 Variable copied when it could be moved
cid#1660003 Variable copied when it could be moved
cid#1659999 Variable copied when it could be moved
cid#1659998 Variable copied when it could be moved
cid#1659995 Variable copied when it could be moved
cid#1659993 Variable copied when it could be moved
cid#1659989 Variable copied when it could be moved
cid#1659988 Variable copied when it could be moved

Change-Id: I2a30c8a2ac8785050d49b98635b0b406535b185a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189056
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-07 20:51:26 +02:00
Caolán McNamara 3d36a94b25 cid#1660296 Variable copied when it could be moved
and

cid#1660283 Variable copied when it could be moved
cid#1660278 Variable copied when it could be moved
cid#1660277 Variable copied when it could be moved
cid#1660272 Variable copied when it could be moved
cid#1660271 Variable copied when it could be moved
cid#1660269 Variable copied when it could be moved
cid#1660257 Variable copied when it could be moved
cid#1660251 Variable copied when it could be moved

Change-Id: I6684eaf2162dd3550e2eab3f72cccbaa09448f43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188925
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-04 22:05:59 +02:00
Andras Timar 0e512e7aee LOK: preload hyphenators
Without this fix the hyphenation feature did not work when
bind mounting was not available, e.g. in docker containers.

Change-Id: I800012b5229ce5a56a5698db7057e3a27e760be3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180337
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 7b43ce868f980dc47c37f482900210eae2d0187e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180382
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2025-01-17 12:29:08 +01:00
Bogdan Buzea 9936353861 tdf#152299 - Remove unused define(s) from C/C++ files
Change-Id: Ia2d43ef6d04cf16941c46b329917b3be96bae4b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177138
Reviewed-by: David Gilbert <freedesktop@treblig.org>
Tested-by: Jenkins
2024-12-19 03:04:18 +01:00
Mike Kaganski f4253af367 Avoid assigning unused value
Change-Id: Ic6c59500805a8710150f083ff089b2e1c4c36530
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177217
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-11-25 05:33:01 +01:00
Mike Kaganski c568149596 No need to create PossibleHyphens for no-hyphenation case
Change-Id: Idd509e40f96373fc29d0f313bcb5c14ee8490f17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177212
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-24 17:19:14 +01:00
Mike Kaganski b44339c215 Deduplicate calls to hnj_hyphen_hyphenate3
Change-Id: Iecd3cf707fd692a10382f3a6be02c2dd94f02111
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177201
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-24 16:11:30 +01:00
Mike Kaganski ec775c8ada Deduplicate a bit
Change-Id: I9a19dcc2fbf5297fe391fcd3644843eb51afdb9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177200
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-24 14:44:50 +01:00
Mike Kaganski 7eaf28b0a2 tdf#164005: also initialize locales in hyphenate()
... which is also used in queryAlternativeSpelling

Change-Id: I7f0bbbc6e598d56156efe1446f422f9674ed6f25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177187
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-24 11:28:23 +01:00
Mike Kaganski 9c14ec81b6 tdf#164006: Only use original word's positions, ignore extra encoded length
The encoding of the string passed to Hunspell/hyphen service depends on the
encoding of the dictionary itself. When the usual UTF-8 encoding is used,
the resulting octet string may be longer than the original UTF-16 code unit
count. In that case, the length of the buffer receiving the positions will
be longer, respectively. But on return, the buffer will only contain data
in positions corresponding to the characters, not code units (it is unclear
if we even need to pass buffer that large). So just as the following loop
only iterates up to nWord length, the calculation of hyphen count must use
its length, too, not the length of encWord.

I suspect that the use of UTF-16 code units as hyphen positions is wrong;
it will break in SMP surrogate pairs. The proper would be to iterate code
points. However, I don't have data to test, so let it be TODO/LATER.

Change-Id: Ieed5e696e03cb22e3b48fabc14537372bbe74363
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177077
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-11-23 10:03:41 +01:00
Mike Kaganski 2909196239 tdf#164005: make sure to initialize locales before use of Hyphenator
Change-Id: I23ab742801ab00b68e4f8c5e7bc415c401e28c37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177076
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-11-23 10:03:17 +01:00
Noel Grandin ed0b12f4ea no need to take a copy of the getProcessComponentContext return value
we can just take a "const &".

(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)

Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-11-08 15:23:52 +01:00
Mike Kaganski 0794754e85 Optimize a bit: only create std::locale once in parseDudenResponse
Change-Id: If1aee9fa908b4ad730d858738f3e472a17fd235a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175039
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-17 09:12:54 +02:00
Mike Kaganski 3233383b26 tdf#160127: Improve grammar check popups from Duden
When there is a grammar check error that it has no suggestions for, Duden
may return a JSON without suggestions, but still informing about the type
of the error, like

  ...
  {
      "offset": 468,
      "length": 8,
      "errorcode": 21,
      "type": "orth",
      "proposals": []
  },
  ...

Before the change, we underlined the error, but right-clicking it would
only bring the normal Writer's context menu, as if there were no error.
This was made in commit 7697ef9d8f (Proof
reading suggestions:, 2023-11-28); before that change, the context menu
was shown, but since it had no suggestions, and no explanation text, it
was considered better to just not show the grammar check results. But
no menu for an underlined word is no better; so let's instead show the
explanation, based on the type of the error reported by Duden - that is
stored in SingleProofreadingError::aShortComment. Also set aFullComment,
which is used in the grammar check dialog.

Incidentally, it even improves popups with suggestions, because it now
has the explanation as well, where previously only was an icon without
any text.

It may be further improved in a follow-up, because there is "errorcode"
in the message, which we may use to add more details to the explanation.

tdf#160127 should be fixed with this, too; but if there are cases when
there are neither suggestions, nor explanation available, it will need
further work.

Change-Id: I62cde204e0142d6226c9c9486f1cdb5ffc20dca8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175017
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-10-16 17:47:50 +02:00
Caolán McNamara dd689fb914 cid#1557699 COPY_INSTEAD_OF_MOVE
and

cid#1557435 COPY_INSTEAD_OF_MOVE
cid#1557307 COPY_INSTEAD_OF_MOVE
cid#1557209 COPY_INSTEAD_OF_MOVE
cid#1557192 COPY_INSTEAD_OF_MOVE
cid#1557184 COPY_INSTEAD_OF_MOVE
cid#1557183 COPY_INSTEAD_OF_MOVE
cid#1557171 COPY_INSTEAD_OF_MOVE
cid#1557150 COPY_INSTEAD_OF_MOVE
cid#1557148 COPY_INSTEAD_OF_MOVE
cid#1557123 COPY_INSTEAD_OF_MOVE
cid#1557118 COPY_INSTEAD_OF_MOVE
cid#1557116 COPY_INSTEAD_OF_MOVE
cid#1557103 COPY_INSTEAD_OF_MOVE
cid#1557078 COPY_INSTEAD_OF_MOVE
cid#1557075 COPY_INSTEAD_OF_MOVE
cid#1557071 COPY_INSTEAD_OF_MOVE
cid#1557070 COPY_INSTEAD_OF_MOVE
cid#1557067 COPY_INSTEAD_OF_MOVE
cid#1557049 COPY_INSTEAD_OF_MOVE
cid#1557046 COPY_INSTEAD_OF_MOVE
cid#1557042 COPY_INSTEAD_OF_MOVE
cid#1557036 COPY_INSTEAD_OF_MOVE
cid#1557030 COPY_INSTEAD_OF_MOVE
cid#1557024 COPY_INSTEAD_OF_MOVE
cid#1557012 COPY_INSTEAD_OF_MOVE
cid#1557009 COPY_INSTEAD_OF_MOVE
cid#1557008 COPY_INSTEAD_OF_MOVE
cid#1557004 COPY_INSTEAD_OF_MOVE
cid#1556999 COPY_INSTEAD_OF_MOVE
cid#1556992 COPY_INSTEAD_OF_MOVE
cid#1556987 COPY_INSTEAD_OF_MOVE
cid#1556984 COPY_INSTEAD_OF_MOVE
cid#1556981 COPY_INSTEAD_OF_MOVE

Change-Id: Id2687aa282f4e2d4b8053b73c7aa1a74a9516b16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171974
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-18 11:04:45 +02:00
Caolán McNamara d7056b1456 cid#1558088 COPY_INSTEAD_OF_MOVE
and

cid#1558080 COPY_INSTEAD_OF_MOVE
cid#1558077 COPY_INSTEAD_OF_MOVE
cid#1558055 COPY_INSTEAD_OF_MOVE
cid#1558043 COPY_INSTEAD_OF_MOVE
cid#1558039 COPY_INSTEAD_OF_MOVE
cid#1558015 COPY_INSTEAD_OF_MOVE
cid#1558014 COPY_INSTEAD_OF_MOVE
cid#1558009 COPY_INSTEAD_OF_MOVE
cid#1558002 COPY_INSTEAD_OF_MOVE
cid#1557998 COPY_INSTEAD_OF_MOVE
cid#1557996 COPY_INSTEAD_OF_MOVE
cid#1557990 COPY_INSTEAD_OF_MOVE
cid#1557986 COPY_INSTEAD_OF_MOVE
cid#1557980 COPY_INSTEAD_OF_MOVE
cid#1557971 COPY_INSTEAD_OF_MOVE
cid#1557968 COPY_INSTEAD_OF_MOVE
cid#1557967 COPY_INSTEAD_OF_MOVE
cid#1557961 COPY_INSTEAD_OF_MOVE
cid#1557959 COPY_INSTEAD_OF_MOVE
cid#1557958 COPY_INSTEAD_OF_MOVE
cid#1557956 COPY_INSTEAD_OF_MOVE
cid#1557953 COPY_INSTEAD_OF_MOVE
cid#1557949 COPY_INSTEAD_OF_MOVE
cid#1557947 COPY_INSTEAD_OF_MOVE
cid#1557940 COPY_INSTEAD_OF_MOVE
cid#1557931 COPY_INSTEAD_OF_MOVE
cid#1557930 COPY_INSTEAD_OF_MOVE
cid#1557915 COPY_INSTEAD_OF_MOVE
cid#1557913 COPY_INSTEAD_OF_MOVE
cid#1557910 COPY_INSTEAD_OF_MOVE
cid#1557886 COPY_INSTEAD_OF_MOVE
cid#1557884 COPY_INSTEAD_OF_MOVE
cid#1557880 COPY_INSTEAD_OF_MOVE
cid#1557875 COPY_INSTEAD_OF_MOVE
cid#1557871 COPY_INSTEAD_OF_MOVE
cid#1557862 COPY_INSTEAD_OF_MOVE
cid#1557847 COPY_INSTEAD_OF_MOVE
cid#1557845 COPY_INSTEAD_OF_MOVE
cid#1557844 COPY_INSTEAD_OF_MOVE
cid#1557843 COPY_INSTEAD_OF_MOVE
cid#1557838 COPY_INSTEAD_OF_MOVE
cid#1557835 COPY_INSTEAD_OF_MOVE
cid#1557834 COPY_INSTEAD_OF_MOVE
cid#1557828 COPY_INSTEAD_OF_MOVE
cid#1557823 COPY_INSTEAD_OF_MOVE
cid#1557817 COPY_INSTEAD_OF_MOVE
cid#1557813 COPY_INSTEAD_OF_MOVE
cid#1557812 COPY_INSTEAD_OF_MOVE

Change-Id: I55d4a920daa2d148683419169eb828325fd3c757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171732
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-11 20:14:54 +02:00
Patrick Luby d81ffa179d tdf#161858 prevent crashing by catching any JSON exceptions
Change-Id: I733ac428c96a96be668d6334db8c71efaf51beff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170818
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Tested-by: Jenkins
2024-07-22 13:56:03 +02:00
Gabor Kelemen e1a351ca19 Remove now unneeded osl/diagnose.h
followup to commit 57c228803e

Change-Id: Iebfb23bb65e2bf898bf27f367cc9641f47a14cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167998
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
2024-07-20 10:20:31 +02:00
Sarper Akdemir a7d1a6f313 languagetool show cURL errors with the interaction handler
Only shows the error once for a given checkerURL.

Change-Id: I1873dc09584df33162c93d9d133b12eb8dfede04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169518
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
2024-06-28 14:24:22 +02:00
Noel Grandin 38c980d472 loplugin:ostr in lingucomponent
Change-Id: I1910fd2a7cba63404c37b7bb80b77de2443dd7a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167386
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-09 17:59:34 +02:00
Gabor Kelemen 5a408044f9 tdf#146619 Drop unused 'using namespace' in: lingucomponent/
Change-Id: I98f6edf1da4915ff43312c187e92891371833fc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165533
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-04-01 20:47:37 +02:00
László Németh 3a332d9f1c tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundary
Add new hyphenation option "Compound characters at line end",
equivalent of libhyphen's COMPOUNDLEFTHYPHENMIN, to limit bad
pattern based hyphenation of compound words using morphological
analysis of Hunspell.

* Add checkbox to Text Flow in paragraph formatting dialog window
* Store property in paragraph model:
  css::style::ParagraphProperties::ParaHyphenationCompoundMinLeadingChars
* Add ODF import/export (loext:hyphenation-compound-remain-char-count)
* Add ODF unit tests

Note: slower Hunspell based hyphenation is used only if
ParaHyphenationCompoundMinLeadingChars >= 3 (we assume that
libhyphen hyphenation patterns cover the smaller distances
correctly). Hunpell based hyphenation doesn't introduce
new hyphenation breaks, only detects the stem boundaries
from the libhyphen based hyphenation breaks.

Follow-up to commit c899d3608d
"tdf#158885 sw: don't hyphenate right after a stem boundary",
replacing hyphenation zone dependence with the new "Compound
characters at line end".

Note: preset COMPOUNDLEFTHYPHENMIN values aren't loaded yet
from hyphenation dictionaries.

Note: the suffix of the last stem of the compound is always
hyphenated, i.e. the distance limits only hyphenation
inside the stem, not inside its suffix or at the end of the
stem before the suffix.

Change-Id: I46a0288929a66f7453e3ff97fbc5a0c6a01f038f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164983
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-03-20 13:04:09 +01:00
Noel Grandin 7150ce717f remove deprecated IsGermanPreReform property
deprecated in 2008 (and seemingly never even implemented)

Replace the use of this property in sample code and
in Java unit tests with another property (I arbitrarily
selected "IsIgnoreControlCharacters")

Change-Id: I2cb474f895ac221952b59e98bfdbc01012095519
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164355
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-06 07:56:50 +01:00
Noel Grandin ea4dfeb838 finish removing IsSpellCapitalisation property
which was partially removed in
    commit 9bb9ba6ae0
    Author: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
    Date:   Mon Oct 2 12:33:34 2023 +0200
    [API CHANGE] Remove deprecated IsSpellCapitalization

Change-Id: I861c8c484b77a041d91cb25ddeecb7027a2fd96c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164183
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-04 08:01:05 +01:00
Mike Kaganski 0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
László Németh c899d3608d tdf#158885 sw: don't hyphenate right after a stem boundary
in compound words to get better typography or orthography
with more readable text, if hyphenation zone is enabled.

If there are multiple possible break points in the word
according to the libhyphen based hyphenation, keep only
the best ones using Hunspell morphological data
based on compound word decomposition of non-dictionary
words (pa: fields), and extra morphological data of dictionary
words (hy: fields) or their combination.

For readability and tradition, orthography and typography
prefer or only allow hyphenation between stems in compound
words in several languages, like Danish, Dutch, German,
Hungarian, Norwegian and Sweden.

Hyphenation zone is to avoid of too much or bad hyphenation.
Preferring stem boundaries for hyphenation within the hyphenation
zone is a natural extension of  it, i.e. skip hyphenation within
stems, if there is stem boundary within the hyphenation zone.

Now skip break points after skip boundaries, if their
distance is 3 or less characters (COMPOUNDLEFTHYPHENMIN = 4).

Skip also break points on stem boundaries, if there is a
weighted stem boundary before them within 3 characters.

Weighted stem boundaries are there between the pa: fields,
(stems resulted by the compound word decomposition),
or in hy: field, boundaries marked by double || instead of
a single |.

More information: man (5) hunspell, and option -m hunspell.

Note: break points skipped only in the last stems for languages
with fogemorphemes, yet, because of their incomplete Hunspell
output for morphological analysis.

Change-Id: I739908716d11a9c2db0c9d36fba8657ba6f53bee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161498
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-01-01 00:42:35 +01:00
Caolán McNamara 5096d072be cid#1545965 COPY_INSTEAD_OF_MOVE
and

cid#1545849 COPY_INSTEAD_OF_MOVE
cid#1545814 COPY_INSTEAD_OF_MOVE
cid#1545685 COPY_INSTEAD_OF_MOVE
cid#1545583 COPY_INSTEAD_OF_MOVE
cid#1545575 COPY_INSTEAD_OF_MOVE
cid#1545517 COPY_INSTEAD_OF_MOVE
cid#1545474 COPY_INSTEAD_OF_MOVE

Change-Id: I79a47ee34dace3a4664bfece26c59e719f469cab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161448
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-30 19:58:54 +01:00
Caolán McNamara 9a6298aedb cid#1546006 COPY_INSTEAD_OF_MOVE
and

cid#1545999 COPY_INSTEAD_OF_MOVE
cid#1545995 COPY_INSTEAD_OF_MOVE
cid#1545994 COPY_INSTEAD_OF_MOVE
cid#1545989 COPY_INSTEAD_OF_MOVE
cid#1545982 COPY_INSTEAD_OF_MOVE
cid#1545977 COPY_INSTEAD_OF_MOVE
cid#1545970 COPY_INSTEAD_OF_MOVE
cid#1545856 COPY_INSTEAD_OF_MOVE
cid#1545845 COPY_INSTEAD_OF_MOVE
cid#1545838 COPY_INSTEAD_OF_MOVE
cid#1545776 COPY_INSTEAD_OF_MOVE
cid#1545774 COPY_INSTEAD_OF_MOVE
cid#1545744 COPY_INSTEAD_OF_MOVE
cid#1545719 COPY_INSTEAD_OF_MOVE
cid#1545716 COPY_INSTEAD_OF_MOVE
cid#1545687 COPY_INSTEAD_OF_MOVE
cid#1545648 COPY_INSTEAD_OF_MOVE
cid#1545643 COPY_INSTEAD_OF_MOVE
cid#1545641 COPY_INSTEAD_OF_MOVE
cid#1545604 COPY_INSTEAD_OF_MOVE
cid#1545531 COPY_INSTEAD_OF_MOVE
cid#1545530 COPY_INSTEAD_OF_MOVE
cid#1545524 COPY_INSTEAD_OF_MOVE
cid#1545516 COPY_INSTEAD_OF_MOVE
cid#1545501 COPY_INSTEAD_OF_MOVE
cid#1545486 COPY_INSTEAD_OF_MOVE

Change-Id: Idcf3e27bb9e81b6a77d5ef75c9376eb1d6aff8c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161245
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-23 19:52:50 +01:00
Mike Kaganski 05d5181e2c tdf#158117: encode the username sent to LanguageTool
Change-Id: I762ebb7487b3bcb80cd88b265b4e75c0d8b7c639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159764
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-23 22:30:29 +01:00
Mike Kaganski f5926c8cfb Move user agent initialization to InitCurl_easy
Places that didn't initialize it previously, would benefit automatically

Change-Id: I2f1ff25fc58d9378462072bc92d7b37be2370fc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159299
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-11 08:42:57 +01:00
Stephan Bergmann c0e516609b loplugin:stringstatic, lopluign:ostr (clang-cl)
Change-Id: I7a928a2385286f6d1ab3887c8d315af3f47c052d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159135
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-08 18:58:40 +01:00
Michael Stahl 11f439b861 curl: mitigate migration to OpenSSL on Linux
The problem is that curl 8.3.0 removed the NSS backend, so we now
have no other choice than to use the bundled OpenSSL on Linux.

Currently any curl https connection fails with:

  CurlSession.cxx:963: curl_easy_perform failed: (60) SSL certificate problem: unable to get local issuer certificate

Apparently this requires manually telling curl which CA certificates to
trust; there is a configure flag --with-ca-bundle but that is useless as
it tries to load the file relative to whatever is the current working
directory, and also did i mention that there are at least 3 different
locations where a Linux system may store its system trusted CA
certificates because ALL ABOUT CHOICE.

So add a new header with an init function to try out various file
locations listed in this nice blog article and call it from way too many
places that independently use curl.

https://www.happyassassin.net/posts/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/

TODO: perhaps bundle a cacert.pem as a fallback in case the system chose
to innovate by putting its certificates in yet another unexpected place

(regression from commit c2930ebff8)

Change-Id: Ibf1cc0069bc2ae011ecead9a4c2b455e94b01241
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158915
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-07 14:26:38 +01:00
Gökay Şatır 768da8bf8f Don't encode the text when sending it to Duden corrector.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I9e1a2adede04858e5c43b878786bbcc28922aa5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158023
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 8989cba47fce3763229005b1ed2fec74da7cfb72)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158333
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-22 21:50:28 +02:00
Szymon Kłos b9a081654b lok: LanguageTool provides list of languages
- it sends supported list to the LOK client
- disables Spell Checker for locales supported by LanguageTool
- duden protocol supports only german
- initialize language tool config before usage to fetch correct
  list of supported languages

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146665
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153960
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154161
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 21d0489a5e)
Change-Id: Id0f909fbd2cca47e93ed8632217a45b5087c1ecf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158331
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-22 19:02:13 +02:00
Mert Tumer 7fbea38b7a Load the locales from config file for languagetool
Locales needs to be read again
in the Preferences/Writing Aids section and since
this is a network operation it can cause a problem.
Better to list all the supported locales in the xcu
and load it right away.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135598
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153959
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 84bdf9e81a63a8bd308709c86b51bf3900a23c50)
Change-Id: Iad9201101aa167ad33f479c67f72649786e1f2cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158330
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-22 19:02:06 +02:00
Stephan Bergmann e0c33ec15f loplugin:ostr: automatic rewrite
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2023-10-07 00:47:20 +02:00
Mike Kaganski 5bf7c2fa57 Fix --disable-curl build
Change-Id: I3020d41eb6d0988cc886495a88a073a23bc8161c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156910
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-09-14 12:55:33 +02:00
Xisco Fauli 94e6049b64 Revert recent LanguageTool commits
Reason for revert: See discussion in https://gerrit.libreoffice.org/c/core/+/154302
- it's causing CppunitTest_sw_layoutwriter2 to fail on Windows.
- it's causing CppunitTest_sw_layoutwriter to fail on Linux.
- Probably other recent CI failures are also related.
- A similar commit was reverted one year ago for similar reasons -> https://gerrit.libreoffice.org/c/core/+/135859

This commit contains the following commits:

Revert "lok: remove old hack for LanguageTool locales"

This reverts commit 9a5329a266.

Revert "lok: LanguageTool provides list of languages"

This reverts commit 21d0489a5e.

Revert "lok: remove duplicated locales for LanguageTool"

This reverts commit a0865169ab.

Revert "Load the locales from config file for languagetool"

This reverts commit 81b0d9a951.

Change-Id: I3dc48097615f510e33e233e868b6b10704d81e67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154342
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-07-12 08:57:41 +02:00
Szymon Kłos 21d0489a5e lok: LanguageTool provides list of languages
- it sends supported list to the LOK client
- disables Spell Checker for locales supported by LanguageTool
- duden protocol supports only german
- initialize language tool config before usage to fetch correct
  list of supported languages

Change-Id: Id9de8519303774163721def8661fa408da449348
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146665
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153960
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154161
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2023-07-07 19:30:47 +02:00