summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-06-05 18:48:55 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-06 07:02:34 +0000
commit268a518a1ac1698a769dbce17e52ac99d7737ac4 (patch)
tree8daf237d8bc5e6c9d577974cf0f208e0e6ec6664 /writerfilter
parentbc1e738708c4b343a63c78bf024cc2df5160b207 (diff)
Convert RunType to scoped enum
Change-Id: I81732f2db5711109e021838da997c0f25b2ea879 Reviewed-on: https://gerrit.libreoffice.org/25925 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx8
-rw-r--r--writerfilter/source/rtftok/rtfdispatchvalue.cxx15
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
4 files changed, 21 insertions, 17 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 88445031e612..8fa7f8fc2108 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -457,7 +457,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
m_aStates.top().nCurrentCharacterStyleIndex = -1;
m_aStates.top().isRightToLeft = false;
- m_aStates.top().eRunType = RTFParserState::LOCH;
+ m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
}
break;
case RTF_PARD:
@@ -725,13 +725,13 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
break;
case RTF_LOCH:
- m_aStates.top().eRunType = RTFParserState::LOCH;
+ m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
break;
case RTF_HICH:
- m_aStates.top().eRunType = RTFParserState::HICH;
+ m_aStates.top().eRunType = RTFParserState::RunType::HICH;
break;
case RTF_DBCH:
- m_aStates.top().eRunType = RTFParserState::DBCH;
+ m_aStates.top().eRunType = RTFParserState::RunType::DBCH;
break;
case RTF_TITLEPG:
{
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index b231ef469524..d89cf086a3f6 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -151,7 +151,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{
case RTF_FS:
case RTF_AFS:
- nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::HICH) ? NS_ooxml::LN_EG_RPrBase_szCs : NS_ooxml::LN_EG_RPrBase_sz;
+ nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ ? NS_ooxml::LN_EG_RPrBase_szCs : NS_ooxml::LN_EG_RPrBase_sz;
break;
case RTF_ANIMTEXT:
nSprm = NS_ooxml::LN_EG_RPrBase_effect;
@@ -178,17 +179,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{
case RTF_LANG:
case RTF_ALANG:
- if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::HICH)
+ if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
{
nSprm = NS_ooxml::LN_CT_Language_bidi;
}
- else if (m_aStates.top().eRunType == RTFParserState::DBCH)
+ else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH)
{
nSprm = NS_ooxml::LN_CT_Language_eastAsia;
}
else
{
- assert(m_aStates.top().eRunType == RTFParserState::LOCH);
+ assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH);
nSprm = NS_ooxml::LN_CT_Language_val;
}
break;
@@ -313,17 +314,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{
case RTF_F:
case RTF_AF:
- if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::HICH)
+ if (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
{
nSprm = NS_ooxml::LN_CT_Fonts_cs;
}
- else if (m_aStates.top().eRunType == RTFParserState::DBCH)
+ else if (m_aStates.top().eRunType == RTFParserState::RunType::DBCH)
{
nSprm = NS_ooxml::LN_CT_Fonts_eastAsia;
}
else
{
- assert(m_aStates.top().eRunType == RTFParserState::LOCH);
+ assert(m_aStates.top().eRunType == RTFParserState::RunType::LOCH);
nSprm = NS_ooxml::LN_CT_Fonts_ascii;
}
if (m_aStates.top().eDestination == Destination::FONTTABLE || m_aStates.top().eDestination == Destination::FONTENTRY)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 761cf2057d03..30ace1388a0e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1099,7 +1099,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
{
// fdo#79384: Word will reject Shift-JIS following \loch
// but apparently OOo could read and (worse) write such documents
- SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::DBCH, "writerfilter.rtf", "invalid Shift-JIS without DBCH");
+ SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::RunType::DBCH, "writerfilter.rtf", "invalid Shift-JIS without DBCH");
assert(bUnicodeChecked);
aBuf.append(ch);
}
@@ -1674,11 +1674,13 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
{
case RTF_B:
case RTF_AB:
- nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::HICH) ? NS_ooxml::LN_EG_RPrBase_bCs : NS_ooxml::LN_EG_RPrBase_b;
+ nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ ? NS_ooxml::LN_EG_RPrBase_bCs : NS_ooxml::LN_EG_RPrBase_b;
break;
case RTF_I:
case RTF_AI:
- nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::HICH) ? NS_ooxml::LN_EG_RPrBase_iCs : NS_ooxml::LN_EG_RPrBase_i;
+ nSprm = (m_aStates.top().isRightToLeft || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
+ ? NS_ooxml::LN_EG_RPrBase_iCs : NS_ooxml::LN_EG_RPrBase_i;
break;
case RTF_OUTL:
nSprm = NS_ooxml::LN_EG_RPrBase_outline;
@@ -1762,7 +1764,7 @@ RTFError RTFDocumentImpl::pushState()
else
{
// fdo#85812 group resets run type of _current_ and new state (but not RTL)
- m_aStates.top().eRunType = RTFParserState::LOCH;
+ m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
if (m_aStates.top().eDestination == Destination::MR)
lcl_DestinationToMath(*m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor);
@@ -3171,7 +3173,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
aShape(),
aDrawingObject(),
aFrame(this),
- eRunType(LOCH),
+ eRunType(RunType::LOCH),
isRightToLeft(false),
nYear(0),
nMonth(0),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 132df5afd640..220da804a81a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -265,7 +265,8 @@ public:
RTFFrame aFrame;
/// Maps to OOXML's ascii, cs or eastAsia.
- enum { LOCH, HICH, DBCH } eRunType;
+ enum class RunType { LOCH, HICH, DBCH };
+ RunType eRunType;
/// ltrch or rtlch
bool isRightToLeft;