200 Commits
Author SHA1 Message Date
Khaled Hosny 4af6707b3b tdf#172646: Fix text search match offsets around surrogate pairs
Use OUString::iterateCodePoints() to get the next code point. Just
incrementing the index does not work with surrogate pairs.

This is an existing bug that was exposed by properly handling surrogate
pairs while case folding in:

commit 8922952429
Author: Khaled Hosny <khaled@libreoffice.org>
Date:   Mon Jul 24 18:45:38 2023 +0300

    i18nutil: Fix ICU case folding of surrogate pairs

Change-Id: I51328ae6d17ef935d5be00f7327949a26724b9ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207750
Tested-by: Jenkins
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
2026-07-08 13:14:20 +02:00
Ethan Garcia 045ce3a5be tdf#168520 Rename testTdf138410 to clarify Arabic diacritic search
Change-Id: Iabc5d71f4aa9f66577d1674edf84af321612b0dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202928
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-03-31 17:57:02 +02:00
Saburo Yoshida b643c5c0ac tdf#169590 i18npool: Fix incorrect line breaking in CJK
Since 5a03d511f4 commit,
ICU line breaking rules are now honored and Asian typography options
for paragraph formats are now ignored.
Respect cases where users apply a list that is different from the
default forbidden character list, or cases where no forbidden character
list is applied.

Change-Id: I7d021c1dcb1e9722eb5f7ae6295b949641dcfe01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198442
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-02-05 11:09:43 +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
László Németh 09b5b77e02 tdf#162514 i18npool: fix Hungarian ordinal numbers with affix
Restores Hungarian break iterator by recognizing ordinal
numbers with affixes, e.g. "50.-et" etc. (to spell checking
bad forms, like "50.-at").

Regression from commit 44699b3de3
"tdf#49885 BreakIterator rule upgrades".

Follow-up to commit f4fe6df6aa
"tdf#162514 i18npool: Handle abbreviations in dictionary breakiterator"
and commit 167bbe31c0
"tdf#162514 i18npool: apply fix for Hungarian abbreviations, too".

Change-Id: I6b6ea363a509a9d8af8330330f78cc23c210d107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196225
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-12-26 20:36:41 +01:00
László Németh 167bbe31c0 tdf#162514 i18npool: apply fix for Hungarian abbreviations, too
Restores Hungarian abbreviation handling to spell checking by
applying the fix for dict_word_hu.txt.

Regression from commit 44699b3de3
"tdf#49885 BreakIterator rule upgrades".

Follow-up to commit f4fe6df6aa
"tdf#162514 i18npool: Handle abbreviations in dictionary breakiterator".

Change-Id: I83e30c831759ae896f1db2da697287b8c4dcd26b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196224
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-12-26 11:33:35 +01:00
Jonathan Clark 01c934f7bc tdf#167873 i18npool: Port CJ brkitr customizations from ICU upstream
Upstream ICU includes non-standard rule extensions for Chinese and
Japanese, which add line breaking opportunities between U+201C/U+201D
double quotation marks and leading/trailing CJK ideographs. This change
backports those rule customizations, for correct layout of Simplified
Chinese.

Regression from:

    commit 5a03d511f4
    Author: Jonathan Clark <jonathan@libreoffice.org>
    Date:   Mon Apr 7 21:37:26 2025 -0600
    tdf#130592 i18npool: Fix incorrect line breaking in mixed CJK+Latin

Change-Id: I3cf6c0cd23e38f9a89c98fdd6c6f665f175b676c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190904
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-09-13 02:47:51 +02:00
Jonathan Clark 5a03d511f4 tdf#130592 i18npool: Fix incorrect line breaking in mixed CJK+Latin
This change updates the CJK BreakIterator to run ICU line breaking rules
after applying user forbidden rules. This fixes several identified CJK
GUI text rendering issues, most significantly that embedded English runs
were previously broken using CJK break rules, rather than using the
correct English rules.

