[Libreoffice-commits] .: 10 commits - cppcanvas/source cui/source editeng/inc editeng/source i18npool/inc i18npool/source reportdesign/source sc/source sd/source sot/source svl/source svtools/source svx/source sw/source tools/source unotools/source unusedcode.easy vcl/generic vcl/inc vcl/source vcl/unx vcl/win
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Jun 19 06:12:49 PDT 2012
cppcanvas/source/mtfrenderer/emfplus.cxx | 2
cppcanvas/source/mtfrenderer/implrenderer.cxx | 19 --
cui/source/options/optasian.cxx | 16 -
cui/source/options/optgenrl.cxx | 7
editeng/inc/editeng/hangulhanja.hxx | 18 -
editeng/source/editeng/textconv.cxx | 11 +
editeng/source/misc/svxacorr.cxx | 5
i18npool/inc/i18npool/mslangid.hxx | 23 ++
i18npool/source/characterclassification/characterclassificationImpl.cxx | 3
i18npool/source/collator/collatorImpl.cxx | 6
i18npool/source/isolang/mslangid.cxx | 59 ++++++
i18npool/source/nativenumber/nativenumbersupplier.cxx | 4
reportdesign/source/core/api/ReportComponent.cxx | 9
sc/source/core/data/drwlayer.cxx | 4
sc/source/core/data/stlpool.cxx | 10 -
sc/source/ui/docshell/docsh.cxx | 4
sd/source/core/drawdoc.cxx | 2
sd/source/core/drawdoc4.cxx | 11 -
sot/source/sdstor/stgelem.cxx | 4
svl/source/misc/inettype.cxx | 5
svtools/source/contnr/svtabbx.cxx | 7
svtools/source/control/ctrltool.cxx | 32 +--
svtools/source/edit/syntaxhighlight.cxx | 2
svtools/source/filter/wmf/enhwmf.cxx | 2
svtools/source/svhtml/parhtml.cxx | 10 -
svx/source/dialog/ctredlin.cxx | 2
sw/source/core/text/portxt.cxx | 5
sw/source/core/txtnode/fntcache.cxx | 9
sw/source/filter/ww8/ww8par6.cxx | 9
sw/source/filter/ww8/ww8scan.cxx | 27 --
sw/source/ui/app/docshini.cxx | 9
tools/source/inet/inetmime.cxx | 2
unotools/source/config/fontcfg.cxx | 95 ++++------
unotools/source/config/lingucfg.cxx | 4
unotools/source/i18n/localedatawrapper.cxx | 13 -
unusedcode.easy | 1
vcl/generic/glyphs/gcach_ftyp.cxx | 23 --
vcl/generic/print/genpspgraphics.cxx | 46 ++--
vcl/inc/langboost.hxx | 18 +
vcl/source/control/field2.cxx | 2
vcl/source/gdi/outdev3.cxx | 47 +---
vcl/source/gdi/pdfwriter_impl.cxx | 2
vcl/source/window/mnemonic.cxx | 19 --
vcl/source/window/window.cxx | 17 -
vcl/unx/generic/app/i18n_cb.cxx | 2
vcl/win/source/gdi/salgdi3.cxx | 18 -
46 files changed, 298 insertions(+), 347 deletions(-)
New commits:
commit d9e4c74811855de15f1bf2045c2c9b061a2d4dc6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 13:48:45 2012 +0100
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
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 035aa7f..914923d 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -33,6 +33,7 @@
#include <optasian.hrc>
#include <dialmgr.hxx>
#include <cuires.hrc>
+#include <i18npool/mslangid.hxx>
#include <tools/shl.hxx>
#include <svl/asiancfg.hxx>
#include <com/sun/star/lang/Locale.hpp>
@@ -301,17 +302,10 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet& )
{
eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage(
Application::GetSettings().GetLocale() );
- switch(eLastUsedLanguageTypeForForbiddenCharacters)
- {
- case LANGUAGE_CHINESE :
- case LANGUAGE_CHINESE_SINGAPORE :
- eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
- break;
- case LANGUAGE_CHINESE_HONGKONG :
- case LANGUAGE_CHINESE_MACAU :
- eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
- break;
- }
+ if (MsLangId::isSimplifiedChinese(eLastUsedLanguageTypeForForbiddenCharacters))
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
+ else if (MsLangId::isTraditionalChinese(eLastUsedLanguageTypeForForbiddenCharacters))
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
}
aLanguageLB.SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters );
LanguageHdl(&aLanguageLB);
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 2454f17..6645a2e 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -27,6 +27,7 @@
************************************************************************/
#include <comphelper/string.hxx>
+#include <i18npool/mslangid.hxx>
#include <tools/shl.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
@@ -162,11 +163,7 @@ SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSe
aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND );
aFatherName.SetZOrder( &aFirstName, WINDOW_ZORDER_BEHIND );
}
- else if ( LANGUAGE_JAPANESE == eLang ||
- LANGUAGE_KOREAN == eLang ||
- LANGUAGE_HUNGARIAN == eLang ||
- LANGUAGE_CHINESE_TRADITIONAL == eLang ||
- LANGUAGE_CHINESE_SIMPLIFIED == eLang)
+ else if (MsLangId::isFamilyNameFirst(eLang))
{
aUsCityEdit.Hide();
aUsStateEdit.Hide();
diff --git a/editeng/inc/editeng/hangulhanja.hxx b/editeng/inc/editeng/hangulhanja.hxx
index b952530..0b10bd5 100644
--- a/editeng/inc/editeng/hangulhanja.hxx
+++ b/editeng/inc/editeng/hangulhanja.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include "editeng/editengdllapi.h"
+#include <i18npool/mslangid.hxx>
//.............................................................................
namespace editeng
@@ -275,20 +276,17 @@ namespace editeng
sal_Bool HangulHanjaConversion::IsSimplified( LanguageType nLang )
{
- return nLang == LANGUAGE_CHINESE_SIMPLIFIED ||
- nLang == LANGUAGE_CHINESE_SINGAPORE;
+ return MsLangId::isSimplifiedChinese(nLang);
}
sal_Bool HangulHanjaConversion::IsTraditional( LanguageType nLang )
{
- return nLang == LANGUAGE_CHINESE_TRADITIONAL ||
- nLang == LANGUAGE_CHINESE_HONGKONG ||
- nLang == LANGUAGE_CHINESE_MACAU;
+ return MsLangId::isTraditionalChinese(nLang);
}
sal_Bool HangulHanjaConversion::IsChinese( LanguageType nLang )
{
- return IsTraditional( nLang ) || IsSimplified( nLang );
+ return MsLangId::isChinese(nLang);
}
//.............................................................................
} // namespace svx
diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx
index f1da981..7fb3d8d 100644
--- a/i18npool/inc/i18npool/mslangid.hxx
+++ b/i18npool/inc/i18npool/mslangid.hxx
@@ -184,6 +184,29 @@ public:
/** Whether locale has a Right-To-Left orientation. */
static bool isRightToLeft( LanguageType nLang );
+ /** Whether locale is a CJK locale */
+ static bool isCJK( LanguageType nLang );
+
+ /** Whether locale is a chinese locale */
+ static bool isChinese( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( LanguageType nLang );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( LanguageType nLang );
+
+ /** Whether locale is a korean locale */
+ static bool isKorean( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is one where family name comes first, e.g. Japan, Hungary, Samoa */
+ static bool isFamilyNameFirst( LanguageType nLang );
/** Whether there are "forbidden characters at start or end of line" in
this locale. CJK locales.
diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx
index 70d1683..df4abe4 100644
--- a/i18npool/source/characterclassification/characterclassificationImpl.cxx
+++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx
@@ -178,7 +178,6 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
}
static sal_Unicode under = (sal_Unicode)'_';
- static OUString tw("TW");
sal_Int32 l = rLocale.Language.getLength();
sal_Int32 c = rLocale.Country.getLength();
sal_Int32 v = rLocale.Variant.getLength();
@@ -197,7 +196,7 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
rLocale.Country.compareToAscii("MO") == 0) &&
// if the country code is HK or MO, one more step to try TW.
createLocaleSpecificCharacterClassification(aBuf.append(rLocale.Language).append(under).append(
- tw).makeStringAndClear(), rLocale)) ||
+ "TW").makeStringAndClear(), rLocale)) ||
(l > 0 &&
// load service with name <base>_<lang>
createLocaleSpecificCharacterClassification(rLocale.Language, rLocale))) {
diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx
index 93cc2a6..b76bea6 100644
--- a/i18npool/source/collator/collatorImpl.cxx
+++ b/i18npool/source/collator/collatorImpl.cxx
@@ -195,8 +195,6 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
}
static sal_Unicode under = (sal_Unicode) '_';
- static OUString tw("TW");
- static OUString unicode("Unicode");
sal_Int32 l = rLocale.Language.getLength();
sal_Int32 c = rLocale.Country.getLength();
@@ -215,7 +213,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
under).append(rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) ||
(l > 0 && c > 0 && a > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO") &&
// if the country code is HK or MO, one more step to try TW.
- createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append(tw).append(under).append(
+ createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append("TW").append(under).append(
rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) ||
(l > 0 && a > 0 &&
// load service with name <base>_<lang>_<algorithm>
@@ -225,7 +223,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
(a > 0 &&
createCollator(rLocale, rSortAlgorithm, rSortAlgorithm)) ||
// load default service with name <base>_Unicode
- createCollator(rLocale, unicode, rSortAlgorithm)) {
+ createCollator(rLocale, "Unicode", rSortAlgorithm)) {
return;
} else {
cachedItem = NULL;
diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx
index 3cd877e..206a8c7 100644
--- a/i18npool/source/isolang/mslangid.cxx
+++ b/i18npool/source/isolang/mslangid.cxx
@@ -249,9 +249,54 @@ bool MsLangId::isRightToLeft( LanguageType nLang )
return false;
}
+// static
+bool MsLangId::isSimplifiedChinese( LanguageType nLang )
+{
+ return isChinese(nLang) && !isTraditionalChinese(nLang);
+}
// static
-bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
+bool MsLangId::isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale )
+{
+ return rLocale.Language == "zh" && !isTraditionalChinese(rLocale);
+}
+
+// static
+bool MsLangId::isTraditionalChinese( LanguageType nLang )
+{
+ bool bRet = false;
+ switch (nLang)
+ {
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_MACAU:
+ bRet = true;
+ default:
+ break;
+ }
+ return bRet;
+}
+
+// static
+bool MsLangId::isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale )
+{
+ return rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO");
+}
+
+//static
+bool MsLangId::isChinese( LanguageType nLang )
+{
+ return MsLangId::getPrimaryLanguage(nLang) == LANGUAGE_CHINESE;
+}
+
+//static
+bool MsLangId::isKorean( LanguageType nLang )
+{
+ return MsLangId::getPrimaryLanguage(nLang) == LANGUAGE_KOREAN;
+}
+
+// static
+bool MsLangId::isCJK( LanguageType nLang )
{
switch (nLang & LANGUAGE_MASK_PRIMARY)
{
@@ -265,6 +310,18 @@ bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
return false;
}
+// static
+bool MsLangId::isFamilyNameFirst( LanguageType nLang )
+{
+ return isCJK(nLang) || nLang == LANGUAGE_HUNGARIAN;
+}
+
+// static
+bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
+{
+ return isCJK(nLang);
+}
+
// static
bool MsLangId::needsSequenceChecking( LanguageType nLang )
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 2d09dab..cd3d2ca 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -26,7 +26,7 @@
*
************************************************************************/
-
+#include <i18npool/mslangid.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/macros.h>
#include <nativenumbersupplier.hxx>
@@ -526,7 +526,7 @@ static sal_Int16 sizeof_natnum2 = SAL_N_ELEMENTS(natnum2);
static sal_Int16 SAL_CALL getLanguageNumber( const Locale& rLocale)
{
// return zh_TW for TW, HK and MO, return zh_CN for other zh locales.
- if (isLang("zh")) return (isCtry("TW") || isCtry("HK") || isCtry("MO")) ? 1 : 0;
+ if (isLang("zh")) return MsLangId::isTraditionalChinese(rLocale) ? 1 : 0;
for (sal_Int16 i = 2; i < nbOfLocale; i++)
if (isLang(natnum1Locales[i]))
diff --git a/reportdesign/source/core/api/ReportComponent.cxx b/reportdesign/source/core/api/ReportComponent.cxx
index 38b80c8..4045db8 100644
--- a/reportdesign/source/core/api/ReportComponent.cxx
+++ b/reportdesign/source/core/api/ReportComponent.cxx
@@ -58,13 +58,8 @@ void lcl_getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont,Langu
// be queried for Korean, too (the Latin language from the document can't be Korean).
// This is the same logic as in SwDocShell::InitNew.
LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
- switch( eUiLanguage )
- {
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- eLatin = eUiLanguage;
- break;
- }
+ if (MsLangId::isKorean(eUiLanguage))
+ eLatin = eUiLanguage;
rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, _eCJK, DEFAULTFONT_FLAGS_ONLYONE );
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 3964938..dbe0a9d 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -51,6 +51,7 @@
#include <svx/svdograf.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdundo.hxx>
+#include <i18npool/mslangid.hxx>
#include <editeng/unolingu.hxx>
#include <svx/drawitem.hxx>
#include <editeng/fhgtitem.hxx>
@@ -259,8 +260,7 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) :
// default for script spacing depends on locale, see SdDrawDocument ctor in sd
LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
- if ( eOfficeLanguage == LANGUAGE_KOREAN || eOfficeLanguage == LANGUAGE_KOREAN_JOHAB ||
- eOfficeLanguage == LANGUAGE_JAPANESE )
+ if (MsLangId::isKorean(eOfficeLanguage) || eOfficeLanguage == LANGUAGE_JAPANESE)
{
// secondary is edit engine pool
rPool.GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 45ebdc4..96e7cfb 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -28,6 +28,7 @@
#include "scitems.hxx"
#include <editeng/eeitem.hxx>
+#include <i18npool/mslangid.hxx>
#include <svx/algitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brshitem.hxx>
@@ -291,13 +292,8 @@ void ScStyleSheetPool::CreateStandardStyles()
// be queried for Korean, too (the Latin language from the document can't be Korean).
// This is the same logic as in SwDocShell::InitNew.
LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
- switch( eUiLanguage )
- {
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- eLatin = eUiLanguage;
- break;
- }
+ if (MsLangId::isKorean(eUiLanguage))
+ eLatin = eUiLanguage;
lcl_CheckFont( *pSet, eLatin, DEFAULTFONT_LATIN_SPREADSHEET, ATTR_FONT );
lcl_CheckFont( *pSet, eCjk, DEFAULTFONT_CJK_SPREADSHEET, ATTR_CJK_FONT );
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 4c7c989..d88383f 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -242,7 +242,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
}
// for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text
- if( ( LANGUAGE_KOREAN == eRealCTLLanguage ) || ( LANGUAGE_KOREAN_JOHAB == eRealCTLLanguage ) || ( LANGUAGE_JAPANESE == eRealCTLLanguage ) )
+ if (MsLangId::isKorean(eRealCTLLanguage) || (LANGUAGE_JAPANESE == eRealCTLLanguage))
{
GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( sal_False, EE_PARA_ASIANCJKSPACING ) );
}
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 6fce9ca..100bae1 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -29,7 +29,7 @@
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-
+#include <i18npool/mslangid.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/dispatch.hxx>
#include "Outliner.hxx"
@@ -1389,13 +1389,8 @@ void SdDrawDocument::getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rC
// be queried for Korean, too (the Latin language from the document can't be Korean).
// This is the same logic as in SwDocShell::InitNew.
LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
- switch( eUiLanguage )
- {
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- eLatin = eUiLanguage;
- break;
- }
+ if (MsLangId::isKorean(eUiLanguage))
+ eLatin = eUiLanguage;
rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE );
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index e14b698..3c8ff6c 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -895,22 +895,17 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage )
if ( eLanguage == LANGUAGE_SYSTEM )
eLanguage = MsLangId::getSystemUILanguage();
- switch( eLanguage )
+ if (MsLangId::isSimplifiedChinese(eLanguage))
{
- case LANGUAGE_CHINESE:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_SINGAPORE:
- mpArray = aImplSimplifiedChinese;
- mnElem = SAL_N_ELEMENTS(aImplSimplifiedChinese);
- break;
-
// equivalent for traditional chinese disabled by popular request, #i89077#
-
- default:
- mpArray = NULL;
- mnElem = 0;
- break;
- };
+ mpArray = aImplSimplifiedChinese;
+ mnElem = SAL_N_ELEMENTS(aImplSimplifiedChinese);
+ }
+ else
+ {
+ mpArray = NULL;
+ mnElem = 0;
+ }
}
//------------------------------------------------------------------------
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 5bcd3e3..6cb66ce 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 7aec18c..3db14e6 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 6d79548..9df457c 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 178483b..cd5d1ff 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 a860c3b..383b4a3 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(
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index b13fe32..5c88936 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <i18npool/mslangid.hxx>
#include <unotools/fontcfg.hxx>
#include <unotools/fontdefs.hxx>
#include <comphelper/processfactory.hxx>
@@ -325,13 +326,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
{
return rtl::OUString(FALLBACKFONT_UI_SANS_LATIN2);
}
- else if ( aLocale.Language == "zh" )
- {
- if( ! aLocale.Country.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cn" ) ) )
- return rtl::OUString(FALLBACKFONT_UI_SANS_CHINTRD);
- else
- return rtl::OUString(FALLBACKFONT_UI_SANS_CHINSIM);
- }
+ else if (MsLangId::isTraditionalChinese(aLocale))
+ return rtl::OUString(FALLBACKFONT_UI_SANS_CHINTRD);
+ else if (MsLangId::isSimplifiedChinese(aLocale))
+ return rtl::OUString(FALLBACKFONT_UI_SANS_CHINSIM);
else if ( aLocale.Language == "ja" )
{
// we need localized names for japanese fonts
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 5e60a3d..286932e 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -639,9 +639,7 @@ sal_Bool SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProp
if( ! (rVal >>= rOpt.bIsDirectionToSimplified) )
{
//default is locale dependent:
- if( rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_HONGKONG
- || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_MACAU
- || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_TRADITIONAL )
+ if (MsLangId::isTraditionalChinese(rOpt.nDefaultLanguage_CJK))
{
rOpt.bIsDirectionToSimplified = sal_False;
}
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 7c4bc21..9cd88a4 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -50,6 +50,7 @@
#include "osl/file.hxx"
#include "osl/thread.hxx"
+#include "langboost.hxx"
#include "sft.hxx"
#include <ft2build.h>
@@ -177,27 +178,7 @@ FtFontFile::FtFontFile( const ::rtl::OString& rNativeFileName )
if( bOnce )
{
bOnce = false;
- LanguageType aLang = Application::GetSettings().GetUILanguage();
- switch( aLang )
- {
- case LANGUAGE_JAPANESE:
- pLangBoost = "jan";
- break;
- case LANGUAGE_CHINESE:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_SINGAPORE:
- pLangBoost = "zhs";
- break;
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_MACAU:
- pLangBoost = "zht";
- break;
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- pLangBoost = "kor";
- break;
- }
+ pLangBoost = vcl::getLangBoost();
}
if( pLangBoost && !strncasecmp( pLangBoost, &maNativeFileName.getStr()[nPos+1], 3 ) )
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 29c0610..95aed99 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -54,13 +54,15 @@
#include "fontsubset.hxx"
#include "salprn.hxx"
#include "region.h"
+#include "langboost.hxx"
#ifdef ENABLE_GRAPHITE
#include <graphite_layout.hxx>
#include <graphite_serverfont.hxx>
#endif
-#include "comphelper/string.hxx"
+#include <comphelper/string.hxx>
+#include <i18npool/mslangid.hxx>
using namespace psp;
@@ -1178,6 +1180,26 @@ ImplDevFontAttributes GenPspGraphics::Info2DevFontAttributes( const psp::FastPri
return aDFA;
}
+namespace vcl
+{
+ const char* getLangBoost()
+ {
+ const char* pLangBoost;
+ const LanguageType eLang = Application::GetSettings().GetUILanguage();
+ if (eLang == LANGUAGE_JAPANESE)
+ pLangBoost = "jan";
+ else if (MsLangId::isKorean(eLang))
+ pLangBoost = "kor";
+ else if (MsLangId::isSimplifiedChinese(eLang))
+ pLangBoost = "zhs";
+ else if (MsLangId::isTraditionalChinese(eLang))
+ pLangBoost = "zht";
+ else
+ pLangBoost = NULL;
+ return pLangBoost;
+ }
+}
+
// -----------------------------------------------------------------------
void GenPspGraphics::AnnounceFonts( ImplDevFontList* pFontList, const psp::FastPrintFontInfo& aInfo )
@@ -1199,27 +1221,7 @@ void GenPspGraphics::AnnounceFonts( ImplDevFontList* pFontList, const psp::FastP
if( bOnce )
{
bOnce = false;
- const LanguageType aLang = Application::GetSettings().GetUILanguage();
- switch( aLang )
- {
- case LANGUAGE_JAPANESE:
- pLangBoost = "jan";
- break;
- case LANGUAGE_CHINESE:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_SINGAPORE:
- pLangBoost = "zhs";
- break;
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_MACAU:
- pLangBoost = "zht";
- break;
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- pLangBoost = "kor";
- break;
- }
+ pLangBoost = vcl::getLangBoost();
}
if( pLangBoost )
diff --git a/vcl/inc/langboost.hxx b/vcl/inc/langboost.hxx
new file mode 100644
index 0000000..f612cba
--- /dev/null
+++ b/vcl/inc/langboost.hxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _VCL_LANGBOOST_HXX
+#define _VCL_LANGBOOST_HXX
+
+namespace vcl
+{
+ const char* getLangBoost();
+}
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index daddd90..948fcc3 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -2734,30 +2734,19 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
}
// if still needed use the font request's attributes to find a good match
- switch( rFSD.meLanguage )
+ if (MsLangId::isSimplifiedChinese(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_SC;
+ else if (MsLangId::isTraditionalChinese(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC;
+ else if (MsLangId::isKorean(rFSD.meLanguage))
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_KR;
+ else if (rFSD.meLanguage == LANGUAGE_JAPANESE)
+ nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP;
+ else
{
- case LANGUAGE_CHINESE:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_SINGAPORE:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_SC;
- break;
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_MACAU:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_TC;
- break;
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_KR;
- break;
- case LANGUAGE_JAPANESE:
- nSearchType |= IMPL_FONT_ATTR_CJK | IMPL_FONT_ATTR_CJK_JP;
- break;
- default:
- nSearchType |= ImplIsCJKFont( rFSD.maName );
- if( rFSD.IsSymbolFont() )
- nSearchType |= IMPL_FONT_ATTR_SYMBOL;
- break;
+ nSearchType |= ImplIsCJKFont( rFSD.maName );
+ if( rFSD.IsSymbolFont() )
+ nSearchType |= IMPL_FONT_ATTR_SYMBOL;
}
ImplCalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.meFamily, pFontAttr );
@@ -2936,15 +2925,13 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const Font& rFont )
{
LanguageType eLang = rFont.GetLanguage();
// In Chinese Simplified the EmphasisMarks are below/left
- if ( (eLang == LANGUAGE_CHINESE_SIMPLIFIED) ||
- (eLang == LANGUAGE_CHINESE_SINGAPORE) )
+ if (MsLangId::isSimplifiedChinese(eLang))
nEmphasisMark |= EMPHASISMARK_POS_BELOW;
else
{
eLang = rFont.GetCJKContextLanguage();
// In Chinese Simplified the EmphasisMarks are below/left
- if ( (eLang == LANGUAGE_CHINESE_SIMPLIFIED) ||
- (eLang == LANGUAGE_CHINESE_SINGAPORE) )
+ if (MsLangId::isSimplifiedChinese(eLang))
nEmphasisMark |= EMPHASISMARK_POS_BELOW;
else
nEmphasisMark |= EMPHASISMARK_POS_ABOVE;
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index daeae8b..4d9acb9 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -34,6 +34,7 @@
#include <vcl/unohelp.hxx>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <i18npool/mslangid.hxx>
using namespace ::com::sun::star;
@@ -148,22 +149,8 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
sal_Bool bChanged = sal_False;
xub_StrLen nLen = aKey.Len();
- sal_Bool bCJK = sal_False;
- switch( Application::GetSettings().GetUILanguage() )
- {
- case LANGUAGE_JAPANESE:
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_SINGAPORE:
- case LANGUAGE_CHINESE_MACAU:
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- bCJK = sal_True;
- break;
- default:
- break;
- }
+ bool bCJK = MsLangId::isCJK(Application::GetSettings().GetUILanguage());
+
// #107889# in CJK versions ALL strings (even those that contain latin characters)
// will get mnemonics in the form: xyz (M)
// thus steps 1) and 2) are skipped for CJK locales
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b0d10a1..8cb1a52 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <i18npool/mslangid.hxx>
#include "tools/time.hxx"
#include "tools/debug.hxx"
@@ -405,21 +406,9 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
// if the UI is korean, chinese or another locale
// where the system font size is kown to be often too small to
// generate readable fonts enforce a minimum font size of 9 points
- bool bBrokenLangFontHeight = false;
- static const LanguageType eBrokenSystemFontSizeLanguages[] =
- { LANGUAGE_KOREAN, LANGUAGE_KOREAN_JOHAB,
- LANGUAGE_CHINESE_HONGKONG, LANGUAGE_CHINESE_MACAU, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_SINGAPORE, LANGUAGE_CHINESE_TRADITIONAL
- };
- static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet(
- eBrokenSystemFontSizeLanguages,
- eBrokenSystemFontSizeLanguages + SAL_N_ELEMENTS(eBrokenSystemFontSizeLanguages)
- );
- LanguageType aLang = Application::GetSettings().GetUILanguage();
- if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() )
- {
+ bool bBrokenLangFontHeight = MsLangId::isCJK(Application::GetSettings().GetUILanguage());
+ if (bBrokenLangFontHeight)
defFontheight = Max(9, defFontheight);
- bBrokenLangFontHeight = true;
- }
// i22098, toolfont will be scaled differently to avoid bloated rulers and status bars for big fonts
int toolfontheight = defFontheight;
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index dfb3d3d..59ee078 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -428,23 +428,7 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar )
if( !nDefaultLang )
nDefaultLang = Application::GetSettings().GetUILanguage();
- LanguageType nDefaultCJK = LANGUAGE_CHINESE;
- switch( nDefaultLang )
- {
- case LANGUAGE_JAPANESE:
- case LANGUAGE_KOREAN:
- case LANGUAGE_KOREAN_JOHAB:
- case LANGUAGE_CHINESE_SIMPLIFIED:
- case LANGUAGE_CHINESE_TRADITIONAL:
- case LANGUAGE_CHINESE_SINGAPORE:
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_MACAU:
- nDefaultCJK = nDefaultLang;
- break;
- default:
- nDefaultCJK = LANGUAGE_CHINESE;
- break;
- }
+ LanguageType nDefaultCJK = MsLangId::isCJK(nDefaultLang) ? nDefaultLang : LANGUAGE_CHINESE;
// change the marked entries to prefered language
static const int nCount = SAL_N_ELEMENTS(aLangFromCodeChart);
commit 2a598619d7fbc992f1903a745fd536ddf5e45c81
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 11:50:11 2012 +0100
Related: #i89077# Singapore uses simplified chinese
Change-Id: If6b17c0a19455edb7d7fb94c5d552267c1fe5984
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 8561167..e14b698 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -899,19 +899,12 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage )
{
case LANGUAGE_CHINESE:
case LANGUAGE_CHINESE_SIMPLIFIED:
+ case LANGUAGE_CHINESE_SINGAPORE:
mpArray = aImplSimplifiedChinese;
mnElem = SAL_N_ELEMENTS(aImplSimplifiedChinese);
break;
-#if 0 // #i89077# disabled by popular request
- case LANGUAGE_CHINESE_HONGKONG:
- case LANGUAGE_CHINESE_SINGAPORE:
- case LANGUAGE_CHINESE_MACAU:
- case LANGUAGE_CHINESE_TRADITIONAL:
- mpArray = aImplTraditionalChinese;
- mnElem = SAL_N_ELEMENTS(aImplTraditionalChinese);
- break;
-#endif
+ // equivalent for traditional chinese disabled by popular request, #i89077#
default:
mpArray = NULL;
commit 749ffa2991c3b20e3c250d6473aaada3c1b28710
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 11:40:27 2012 +0100
move odd IsSimilarChinese debugging thing to local scope
Change-Id: I3abcd97b15d9a8500435fab795a7834fa5745dc9
diff --git a/editeng/inc/editeng/hangulhanja.hxx b/editeng/inc/editeng/hangulhanja.hxx
index 25f91bc..b952530 100644
--- a/editeng/inc/editeng/hangulhanja.hxx
+++ b/editeng/inc/editeng/hangulhanja.hxx
@@ -141,7 +141,6 @@ namespace editeng
static inline sal_Bool IsSimplified( LanguageType nLang );
static inline sal_Bool IsTraditional( LanguageType nLang );
static inline sal_Bool IsChinese( LanguageType nLang );
- static inline sal_Bool IsSimilarChinese( LanguageType nLang1, LanguageType nLang2 );
// used to specify that the conversion direction states from the
// last incarnation should be used as
@@ -291,13 +290,6 @@ namespace editeng
{
return IsTraditional( nLang ) || IsSimplified( nLang );
}
-
- sal_Bool HangulHanjaConversion::IsSimilarChinese( LanguageType nLang1, LanguageType nLang2 )
- {
- return (IsTraditional(nLang1) && IsTraditional(nLang2)) ||
- (IsSimplified(nLang1) && IsSimplified(nLang2));
- }
-
//.............................................................................
} // namespace svx
//.............................................................................
diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx
index e444b03..425bb44 100644
--- a/editeng/source/editeng/textconv.cxx
+++ b/editeng/source/editeng/textconv.cxx
@@ -336,6 +336,17 @@ void TextConvWrapper::HandleNewUnit(
SelectNewUnit_impl( nUnitStart, nUnitEnd );
}
+#ifdef DBG_UTIL
+namespace
+{
+ sal_Bool IsSimilarChinese( LanguageType nLang1, LanguageType nLang2 )
+ {
+ using namespace editeng;
+ return (HangulHanjaConversion::IsTraditional(nLang1) && HangulHanjaConversion::IsTraditional(nLang2)) ||
+ (HangulHanjaConversion::IsSimplified(nLang1) && HangulHanjaConversion::IsSimplified(nLang2));
+ }
+}
+#endif
void TextConvWrapper::ReplaceUnit(
const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
commit 447e5b4b36271b197660a9383a0f88c2761896c6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 11:36:39 2012 +0100
death to some UniStrings
Change-Id: I0fa0c60e12c418d25f8bd96cc04c6abd74b1a608
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 82df051..b99a53f 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1180,7 +1180,7 @@ namespace cppcanvas
}
// create and add the text action
- XubString text( chars, stringLength );
+ rtl::OUString text(chars, stringLength);
delete[] chars;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index fa9c7af..7f8da77 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1030,8 +1030,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
// check on the basis of the exception list
if( pExceptStt )
{
- sWord = String(
- pStr, sal::static_int_cast< xub_StrLen >( pExceptStt - pStr + 1 ) );
+ sWord = rtl::OUString(pStr, pExceptStt - pStr + 1);
if( FindInCplSttExceptList(eLang, sWord) )
return sal_False;
@@ -1725,7 +1724,7 @@ static const SvxAutocorrWord* lcl_SearchWordsInList(
( nCalcStt < rStt &&
IsWordDelim( rTxt.GetChar(nCalcStt - 1 ) ))) )
{
- String sWord( rTxt.GetBuffer() + nCalcStt, rChk.Len() );
+ rtl::OUString sWord(rTxt.GetBuffer() + nCalcStt, rChk.Len());
if( rCmp.isEqual( rChk, sWord ))
{
rStt = nCalcStt;
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index d465d8b..e70cf2d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -214,8 +214,8 @@ void ScDocShell::FillClass( SvGlobalName* pClassName,
{
*pClassName = SvGlobalName( SO3_SC_CLASSID_60 );
*pFormat = bTemplate ? SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE : SOT_FORMATSTR_ID_STARCALC_8;
- *pFullTypeName = String( RTL_CONSTASCII_USTRINGPARAM("calc8") );
- *pShortTypeName = String( ScResId( SCSTR_SHORT_SCDOC_NAME ) );
+ *pFullTypeName = rtl::OUString("calc8");
+ *pShortTypeName = ScResId(SCSTR_SHORT_SCDOC_NAME).toString();
}
else
{
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index e8eb0e5..1a212a7 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -293,7 +293,7 @@ void StgEntry::GetName( String& rName ) const
sal_uInt16 n = nNameLen;
if( n )
n = ( n >> 1 ) - 1;
- rName = String( nName, n );
+ rName = rtl::OUString(nName, n);
}
// Compare two entries. Do this case-insensitive.
@@ -350,7 +350,7 @@ sal_Bool StgEntry::Load( const void* pFrom )
return sal_False;
}
- aName = String( nName, n );
+ aName = rtl::OUString( nName, n );
// I don't know the locale, so en_US is hopefully fine
aName = ToUpperUnicode( aName );
aName.Erase( nMaxLegalStr );
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index edf11cb..fac059b 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -958,7 +958,7 @@ bool INetContentTypes::parse(UniString const & rMediaType,
}
if (p == pToken)
return false;
- rType = UniString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
+ rType = rtl::OUString(pToken, p - pToken);
if (bDowncase)
rType.ToLowerAscii();
@@ -976,8 +976,7 @@ bool INetContentTypes::parse(UniString const & rMediaType,
}
if (p == pToken)
return false;
- rSubType = UniString(
- pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
+ rSubType = rtl::OUString(pToken, p - pToken);
if (bDowncase)
rSubType.ToLowerAscii();
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 497bd20..ad14ca3 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -91,8 +91,7 @@ void SvTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
{
if( pCurToken && nCurTokenLen )
- // aToken.Assign( pCurToken, nCurTokenLen );
- aToken = XubString( pCurToken, nCurTokenLen );
+ aToken = rtl::OUString(pCurToken, nCurTokenLen);
else
aToken.Erase();
SvLBoxString* pStr = new SvLBoxString( pEntry, 0, aToken );
@@ -339,7 +338,7 @@ void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry, sal
if( nCol == 0xffff )
{
if( pCurToken )
- aTemp = XubString( pCurToken, nCurTokenLen );
+ aTemp = rtl::OUString(pCurToken, nCurTokenLen);
else
aTemp.Erase(); // delete all columns without a token
((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
@@ -350,7 +349,7 @@ void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry, sal
{
if( !nCol )
{
- aTemp = XubString( pCurToken, nCurTokenLen );
+ aTemp = rtl::OUString(pCurToken, nCurTokenLen);
((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
if( !pNextToken )
break;
diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx
index 2bf3d02..a366c03 100644
--- a/svtools/source/edit/syntaxhighlight.cxx
+++ b/svtools/source/edit/syntaxhighlight.cxx
@@ -423,7 +423,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType,
if( bCanBeKeyword )
{
- String aKWString(rpStartPos, sal::static_int_cast< xub_StrLen >(nCount) );
+ rtl::OUString aKWString(rpStartPos, nCount);
rtl::OString aByteStr = rtl::OUStringToOString(aKWString,
RTL_TEXTENCODING_ASCII_US).toAsciiLowerCase();
if ( bsearch( aByteStr.getStr(), ppListKeyWords, nKeyWordCount, sizeof( char* ),
diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx
index cadb5e2..f19c8f1 100644
--- a/svtools/source/filter/wmf/enhwmf.cxx
+++ b/svtools/source/filter/wmf/enhwmf.cxx
@@ -1180,7 +1180,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
*pTmp = nTmp;
}
#endif
- aText = String( pBuf, (xub_StrLen)nLen );
+ aText = rtl::OUString(pBuf, nLen);
delete[] pBuf;
}
}
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 5427d86..5d94f12 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -519,7 +519,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak )
if( IsParserWorking() && !rInput.IsEof() )
{
- String sEntity( sEntityBuffer.getStr(), nPos );
+ rtl::OUString sEntity(sEntityBuffer.getStr(), nPos);
cChar = GetHTMLCharName( sEntity );
// not found ( == 0 ): plain text
@@ -533,8 +533,8 @@ int HTMLParser::ScanText( const sal_Unicode cBreak )
{
nNextCh = sEntityBuffer[i];
sEntityBuffer.setLength( i );
- sEntity.Assign( sEntityBuffer.getStr(), i );
- cChar = GetHTMLCharName( sEntity );
+ sEntity = rtl::OUString(sEntityBuffer.getStr(), i);
+ cChar = GetHTMLCharName( sEntity );
if( cChar )
{
rInput.SeekRel( -(long)
@@ -896,9 +896,7 @@ int HTMLParser::_GetNextRawToken()
nNextCh = GetNextChar();
}
- String aTok( sTmpBuffer.getStr(),
- sal::static_int_cast< xub_StrLen >(
- sTmpBuffer.getLength()) );
+ String aTok( sTmpBuffer.toString() );
aTok.ToUpperAscii();
bool bDone = false;
if( bReadScript || aEndToken.Len() )
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 10c5aa8..5d7775e 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -469,7 +469,7 @@ void SvxRedlinTable::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
{
if( pCurToken && nCurTokenLen )
- aToken = XubString( pCurToken, nCurTokenLen );
+ aToken = rtl::OUString(pCurToken, nCurTokenLen);
else
aToken.Erase();
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 531d5fc..7a45808 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -344,7 +344,7 @@ bool parseParameters(ParameterList const & rInput,
bBadEncoding = true;
break;
}
- aValue += UniString(pUnicode, static_cast< xub_StrLen >(nSize));
+ aValue += rtl::OUString(pUnicode, static_cast<sal_Int32>(nSize));
delete[] pUnicode;
pNext = pNext->m_pNext;
}
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 698a457..f4714b6 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -1458,17 +1458,17 @@ rtl::OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper
// day of month
nVal = rCal.getValue( CalendarFieldIndex::DAY_OF_MONTH );
pBuf = ImplAdd2UNum( aBuf, nVal, bDayOfMonthWithLeadingZero );
- String aDay( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ rtl::OUString aDay(aBuf, pBuf-aBuf);
// month of year
nVal = rCal.getValue( CalendarFieldIndex::MONTH );
- String aMonth( rCal.getDisplayName( CalendarDisplayIndex::MONTH, nVal, nDisplayMonth ) );
+ rtl::OUString aMonth( rCal.getDisplayName( CalendarDisplayIndex::MONTH, nVal, nDisplayMonth ) );
// year
nVal = rCal.getValue( CalendarFieldIndex::YEAR );
if ( bTwoDigitYear )
pBuf = ImplAddUNum( aBuf, nVal % 100, 2 );
else
pBuf = ImplAddUNum( aBuf, nVal );
- String aYear( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ rtl::OUString aYear(aBuf, pBuf-aBuf);
// concatenate
switch ( getLongDateFormat() )
{
@@ -1524,7 +1524,7 @@ rtl::OUString LocaleDataWrapper::getDuration( const Time& rTime, sal_Bool bSec,
}
}
- return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ return rtl::OUString(aBuf, pBuf-aBuf);
}
@@ -1554,14 +1554,13 @@ rtl::OUString LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals
sal_Unicode* pBuf = ImplAddFormatNum( pBuffer, nNumber, nDecimals,
bUseThousandSep, bTrailingZeros );
- String aStr( pBuffer, (xub_StrLen)(sal_uLong)(pBuf-pBuffer) );
+ rtl::OUString aStr(pBuffer, pBuf-pBuffer);
if ( pBuffer != aBuf )
delete [] pBuffer;
return aStr;
}
-
rtl::OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
const rtl::OUString& rCurrencySymbol, sal_Bool bUseThousandSep ) const
{
@@ -1753,7 +1752,7 @@ rtl::OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimal
}
}
- String aNumber( pBuffer, (xub_StrLen)(sal_uLong)(pBuf-pBuffer) );
+ rtl::OUString aNumber(pBuffer, pBuf-pBuffer);
if ( pBuffer != aBuf )
delete [] pBuffer;
diff --git a/unusedcode.easy b/unusedcode.easy
index da7c664..d23ad1b 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -70,6 +70,7 @@ SrchAttrItemList::Replace(SearchAttrItem const&, unsigned short)
SrchAttrItemList::Replace(SearchAttrItem const*, unsigned short, unsigned short)
SrchAttrItemList::_ForEach(unsigned short, unsigned short, unsigned char (*)(SearchAttrItem const&, void*), void*)
StgCache::Pos2Page(int)
+String::String(rtl::OString const&, unsigned short, unsigned int)
String::String(unsigned short const*)
SvLBoxButton::Check(SvLBox*, SvLBoxEntry*, unsigned char)
SvPtrarr::Replace(void* const*, unsigned short, unsigned short)
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 4ed66e5..e7f915a 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1333,7 +1333,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
}
}
- return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ return rtl::OUString(aBuf, pBuf-aBuf);
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 06d04cc..daddd90 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -4079,7 +4079,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind...
for( int i = 0; i < nTestStrLen; ++i)
aChars[i] = cStrikeoutChar;
- const String aStrikeoutTest( aChars, nTestStrLen );
+ const rtl::OUString aStrikeoutTest(aChars, nTestStrLen);
// calculate approximation of strikeout atom size
long nStrikeoutWidth = 0;
@@ -4099,7 +4099,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
// build the strikeout string
for( int i = nTestStrLen; i < nStrikeStrLen; ++i)
aChars[i] = cStrikeoutChar;
- const String aStrikeoutText( aChars, xub_StrLen(nStrikeStrLen) );
+ const rtl::OUString aStrikeoutText(aChars, nStrikeStrLen);
if( mpFontEntry->mnOrientation )
ImplRotatePos( 0, 0, nDistX, nDistY, mpFontEntry->mnOrientation );
@@ -6370,7 +6370,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth,
xub_StrLen nRetVal = sal::static_int_cast<xub_StrLen>(pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor ));
// calculate hyphenated break position
- String aHyphenatorStr( &nHyphenatorChar, 1 );
+ rtl::OUString aHyphenatorStr(nHyphenatorChar);
xub_StrLen nTempLen = 1;
SalLayout* pHyphenatorLayout = ImplLayout( aHyphenatorStr, 0, nTempLen );
if( pHyphenatorLayout )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 72201ba..5d7873c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2375,7 +2375,7 @@ PDFSalLayout::PDFSalLayout( PDFWriterImpl& rPDFWriterImpl,
bool PDFSalLayout::LayoutText( ImplLayoutArgs& rArgs )
{
- const String aText( rArgs.mpStr+rArgs.mnMinCharPos, sal::static_int_cast<xub_StrLen>(rArgs.mnEndCharPos-rArgs.mnMinCharPos) );
+ const rtl::OUString aText(rArgs.mpStr+rArgs.mnMinCharPos, rArgs.mnEndCharPos-rArgs.mnMinCharPos);
SetText( aText );
SetUnitsPerPixel( 1000 );
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index 40818d0..d3c3c6b 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -392,7 +392,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data,
pPreeditData->aInputEv.mpTextAttr = Preedit_FeedbackToSAL(
pPreeditData->aText.pCharStyle, pPreeditData->aText.nLength, pPreeditData->aInputFlags);
pPreeditData->aInputEv.mnCursorPos = call_data->caret;
- pPreeditData->aInputEv.maText = String (pPreeditData->aText.pUnicodeBuffer,
+ pPreeditData->aInputEv.maText = rtl::OUString(pPreeditData->aText.pUnicodeBuffer,
pPreeditData->aText.nLength);
pPreeditData->aInputEv.mnCursorFlags = 0; // default: make cursor visible
pPreeditData->aInputEv.mnDeltaStart = 0; // call_data->chg_first;
commit aae1b8ffade1ef0756899436497fa049b396fc26
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 10:35:57 2012 +0100
reduce amount of static Strings
Change-Id: Ic397223332982619d62a30326fa8ceddd59010f3
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 634c1c7..b13fe32 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -287,58 +287,31 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
#define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;"
#define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;"
- // we need localized names for japanese fonts
- static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
- static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
- static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
- static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
- static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
-
- String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) );
- aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) );
- aFallBackJapaneseLocalized += OUString( aMSPGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += OUString( aMSGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += OUString( aTLPGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += OUString( aLXGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += OUString( aKochiGothic );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE2 ) );
- static const OUString aFallBackJapanese( aFallBackJapaneseLocalized );
- static const OUString aFallback (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS));
- static const OUString aFallbackLatin2 (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS_LATIN2));
- static const OUString aFallBackArabic (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_ARABIC ) );
- static const OUString aFallBackThai (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_THAI ) );
- static const OUString aFallBackChineseSIM (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINSIM ) );
- static const OUString aFallBackChineseTRD (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINTRD ) );
-
- // we need localized names for korean fonts
- static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 };
- static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 };
- rtl::OUString aFallBackKoreanLocalized( aSunGulim );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackKoreanLocalized += rtl::OUString( aBaekmukGulim );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) );
- aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_KOREAN ) );
- static const OUString aFallBackKorean( aFallBackKoreanLocalized );
-
// optimize font list for some locales, as long as Andale Sans UI does not support them
if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ar" ) ) ||
aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "he" ) ) ||
aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "iw" ) ) )
{
- return aFallBackArabic;
+ return rtl::OUString(FALLBACKFONT_UI_SANS_ARABIC);
}
else if ( aLocale.Language == "th" )
{
- return aFallBackThai;
+ return rtl::OUString(FALLBACKFONT_UI_SANS_THAI);
}
else if ( aLocale.Language == "ko" )
{
- return aFallBackKorean;
+ // we need localized names for korean fonts
+ const sal_Unicode aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 };
+ const sal_Unicode aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 };
+
+ rtl::OUStringBuffer aFallBackKoreanLocalized;
+ aFallBackKoreanLocalized.append(aSunGulim);
+ aFallBackKoreanLocalized.append(';');
+ aFallBackKoreanLocalized.append(aBaekmukGulim);
+ aFallBackKoreanLocalized.append(";");
+ aFallBackKoreanLocalized.append(FALLBACKFONT_UI_SANS_KOREAN);
+
+ return aFallBackKoreanLocalized.makeStringAndClear();
}
else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cs" ) ) ||
aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hu" ) ) ||
@@ -350,21 +323,43 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sl" ) ) ||
aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sb" ) ) )
{
- return aFallbackLatin2;
+ return rtl::OUString(FALLBACKFONT_UI_SANS_LATIN2);
}
else if ( aLocale.Language == "zh" )
{
if( ! aLocale.Country.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cn" ) ) )
- return aFallBackChineseTRD;
+ return rtl::OUString(FALLBACKFONT_UI_SANS_CHINTRD);
else
- return aFallBackChineseSIM;
+ return rtl::OUString(FALLBACKFONT_UI_SANS_CHINSIM);
}
else if ( aLocale.Language == "ja" )
{
- return aFallBackJapanese;
+ // we need localized names for japanese fonts
+ const sal_Unicode aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ const sal_Unicode aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ const sal_Unicode aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ const sal_Unicode aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ const sal_Unicode aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+
+ rtl::OUStringBuffer aFallBackJapaneseLocalized;
+ aFallBackJapaneseLocalized.append("MS UI Gothic;");
+ aFallBackJapaneseLocalized.append(FALLBACKFONT_UI_SANS_JAPANESE1);
+ aFallBackJapaneseLocalized.append(aMSPGothic);
+ aFallBackJapaneseLocalized.append(';');
+ aFallBackJapaneseLocalized.append(aMSGothic);
+ aFallBackJapaneseLocalized.append(';');
+ aFallBackJapaneseLocalized.append(aTLPGothic);
+ aFallBackJapaneseLocalized.append(';');
+ aFallBackJapaneseLocalized.append(aLXGothic);
+ aFallBackJapaneseLocalized.append(';');
+ aFallBackJapaneseLocalized.append(aKochiGothic);
+ aFallBackJapaneseLocalized.append(';');
+ aFallBackJapaneseLocalized.append(FALLBACKFONT_UI_SANS_JAPANESE2);
+
+ return aFallBackJapaneseLocalized.makeStringAndClear();
}
- return aFallback;
+ return rtl::OUString(FALLBACKFONT_UI_SANS);
}
// ------------------------------------------------------------------------------------
commit 37b30a6d7dae930b2007594de5ce45ad5f61456a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 10:32:43 2012 +0100
why on earth are these double null terminated
Change-Id: If7246afada76ca078ace48ef6f8bdb6a72adc00a
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 03a2761..634c1c7 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -288,11 +288,11 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
#define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;"
// we need localized names for japanese fonts
- static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
- static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 };
+ static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
+ static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 };
String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) );
aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) );
commit 16bf6e9c5f82127a4e9201c39edc8925d8b4a235
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 10:01:59 2012 +0100
use a temporary rather than calling Erase
Change-Id: I77c80d332e4bef34c31accf6e2ab77e59f9bf93e
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 0425189..8c25ee5 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1052,11 +1052,8 @@ namespace cppcanvas
pChars[0] = '/';
pChars[3]=pChars[2]=pChars[1]=pChars[0];
- long nStrikeoutWidth = nWidth;
- String aStrikeoutTest(pChars, SAL_N_ELEMENTS(pChars));
-
- nStrikeoutWidth = ( rParms.mrVDev.GetTextWidth( aStrikeoutTest ) + 2 ) / 4;
- aStrikeoutTest.Erase();
+ long nStrikeoutWidth = (rParms.mrVDev.GetTextWidth(
+ rtl::OUString(pChars, SAL_N_ELEMENTS(pChars))) + 2) / 4;
if( nStrikeoutWidth <= 0 )
nStrikeoutWidth = 1;
@@ -1071,7 +1068,6 @@ namespace cppcanvas
while( (nFullStrikeoutWidth+=nStrikeoutWidth ) < nMaxWidth+1 )
aStrikeoutText += pChars[0];
-
xub_StrLen nLen = aStrikeoutText.Len();
if( nLen )
commit 67d0936315837eca82b2e530cb7ea8ba833d7308
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 09:59:34 2012 +0100
where is the logic of having 5 pChars if we only need 4
Change-Id: I16c1f5ee7a05aa011d00e6f1de86e1aa5d9621b8
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index bf2c0d5..0425189 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1045,7 +1045,7 @@ namespace cppcanvas
{
long nWidth = rParms.mrVDev.GetTextWidth( rString,nIndex,nLength );
- xub_Unicode pChars[5];
+ xub_Unicode pChars[4];
if ( rState.textStrikeoutStyle == STRIKEOUT_X )
pChars[0] = 'X';
else
@@ -1053,7 +1053,7 @@ namespace cppcanvas
pChars[3]=pChars[2]=pChars[1]=pChars[0];
long nStrikeoutWidth = nWidth;
- String aStrikeoutTest( pChars, 4 );
+ String aStrikeoutTest(pChars, SAL_N_ELEMENTS(pChars));
nStrikeoutWidth = ( rParms.mrVDev.GetTextWidth( aStrikeoutTest ) + 2 ) / 4;
aStrikeoutTest.Erase();
commit 64a9f8942d862173f9f22af10782d6a73c4900c9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 09:55:51 2012 +0100
if the string is created of len 0, then no point passing any arguments
Change-Id: I0055ad846f438765c5259e02025e6ef5f32c6169
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index db41506..bf2c0d5 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1067,7 +1067,7 @@ namespace cppcanvas
nMaxWidth += nWidth + 1;
long nFullStrikeoutWidth = 0;
- String aStrikeoutText( pChars, 0 );
+ String aStrikeoutText;
while( (nFullStrikeoutWidth+=nStrikeoutWidth ) < nMaxWidth+1 )
aStrikeoutText += pChars[0];
commit d531ef63a40c2cbfb02ae7c344bb292ddc7a02eb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 19 09:54:59 2012 +0100
if the string is created from 4 sal_Unicodes then it cannot be of 0 len
Change-Id: I14695ec0871e186266770d7cfe90f532de31ea57
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 028aa0c..db41506 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1055,14 +1055,11 @@ namespace cppcanvas
long nStrikeoutWidth = nWidth;
String aStrikeoutTest( pChars, 4 );
- if( aStrikeoutTest.Len() )
- {
- nStrikeoutWidth = ( rParms.mrVDev.GetTextWidth( aStrikeoutTest ) + 2 ) / 4;
- aStrikeoutTest.Erase();
+ nStrikeoutWidth = ( rParms.mrVDev.GetTextWidth( aStrikeoutTest ) + 2 ) / 4;
+ aStrikeoutTest.Erase();
- if( nStrikeoutWidth <= 0 )
- nStrikeoutWidth = 1;
- }
+ if( nStrikeoutWidth <= 0 )
+ nStrikeoutWidth = 1;
long nMaxWidth = nStrikeoutWidth/2;
if ( nMaxWidth < 2 )
More information about the Libreoffice-commits
mailing list