[Libreoffice-commits] core.git: editeng/source

Kohei Yoshida kohei.yoshida at collabora.com
Sun Feb 9 22:27:46 PST 2014


 editeng/source/outliner/outlvw.cxx |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

New commits:
commit 49341001e76389f11bf67d756f4742275bc9dcd9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Feb 10 01:26:35 2014 -0500

    fdo#46707: Don't bother with synonyms for text with mixed script types.
    
    Change-Id: I7922905523406d05f864b10e1ecfd27f3fb5f9d6

diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 6defd32..1b94561 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>
@@ -1446,6 +1447,27 @@ 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;
+
+    if (!nScriptCount || nScriptCount > 1)
+        return false;
+
+    return true;
+}
+
+}
+
 // 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(
@@ -1461,6 +1483,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 ) );
 


More information about the Libreoffice-commits mailing list