By implementing this fallback to the ICU rules, the CJK BreakIterator
now also correctly handles non-breaking characters. This change
therefore also fixes tdf#117554.

Change-Id: I3bacc7e2b559729df2c37c010974d180c8eef1f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183825
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-04-09 06:47:38 +02:00
Jonathan Clark 9a14a0fd8b tdf#162912 i18npool: Updated CJK BreakIterator to use custom rules
Regression from commit 14c6cde779:
  "tdf#49885 Updated CJK BreakIterator to use ICU"

Previously, languages requiring dictionary-based break iterators were
handled by instantiating a stock ICU break iterator as a special case.
tdf#49885 upgraded our custom rules to support passthrough for
dictionary-based breaking, so this special case is no longer necessary.

Change-Id: Iebb06de82eb511946e5b220e5dc414440838b03c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177713
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-12-03 01:29:20 +01:00
Jonathan Clark f23c1baa46 tdf#164062 i18npool: Added da_DK as a prepostdash language
Previously, Danish words ending with hyphens were not handled correctly
during spell checking. This change fixes the issue by modifying the
da_DK locale to reference the existing breakiterator rules for languages
with word-final hyphens.

Change-Id: I9b08fb5246b5b846814dc3b4b9ba249b29fc7a84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177504
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-11-29 22:09:00 +01:00
Jonathan Clark f4fe6df6aa tdf#162514 i18npool: Handle abbreviations in dictionary breakiterator
Restores abbreviation handling to spell checking.

Regression from commit 44699b3de3
 "tdf#49885 BreakIterator rule upgrades".

Change-Id: I2883f984952aa3e54cfe800590a16c0de74ae0e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177506
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2024-11-29 18:40:51 +01:00
Noel Grandin 5de73f04f3 new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04 08:51:00 +01:00
Jonathan Clark aa938fe03c tdf#150621 Changed Korean word counting to use words
Previously, Writer counted characters for all CJK languages, rather than
words. This is the correct behavior for Chinese and Japanese, which make
extensive use of ideographs. However, it is not correct for Korean.

This change adjusts the Writer word count algorithm to count Korean
words, rather than Korean characters.

Change-Id: I6e77136867baca1a7b51248886ee5fd7073ad364
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170621
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-07-17 15:45:41 +02:00
Jonathan Clark 8c063d4e29 tdf#114160 Regression tests for non-breaking ZWJ
Per Unicode rules, ZWJ shouldn't be treated as a line break opportunity.
This change adds regression tests to verify lines do not break at ZWJ.

tdf#114160 was a regression introduced during a prior ICU upgrade. This
was fixed by commit 44699b3de3, but no
tests were added for ZWJ at that time.

Change-Id: Ieca919daea11dc161ae35fb6ffe5bd366cf4a6f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170534
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2024-07-16 04:43:26 +02:00
Jonathan Clark 174aa6e980 tdf#46950 Allow intra-word right double quotation mark
Hebrew text may use the character RIGHT DOUBLE QUOTATION MARK as a
substitute for HEBREW PUNCTUATION GERSHAYIM. This change customizes the
ICU word BreakIterator rules to that end.

Change-Id: I03a48729de103505a2f68f9a1635c0f0cd7d126a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170536
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2024-07-16 02:17:54 +02:00
Xisco Fauli 83a8d5a275 BootstrapFixture: get rid of mxComponentContext
Change-Id: I0318485c3c0159277e47096e0c7e0df8ed109ea4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169865
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-07-02 15:35:00 +02:00
László Németh 2b9fee5a3e tdf#161737 i18npool: fix bad word selection with NNBSP
Fix word breaking rules also for editing. Previously
the word was selected with the following narrow no-break
space, e.g. at French words before exclamation and question
marks (where narrow no-break space allows to get correct
typography, if the OpenType/Graphite font doesn't have
this feature).

Add this and the previous fixes for Hungarian, which
handled by extra word-breaking rule files.

