diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-06-18 00:45:50 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-27 08:04:49 +0000 |
commit | 35314e0a499602936df0062ae9e7ce074d39f801 (patch) | |
tree | ddaefecfaa9a0ec2b7698e09b7f78e4b6eb09598 /writerfilter | |
parent | c1df0c41b602ac144fdde4efcf546549443afa86 (diff) |
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 <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9d9805fc147f..d05ac5be2999 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; |