diff options
author | László Németh <nemeth@numbertext.org> | 2020-06-25 10:54:41 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-06-26 09:03:19 +0200 |
commit | 8d4b6e5858935c4a32f89b9e09c5f1084d34a04c (patch) | |
tree | 5e5aa0586a6cf9c0d7e89da37e0070952e5b3e35 /editeng | |
parent | 70ee8666edb0851222550029e445ef61434a0376 (diff) |
tdf#123786 AutoCorrect: fix apostrophe in Russian
and Ukrainian at "Single quotes" replacement
outside of second level quotations.
For example:
„quote' -> „quote‘
but now
apostrophe' -> apostrophe’
instead of the bad
apostrophe' -> apostrophe“
Change-Id: Iad69b7f88ab9677f25ee0f806d035e16cdebe29b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97096
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 58878e41f9fa..e8ae81f045d2 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -321,6 +321,7 @@ static constexpr sal_Unicode cRightSingleAngleQuote = 0x203A; const sal_Unicode aStopDoubleAngleQuoteStart[] = { 0x201E, 0x201D, 0 }; // preceding ,, const sal_Unicode aStopDoubleAngleQuoteEnd[] = { cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0x201D, 0x201E, 0 }; // preceding >> const sal_Unicode aStopSingleQuoteEnd[] = { 0x201A, 0x2018, 0x201C, 0x201E, 0 }; +const sal_Unicode aStopSingleQuoteEndRuUa[] = { 0x201E, 0x201C, cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0 }; SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile, const OUString& rUserAutocorrFile ) @@ -1355,19 +1356,30 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, { eType = ACQuotes::DoubleAngleQuote; } - // tdf#128860 use apostrophe outside of second level quotation in Czech, German, Icelandic, - // Slovak and Slovenian instead of the – in this case, bad – closing quotation mark U+2018. else if ( bSingle && nInsPos && !bSttQuote && - ( primary(eLang) == primary(LANGUAGE_GERMAN) || eLang.anyOf ( - LANGUAGE_CZECH, - LANGUAGE_ICELANDIC, - LANGUAGE_SLOVAK, - LANGUAGE_SLOVENIAN ) ) && - !lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEnd[0], aStopSingleQuoteEnd + 1 ) ) + // tdf#128860 use apostrophe outside of second level quotation in Czech, German, Icelandic, + // Slovak and Slovenian instead of the – in this case, bad – closing quotation mark U+2018. + // tdf#123786 the same for Russian and Ukrainian + ( ( eLang.anyOf ( + LANGUAGE_CZECH, + LANGUAGE_GERMAN, + LANGUAGE_GERMAN_SWISS, + LANGUAGE_GERMAN_AUSTRIAN, + LANGUAGE_GERMAN_LUXEMBOURG, + LANGUAGE_GERMAN_LIECHTENSTEIN, + LANGUAGE_ICELANDIC, + LANGUAGE_SLOVAK, + LANGUAGE_SLOVENIAN ) && + !lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEnd[0], aStopSingleQuoteEnd + 1 ) ) || + ( eLang.anyOf ( + LANGUAGE_RUSSIAN, + LANGUAGE_UKRAINIAN ) && + !lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEndRuUa[0], aStopSingleQuoteEndRuUa + 1 ) ) ) ) { LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang ); CharClass& rCC = GetCharClass( eLang ); - if ( rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEnd[0]) && + if ( ( rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEnd[0]) || + rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEndRuUa[0]) ) && // use apostrophe only after letters, not after digits or punctuation rCC.isLetter(rTxt, nInsPos-1) ) { |