summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-11-26 22:53:32 -0500
committerAugust Sodora <augsod@gmail.com>2011-11-26 22:57:21 -0500
commit38ba2f002b6fe76273b3abc1092a93e10551057a (patch)
treef02077cc90fe46eff356dce9d086bf3765f2b39a /svl
parent530fc2fef8ff53ad99ac43b3a8bb8a70a358b4b7 (diff)
String->OUString
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/lngmisc.hxx2
-rw-r--r--svl/source/misc/lngmisc.cxx32
2 files changed, 19 insertions, 15 deletions
diff --git a/svl/inc/svl/lngmisc.hxx b/svl/inc/svl/lngmisc.hxx
index 4a94bc726cfb..72d829c1ca81 100644
--- a/svl/inc/svl/lngmisc.hxx
+++ b/svl/inc/svl/lngmisc.hxx
@@ -64,7 +64,7 @@ SVL_DLLPUBLIC bool RemoveControlChars( rtl::OUString &rTxt );
SVL_DLLPUBLIC bool ReplaceControlChars(rtl::OUString &rTxt);
-SVL_DLLPUBLIC String GetThesaurusReplaceText( const String &rText );
+SVL_DLLPUBLIC ::rtl::OUString GetThesaurusReplaceText( const ::rtl::OUString &rText );
} // namespace linguistic
diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx
index 49a44334de62..2372e8145cd3 100644
--- a/svl/source/misc/lngmisc.cxx
+++ b/svl/source/misc/lngmisc.cxx
@@ -105,35 +105,39 @@ namespace linguistic
return true;
}
- String GetThesaurusReplaceText(const String &rText)
+ ::rtl::OUString GetThesaurusReplaceText(const ::rtl::OUString &rText)
{
// The strings for synonyms returned by the thesaurus sometimes have some
// explanation text put in between '(' and ')' or a trailing '*'.
// These parts should not be put in the ReplaceEdit Text that may get
// inserted into the document. Thus we strip them from the text.
- String aText( rText );
+ ::rtl::OUString aText(rText);
- xub_StrLen nPos = aText.Search( sal_Unicode('(') );
- while (STRING_NOTFOUND != nPos)
+ sal_Int32 nPos = aText.indexOf(sal_Unicode('('));
+ while (nPos >= 0)
{
- xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos );
- if (STRING_NOTFOUND != nEnd)
- aText.Erase( nPos, nEnd-nPos+1 );
+ sal_Int32 nEnd = aText.indexOf(sal_Unicode(')'), nPos);
+ if (nEnd >= 0)
+ {
+ ::rtl::OUStringBuffer aTextBuf(aText);
+ aTextBuf.remove(nPos, nEnd - nPos + 1);
+ aText = aTextBuf.makeStringAndClear();
+ }
else
break;
- nPos = aText.Search( sal_Unicode('(') );
+ nPos = aText.indexOf(sal_Unicode('('));
}
- nPos = aText.Search( sal_Unicode('*') );
- if (STRING_NOTFOUND != nPos)
- aText.Erase( nPos );
+ nPos = aText.indexOf(sal_Unicode('*'));
+ if(nPos == 0)
+ aText = ::rtl::OUString();
+ else if(nPos > 0)
+ aText = aText.copy(0, nPos);
// remove any possible remaining ' ' that may confuse the thesaurus
// when it gets called with the text
- aText = comphelper::string::strip(aText, ' ');
-
- return aText;
+ return comphelper::string::strip(aText, ' ');
}
} // namespace linguistic