summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-01-24 15:27:14 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-24 16:13:47 +0000
commit66dd28f2631ef1f7219d773b457748574eee59b1 (patch)
treeb9d786bdd56b6548d9f3ce53188338272dcb1e89 /writerfilter
parentcoverity#1265796 Dereference null return value (diff)
downloadcore-66dd28f2631ef1f7219d773b457748574eee59b1.tar.gz
core-66dd28f2631ef1f7219d773b457748574eee59b1.zip
writerfilter: turn RTFBorderState into a C++11 scoped enumeration
Change-Id: I7d608238a72dd71eb22dd72ddb5c6c47cc0150f5 Reviewed-on: https://gerrit.libreoffice.org/14153 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx22
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx14
2 files changed, 18 insertions, 18 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5ef3834f8f98..d24b5d27afb1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -119,7 +119,7 @@ static void
lcl_putBorderProperty(RTFStack& aStates, Id nId, RTFValue::Pointer_t pValue)
{
RTFSprms* pAttributes = nullptr;
- if (aStates.top().nBorderState == BORDER_PARAGRAPH_BOX)
+ if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH_BOX)
for (int i = 0; i < 4; i++)
{
RTFValue::Pointer_t p = aStates.top().aParagraphSprms.find(lcl_getParagraphBorder(i));
@@ -129,7 +129,7 @@ lcl_putBorderProperty(RTFStack& aStates, Id nId, RTFValue::Pointer_t pValue)
rAttributes.set(nId, pValue);
}
}
- else if (aStates.top().nBorderState == BORDER_CHARACTER)
+ else if (aStates.top().nBorderState == RTFBorderState::CHARACTER)
{
RTFValue::Pointer_t pPointer = aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_RPrBase_bdr);
if (pPointer.get())
@@ -139,11 +139,11 @@ lcl_putBorderProperty(RTFStack& aStates, Id nId, RTFValue::Pointer_t pValue)
}
}
// Attributes of the last border type
- else if (aStates.top().nBorderState == BORDER_PARAGRAPH)
+ else if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH)
pAttributes = &lcl_getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr);
- else if (aStates.top().nBorderState == BORDER_CELL)
+ else if (aStates.top().nBorderState == RTFBorderState::CELL)
pAttributes = &lcl_getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders);
- else if (aStates.top().nBorderState == BORDER_PAGE)
+ else if (aStates.top().nBorderState == RTFBorderState::PAGE)
pAttributes = &lcl_getLastAttributes(aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders);
if (pAttributes)
pAttributes->set(nId, pValue);
@@ -2992,7 +2992,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
auto pValue = std::make_shared<RTFValue>(aAttributes);
for (int i = 0; i < 4; i++)
m_aStates.top().aParagraphSprms.set(lcl_getParagraphBorder(i), pValue);
- m_aStates.top().nBorderState = BORDER_PARAGRAPH_BOX;
+ m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX;
}
break;
case RTF_LTRSECT:
@@ -3058,7 +3058,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
}
lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue);
- m_aStates.top().nBorderState = BORDER_CELL;
+ m_aStates.top().nBorderState = RTFBorderState::CELL;
}
break;
case RTF_PGBRDRT:
@@ -3087,7 +3087,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
}
lcl_putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue);
- m_aStates.top().nBorderState = BORDER_PAGE;
+ m_aStates.top().nBorderState = RTFBorderState::PAGE;
}
break;
case RTF_BRDRT:
@@ -3116,7 +3116,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
}
lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue);
- m_aStates.top().nBorderState = BORDER_PARAGRAPH;
+ m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH;
}
break;
case RTF_CHBRDR:
@@ -3124,7 +3124,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
RTFSprms aAttributes;
auto pValue = std::make_shared<RTFValue>(aAttributes);
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue);
- m_aStates.top().nBorderState = BORDER_CHARACTER;
+ m_aStates.top().nBorderState = RTFBorderState::CHARACTER;
}
break;
case RTF_CLMGF:
@@ -6100,7 +6100,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
nInternalState(RTFInternalState::NORMAL),
nDestinationState(DESTINATION_NORMAL),
eFieldStatus(RTFFieldStatus::NONE),
- nBorderState(BORDER_NONE),
+ nBorderState(RTFBorderState::NONE),
aTableSprms(),
aTableAttributes(),
aCharacterSprms(),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 13406677aded..f308f08178e3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -34,14 +34,14 @@ namespace writerfilter
{
namespace rtftok
{
-enum RTFBorderState
+enum class RTFBorderState
{
- BORDER_NONE,
- BORDER_PARAGRAPH,
- BORDER_PARAGRAPH_BOX,
- BORDER_CELL,
- BORDER_PAGE,
- BORDER_CHARACTER
+ NONE,
+ PARAGRAPH,
+ PARAGRAPH_BOX,
+ CELL,
+ PAGE,
+ CHARACTER
};
/// Minimalistic buffer of elements for nested cells.