Kaydet (Commit) 150e3277 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#57640 we really want to *titlecase* the initial character

http://srfi.schemers.org/srfi-13/mail-archive/msg00046.html summarizes well..
"
- Titlecase <> uppercase
  Unicode defines three kinds of case mapping: lowercase, uppercase, and
  titlecase. The difference between uppercasing and titlecasing a character
  or character sequence can be seen in compound characters (that is,
  a single character that represents a compount of two characters).

  For example, in Unicode, character U+01F3 is LATIN SMALL LETTER DZ.  (Let us
  write this compound character using ASCII as "dz".) This character
  uppercases to character U+01F1, LATIN CAPITAL LETTER DZ.  (Which is
  basically "DZ".) But it titlecases to to character U+01F2, LATIN CAPITAL
  LETTER D WITH SMALL LETTER Z. (Which we can write "Dz".)

      character	uppercase titlecase
      --------- --------- ---------
      dz	DZ	  Dz
"

See TestCharacterClassification::testTitleCase for titlecase regression
tests.

Change-Id: I198379832d1910632bb6358149a5276b68d7c6eb
üst 6541e447
...@@ -855,7 +855,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -855,7 +855,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
{ {
// valid separator -> replace // valid separator -> replace
rtl::OUString sChar( *pWordStt ); rtl::OUString sChar( *pWordStt );
sChar = rCC.uppercase( sChar ); sChar = rCC.titlecase(sChar); //see fdo#56740
return !comphelper::string::equals(sChar, *pWordStt) && return !comphelper::string::equals(sChar, *pWordStt) &&
rDoc.ReplaceRange( xub_StrLen( pWordStt - pStart ), 1, sChar ); rDoc.ReplaceRange( xub_StrLen( pWordStt - pStart ), 1, sChar );
} }
...@@ -1030,7 +1030,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -1030,7 +1030,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
sal_Unicode cSave = *pWordStt; sal_Unicode cSave = *pWordStt;
nSttPos = sal::static_int_cast< xub_StrLen >( pWordStt - rTxt.GetBuffer() ); nSttPos = sal::static_int_cast< xub_StrLen >( pWordStt - rTxt.GetBuffer() );
rtl::OUString sChar( cSave ); rtl::OUString sChar( cSave );
sChar = rCC.uppercase( sChar ); sChar = rCC.titlecase(sChar); //see fdo#56740
sal_Bool bRet = sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar ); sal_Bool bRet = sChar[0] != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar );
// Parahaps someone wants to have the word // Parahaps someone wants to have the word
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment