summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx21
-rw-r--r--include/i18nlangtag/mslangid.hxx3
-rw-r--r--sw/source/core/text/inftxt.cxx4
3 files changed, 27 insertions, 1 deletions
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 71f6b7b49e66..ad062a8d3dcf 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -165,6 +165,27 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa
return nLang;
}
+// static
+bool MsLangId::usesHyphenation(LanguageType nLang)
+{
+ if (primary(nLang).anyOf(
+ primary(LANGUAGE_ARABIC_PRIMARY_ONLY),
+ primary(LANGUAGE_FARSI),
+ primary(LANGUAGE_KASHMIRI),
+ primary(LANGUAGE_KURDISH_ARABIC_IRAQ),
+ primary(LANGUAGE_PUNJABI),
+ primary(LANGUAGE_SINDHI),
+ primary(LANGUAGE_USER_MALAY_ARABIC_MALAYSIA),
+ primary(LANGUAGE_SOMALI),
+ primary(LANGUAGE_SWAHILI),
+ primary(LANGUAGE_URDU_PAKISTAN))
+ || isCJK(nLang))
+ {
+ return false;
+ }
+ return true;
+}
+
// static
css::lang::Locale MsLangId::Conversion::convertLanguageToLocale(
diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx
index 4966fde852f3..aee1f23eb816 100644
--- a/include/i18nlangtag/mslangid.hxx
+++ b/include/i18nlangtag/mslangid.hxx
@@ -126,6 +126,9 @@ public:
static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
+ /** Whether the language uses hyphenation. */
+ static bool usesHyphenation( LanguageType nLang );
+
/** Whether locale has a Right-To-Left orientation for text. */
static bool isRightToLeft( LanguageType nLang );
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 14eb8b13c11d..a5e588ebad0b 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -66,6 +66,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/gradient.hxx>
+#include <i18nlangtag/mslangid.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::linguistic2;
@@ -1446,7 +1447,8 @@ bool SwTextFormatInfo::IsHyphenate() const
LanguageType eTmp = GetFont()->GetLanguage();
// TODO: check for more ideographic langs w/o hyphenation as a concept
- if ( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp || LANGUAGE_JAPANESE == eTmp )
+ if ( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp
+ || !MsLangId::usesHyphenation(eTmp) )
return false;
uno::Reference< XHyphenator > xHyph = ::GetHyphenator();