summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-06-18 00:45:50 +0200
committerMichael Stahl <mstahl@redhat.com>2014-06-18 00:48:43 +0200
commitfc49c052dbdbb5ab3b0a02a13143705f769b9662 (patch)
tree7d772edb2921cb2be302833cbee7681c44f8ff34
parent31376a31d12a22d4870bbe4033dbbce18c13f07d (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
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx41
1 files changed, 27 insertions, 14 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 465ada36457a..2dd00c75acfd 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;