summaryrefslogtreecommitdiff
path: root/svl/source/misc/lngmisc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svl/source/misc/lngmisc.cxx')
-rw-r--r--svl/source/misc/lngmisc.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx
index 4f203b22e200..c0866b21e785 100644
--- a/svl/source/misc/lngmisc.cxx
+++ b/svl/source/misc/lngmisc.cxx
@@ -27,7 +27,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svl.hxx"
+<<<<<<< local
#include <svl/lngmisc.hxx>
+=======
+
+#include <lngmisc.hxx>
+>>>>>>> other
#include <tools/solar.h>
#include <tools/string.hxx>
#include <tools/debug.hxx>
@@ -132,6 +137,38 @@ BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char /*aRplcChar*/ )
return bModified;
}
+
+String GetThesaurusReplaceText( const String &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 );
+
+ xub_StrLen nPos = aText.Search( sal_Unicode('(') );
+ while (STRING_NOTFOUND != nPos)
+ {
+ xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos );
+ if (STRING_NOTFOUND != nEnd)
+ aText.Erase( nPos, nEnd-nPos+1 );
+ else
+ break;
+ nPos = aText.Search( sal_Unicode('(') );
+ }
+
+ nPos = aText.Search( sal_Unicode('*') );
+ if (STRING_NOTFOUND != nPos)
+ aText.Erase( nPos );
+
+ // remove any possible remaining ' ' that may confuse the thesaurus
+ // when it gets called with the text
+ aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') );
+
+ return aText;
+}
+
///////////////////////////////////////////////////////////////////////////
} // namespace linguistic