Follow-up to commit 6e002da161
"tdf#161737 i18npool: fix fake spelling alarms with NNBSP".

Change-Id: I7230bd356e5f0360172b652e615a61d96131d336
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169624
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-06-27 16:49:51 +02:00
László Németh 6e002da161 tdf#161737 i18npool: fix fake spelling alarms with NNBSP
Fix word break by excluding narrow no-break space at the
end of the words for spell checking.

This was a problem e.g. for French, where (automatically? or
manually) inserted narrow no-break space is used to get correct
typography before exclamation and question marks, also after and
before guillemets, if the OpenType/Graphite font doesn't have this
feature).

Regression from commit 44699b3de3
"tdf#49885 BreakIterator rule upgrades".

Note: this fixes also the problem, when digits separated
by NNBSP thousand separator weren't handled by spell checking,
alarming fake spelling mistakes, when "Check words with numbers"
was enabled in Tools->Options->Languages and Locales->Writing Aids.
(TODO: at the case of thousand separators, remove NBSP by the
linguistic module or by the spell checking dictionaries to allow
to check numbers with thousand separators and with correct suffix.)

Change-Id: I36e10add7e0ba840f207a375ccc8668dbfef9572
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169618
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2024-06-27 16:48:41 +02:00
László Németh 3a02490e1a tdf#138258 i18npool: allow ASCII double quote to match typographic quote
Similar to the straight (typewriter or ASCII) apostrophe, straight
double quotation mark (") matches its typographic variants now,
like other word processors do.

Note: regex search doesn't use this matching, similar to the apostrophe
search.

Follow-up to commit d40f2d02df
"tdf#117643 Writer: fix apostrophe search regression".

Change-Id: If6a3ee00750828583cd0cfc4aa7f7b656ea9bd1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169605
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2024-06-27 10:22:11 +02:00
Noel Grandin d573e2ae17 loplugin:ostr in various
Change-Id: I9f399b3752da9df930e0647536ffcd4e82beb1ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167856
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-20 22:09:56 +02:00
Jonathan Clark 44699b3de3 tdf#49885 BreakIterator rule upgrades
This change re-bases the BreakIterator rule customizations on top of a
clean copy of the ICU 74.2 rules.

Change-Id: Iadcf16cab138cc6c869fac61ad64e996e65b5ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166273
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-09 21:23:50 +02:00
Noel Grandin 43f4c07574 loplugin:ostr in i18npool
Change-Id: I0176d93b38788e28fa42baad293597f98eaa7a21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167378
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-09 12:48:08 +02:00
Jonathan Clark 14c6cde779 tdf#49885 Updated CJK BreakIterator to use ICU
Previously, the CJK BreakIterator used custom dictionaries for Chinese
and Japanese. This change removes these custom dictionaries in favor of
the upstream ICU implementation, which uses an externally-maintained
frequency dictionary for these languages.

This change also removes support code for dictionary-based break
iterators, as it is no longer used.

Change-Id: I55c4ce9c842d1751997309fd7446e0a6917915dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166136
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-03 12:30:59 +02:00
Jonathan Clark 64743ee6bc tdf#49885 Removed custom Thai BreakIterator
Previously, a custom BreakIterator was used for Thai grapheme clusters.
This change deletes the custom BreakIterator, in favor of the ICU
implementation.

Change-Id: Icec94c73a5734c2059786dfbba085f487c488d7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166156
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2024-04-20 21:26:06 +02:00
Jonathan Clark fb94cc0d13 tdf#49885 Reviewed BreakIterator customizations
This change completes the review of BreakIterator rule customizations,
and adds unit tests for relevant customizations.

Change-Id: I06678fcccfc48d020aac64dd9f58ff36a763af30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166017
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2024-04-17 13:27:57 +02:00
Ashwani5009 ea462462db tdf#147021 Replace SAL_N_ELEMENTS with std::size
As part of the efforts in #145538 to replace the SAL_N_ELEMENTS()
macro with std::size() and std::ssize(), this commit performs the
necessary changes for a few files in the i18npool module.

Change-Id: Ic64be31b74cd74faf17497a47d6a15158b85184c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166013
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-04-12 19:54:13 +02:00
Stephan Bergmann f94351f54b Extended loplugin:ostr: i18npool
Change-Id: Ia0a844bc6e3f27758c869f5e229097085288e8bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159698
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-20 07:26:48 +01:00
Stephan Bergmann 3bbed358b6 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: i18npool
Change-Id: If3eb4d8fb3068e26ce42c8cc751c2de38b5d04cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158202
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20 07:06:43 +02:00
Stephan Bergmann b4844c310b Repurpose loplugin:stringstatic for O[U]String vars that can be constexpr
...now that warning about O[U]String vars that could be O[U]StringLiteral is no
longer useful

Change-Id: I389e72038171f28482049b41f6224257dd11f452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15 21:15:49 +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
Khaled Hosny d592e50248 i18npool: Test case folding of surrogate pairs
Change-Id: I3097651927b85aaa46fc4fc59badf22d24fcb928
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154872
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-24 21:07:02 +02:00
Khaled Hosny 88790291dd tdf#97152: Fix upper case mapping of lunate sigma (U+03F2)
It was mapped to uppercase sigma (U+03A3) while it should be mapped to
uppercase lunate sigma (U+03F9). Fix by letting this slot fallback to
ICU case folding.

Change-Id: I14ffa0151c740779b67af14be8c7af8c51c3a1e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154845
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-24 20:20:21 +02:00
Khaled Hosny 9eb88d78c8 tdf#96343, tdf#134766, tdf#97152: Fallback to ICU for case mapping
If we are requested to case map a character not present in our case
mapping data, fallback to ICU case mapping functions.

We should switch completely to ICU at some point, but we need to
evaluate our case mapping data and see if it differs from ICU and if
there is a reason for it.

Does not handle the case of U+03F2 turning into Sigma from tdf#97152.

Change-Id: Icf13ac7aab6d07b2a90fc0ff5ef1c4f50c7a7f8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154803
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-24 20:20:07 +02:00
Khaled Hosny c728b15cba i18npool: Add a test for sigma case folding
This is one of the special case folding characters.

Change-Id: Icfe986b216eb62ed595402b31908c2fd22cd475e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154821
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-24 07:35:29 +02:00
Khaled Hosny 9d61345084 CppunitTest_i18npool_characterclassification: use CPPUNIT_TEST_FIXTURE()
Change-Id: I6cc87255af385116b7e86ceaea67b26ca1f44709
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154806
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-24 07:35:22 +02:00
Khaled Hosny f0b87e8162 Require icu-i18n >= 66
We were requiring ICU 4.6 which was released in 2011, and ifdef'ing our
way through newer ICU versions. ICU is a core dependency and it makes no
sense to build LibreOffice with such ancient versions of it.

This change requires ICU 66 (released in 2020), and removes all the
ifdefs for older versions. There are more cleanups to do, but these will
be done separately.

Change-Id: I2e4f7608a08f4d531b0a4c74bbfdf91a451f833f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153387
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-21 16:59:20 +02:00
Stephan Bergmann c9b6bf655e Add some tests for (Japanese) i18n::IndexEntrySupplier behavior
...in preparation for some upcoming i18npool/util/i18npool.component clean-up

Change-Id: I8e93aa33759f2bdd6b9422b3833a608cfbed1df0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150948
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-25 09:18:15 +02:00
Stephan Bergmann 852af3af0d Fix UBSan function-type-mismatch
...as seen with the additions to CppunitTest_i18npool_transliteration made here,

> i18npool/source/transliteration/textToPronounce_zh.cxx:175:17: runtime error: call to function get_zh_zhuyin through pointer to incorrect function type 'unsigned short **(*)()'
> workdir/CustomTarget/i18npool/indexentry/zh_zhuyin.cxx:1512: note: get_zh_zhuyin defined here
>  #0 in i18npool::TextToPronounce_zh::TextToPronounce_zh(char const*) at i18npool/source/transliteration/textToPronounce_zh.cxx:175:17
>  #1 in i18npool::TextToChuyin_zh_TW::TextToChuyin_zh_TW() at i18npool/source/transliteration/textToPronounce_zh.cxx:149:5
>  #2 in TextToChuyin_zh_TW_CreateInstance(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) at i18npool/source/registerservices/registerservices.cxx:236:1
>  #3 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceEveryTime(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:173:24
>  #4 in cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx:230:12
>  #5 in non-virtual thunk to cppu::(anonymous namespace)::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/factory.cxx
>  #6 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:709:26
>  #7 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool) at cppuhelper/source/servicemanager.cxx:675:16
>  #8 in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx:1006:36
>  #9 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) at cppuhelper/source/servicemanager.cxx
>  #10 in i18npool::TransliterationImpl::loadBody(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration>&) at i18npool/source/transliteration/transliterationImpl.cxx:619:45
>  #11 in i18npool::TransliterationImpl::loadModuleByName(std::basic_string_view<char16_t, std::char_traits<char16_t>>, com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration>&, com::sun::star::lang::Locale const&) at i18npool/source/transliteration/transliterationImpl.cxx:630:5
>  #12 in i18npool::TransliterationImpl::loadModuleByImplName(rtl::OUString const&, com::sun::star::lang::Locale const&) at i18npool/source/transliteration/transliterationImpl.cxx:278:9
>  #13 in (anonymous namespace)::Transliteration::testTextToChuyin_zh_TW() at i18npool/qa/cppunit/transliteration.cxx:120:27

For one, there had always been a mismatch between the return type `const
sal_uInt16**` generated in i18npool/source/indexentry/genindex_data.cxx since
d319c4611e "INTEGRATION: CWS i18n24 (1.1.2); FILE
ADDED" vs. `sal_uInt16**` used in
i18npool/source/transliteration/textToPronounce_zh.cxx since
f4705bf0a3 "INTEGRATION: CWS i18n24 (1.8.36); FILE
MERGED".

And for another (and more severe, as it caused random writes), there had also
been a mismatch between the parameters `(sal_Int16 &max_index)` newly generated
in i18npool/source/indexentry/genindex_data.cxx since
7696cd3902 "INTEGRATION: CWS i18n31 (1.4.60); FILE
MERGED" (and correctly used in
i18npool/source/indexentry/indexentrysupplier_asian.cxx since
58dcf0ffaf "INTEGRATION: CWS i18n31 (1.9.60); FILE
MERGED") vs. the original `()` used in
i18npool/source/transliteration/textToPronounce_zh.cxx ever since
f4705bf0a3 "INTEGRATION: CWS i18n24 (1.8.36); FILE
MERGED".

For DISABLE_DYNLOADING, the second (missing max_index parameter) issue appears
to have been broken even further with 9db03b879b
"i18npool: fix wrong static function symbols", replacing the wrong

    sal_uInt16** get_zh_zhuyin();
    sal_uInt16** get_zh_pinyin();

declarations in i18npool/source/transliteration/textToPronounce_zh.cxx with the
even worse declarations

    sal_uInt16** get_collator_data_zh_zhuyin();
    sal_uInt16** get_collator_data_zh_pinyin();

corresponding to function definitions generated by
i18npool/source/collator/gencoll_rule.cxx (which also happen to have zero
parameters, but non-matching return types, and apparently completely different
collation vs. transliteration semantics).

Change-Id: Id91b17eeb7fcdd0c711d52a624375356dc47fc32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150302
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-13 08:23:59 +02:00
Stephan Bergmann 65710a8d00 Fix typos in XML that broke three implementation elements
The typos all originated with d2140a6320
"i18npool: create instances with uno constructors", causing three intended
constructor attributes to rather be plain character data.  Which apparently went
unnoticed until recently (see the TODOs resolved here that had been introduced
with 456a146b9e "tdf#151971: Fix used
implementation names of transliteration services"), in part because the Parser
class in cppuhelper/source/servicemanager.cxx silently ignores any unexpected
character data via xmlreader::XmlReader::Text::NONE.)

Change-Id: Ia8fdbc09c67d10530b4d86dbbbde2b6b84038e66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150021
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-04 16:42:58 +02:00
Stephan Bergmann 456a146b9e tdf#151971: Fix used implementation names of transliteration services
...after 04af4e4f55 "[API CHANGE] Fix all bad
UNOIDL identifiers across offapi" had changed the spelling (character case) of
some of the css.i18n.TransliterationModules[New] enum values involved here, so
that the TmItem1 macro generated broken TMList::implName values now.  (Which in
turn caused TransliterationImpl::loadBody to throw "unsatisfied query for
interface of type com.sun.star.i18n.XExtendedTransliteration!"
css::uno::RuntimeExceptions, which remained uncaught.)

Also add a test verifying that loading all those transliteration services no
longer fails throwing exceptions.  Which lead to two open TODOs:  For one, the
value of maxCascade in i18npool/inc/transliterationImpl.hxx might come from a
time when there were fewer TransliterationModules[New] enum values and might no
longer be appropriate.  This would need some further investigation.  But for
another, there are two transliteration services that cannot currently be
instantiated.  That looks like a regression that should be fixed in a follow-up
commit.

Change-Id: Icfca3e841360d4b471013e2c96d6868a75a21a1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150018
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-04 14:21:39 +02:00
ektagoel12 eb5c14f305 tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Also change some range based for

Change-Id: I2e17feaba7a6b219aa0c9126c5046cf3bdf855d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145988
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-31 13:30:53 +00:00
Khaled Hosny 2a78fbf4e4 tdf#91764: Combining marks from “complex” scripts can’t be searched for
Don’t skip search results that are in the middle of a grapheme cluster
(AKA cell in LO speak).

It is not clear why it was done like this, as these checks are present
all the way back to the first commit of this file:

commit 36eb193f48
Author: Rüdiger Timm <rt@openoffice.org>
Date:   Tue Apr 8 15:01:00 2003 +0000

    INTEGRATION: CWS calc06 (1.1.2); FILE ADDED
    2003/03/26 15:54:42 er 1.1.2.1: #i3393# moved from i18n module, cleaned out tools module usage, and added support for regexp

But ignoring such results and only for so-called “complex” scripts seems
arbitrary, and as the linked issue shows, people want to be able to
search for combining marks. Furthermore, it prevents searching for a
base character followed by a combining mark, unless ignoring diacritics
is enabled.

Change-Id: I530788d928861ddfa18dd7b813d0a13f53c0b77b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138410
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-08-19 19:02:01 +02:00
Rene Engelhard 67c577c692 apply ICU test workaround to < 70 to "fix" test with ICU 71
See also 263961306e

Change-Id: Ib64ec43dba59ffddb34fe7f1a0f0d2e589c3455c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133063
Tested-by: René Engelhard <rene@debian.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2022-04-15 20:23:13 +02:00
Mike Kaganski 0dc4cbe342 Use icu::UnicodeString directly
Change-Id: I41b4e64d6d3a9310d819904c8d32c689e6300bcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131296
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-10 08:45:42 +01:00
Hossein 0308e48e46 tdf#145759 30.6001 -> monthDaysWithoutJanFeb
30.6001 shows month days without Jan and Feb.
According to the below link, it is calcuated as (365-31-28)/10 = 30.6
but because of a floating point bug, it was used as 30.6001 as a
workaround.

"30.6001, 25 year old hack?"
https://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv011.cgi?read=31650

The value 30.6 is used as i18nutil::monthDaysWithoutJanFeb here
instead of 30.6001. The new value is ~30.60000038 which is > 30.6, so
the calculations should be correct. In order to make sure, a unit test
is added, and part of the values are checked against the values
calculated by this website:

Julian Day and Civil Date Calculator
https://core2.gsfc.nasa.gov/time/julian.html

Change-Id: I8cc7e046514dc3de652a1c37399e351cb2b614dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125813
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2022-02-25 19:12:41 +01:00
Eike Rathke 263961306e Update to ICU 70.1
Unicode 14, 5 new scripts, 12 new Unicode blocks.

In i18npool/qa/cppunit/test_breakiterator.cxx
TestBreakIterator::testLao() had to be disabled/adapted.
Needs to be investigated, see comments there.
As is, Lao script word break has regressions.

Correct UBLOCK_TANGUT_SUPPLEMENT Unicode range endpoint to
0x18D7F, see
https://www.unicode.org/versions/Unicode14.0.0/erratafixed.html
for which ublock_getCode(0x18D8F) now returned UBLOCK_NO_BLOCK and
thus luckily the assert in svx/source/dialog/charmap.cxx hit.

Change-Id: I4bad16ecfab3f44be365b8f884c57f34af68218e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125322
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2021-11-16 20:23:45 +01:00
Stephan Bergmann 6bc8a1ba51 Missing static
...from aa2064c5c5 "Improve
loplugin:stringliteralvar", similar to 8b32a3edad
"Fix stack-use-after-scope" (though this case doesn't appear to have caused any
actual issues).

(After manual inspection, there appear to be no further missing `static` at
least in aa2064c5c5 "Improve
loplugin:stringliteralvar".)

Change-Id: I2b3d0d8d2af1d65f0c5bef8a858107020a620974
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124137
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-25 11:32:02 +02:00
Mike Kaganski 8a017d25a6 Avoid COW overhead using css::uno::Sequence
The scenarios are:

1. Calling sequence's begin() and end() in pairs to pass to algorithms
   (both calls use getArray(), which does the COW checks)
2. In addition to #1, calling end() again when checking result of find
   algorithms, and/or begin() to calculate result's distance
3. Using non-const sequences in range-based for loops, which internally
   do #1
4. Assigning sequence to another sequence variable, and then modifying
   one of them

In many cases, the sequences could be made const, or treated as const
for the purposes of the algorithms (using std::as_const, std::cbegin,
and std::cend). Where algorithm modifies the sequence, it was changed
to only call getArray() once. For that, css::uno::toNonConstRange was
introduced, which returns a struct (sublclass of std::pair) with two
iterators [begin, end], that are calculated using one call to begin()
and one call to getLength().

To handle #4, css::uno::Sequence::swap was introduced, that swaps the
internal pointer to uno_Sequence. So when a local Sequence variable
should be assigned to another variable, and the latter will be modified
further, it's now possible to use swap instead, so the two sequences
are kept independent.

The modified places were found by temporarily removing non-const end().

Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14 06:00:49 +02:00
DaeHyun Sung 9c13f1ad63 tdf#143526 add Korean Numbering test case & fix Hanja number codepoint
add Korean Numbering test cases
1. koreanCounting
2. koreanLegal
3. koreanDigital
4. koreanDigital2

fix Korean Hanja number codepoint for Zero(0)
Following MS Office's numFmt Strng example
https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/a1bb5809-e361-4e49-8e16-7f1a67da4121

Korean Hanja notation for Hanja is `零 U+96F6` on MS Word 2019 and that
document.
So, fix the Korean Hanja number code pointfor Zero(0) `零 U+96F6`

Change-Id: I1a5b95640a93e7fbc3a0e724b154587877b198a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120676
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2021-08-19 19:10:24 +02:00
Eike Rathke ac80ec817e Make duplicate generated numbering identifiers unique, tdf#143526 follow-up
Change-Id: I28366c4e868e97b70e016b056b73b88b4cc8b812
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119677
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2021-07-29 23:39:47 +02:00