summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-10 01:26:35 -0500
committerEike Rathke <erack@redhat.com>2014-02-10 21:02:39 +0000
commit684a0308dcb847f816967202ba87f536b83dcb4e (patch)
treef8f74c5400a71828b5a9d63adc4106cc98f93cdf /editeng
parent2b81559c7a271e130500380a455cddfa841752c3 (diff)
fdo#46707: Don't bother with synonyms for text with mixed script types.
Change-Id: I7922905523406d05f864b10e1ecfd27f3fb5f9d6 (cherry picked from commit 49341001e76389f11bf67d756f4742275bc9dcd9) Reviewed-on: https://gerrit.libreoffice.org/7962 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/outliner/outlvw.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 036b4642a545..1435c77e58aa 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -29,6 +29,7 @@
#include <editeng/fhgtitem.hxx>
#include <svl/style.hxx>
+#include <svl/languageoptions.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <editeng/outliner.hxx>
@@ -1552,6 +1553,24 @@ Selection OutlinerView::GetSurroundingTextSelection() const
// ===== some code for thesaurus sub menu within context menu
// ======================================================================
+namespace {
+
+bool isSingleScriptType( sal_uInt16 nScriptType )
+{
+ sal_uInt8 nScriptCount = 0;
+
+ if (nScriptType & SCRIPTTYPE_LATIN)
+ ++nScriptCount;
+ if (nScriptType & SCRIPTTYPE_ASIAN)
+ ++nScriptCount;
+ if (nScriptType & SCRIPTTYPE_COMPLEX)
+ ++nScriptCount;
+
+ return nScriptCount == 1;
+}
+
+}
+
// returns: true if a word for thesaurus look-up was found at the current cursor position.
// The status string will be word + iso language string (e.g. "light#en-US")
bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
@@ -1567,6 +1586,10 @@ bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
aText = pEditEngine->GetText( aTextSel );
aTextSel.Adjust();
+
+ if (!isSingleScriptType(pEditEngine->GetScriptType(aTextSel)))
+ return false;
+
LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
OUString aLangText( LanguageTag::convertToBcp47( nLang ) );