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

New commits:
commit fc49c052dbdbb5ab3b0a02a13143705f769b9662
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

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 465ada3..2dd00c7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3354,10 +3354,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;
@@ -3383,14 +3384,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;
     }
@@ -4593,16 +4604,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