writerfilter/source/rtftok/rtfdocumentimpl.cxx |   41 ++++++++++++++++---------
 1 file changed, 27 insertions(+), 14 deletions(-)

New commits:
commit 35314e0a499602936df0062ae9e7ce074d39f801
Author: Michael Stahl <mst...@redhat.com>
Date:   Wed Jun 18 00:45:50 2014 +0200

    writerfilter: RTF import: fix handling of associated char properties
    
    These are all dependent on the active \lrtch \rtlch \loch \hich \dbch.
    
    There does not appear to be a SPRM Id for CJK bold / italic / fontsize.
    
    Change-Id: I055ac29700ccd3b32b02c3f7685629254a6c3fd6
    (cherry picked from commit fc49c052dbdbb5ab3b0a02a13143705f769b9662)
    Reviewed-on: https://gerrit.libreoffice.org/9915
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9d9805f..d05ac5b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3368,10 +3368,11 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
     switch (nKeyword)
     {
     case RTF_FS:
-        nSprm = NS_ooxml::LN_EG_RPrBase_sz;
-        break;
     case RTF_AFS:
-        nSprm = NS_ooxml::LN_EG_RPrBase_szCs;
+        nSprm = (m_aStates.top().isRightToLeft
+                        || m_aStates.top().eRunType == RTFParserState::HICH)
+                ? NS_ooxml::LN_EG_RPrBase_szCs
+                : NS_ooxml::LN_EG_RPrBase_sz;
         break;
     case RTF_ANIMTEXT:
         nSprm = NS_ooxml::LN_EG_RPrBase_effect;
@@ -3397,14 +3398,24 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
     switch (nKeyword)
     {
     case RTF_LANG:
-        nSprm = NS_ooxml::LN_CT_Language_val;
+    case RTF_ALANG:
+        if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == 
RTFParserState::HICH)
+        {
+            nSprm = NS_ooxml::LN_CT_Language_bidi;
+        }
+        else if (m_aStates.top().eRunType == RTFParserState::DBCH)
+        {
+            nSprm = NS_ooxml::LN_CT_Language_eastAsia;
+        }
+        else
+        {
+            assert(m_aStates.top().eRunType == RTFParserState::LOCH);
+            nSprm = NS_ooxml::LN_CT_Language_val;
+        }
         break;
-    case RTF_LANGFE:
+    case RTF_LANGFE: // this one is always CJK apparently
         nSprm = NS_ooxml::LN_CT_Language_eastAsia;
         break;
-    case RTF_ALANG:
-        nSprm = NS_ooxml::LN_CT_Language_bidi;
-        break;
     default:
         break;
     }
@@ -4608,16 +4619,18 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword 
nKeyword, bool bParam, int nParam
     switch (nKeyword)
     {
     case RTF_B:
-        nSprm = NS_ooxml::LN_EG_RPrBase_b;
-        break;
     case RTF_AB:
-        nSprm = NS_ooxml::LN_EG_RPrBase_bCs;
+        nSprm = (m_aStates.top().isRightToLeft
+                        || m_aStates.top().eRunType == RTFParserState::HICH)
+                ? NS_ooxml::LN_EG_RPrBase_bCs
+                : NS_ooxml::LN_EG_RPrBase_b;
         break;
     case RTF_I:
-        nSprm = NS_ooxml::LN_EG_RPrBase_i;
-        break;
     case RTF_AI:
-        nSprm = NS_ooxml::LN_EG_RPrBase_iCs;
+        nSprm = (m_aStates.top().isRightToLeft
+                        || m_aStates.top().eRunType == RTFParserState::HICH)
+                ? NS_ooxml::LN_EG_RPrBase_iCs
+                : NS_ooxml::LN_EG_RPrBase_i;
         break;
     case RTF_OUTL:
         nSprm = NS_ooxml::LN_EG_RPrBase_outline;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to