summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2019-05-30 15:33:29 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-06-06 14:20:44 +0200
commitfd95fb975b754d71d3750e85431a4e596a40e659 (patch)
treeae0e9afd2016a6e95c8a6190403f6cee7592a647 /writerfilter/source/rtftok/rtfdocumentimpl.cxx
parent50696615fa8698ba18f9afc05202acd0a5a24cf8 (diff)
tdf#125719 sw: rtf: refactor associated character properties
1. \rtlch, \ltrch should be placed before their properties. 2. Do not mix associated and normal character properties in output. 3. Do not output empty "\rtlch \ltrch", "\ltrch \rtlch" pairs. 4. Handle associated character properties runs instead of handling separately their parts without order of them. Change-Id: Ibbf7365d04708682a5f1eb664a579c60a47465d2 Reviewed-on: https://gerrit.libreoffice.org/72578 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx49
1 files changed, 38 insertions, 11 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b6d8290283cc..43463dabc152 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1850,17 +1850,41 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
{
case RTF_B:
case RTF_AB:
- nSprm = (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
- ? NS_ooxml::LN_EG_RPrBase_bCs
- : NS_ooxml::LN_EG_RPrBase_b;
+ switch (m_aStates.top().getRunType())
+ {
+ case RTFParserState::RunType::HICH:
+ case RTFParserState::RunType::RTLCH_LTRCH_1:
+ case RTFParserState::RunType::LTRCH_RTLCH_2:
+ case RTFParserState::RunType::DBCH:
+ nSprm = NS_ooxml::LN_EG_RPrBase_bCs;
+ break;
+ case RTFParserState::RunType::NONE:
+ case RTFParserState::RunType::LOCH:
+ case RTFParserState::RunType::LTRCH_RTLCH_1:
+ case RTFParserState::RunType::RTLCH_LTRCH_2:
+ default:
+ nSprm = NS_ooxml::LN_EG_RPrBase_b;
+ break;
+ }
break;
case RTF_I:
case RTF_AI:
- nSprm = (m_aStates.top().getIsRightToLeft()
- || m_aStates.top().getRunType() == RTFParserState::RunType::HICH)
- ? NS_ooxml::LN_EG_RPrBase_iCs
- : NS_ooxml::LN_EG_RPrBase_i;
+ switch (m_aStates.top().getRunType())
+ {
+ case RTFParserState::RunType::HICH:
+ case RTFParserState::RunType::RTLCH_LTRCH_1:
+ case RTFParserState::RunType::LTRCH_RTLCH_2:
+ case RTFParserState::RunType::DBCH:
+ nSprm = NS_ooxml::LN_EG_RPrBase_iCs;
+ break;
+ case RTFParserState::RunType::NONE:
+ case RTFParserState::RunType::LOCH:
+ case RTFParserState::RunType::LTRCH_RTLCH_1:
+ case RTFParserState::RunType::RTLCH_LTRCH_2:
+ default:
+ nSprm = NS_ooxml::LN_EG_RPrBase_i;
+ break;
+ }
break;
case RTF_OUTL:
nSprm = NS_ooxml::LN_EG_RPrBase_outline;
@@ -1950,7 +1974,11 @@ RTFError RTFDocumentImpl::pushState()
else
{
// fdo#85812 group resets run type of _current_ and new state (but not RTL)
- m_aStates.top().setRunType(RTFParserState::RunType::LOCH);
+ if (m_aStates.top().getRunType() != RTFParserState::RunType::LTRCH_RTLCH_2
+ && m_aStates.top().getRunType() != RTFParserState::RunType::RTLCH_LTRCH_2)
+ {
+ m_aStates.top().setRunType(RTFParserState::RunType::NONE);
+ }
if (m_aStates.top().getDestination() == Destination::MR)
lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer,
@@ -3567,8 +3595,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
, m_nListLevelNum(0)
, m_bLevelNumbersValid(true)
, m_aFrame(this)
- , m_eRunType(RunType::LOCH)
- , m_bIsRightToLeft(false)
+ , m_eRunType(RunType::NONE)
, m_nYear(0)
, m_nMonth(0)
, m_nDay(0)