diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2012-07-30 23:37:30 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2012-07-30 23:43:48 +0200 |
commit | d602a3b280fcc1cf16660d8719cd8eb8797dd2ad (patch) | |
tree | a95c7f891933bc7a7c8997e6114e9e4b6f7c297e /sw/source/ui | |
parent | fa351042bc425f0437bfb50d09220bedbc257948 (diff) |
First step to change sorted vector with LookupTree for word autocompletion.
With this commit autocompletion words are inserted into a LookupTree
instance and used when autocompleting words. Previouslly used sorted
vector is still used for the GUI.
Change-Id: Ib5aed38d575fbef7221afbebe824a440d4ffbc7e
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/docvw/edtwin.cxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 09e96336b065..e3b3933d872d 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -5612,31 +5612,27 @@ void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord ) // Add matching words from AutoCompleteWord list const SwAutoCompleteWord& rACList = rSh.GetAutoCompleteWords(); - sal_uInt16 nPos, nEnd; - // TODO - GetRange only performs a case insensitive match for ASCII - if ( rACList.GetRange( rWord, nPos, nEnd ) ) + std::vector<String> strings; + if ( rACList.GetWordsMatching( rWord, strings ) ) { - for ( ; nPos < nEnd; ++nPos ) + for (unsigned int i= 0; i<strings.size(); i++) { - const String& rStr = rACList[nPos]; - // Check string longer than word - if ( rStr.Len() > rWord.Len() ) + String aCompletedString = strings[i]; + if ( aWordCase == CASE_LOWER ) + m_aHelpStrings.push_back( rCC.lowercase( aCompletedString ) ); + else if ( aWordCase == CASE_SENTENCE ) { - if ( aWordCase == CASE_LOWER ) - m_aHelpStrings.push_back( rCC.lowercase( rStr ) ); - else if ( aWordCase == CASE_SENTENCE ) - { - String sTmp = rCC.lowercase( rStr ); - sTmp.SetChar( 0, rStr.GetChar(0) ); - m_aHelpStrings.push_back( sTmp ); - } - else if ( aWordCase == CASE_UPPER ) - m_aHelpStrings.push_back( rCC.uppercase( rStr ) ); - else // CASE_OTHER - use retrieved capitalization - m_aHelpStrings.push_back( rStr ); + String sTmp = rCC.lowercase( aCompletedString ); + sTmp.SetChar( 0, aCompletedString.GetChar(0) ); + m_aHelpStrings.push_back( sTmp ); } + else if ( aWordCase == CASE_UPPER ) + m_aHelpStrings.push_back( rCC.uppercase( aCompletedString ) ); + else // CASE_OTHER - use retrieved capitalization + m_aHelpStrings.push_back( aCompletedString ); } } + } namespace { |