summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-08-27 15:00:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-08-27 15:05:48 +0100
commit4143d7bc7078fb367130e092a354b20da57585cc (patch)
tree7d54afe2c796c83b3450b455e82c8da99a93b820 /sw/source/filter/ww8/ww8par.cxx
parent56c9850145faa9ac04c3f09633e56b6c8c22c6c4 (diff)
sync GetCurrentCJKCharSet with GetCurrentCharSet
Change-Id: Ibcf1fa35617ee8d7fab6b66e3e8c8881ad55c3e5
Diffstat (limited to 'sw/source/filter/ww8/ww8par.cxx')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx49
1 files changed, 23 insertions, 26 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 53a2a02dbb2c..4fc41eb40f4b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2809,6 +2809,24 @@ rtl_TextEncoding SwWW8ImplReader::GetCharSetFromLanguage()
return msfilter::util::getBestTextEncodingFromLocale(aLocale);
}
+rtl_TextEncoding SwWW8ImplReader::GetCJKCharSetFromLanguage()
+{
+ /*
+ #i22206#/#i52786#
+ The (default) character set used for a run of text is the default
+ character set for the version of Word that last saved the document.
+
+ This is a bit tentative, more might be required if the concept is correct.
+ When later version of word write older 6/95 documents the charset is
+ correctly set in the character runs involved, so its hard to reproduce
+ documents that require this to be sure of the process involved.
+ */
+ const SvxLanguageItem *pLang = (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_CJK_LANGUAGE);
+ LanguageType eLang = pLang ? pLang->GetLanguage() : LANGUAGE_SYSTEM;
+ ::com::sun::star::lang::Locale aLocale(LanguageTag::convertToLocale(eLang));
+ return msfilter::util::getBestTextEncodingFromLocale(aLocale);
+}
+
rtl_TextEncoding SwWW8ImplReader::GetCurrentCharSet()
{
/*
@@ -2846,33 +2864,12 @@ rtl_TextEncoding SwWW8ImplReader::GetCurrentCJKCharSet()
{
if (!maFontSrcCJKCharSets.empty())
eSrcCharSet = maFontSrcCJKCharSets.top();
- if (!vColl.empty())
- {
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
- eSrcCharSet = vColl[nCharFmt].GetCJKCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW && nAktColl < vColl.size())
- eSrcCharSet = vColl[nAktColl].GetCJKCharSet();
- }
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && nCharFmt >= 0 && (size_t)nCharFmt < vColl.size() )
+ eSrcCharSet = vColl[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW && StyleExists(nAktColl) && nAktColl < vColl.size())
+ eSrcCharSet = vColl[nAktColl].GetCJKCharSet();
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
- { // patch from cmc for #i52786#
- /*
- #i22206#/#i52786#
- The (default) character set used for a run of text is the default
- character set for the version of Word that last saved the document.
-
- This is a bit tentative, more might be required if the concept is correct.
- When later version of word write older 6/95 documents the charset is
- correctly set in the character runs involved, so its hard to reproduce
- documents that require this to be sure of the process involved.
- */
- const SvxLanguageItem *pLang =
- (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE);
- if (pLang)
- {
- ::com::sun::star::lang::Locale aLocale(LanguageTag::convertToLocale(pLang->GetLanguage()));
- eSrcCharSet = msfilter::util::getBestTextEncodingFromLocale(aLocale);
- }
- }
+ eSrcCharSet = GetCJKCharSetFromLanguage();
}
return eSrcCharSet;
}