summaryrefslogtreecommitdiff
path: root/linguistic
AgeCommit message (Collapse)Author
2024-06-10silence unknown property 'HyphNoLastWord'... etc warningsCaolán McNamara
warn: linguistic:3688232:3688232:linguistic/source/lngprophelp.cxx:636: unknown property 'HyphNoLastWord' warn: linguistic:3688232:3688232:linguistic/source/lngprophelp.cxx:636: unknown property 'HyphKeepType' warn: linguistic:3688232:3688232:linguistic/source/lngprophelp.cxx:636: unknown property 'HyphKeep' Change-Id: I4f99961e17bd4e0f90925b8530e25729d964d42e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168600 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-05-10loplugin:ostr in linguisticNoel Grandin
Change-Id: Iebc2db1c5750a8cea835722c396d6f708fe6e0be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167426 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-05Silence strange -Wmaybe-uninitialized with recent GCC 14Stephan Bergmann
...seen at least with some (--enable-dbgutil --enable-otpimized etc.) configuration and a recent GCC 14 trunk, > In file included from ~/gcc/inst/include/c++/14.0.1/vector:66, > from include/unotools/options.hxx:26, > from include/unotools/lingucfg.hxx:27, > from linguistic/source/lngsvcmgr.cxx:35: > In destructor ‘constexpr std::__cxx1998::vector< <template-parameter-1-1>, <template-parameter-1-2> >::~vector() [with _Tp = SvcInfo; _Alloc = std::allocator<SvcInfo>]’, > inlined from ‘constexpr std::__debug::vector<_Tp, _Allocator>::~vector() [with _Tp = SvcInfo; _Allocator = std::allocator<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/debug/vector:245:7, > inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = std::__debug::vector<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/optional:283:35, > inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = std::__debug::vector<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/optional:314:14, > inlined from ‘constexpr std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = std::__debug::vector<SvcInfo>; bool _Copy = false; bool _Move = false]’ at ~/gcc/inst/include/c++/14.0.1/optional:437:65, > inlined from ‘constexpr std::_Optional_base<std::__debug::vector<SvcInfo>, false, false>::~_Optional_base()’ at ~/gcc/inst/include/c++/14.0.1/optional:508:12, > inlined from ‘constexpr std::optional<std::__debug::vector<SvcInfo> >::~optional()’ at ~/gcc/inst/include/c++/14.0.1/optional:703:11, > inlined from ‘LngSvcMgr::~LngSvcMgr()’ at linguistic/source/lngsvcmgr.cxx:519:1: > ~/gcc/inst/include/c++/14.0.1/bits/stl_vector.h:735:22: error: ‘((std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >*)((char*)this + 16))[22].std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_M_impl.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data::_M_finish’ may be used uninitialized [-Werror=maybe-uninitialized] > 735 | std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 736 | _M_get_Tp_allocator()); > | ~~~~~~~~~~~~~~~~~~~~~~ > ~/gcc/inst/include/c++/14.0.1/bits/stl_vector.h:735:22: error: ‘((std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >*)((char*)this + 16))[22].std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_M_impl.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data::_M_start’ may be used uninitialized [-Werror=maybe-uninitialized] Change-Id: I02815c39ee6026b4637a4bb6ad2804af7a446a57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165821 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-04-04loplugin:unusedmethodsNoel Grandin
Change-Id: I19f466a272c821185bea4b45efd34392e525c0d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165785 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-04Revert "osl::Mutex->std::mutex in GrammarCheckingIterator"Stephan Bergmann
This reverts commit 829fa53fe877d0f0fc33d634fa7fbfbed23b7676, which started all sorts of `make check` tests to hang for me due to a recursive locking attempt in > #5 std::mutex::lock (this=0x7f6af81e62c0) at ~/gcc/inst/include/c++/14.0.1/bits/std_mutex.h:113 > #6 std::unique_lock<std::mutex>::lock (this=<synthetic pointer>) at ~/gcc/inst/include/c++/14.0.1/bits/unique_lock.h:147 > #7 std::unique_lock<std::mutex>::unique_lock (this=<synthetic pointer>, __m=...) at ~/gcc/inst/include/c++/14.0.1/bits/unique_lock.h:73 > #8 GrammarCheckingIterator::NextDocId (this=0x7f6af81e6260) at linguistic/source/gciterator.cxx:317 > #9 GrammarCheckingIterator::GetOrCreateDocId (this=this@entry=0x7f6af81e6260, xComponent=uno::Reference to (SwXTextDocument *) 0x7f6af8430ec8) at linguistic/source/gciterator.cxx:339 > #10 0x00007f6b3b9e9da9 in GrammarCheckingIterator::startProofreading (this=0x7f6af81e6260, xDoc=<optimized out>, xIteratorProvider=<optimized out>) at linguistic/source/gciterator.cxx:773 > #11 0x00007f6b16441ec3 in SwDoc::StartGrammarChecking (this=<optimized out>, bSkipStart=bSkipStart@entry=false) at sw/source/core/doc/docnew.cxx:180 > #12 0x00007f6b164c4eae in sw::DocumentTimerManager::DoIdleJobs (this=0x7f6afad005a0) at sw/source/core/doc/DocumentTimerManager.cxx:169 > #13 0x00007f6b3e83a68b in Scheduler::CallbackTaskScheduling () at vcl/source/app/scheduler.cxx:509 > #14 0x00007f6b3eb1725f in SalTimer::CallCallback (this=<optimized out>) at vcl/inc/saltimer.hxx:54 > #15 SvpSalInstance::CheckTimeout (this=this@entry=0xffebe0, bExecuteTimers=bExecuteTimers@entry=true) at vcl/headless/svpinst.cxx:157 > #16 0x00007f6b3eb1761d in SvpSalInstance::ImplYield (this=this@entry=0xffebe0, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:395 > #17 0x00007f6b3eb17cd5 in SvpSalInstance::DoYield (this=0xffebe0, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:467 > #18 0x00007f6b3e86aa44 in ImplYield (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:394 > #19 0x00007f6b3e86b13b in Application::Execute () at vcl/source/app/svapp.cxx:369 > #20 0x00007f6b3c8e715f in desktop::Desktop::Main (this=0x7ffe5e22fcb0) at desktop/source/app/app.cxx:1615 > #21 0x00007f6b3e87e6fb in ImplSVMain () at vcl/source/app/svmain.cxx:229 > #22 0x00007f6b3e87e9c5 in SVMain () at vcl/source/app/svmain.cxx:261 > #23 0x00007f6b3c91de37 in soffice_main () at desktop/source/app/sofficemain.cxx:93 > #24 0x000000000040078b in sal_main () at desktop/source/app/main.c:51 > #25 main (argc=argc@entry=8, argv=argv@entry=0x7ffe5e22feb8) at desktop/source/app/main.c:49 Change-Id: I60b8b0ba00cae691d6089325e4379a86221dc95b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165764 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-04-03osl::Mutex->std::mutex in GrammarCheckingIteratorNoel Grandin
Change-Id: Icda197a9c1a20b245079c91a7a7b2301a5955b09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165736 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-01tdf#146619 Drop unused 'using namespace' in: linguistic/Gabor Kelemen
Change-Id: Ib4df4e592e6b485dc087eddb49f59fc24c710380 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165532 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-20tdf#158885 cui offapi sw xmloff: fix hyphenation at stem boundaryLászló Németh
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 c899d3608d30f3ab4c2bc193c1fcd765221614a4 "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-08Remove duplicated includeAndrea Gelmini
Change-Id: Iaba173fc0bb56c9eb2f61ddb092eefba6d59cf68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164566 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2024-03-08use more string_viewNoel Grandin
found by tweaking the stringview loplugin Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-06remove deprecated IsGermanPreReform propertyNoel Grandin
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-04finish removing IsSpellCapitalisation propertyNoel Grandin
which was partially removed in commit 9bb9ba6ae02692e65498bae4598e3b63bb65c02e 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-02-28use more string view in linguisticNoel Grandin
Change-Id: Ib5c776f95b424128871a1676d996ae95b7048c64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164016 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-14lok: implement a joinThreads function - to wind down thread pools.Michael Meeks
Necessary to do this before forking on Unix systems; use a dynamic_cast interface since this is all for internal use. Change-Id: I8a911322acd4ec5654eb0d14804c09d513a0bd4b Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163335 Tested-by: Jenkins
2024-01-27Drop std::as_const from css::uno::Sequence iterationsMike Kaganski
Obsoleted by commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (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-09avoid null deref of xIgnoreAllCaolán McNamara
Change-Id: Ib8e3309c046a74ca13f88fd0a668f3e1d6b909b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161802 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161815 Tested-by: Jenkins
2024-01-09tdf#150716 - Partially solves the issue.Gökay Şatır
This PR fixes the IgnoreAll issue. "Ignore" functionality needs another PR. Grammar checker and spell checker have different implementations. IgnoreAll functionality is implemented for spell checker but not grammar checker. This PR implements IgnoreAll for grammar checkers. Note: Ignore All function is valid per editing session. The ignored words is reset after the session is closed. Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I7c2b77b18e0a26a6a1c5fa9e8e66075a34612884 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159813 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit c0a619aa945c852652dc353dbe4c42cabbc2b779) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161699 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-01tdf#158885 sw: don't hyphenate right after a stem boundaryLászló Németh
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>
2023-12-22Lok: make Ignore All list name independent on UI languageMike Kaganski
Fixes not working "Ignore All" context menu entry in e.g. German UI in Online. Change-Id: I761c9f65c89fb5c7e929ea20f2db4eff20f7d53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161170 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-20Extended loplugin:ostr: linguisticStephan Bergmann
Change-Id: I74b95a853a142da3e2df5b974a13d991f13d28eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159694 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-11Move user agent initialization to InitCurl_easyMike Kaganski
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-10Add missing license headersMike Kaganski
Change-Id: I4c94fb9d92b02b42b185d205887fa7bce1c45be6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-09officecfg,*: add Office::Security::Net::AllowInsecureProtocolsMichael Stahl
By default, unencrypted network connections are allowed. But now it can be disabled, for everything that uses libcurl. Change-Id: I8e103f5a968ace2a19fdb9d6934c9a51b2aeabe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159011 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-07curl: mitigate migration to OpenSSL on LinuxMichael Stahl
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 c2930ebff82c4f7ffe8377ab82627131f8544226) Change-Id: Ibf1cc0069bc2ae011ecead9a4c2b455e94b01241 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158915 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann
...in include files. This is a mix of automatic rewriting in include files and manual fixups (mostly addressing loplugin:redundantfcast) in source files that include those. Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: linguisticStephan Bergmann
Change-Id: I0866cdaffa7059c30a65373efcd37a91b1b6e63e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-18Clean up the remaining uses of OUStringConstExpr, and drop itStephan Bergmann
Change-Id: I30b2ac77b58e2ae1d1e997a0c830c513542b973d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158101 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-11Drop o3tl::span, can use C++20 std::span directly nowStephan Bergmann
Change-Id: Ic21ff7bf48f07f7277979d52e99d2c5c268de83f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157825 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-09-10using decls should come after #includeNoel Grandin
Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-26new loplugin:constexprliteralNoel Grandin
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-02Simplify a bitMike Kaganski
Change-Id: I0d03a1c68cec9ff0edc2c14f3837054a2c693a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152534 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-02tdf#155647: Pass XFlatParagraph by normal Reference, not WeakReferenceMike Kaganski
Since commit a7ce722b476c4bb0c9a113ae0c2759181edfe48f (tdf#155232: drop m_aFlatParaList from SwXFlatParagraphIterator, 2023-05-13), the instances of XFlatParagraph are not cached in its iterator. Hence, the instances created in GrammarCheckingIterator to pass to AddEntry got immediately destroyed upon the scope end, before the checking thread (where weak references were passed) had a chance to create own hard references. Then GrammarCheckingIterator::DequeueAndCheck found that xFlatPara was empty, and exited. Just pass hard references there. The iterator was passed to the thread by hard reference in FPEntry anyway; and so, the use of weak reference to flat paragraph objects provided no benefit, when the iterator kept hard references. Change-Id: Ib56652d88b9a5c6f20aa3d70fed18f8be0d3a3df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152554 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-02Fix nullptr dereferenceMike Kaganski
Seen e.g. in builds where no grammar checker was available (like bibisect, or own builds), and LanguageTool is enabled in its page, and then enabled in Writing Aids options page (Available Language Modules list) in the same session, without program restart. Change-Id: I5ac007ec5e1dfc860085bfd3f95aa61a737ec449 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152529 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-13use more optional for CharClassNoel Grandin
Change-Id: I67984321b8f38928bfab9fb0b624620e7d286a11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151722 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-06Use getXWeak in linguisticMike Kaganski
Change-Id: I1202763917dab414e8bc540bd89d736e74fa1450 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150858 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-09Use officecfg instead of SvxLanguageToolOptionsMike Kaganski
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-08Add some SAL_WARNs and SAL_INFOsMike Kaganski
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-05tdf#152459: fallback to language-only when looking for grammar checkerMike Kaganski
LanguageTool registers itself for languages like "en-US", "es-AR", "de-DE"; but also for generic "en", "es", "de". When the requested language, like "fr-CH" or "es-PH", is not found in the registered grammar checkers, the fallback strings will be attempted. Change-Id: Id460db8d378f246ea98191d22bdb3537fd1aee1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148201 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-05No need to use a clearable guard hereMike Kaganski
Change-Id: I34a3aba881ae3591130fb3a0d7ae9eb768f615bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148267 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-05Swap instead of copy-assignmentMike Kaganski
Change-Id: I5f54dad94cde60dd299f3db22c19a3565a2524a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148268 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-28tdf#143148 Use pragma once instead of include guardsniket1322git
Change-Id: I0f531280f4d85de3eae6de36bfba975e96d8e7fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147661 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2023-02-15Make a few warning messages a bit more usefulTor Lillqvist
Change-Id: Ie533e76532f2ee6477cce8042d958d36bf9ebb9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147082 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-02Remove redundant attributes that were added to published XLinguPropertiesStephan Bergmann
...by 57d79744c77eef96b4c2bd3b16e0a04317ffcf9e "tdf#136306 offapi linguistic: add options to disable rule-based compounding". See <https://lists.freedesktop.org/archives/libreoffice/2023-January/089784.html> "Re: Request for [API CHANGE] in spell checking: add new options to disable rule-based compounding" for details. (And I want to get offapi/type_reference/offapi.idl back into a clean state before updating the reference rdbs, which I want to do now that LO 7.5.0 has been released, so I'm taking over here.) Change-Id: I75d0ccdfdf644421e22c95de5db3267e8872a09d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146505 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-01linguistic: add REST API protocol unit testHenry Castro
Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: I4768f8bb5bfa572d222fa5610f95c99169e6e390 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143249 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145600 Tested-by: Jenkins
2023-01-30no need to take SolarMutex when calling Idle::StartNoel Grandin
but it is wise to hold our own mutex while accessing our own field Change-Id: Ic66ab8dde5711e0a91b6c31cebf42a6066e638b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146309 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-21tdf#144915 effectively remove limit on number of words in dictionaryCaolán McNamara
this was 2000 entries in the initial checkin, then changed to 30000 (in 2008). Lets makes it effectively unlimited. Change-Id: Ia757e3283f1ff41d62e6738af9d1f6674ba2fd56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145916 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-17Properties SortedTextId and DocumentElementsCount added for grammar checkFred Kruse
The LanguageTool extension (LT extension) runs not only a grammar check on the level of sentences and paragraphs, some rules work on the level of many paragraphs or full text. The LT extension uses a complex caching mechanism to support this feature. A mapping from a check request to the cached to the (flat)paragraphs is necessary. Until now, this is done by a time-consuming and error-prone mechanism. The adding of the SortedTextId introduce a feature, a paragraph to be checked can be fast and easy identified. The flatparagraphs also can easily be mapped to cursors to get additional information of the paragraph, used for further features of LT extension. The added Property DocumentElementsCount to flatparagraphs and doProofreading gives the extension the hint to recreate the cache. Change-Id: I4b6b58bba4dfb3e870fe7b71fd8537ee9ffd6476 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142251 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-01-05Revert all the recent loplugin:unocast changesStephan Bergmann
...as obsoleted by ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for dynamic_cast on UNO proxy objects". This reverts all of: 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c "loplugin:unocast (framework::Desktop)" 03efbf72f4ddf7a84aa8aabef348331bd4b75e8a "loplugin:unocast (vclcanvas::TextLayout)" 80099fdd51a69eaa6c36ca88ef772810e4a777fa "loplugin:unocast (SalGtkXWindow)" cc147f576d8687fb79c77d47d41dc4ba1678a469 "loplugin:unocast (sdext::presenter::CachablePresenterView)" 40db42be1d8fd0f9c6c8c5ba3767ddb9ee2034c2 "loplugin:unocast (vclcanvas::CanvasFont)" 2d1e7995eae29e2826449eb5179f5fae181794a5 "loplugin:unocast (CairoColorSpace)" 4c0bbe4bd97636207cf71a6aa120c67698891da9 "loplugin:unocast (canvas::ParametricPolyPolygon)" 89803666621c07d1b1ac9d3bd883f0ca192a91a0 "loplugin:unocast (vclcanas::CanvasBitmap)" d5e0c2c8db71878d21c2a7255af08cf5f9a6dd04 "loplugin:unocast (sfx2::DigitalSignatures)" c0c4519e0d5b555f59bbc04cc616454edfd1f4ce "loplugin:unocast (VCLXAccessibleComponent)" feb8b833a6245d42400f42a0bc789dc84594ee6f "loplugin:unocast (VCLXDialog)" 1fa58cc6cc9c3849753342a5d9a6ddfa461b5e66 "loplugin:unocast (VCLXMultiPage)" f481f036deb1b1b46f3038074c4659f3a91b9c6c "loplugin:unocast (DocumentSettingsSerializer)" 73df933f5fa5932f94e5a1b338a3eda00a9ce354 "loplugin:unocast (css::embed::EmbeddedUpdate)" 420165ab0ef03c0467f9d17f504de2d2fc78f0e6 "loplugin:unocast (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)" 9abe8ee067e6c00f19d8a13346d53c4641c27166 "loplugin:unocast (MutableTreeNode)" 9f3022ceb036f23b4b0994c3e2fbd1001bff225a "loplugin:unocast (VCLXTabPage)" 1be70dda02c12a60778b7607cff2520ae1aa611e "loplugin:unocast (vcl::unotools::VclCanvasBitmap)" d6a70bb641b96e8e5616448c2378131ed62658b4 "loplugin:unocast (basegfx::unotools::UnoPolyPolygon)" 5a14f009e6782c077463c8cbb8e9cea3d7950107 "loplugin:unocast (xmlsecurity::Certificate)" 99009c9535dfa3e0d838989ccc7d84bfa2320ff4 "loplugin:unocast (sd::Annotation)" 0c7585c5fa78887e5459885ed744e8044fd76137 "loplugin:unocast (sd::TextApiObject)" 24e14afd1bfcaed6c200ab081973fba7e47267ca "loplugin:unocast (SignatureVerifierImpl)" 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 "loplugin:unocast (pcr::PropertyEventTranslation)" a97e2d2702d9a6f37775ccee2c08c4f3b2479c4b "loplugin:unocast (RangePageBreaks)" 19dfdf86ad1f5b08041d8b7a9f196caf881231ab "iloplugin:unocast (pcr::OFormattedNumericControl)" f9785ea595fd8e911f6370e836fa579225b9e571 "loplugin:unocast (frm::OInterfaceContainer)" 5e5f40a4a92a31b0932c690219d002fcf18598cf "loplugin:unocast (ScVbaShapes)" 27b35b2c215b4832d4378ec3a7ecbba926552d06 "loplugin:unocast (ScVbaShapeRange)" cb3108f860065928552a86cf8acc4b3a95718ecf "cid#1517812 Dereference null return value" feba0ddb1521d1142560fe54b7d7696ee910237f "loplugin:unocast (weld::TransportAsXWindow)" 4d6c23216559eb48f9943bb49d6e475a6d64ba15 "loplugin:unocast (oox::ForumlaImExportBase)" 4844c096a8ab6a9a620c410a0949d4499f12a504 "loplugin:unocast (cairocanvas::SurfaceProvider)" 9a0b523e0a84d403b9092176ccec4b3e3efe42d0 "loplugin:unocast (cairocanvas::CanvasBitmap)" 8a5648d8e59b4b007dbbf3824777c19a21efc61e "loplugin:unocast (cairocanvas::TextLayout)" 28c27a0623bc78a0590858f97d03b620985bc84c "loplugin:unocast (cairocanvas::CanvasFont)" 53bc223cb3288e32a417696ee61c29e5f01f209d "loplugin:unocast (cairocanvas::RepaintTarget)" 5f70b0b9f6bc4ab145ddbd9155590ed4a3b1b9ec "loplugin:unocast (SvXMLImport)" 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 "loplugin:unocast (VCLXWindow)" 88b4f966202717cd4ad38a30a8eda22c3e69ed35 "loplugin:unocast (sfx2::sidebar::SidebarController)" f1b7a69b280aefe2f1b3b0f32193494fd765f2bd "loplugin:unocast (SvxLineStyleToolBoxControl)" ba76f0ba7e8de4d2953739c952004b7d9af47197 "loplugin:unocast (i18npool::Calendar_gregorian)" 840154daf934d8df52ead1cb7acd798c4d30f007 "loplugin:unocast (framework::AddonsToolBarWrapper)" b0e9c4c5f063cefa9557810e3349bdb9c7493091 "loplugin:unocast (GrammarCheckingIterator)" 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac "loplugin:unocast (ucb::ucp::ext::Content)" 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a "loplugin:unocast (basic::SfxScriptLibraryContainer)" 9e73ff9fce12e102bb3c3cea8d8bb96c88f2c9ad "loplugin:unocast (sdext::presenter::PresenterNotesView)" a98acca8fbc38d3fd5600ae5056a8e42b6d8a40d "loplugin:unocast (SelectionChangeHandler)" c0b59ad6e35b0cb0dea0821e95f95569739078c1 "Consistently use comphelper::getSomethingImpl<I>(aIdentifier, this)" 276e3ccbdd3259ec3daf8a1a98fa7f406b14e21c "loplugin:unocast (vclcanvas::RepaintTarget)" Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-30tdf#136306 offapi linguistic: add options to disable rule-based compoundingLászló Németh
Add two new spell checking options to disable rule-based closed and hyphenated compound word recognition with Hunspell dictionaries: com::sun::star::linguistic2::XLinguProperties::IsSpellClosedCompound com::sun::star::linguistic2::XLinguProperties::IsSpellHyphenatedCompound For professional proofreaders, it can be more important to avoid of the mistakes of the rule-based compound word recognition, than to speed up proofreading. Disabling the following two new options will report all rule-based closed compound words (default in Dutch, German, Hungarian etc. dictionaries) and rule-based hyphenated compound words (all languages with BREAK usage in their Hunspell dictionaries): - "Accept possible closed compound words" - "Accept possible hyphenated compound words" For example, disabling the second one, dictionary word "scot-free" will be still correct word in English spell checking, but not the previously accepted compound "arbitrary-word-with-hyphen". Note: the second option works with the update to Hunspell 1.7.2. Change-Id: Id879610927d5e8269fda5ad207c1c2fe1f57a0b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144875 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-12-14loplugin:unocast (GrammarCheckingIterator)Stephan Bergmann
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I4ecaa3cfafbb2e01ede956e4f3f6d58f40bdbb57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144146 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>