diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-04-21 11:25:18 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-24 17:00:53 +0100 |
commit | c5282a72180ab7747c923cdc2b1988d15d3956b1 (patch) | |
tree | 36c56739bff1c8dafba97a07a522e0b03ee8d138 | |
parent | 6441b280c34c55301df169577de24f25ed0280b4 (diff) |
fdo#48023 fix RTF import of Russian characters without an encoding specified
lcl_GetDefaultTextEncodingForRTF() in editeng did the same.
Signed-off-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index aca6a2991ab4..02afdc00afba 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -549,13 +549,26 @@ sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 nIndex) return 0; } +rtl_TextEncoding lcl_getDefaultTextEncoding() +{ + + const OUString& rLanguage = Application::GetSettings().GetLocale().Language; + + if (rLanguage == "ru" || rLanguage == "uk") + return RTL_TEXTENCODING_MS_1251; + if (rLanguage == "tr") + return RTL_TEXTENCODING_MS_1254; + else + return RTL_TEXTENCODING_MS_1252; +} + rtl_TextEncoding RTFDocumentImpl::getEncoding(sal_uInt32 nFontIndex) { if (!m_pSuperstream) { if (nFontIndex < m_aFontEncodings.size()) return m_aFontEncodings[nFontIndex]; - return 0; + return lcl_getDefaultTextEncoding(); } else return m_pSuperstream->getEncoding(nFontIndex); |