sw/qa/extras/uiwriter/uiwriter6.cxx | 5 +++++ sw/source/core/edit/acorrect.cxx | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
New commits: commit 62b402030553740b96a624434f3700446e0fbd7c Author: László Németh <nem...@numbertext.org> AuthorDate: Thu Nov 3 21:42:48 2022 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Nov 14 13:35:04 2022 +0100 tdf#148672 Old Hungarian transliteration: fix "word]" Words ending with closing bracket weren't transliterated, because NatNum12 parameters couldn't contain closing bracket. Transliterate without the bracket, and append it to the result. Note: "[word]", "(word)" etc. forms will be handled by the next libnumbertext release. Conflicts: sw/source/core/edit/acorrect.cxx (cherry-picked from commit 733bfd9597fc42c569c6855bb71c56429e009fa6) Change-Id: Id0d34267575782487819e3a3f76d1b547866e362 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142254 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142672 diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index e66fae378115..48b8bcf8d22a 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -1803,6 +1803,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) emulateTyping(*pXTextDocument, u"„idézőjel” "); sReplaced += u"⹂𐳐𐳇𐳋𐳯𐳟𐳒𐳉𐳖‟ "; CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); + + // tdf#148672 transliterate word with closing bracket + emulateTyping(*pXTextDocument, u"word] "); + sReplaced += u"𐳮𐳛𐳢𐳇] "; // This was "word]" (no transliteration) + CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testAutoCorr) diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 75b45488465d..ed2a0fb3ca41 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -564,10 +564,21 @@ bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos, if (pFormatter && !sWord.isEmpty()) { const Color* pColor = nullptr; - // Send text as NatNum12 prefix - OUString sPrefix("[NatNum12 " + sDisambiguatedWord.makeStringAndClear() + "]0"); + + // Send text as NatNum12 prefix: "word" -> "[NatNum12 word]0" + + // Closing bracket doesn't allowed in NatNum parameters, remove it from transliteration: + // "[word]" -> "[NatNum12 [word]0" + bool bHasBracket = sWord.endsWith("]"); + if ( !bHasBracket ) + sDisambiguatedWord.append("]"); + OUString sPrefix("[NatNum12 " + sDisambiguatedWord.makeStringAndClear() + "0"); if (pFormatter->GetPreviewString(sPrefix, 0, sConverted, &pColor, LANGUAGE_USER_HUNGARIAN_ROVAS)) + { + if ( bHasBracket ) + sConverted = sConverted + "]"; bRet = true; + } } SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(rSttPos)),