diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-19 13:48:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-06-19 14:11:50 +0100 |
commit | d9e4c74811855de15f1bf2045c2c9b061a2d4dc6 (patch) | |
tree | 895cbcd595094e9fd2621a943fc83bb004b429c9 /sw/source | |
parent | 2a598619d7fbc992f1903a745fd536ddf5e45c81 (diff) |
merge together hand-crafted traditional/simplified chinese tests
merge together a gadzillion hand-crafted
isSimpleChinese/isTraditionalChinese/isKoreanVariants/isCJK
implementations which should fix a goodly amount of them
add a MsLangId::isFamilyNameFirst for locales where
family name appears first while I'm at it.
Change-Id: I65377793be037d16fe7250cd7450b28aec689e83
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/text/portxt.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 27 | ||||
-rw-r--r-- | sw/source/ui/app/docshini.cxx | 9 |
5 files changed, 20 insertions, 39 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 5bcd3e331a34..6cb66ce90449 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -29,6 +29,7 @@ #include <ctype.h> #include <com/sun/star/i18n/ScriptType.hdl> +#include <i18npool/mslangid.hxx> #include <hintids.hxx> // CH_TXTATR #include <SwPortionHandler.hxx> #include <porlay.hxx> @@ -101,7 +102,7 @@ sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, LanguageType aLang = rInf.GetTxtFrm()->GetTxtNode()->GetLang( rInf.GetIdx(), 1, nScript ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang ) + if (MsLangId::isKorean(aLang)) { const SwLinePortion* pPor = rPor.GetPortion(); if ( pPor && ( pPor->IsKernPortion() || @@ -209,7 +210,7 @@ sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, LanguageType aLang = rInf.GetTxtFrm()->GetTxtNode()->GetLang( nPos, 1, nNextScript ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang ) + if (MsLangId::isKorean(aLang)) ++nCnt; } } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 7aec18cf412f..3db14e6487de 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include <i18npool/mslangid.hxx> #include <vcl/outdev.hxx> #include <vcl/print.hxx> #include <vcl/lineinfo.hxx> @@ -1093,7 +1094,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) if ( ( SW_CJK == nActual || SW_LATIN == nActual ) && nSpaceAdd ) { LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang) + if (MsLangId::isKorean(aLang)) { long nSpaceSum = nSpaceAdd; for ( sal_uInt16 nI = 0; nI < rInf.GetLen(); ++nI ) @@ -1269,7 +1270,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang ) + if (MsLangId::isKorean(aLang)) { long nSpaceSum = nSpaceAdd; for ( sal_uInt16 nI = 0; nI < rInf.GetLen(); ++nI ) @@ -1480,7 +1481,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang ) + if (MsLangId::isKorean(aLang)) { long nSpaceSum = nSpaceAdd; for ( sal_uInt16 nI = 0; nI < rInf.GetLen(); ++nI ) @@ -2050,7 +2051,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf ) { LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK ); - if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang ) + if (MsLangId::isKorean(aLang)) { long nSpaceSum = nSpaceAdd; for ( sal_uInt16 nI = 0; nI < rInf.GetLen(); ++nI ) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 6d7954840303..9df457c02b0d 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -75,6 +75,7 @@ #include <editeng/pgrditem.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/charhiddenitem.hxx> +#include <i18npool/mslangid.hxx> #include <fmtpdsc.hxx> #include <node.hxx> #include <ndtxt.hxx> // SwTxtNode, siehe unten: JoinNode() @@ -4365,10 +4366,7 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n nVal = EMPHASISMARK_NONE; break; case 2: - if ((nLang == LANGUAGE_CHINESE_HONGKONG) || - (nLang == LANGUAGE_CHINESE_MACAU) || - (nLang == LANGUAGE_CHINESE_TRADITIONAL) || - (nLang == LANGUAGE_KOREAN)) + if (MsLangId::isKorean(nLang) || MsLangId::isTraditionalChinese(nLang)) nVal = EMPHASISMARK_CIRCLE_ABOVE; else if (nLang == LANGUAGE_JAPANESE) nVal = EMPHASISMARK_SIDE_DOTS; @@ -4382,8 +4380,7 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n nVal = EMPHASISMARK_DOTS_BELOW; break; case 1: - if ((nLang == LANGUAGE_CHINESE_SIMPLIFIED) || - (nLang == LANGUAGE_CHINESE_SINGAPORE)) + if (MsLangId::isSimplifiedChinese(nLang)) nVal = EMPHASISMARK_DOTS_BELOW; else nVal = EMPHASISMARK_DOTS_ABOVE; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 178483b57ab8..cd5d1ff76572 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -31,7 +31,8 @@ #include <functional> #include <algorithm> -#include <string.h> // memset() +#include <string.h> +#include <i18npool/mslangid.hxx> #include <rtl/tencinfo.h> #include <sal/macros.h> @@ -5582,25 +5583,11 @@ WW8Fib::WW8Fib(sal_uInt8 nVer) lid = 0x409; // LANGUAGE_ENGLISH_US LanguageType nLang = Application::GetSettings().GetLanguage(); - switch( nLang ) - { - case LANGUAGE_CHINESE: - case LANGUAGE_CHINESE_SIMPLIFIED: - case LANGUAGE_CHINESE_HONGKONG: - case LANGUAGE_CHINESE_SINGAPORE: - case LANGUAGE_CHINESE_MACAU: - case LANGUAGE_CHINESE_TRADITIONAL: - case LANGUAGE_KOREAN: - case LANGUAGE_KOREAN_JOHAB: - case LANGUAGE_JAPANESE: - lidFE = nLang; - fFarEast = true; - break; - default: - lidFE = lid; - fFarEast = false; - break; - }; + fFarEast = MsLangId::isCJK(nLang); + if (fFarEast) + lidFE = nLang; + else + lidFE = lid; Locale aTempLocale; SvxLanguageToLocale( aTempLocale, lid ); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index a860c3ba67f7..383b4a3e4292 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -214,13 +214,8 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if ( i == 0 ) { LanguageType eUiLanguage = Application::GetSettings().GetUILanguage(); - switch( eUiLanguage ) - { - case LANGUAGE_KOREAN: - case LANGUAGE_KOREAN_JOHAB: - eLanguage = eUiLanguage; - break; - } + if (MsLangId::isKorean(eUiLanguage)) + eLanguage = eUiLanguage; } Font aLangDefFont = OutputDevice::GetDefaultFont( |