[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Apr 24 09:27:37 PDT 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit c5282a72180ab7747c923cdc2b1988d15d3956b1
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Apr 21 11:25:18 2012 +0200

    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 at redhat.com>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index aca6a29..02afdc0 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);


More information about the Libreoffice-commits mailing list