diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-12-03 20:26:24 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-12-05 18:53:00 +0000 |
commit | 28b420533905e506f3f2a6a6afd8671f301c9001 (patch) | |
tree | 30f82a4ded63816ddf4a6d3af06b469de8a7e66e /sw/source/ui | |
parent | 093b3ed2306f4c400cf8448d18e86dc5ac6c0433 (diff) |
autocomplete using the context's case i#22961
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index dccc9707bce5..b10c3954036f 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -5467,8 +5467,28 @@ void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord ) // actual word if( rS.Len() > rWord.Len() ) { - String* pNew = new String( rS ); - if( !aArr.Insert( pNew ) ) + CharClass &rCC = GetAppCharClass(); + String aMatch; + int upper = 0, lower = 0, letters = 0; + for( xub_StrLen i = 0; i < rWord.Len(); i++ ) { + sal_Int32 nCharType = rCC.getCharacterType( rWord, i ); + if( !CharClass::isLetterType( nCharType ) ) + continue; + letters++; + if( i18n::KCharacterType::LOWER & nCharType ) + lower++; + if( i18n::KCharacterType::UPPER & nCharType ) + upper++; + } + if (lower == letters) + aMatch = rCC.lower( rS ); + else if (upper == letters) + aMatch = rCC.upper( rS ); + else // mixed case - use what we have + aMatch = rS; + + String *pNew = new String( aMatch ); + if (!aArr.Insert( pNew )) delete pNew; } ++nStt; |