Commit Graph
853 Commits
Author SHA1 Message Date
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
Szymon Kłos a0865169ab lok: remove duplicated locales for LanguageTool
Change-Id: I8fd1632f36a6c2c2d61331d6ce5dbd3cce83e2a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146776
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153961
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154155
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2023-07-07 12:01:49 +02:00
Mert Tumer 81b0d9a951 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>
Change-Id: I2ced6789df2a1d6fa2996e2d6b7d2a18e266afac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154154
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2023-07-07 12:01:40 +02:00
Khaled Hosny 2940fb7d2a tdf#64830: Don’t require hunspell dictionary for every Arabic locale
For old-style hunspell dictionaries, if “ar” dictionary is found, add
the rest of Arabic locales for that dictionary’s aLocaleNames, so that
distributions don’t have to symlink the dictionary files.

This is similar to the fix for macOS spell checking in:

Author: Khaled Hosny <khaled@aliftype.com>
Date:   Tue Feb 7 21:29:12 2023 +0200

    tdf#153436: Improve handling of Arabic system spell dictionary on macOS

Change-Id: I96b23566cba7b345a10e10c10f1bfe02ce1f8cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152706
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-07 17:56:49 +02:00
Mike Kaganski 23f918ef6a Use getXWeak in lingucomponent
Change-Id: Icd70dd656d847f595cc1325ed0decb4941a82cde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150857
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-04 22:51:50 +02:00
Noel Grandin 5c1561561a loplugin:unnecessarygetstr extend to more std::string checking
suggested by mike kaganski

Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-24 18:04:50 +02:00
Noel Grandin dba55c304a loplugin:unnecessarygetstr extend to createFromAscii
idea from mike kaganski

Change-Id: I0ecb9cad091d7a048d2ddae73165bf22748f3872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-24 12:45:22 +02:00
Mike Kaganski 0f6ec3939d Introduce o3tl::toU converting wstring_view to u16string_view
Change-Id: I5be9aa767020c2516984e47fcd0f51d4661fdf17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150779
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-22 12:46:01 +02:00
Noel Grandin f712c53133 loplugin:unnecessarygetstr extend to checking std::string::c_str
Change-Id: I17398e2a6a31a2c98ba8e54b5c8045f22aee8759
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150749
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-21 21:46:09 +02:00
Mike Kaganski 9aca8e1333 Use officecfg instead of SvxLanguageToolOptions
Change-Id: Ia9add4ff3ebe20ba491e33de1e9a2644a48ef7a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148548
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-09 19:36:57 +00:00
Mike Kaganski 3579343ec0 Some refactoring and deduplication
Change-Id: I443bd562bc9df6636bf71a230a05a12e443c6614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148532
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-09 12:08:16 +00:00
Mike Kaganski 6b6d59d04e Add some SAL_WARNs and SAL_INFOs
These help when debugging the LanguageTool issues.

Change-Id: I04bb84dbffc8e4c4e0b353f8e830fe66d8dff576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148199
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-08 12:52:12 +00:00
Stephan Bergmann a45f25bdfb Fix rtl::createUriCharClass argument (C++20)
Change-Id: Ifb4d8a430adc19d51d07af3ca2aff66a7983224a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148283
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-05 17:31:12 +00:00
Mike Kaganski e6d8db305d A bit more of refactoring
Change-Id: I43dde0375674c4078658a2179108edb5187d2cfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148257
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-04 21:42:00 +00:00
Mike Kaganski e35905c1b2 Set useragent for requests to LanguageTool server
Use the same string that is used in CurlSession

Change-Id: Ia383f2490cf484715f429df09ec80603ca3f9387
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148251
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-04 17:59:56 +00:00
Mike Kaganski 5a87ff41ef Restructure and deduplicate the code
Change-Id: Ib8701cbfbe0a025e19c34f0b52e0f67bf728f636
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148250
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-04 17:59:49 +00:00
Mike Kaganski 43dcdfae40 tdf#153617: percent-encode the text sent to LanguageTool API.
Change-Id: I0bb55c70f5602444440fca6e3c13b3d75418e49d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148236
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-04 14:18:51 +00:00
Mike Kaganski 5b9089a237 tdf#153948: LanguageTool: cache the prepared request
So that when the same text is re-checked using different
settings (e.g., language), the cached result is not used.

Change-Id: Ic4ed63c6835f9d3935f1b9541c80822bb52313c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148200
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-04 07:08:18 +00:00
Miklos Vajna 27b8c67bb1 lingucomponent: don't get locales from the server when this is disabled
Do it like LanguageToolGrammarChecker::doProofreading(), which already
checked for this setting.

Helps when soffice starts up in an environment without network access
and also is pointless. Avoids this warning:

warn:languagetool:13511:13511:lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx:508: CURL request returned with error: 28

Which looked odd, given that LT was disabled already.

Change-Id: Ideb0c59ad79bdbd7d22acef22e31a43377d30ec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148166
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-03-03 10:51:30 +00:00
Gabor Kelemen 259ae22056 Drop 'using namespace ::std' in dirs [e-p]*
Change-Id: Ibe6a2f662f5721c594d28a8e0d7340d0f3cffe95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147075
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-02-15 18:39:38 +00:00
Khaled Hosny 9d44236a62 tdf#153436: Improve handling of Arabic system spell dictionary on macOS
The system has only a generic “ar” spell dictionary, but LibreOffice
wants country code as well. Since it is the same dictionary for all
Arabic locales, we now add entries to all Arabic country codes we know
about.

Change-Id: Iaf5a8f495b3d1023d7fe40654afa0cce3fe9fbdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146641
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
2023-02-07 22:01:07 +00:00
Caolán McNamara 6285297c69 cid#1520803 silence Unchecked return value from library
Change-Id: I47bfb2b64526d47c2a064e3bb3d93474420825af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146613
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-07 19:54:39 +00:00
Andrea Gelmini d8e6b488ce Remove duplicated include
Change-Id: Ia5f606fd64737aed372afb2ee4762f9eb3e21a86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146380
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-01-31 21:53:56 +00:00