summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-24 10:20:30 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-24 10:20:45 +0100
commitc7da07ad5150d9c0d8e1a99b053009f103d792d9 (patch)
treef841c310783800df0206e3dc74d9722216b533ea /writerfilter
parent7bdb58940ff1cfa1d76bbad26c9cbac8bb2caf2a (diff)
writerfilter: turn RTFInternalState into a C++11 scoped enumeration
Change-Id: I7407aeba6ddcfd783cee508faa6731c59d0b9759
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx21
-rw-r--r--writerfilter/source/rtftok/rtflistener.hxx8
-rw-r--r--writerfilter/source/rtftok/rtflookahead.cxx2
-rw-r--r--writerfilter/source/rtftok/rtftokenizer.cxx6
4 files changed, 18 insertions, 19 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0664af6273af..66afbb448fbc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -997,7 +997,7 @@ RTFError RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing
RTFError RTFDocumentImpl::resolveChars(char ch)
{
- if (m_aStates.top().nInternalState == INTERNAL_BIN)
+ if (m_aStates.top().nInternalState == RTFInternalState::BIN)
{
m_pBinaryData.reset(new SvMemoryStream());
m_pBinaryData->WriteChar(ch);
@@ -1006,7 +1006,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
Strm().ReadChar(ch);
m_pBinaryData->WriteChar(ch);
}
- m_aStates.top().nInternalState = INTERNAL_NORMAL;
+ m_aStates.top().nInternalState = RTFInternalState::NORMAL;
return RTFError::OK;
}
@@ -1016,10 +1016,9 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
bool bUnicodeChecked = false;
bool bSkipped = false;
- while (!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX
- || (ch != '{' && ch != '}' && ch != '\\')))
+ while (!Strm().IsEof() && (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != '{' && ch != '}' && ch != '\\')))
{
- if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != 0x0d && ch != 0x0a))
{
if (m_aStates.top().nCharsToSkip == 0)
{
@@ -1038,7 +1037,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
}
// read a single char if we're in hex mode
- if (m_aStates.top().nInternalState == INTERNAL_HEX)
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX)
break;
if (RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding)
@@ -1067,10 +1066,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
Strm().ReadChar(ch);
}
- if (m_aStates.top().nInternalState != INTERNAL_HEX && !Strm().IsEof())
+ if (m_aStates.top().nInternalState != RTFInternalState::HEX && !Strm().IsEof())
Strm().SeekRel(-1);
- if (m_aStates.top().nInternalState == INTERNAL_HEX && m_aStates.top().nDestinationState != DESTINATION_LEVELNUMBERS)
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX && m_aStates.top().nDestinationState != DESTINATION_LEVELNUMBERS)
{
if (!bSkipped)
m_aHexBuffer.append(ch);
@@ -2185,7 +2184,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
}
break;
case RTF_HEXCHAR:
- m_aStates.top().nInternalState = INTERNAL_HEX;
+ m_aStates.top().nInternalState = RTFInternalState::HEX;
break;
case RTF_CELL:
case RTF_NESTCELL:
@@ -4526,7 +4525,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_BIN:
{
- m_aStates.top().nInternalState = INTERNAL_BIN;
+ m_aStates.top().nInternalState = RTFInternalState::BIN;
m_aStates.top().nBinaryToRead = nParam;
}
break;
@@ -6135,7 +6134,7 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)
RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
: m_pDocumentImpl(pDocumentImpl),
- nInternalState(INTERNAL_NORMAL),
+ nInternalState(RTFInternalState::NORMAL),
nDestinationState(DESTINATION_NORMAL),
nFieldStatus(FIELD_NONE),
nBorderState(BORDER_NONE),
diff --git a/writerfilter/source/rtftok/rtflistener.hxx b/writerfilter/source/rtftok/rtflistener.hxx
index f37064c85c25..0715557f01da 100644
--- a/writerfilter/source/rtftok/rtflistener.hxx
+++ b/writerfilter/source/rtftok/rtflistener.hxx
@@ -16,11 +16,11 @@ namespace writerfilter
{
namespace rtftok
{
-enum RTFInternalState
+enum class RTFInternalState
{
- INTERNAL_NORMAL,
- INTERNAL_BIN,
- INTERNAL_HEX
+ NORMAL,
+ BIN,
+ HEX
};
enum class RTFError
diff --git a/writerfilter/source/rtftok/rtflookahead.cxx b/writerfilter/source/rtftok/rtflookahead.cxx
index 00ab4a9fe272..b90e8dd38b52 100644
--- a/writerfilter/source/rtftok/rtflookahead.cxx
+++ b/writerfilter/source/rtftok/rtflookahead.cxx
@@ -93,7 +93,7 @@ void RTFLookahead::setDestinationState(RTFDestinationState /*nDestinationState*/
RTFInternalState RTFLookahead::getInternalState()
{
- return INTERNAL_NORMAL;
+ return RTFInternalState::NORMAL;
}
void RTFLookahead::setInternalState(RTFInternalState /*nInternalState*/)
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index fbcff422945b..85fc0506abec 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -88,7 +88,7 @@ RTFError RTFTokenizer::resolveParse()
if (m_nGroup < 0)
return RTFError::GROUP_UNDER;
- if (m_nGroup > 0 && m_rImport.getInternalState() == INTERNAL_BIN)
+ if (m_nGroup > 0 && m_rImport.getInternalState() == RTFInternalState::BIN)
{
ret = m_rImport.resolveChars(ch);
if (ret != RTFError::OK)
@@ -129,7 +129,7 @@ RTFError RTFTokenizer::resolveParse()
default:
if (m_nGroup == 0)
return RTFError::CHAR_OVER;
- if (m_rImport.getInternalState() == INTERNAL_NORMAL)
+ if (m_rImport.getInternalState() == RTFInternalState::NORMAL)
{
ret = m_rImport.resolveChars(ch);
if (ret != RTFError::OK)
@@ -151,7 +151,7 @@ RTFError RTFTokenizer::resolveParse()
return ret;
count = 2;
b = 0;
- m_rImport.setInternalState(INTERNAL_NORMAL);
+ m_rImport.setInternalState(RTFInternalState::NORMAL);
}
}
break;