Kaydet (Commit) c395a894 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: turn RTFDestinationState into a C++11 scoped enumeration

Change-Id: I5d3c0ab5869f415b3a435e5f931613a188e43173
üst 645030d0
...@@ -1856,51 +1856,51 @@ bool RTFSymbol::operator<(const RTFSymbol& rOther) const ...@@ -1856,51 +1856,51 @@ bool RTFSymbol::operator<(const RTFSymbol& rOther) const
RTFMathSymbol aRTFMathControlWords[] = RTFMathSymbol aRTFMathControlWords[] =
{ {
// eKeyword nToken eDestination // eKeyword nToken eDestination
{RTF_MOMATH, M_TOKEN(oMath), DESTINATION_MOMATH}, {RTF_MOMATH, M_TOKEN(oMath), Destination::MOMATH},
{RTF_MF, M_TOKEN(f), DESTINATION_MF}, {RTF_MF, M_TOKEN(f), Destination::MF},
{RTF_MFPR, M_TOKEN(fPr), DESTINATION_MFPR}, {RTF_MFPR, M_TOKEN(fPr), Destination::MFPR},
{RTF_MCTRLPR, M_TOKEN(ctrlPr), DESTINATION_MCTRLPR}, {RTF_MCTRLPR, M_TOKEN(ctrlPr), Destination::MCTRLPR},
{RTF_MNUM, M_TOKEN(num), DESTINATION_MNUM}, {RTF_MNUM, M_TOKEN(num), Destination::MNUM},
{RTF_MDEN, M_TOKEN(den), DESTINATION_MDEN}, {RTF_MDEN, M_TOKEN(den), Destination::MDEN},
{RTF_MACC, M_TOKEN(acc), DESTINATION_MACC}, {RTF_MACC, M_TOKEN(acc), Destination::MACC},
{RTF_MACCPR, M_TOKEN(accPr), DESTINATION_MACCPR}, {RTF_MACCPR, M_TOKEN(accPr), Destination::MACCPR},
{RTF_MBAR, M_TOKEN(bar), DESTINATION_MBAR}, {RTF_MBAR, M_TOKEN(bar), Destination::MBAR},
{RTF_MBARPR, M_TOKEN(barPr), DESTINATION_MBARPR}, {RTF_MBARPR, M_TOKEN(barPr), Destination::MBARPR},
{RTF_ME, M_TOKEN(e), DESTINATION_ME}, {RTF_ME, M_TOKEN(e), Destination::ME},
{RTF_MD, M_TOKEN(d), DESTINATION_MD}, {RTF_MD, M_TOKEN(d), Destination::MD},
{RTF_MDPR, M_TOKEN(dPr), DESTINATION_MDPR}, {RTF_MDPR, M_TOKEN(dPr), Destination::MDPR},
{RTF_MFUNC, M_TOKEN(func), DESTINATION_MFUNC}, {RTF_MFUNC, M_TOKEN(func), Destination::MFUNC},
{RTF_MFUNCPR, M_TOKEN(funcPr), DESTINATION_MFUNCPR}, {RTF_MFUNCPR, M_TOKEN(funcPr), Destination::MFUNCPR},
{RTF_MFNAME, M_TOKEN(fName), DESTINATION_MFNAME}, {RTF_MFNAME, M_TOKEN(fName), Destination::MFNAME},
{RTF_MLIMLOW, M_TOKEN(limLow), DESTINATION_MLIMLOW}, {RTF_MLIMLOW, M_TOKEN(limLow), Destination::MLIMLOW},
{RTF_MLIMLOWPR, M_TOKEN(limLowPr), DESTINATION_MLIMLOWPR}, {RTF_MLIMLOWPR, M_TOKEN(limLowPr), Destination::MLIMLOWPR},
{RTF_MLIM, M_TOKEN(lim), DESTINATION_MLIM}, {RTF_MLIM, M_TOKEN(lim), Destination::MLIM},
{RTF_MM, M_TOKEN(m), DESTINATION_MM}, {RTF_MM, M_TOKEN(m), Destination::MM},
{RTF_MMPR, M_TOKEN(mPr), DESTINATION_MMPR}, {RTF_MMPR, M_TOKEN(mPr), Destination::MMPR},
{RTF_MMR, M_TOKEN(mr), DESTINATION_MMR}, {RTF_MMR, M_TOKEN(mr), Destination::MMR},
{RTF_MNARY, M_TOKEN(nary), DESTINATION_MNARY}, {RTF_MNARY, M_TOKEN(nary), Destination::MNARY},
{RTF_MNARYPR, M_TOKEN(naryPr), DESTINATION_MNARYPR}, {RTF_MNARYPR, M_TOKEN(naryPr), Destination::MNARYPR},
{RTF_MSUB, M_TOKEN(sub), DESTINATION_MSUB}, {RTF_MSUB, M_TOKEN(sub), Destination::MSUB},
{RTF_MSUP, M_TOKEN(sup), DESTINATION_MSUP}, {RTF_MSUP, M_TOKEN(sup), Destination::MSUP},
{RTF_MLIMUPP, M_TOKEN(limUpp), DESTINATION_MLIMUPP}, {RTF_MLIMUPP, M_TOKEN(limUpp), Destination::MLIMUPP},
{RTF_MLIMUPPPR, M_TOKEN(limUppPr), DESTINATION_MLIMUPPPR}, {RTF_MLIMUPPPR, M_TOKEN(limUppPr), Destination::MLIMUPPPR},
{RTF_MGROUPCHR, M_TOKEN(groupChr), DESTINATION_MGROUPCHR}, {RTF_MGROUPCHR, M_TOKEN(groupChr), Destination::MGROUPCHR},
{RTF_MGROUPCHRPR, M_TOKEN(groupChrPr), DESTINATION_MGROUPCHRPR}, {RTF_MGROUPCHRPR, M_TOKEN(groupChrPr), Destination::MGROUPCHRPR},
{RTF_MBORDERBOX, M_TOKEN(borderBox), DESTINATION_MBORDERBOX}, {RTF_MBORDERBOX, M_TOKEN(borderBox), Destination::MBORDERBOX},
{RTF_MBORDERBOXPR, M_TOKEN(borderBoxPr), DESTINATION_MBORDERBOXPR}, {RTF_MBORDERBOXPR, M_TOKEN(borderBoxPr), Destination::MBORDERBOXPR},
{RTF_MRAD, M_TOKEN(rad), DESTINATION_MRAD}, {RTF_MRAD, M_TOKEN(rad), Destination::MRAD},
{RTF_MRADPR, M_TOKEN(radPr), DESTINATION_MRADPR}, {RTF_MRADPR, M_TOKEN(radPr), Destination::MRADPR},
{RTF_MDEG, M_TOKEN(deg), DESTINATION_MDEG}, {RTF_MDEG, M_TOKEN(deg), Destination::MDEG},
{RTF_MSSUB, M_TOKEN(sSub), DESTINATION_MSSUB}, {RTF_MSSUB, M_TOKEN(sSub), Destination::MSSUB},
{RTF_MSSUBPR, M_TOKEN(sSubPr), DESTINATION_MSSUBPR}, {RTF_MSSUBPR, M_TOKEN(sSubPr), Destination::MSSUBPR},
{RTF_MSSUP, M_TOKEN(sSup), DESTINATION_MSSUP}, {RTF_MSSUP, M_TOKEN(sSup), Destination::MSSUP},
{RTF_MSSUPPR, M_TOKEN(sSupPr), DESTINATION_MSSUPPR}, {RTF_MSSUPPR, M_TOKEN(sSupPr), Destination::MSSUPPR},
{RTF_MSSUBSUP, M_TOKEN(sSubSup), DESTINATION_MSSUBSUP}, {RTF_MSSUBSUP, M_TOKEN(sSubSup), Destination::MSSUBSUP},
{RTF_MSSUBSUPPR, M_TOKEN(sSubSupPr), DESTINATION_MSSUBSUPPR}, {RTF_MSSUBSUPPR, M_TOKEN(sSubSupPr), Destination::MSSUBSUPPR},
{RTF_MSPRE, M_TOKEN(sPre), DESTINATION_MSPRE}, {RTF_MSPRE, M_TOKEN(sPre), Destination::MSPRE},
{RTF_MSPREPR, M_TOKEN(sPrePr), DESTINATION_MSPREPR}, {RTF_MSPREPR, M_TOKEN(sPrePr), Destination::MSPREPR},
{RTF_MBOX, M_TOKEN(box), DESTINATION_MBOX}, {RTF_MBOX, M_TOKEN(box), Destination::MBOX},
{RTF_MEQARR, M_TOKEN(eqArr), DESTINATION_MEQARR}, {RTF_MEQARR, M_TOKEN(eqArr), Destination::MEQARR},
}; };
int nRTFMathControlWords = SAL_N_ELEMENTS(aRTFMathControlWords); int nRTFMathControlWords = SAL_N_ELEMENTS(aRTFMathControlWords);
......
...@@ -15,142 +15,146 @@ namespace writerfilter ...@@ -15,142 +15,146 @@ namespace writerfilter
namespace rtftok namespace rtftok
{ {
// Note that this is not a 1:1 mapping between destination control /**
// words, e.g. RTF_PICT gets mapped to DESTINATION_PICT or * An RTF destination state is the last open destination control word.
// DESTINATION_SHAPEPROPERTYVALUEPICT, etc. *
enum RTFDestinationState * Note that this is not a 1:1 mapping between destination control
* words, e.g. RTF_PICT gets mapped to Destination::PICT or
* Destination::SHAPEPROPERTYVALUEPICT.
*/
enum class Destination
{ {
DESTINATION_NORMAL, NORMAL,
DESTINATION_SKIP, SKIP,
DESTINATION_FONTTABLE, FONTTABLE,
DESTINATION_FONTENTRY, FONTENTRY,
DESTINATION_COLORTABLE, COLORTABLE,
DESTINATION_STYLESHEET, STYLESHEET,
DESTINATION_STYLEENTRY, STYLEENTRY,
DESTINATION_FIELD, FIELD,
DESTINATION_FIELDINSTRUCTION, FIELDINSTRUCTION,
DESTINATION_FIELDRESULT, FIELDRESULT,
DESTINATION_LISTTABLE, LISTTABLE,
DESTINATION_LISTPICTURE, LISTPICTURE,
DESTINATION_LISTENTRY, LISTENTRY,
DESTINATION_LISTNAME, LISTNAME,
DESTINATION_LISTOVERRIDETABLE, LISTOVERRIDETABLE,
DESTINATION_LISTOVERRIDEENTRY, LISTOVERRIDEENTRY,
DESTINATION_LISTLEVEL, LISTLEVEL,
DESTINATION_LEVELTEXT, LEVELTEXT,
DESTINATION_LEVELNUMBERS, LEVELNUMBERS,
DESTINATION_SHPPICT, SHPPICT,
DESTINATION_PICT, PICT,
DESTINATION_PICPROP, PICPROP,
DESTINATION_SHAPEPROPERTY, SHAPEPROPERTY,
DESTINATION_SHAPEPROPERTYNAME, SHAPEPROPERTYNAME,
DESTINATION_SHAPEPROPERTYVALUE, SHAPEPROPERTYVALUE,
DESTINATION_SHAPE, SHAPE,
DESTINATION_SHAPEINSTRUCTION, SHAPEINSTRUCTION,
DESTINATION_SHAPEPROPERTYVALUEPICT, SHAPEPROPERTYVALUEPICT,
DESTINATION_NESTEDTABLEPROPERTIES, NESTEDTABLEPROPERTIES,
DESTINATION_FOOTNOTE, FOOTNOTE,
DESTINATION_BOOKMARKSTART, BOOKMARKSTART,
DESTINATION_BOOKMARKEND, BOOKMARKEND,
DESTINATION_REVISIONTABLE, REVISIONTABLE,
DESTINATION_REVISIONENTRY, REVISIONENTRY,
DESTINATION_SHAPETEXT, SHAPETEXT,
DESTINATION_FORMFIELD, FORMFIELD,
DESTINATION_FORMFIELDNAME, FORMFIELDNAME,
DESTINATION_FORMFIELDLIST, FORMFIELDLIST,
DESTINATION_DATAFIELD, DATAFIELD,
DESTINATION_INFO, INFO,
DESTINATION_CREATIONTIME, CREATIONTIME,
DESTINATION_REVISIONTIME, REVISIONTIME,
DESTINATION_PRINTTIME, PRINTTIME,
DESTINATION_AUTHOR, AUTHOR,
DESTINATION_KEYWORDS, KEYWORDS,
DESTINATION_OPERATOR, OPERATOR,
DESTINATION_COMPANY, COMPANY,
DESTINATION_COMMENT, COMMENT,
DESTINATION_OBJECT, OBJECT,
DESTINATION_OBJDATA, OBJDATA,
DESTINATION_RESULT, RESULT,
DESTINATION_ANNOTATIONDATE, ANNOTATIONDATE,
DESTINATION_ANNOTATIONAUTHOR, ANNOTATIONAUTHOR,
DESTINATION_ANNOTATIONREFERENCE, ANNOTATIONREFERENCE,
DESTINATION_FALT, FALT,
DESTINATION_FLYMAINCONTENT, FLYMAINCONTENT,
DESTINATION_DRAWINGOBJECT, DRAWINGOBJECT,
DESTINATION_PARAGRAPHNUMBERING, PARAGRAPHNUMBERING,
DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE, PARAGRAPHNUMBERING_TEXTBEFORE,
DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER, PARAGRAPHNUMBERING_TEXTAFTER,
DESTINATION_TITLE, TITLE,
DESTINATION_SUBJECT, SUBJECT,
DESTINATION_DOCCOMM, DOCCOMM,
DESTINATION_ATNID, ATNID,
DESTINATION_ANNOTATIONREFERENCESTART, ANNOTATIONREFERENCESTART,
DESTINATION_ANNOTATIONREFERENCEEND, ANNOTATIONREFERENCEEND,
DESTINATION_MOMATH, MOMATH,
DESTINATION_MR, MR,
DESTINATION_MF, MF,
DESTINATION_MFPR, MFPR,
DESTINATION_MCTRLPR, MCTRLPR,
DESTINATION_MNUM, MNUM,
DESTINATION_MDEN, MDEN,
DESTINATION_MACC, MACC,
DESTINATION_MACCPR, MACCPR,
DESTINATION_MCHR, MCHR,
DESTINATION_MPOS, MPOS,
DESTINATION_MVERTJC, MVERTJC,
DESTINATION_MSTRIKEH, MSTRIKEH,
DESTINATION_MDEGHIDE, MDEGHIDE,
DESTINATION_ME, ME,
DESTINATION_MBAR, MBAR,
DESTINATION_MBARPR, MBARPR,
DESTINATION_MD, MD,
DESTINATION_MDPR, MDPR,
DESTINATION_MBEGCHR, MBEGCHR,
DESTINATION_MSEPCHR, MSEPCHR,
DESTINATION_MENDCHR, MENDCHR,
DESTINATION_MFUNC, MFUNC,
DESTINATION_MFUNCPR, MFUNCPR,
DESTINATION_MFNAME, MFNAME,
DESTINATION_MLIMLOW, MLIMLOW,
DESTINATION_MLIMLOWPR, MLIMLOWPR,
DESTINATION_MLIM, MLIM,
DESTINATION_MM, MM,
DESTINATION_MMPR, MMPR,
DESTINATION_MMR, MMR,
DESTINATION_MNARY, MNARY,
DESTINATION_MNARYPR, MNARYPR,
DESTINATION_MSUB, MSUB,
DESTINATION_MSUP, MSUP,
DESTINATION_MSUBHIDE, MSUBHIDE,
DESTINATION_MSUPHIDE, MSUPHIDE,
DESTINATION_MLIMUPP, MLIMUPP,
DESTINATION_MLIMUPPPR, MLIMUPPPR,
DESTINATION_MGROUPCHR, MGROUPCHR,
DESTINATION_MGROUPCHRPR, MGROUPCHRPR,
DESTINATION_MBORDERBOX, MBORDERBOX,
DESTINATION_MBORDERBOXPR, MBORDERBOXPR,
DESTINATION_MRAD, MRAD,
DESTINATION_MRADPR, MRADPR,
DESTINATION_MDEG, MDEG,
DESTINATION_MSSUB, MSSUB,
DESTINATION_MSSUBPR, MSSUBPR,
DESTINATION_MSSUP, MSSUP,
DESTINATION_MSSUPPR, MSSUPPR,
DESTINATION_MSSUBSUP, MSSUBSUP,
DESTINATION_MSSUBSUPPR, MSSUBSUPPR,
DESTINATION_MSPRE, MSPRE,
DESTINATION_MSPREPR, MSPREPR,
DESTINATION_MTYPE, MTYPE,
DESTINATION_MGROW, MGROW,
DESTINATION_MBOX, MBOX,
DESTINATION_MEQARR, MEQARR,
DESTINATION_UPR, UPR,
DESTINATION_LFOLEVEL, LFOLEVEL,
DESTINATION_BACKGROUND, BACKGROUND,
DESTINATION_SHAPEGROUP, SHAPEGROUP,
DESTINATION_FOOTNOTESEPARATOR, FOOTNOTESEPARATOR,
DESTINATION_INDEXENTRY, INDEXENTRY,
DESTINATION_TOCENTRY, TOCENTRY,
}; };
enum RTFKeyword enum RTFKeyword
...@@ -2001,7 +2005,7 @@ struct RTFMathSymbol ...@@ -2001,7 +2005,7 @@ struct RTFMathSymbol
{ {
RTFKeyword eKeyword; RTFKeyword eKeyword;
int nToken; ///< This is the OOXML token equivalent. int nToken; ///< This is the OOXML token equivalent.
RTFDestinationState eDestination; Destination eDestination;
bool operator<(const RTFMathSymbol& rOther) const; bool operator<(const RTFMathSymbol& rOther) const;
}; };
......
...@@ -213,7 +213,7 @@ public: ...@@ -213,7 +213,7 @@ public:
RTFDocumentImpl* m_pDocumentImpl; RTFDocumentImpl* m_pDocumentImpl;
RTFInternalState nInternalState; RTFInternalState nInternalState;
RTFDestinationState nDestinationState; Destination eDestination;
RTFFieldStatus eFieldStatus; RTFFieldStatus eFieldStatus;
RTFBorderState nBorderState; RTFBorderState nBorderState;
// font table, stylesheet table // font table, stylesheet table
...@@ -344,8 +344,8 @@ public: ...@@ -344,8 +344,8 @@ public:
virtual RTFError resolveChars(char ch) SAL_OVERRIDE; virtual RTFError resolveChars(char ch) SAL_OVERRIDE;
virtual RTFError pushState() SAL_OVERRIDE; virtual RTFError pushState() SAL_OVERRIDE;
virtual RTFError popState() SAL_OVERRIDE; virtual RTFError popState() SAL_OVERRIDE;
virtual RTFDestinationState getDestinationState() SAL_OVERRIDE; virtual Destination getDestination() SAL_OVERRIDE;
virtual void setDestinationState(RTFDestinationState nDestinationState) SAL_OVERRIDE; virtual void setDestination(Destination eDestination) SAL_OVERRIDE;
virtual RTFInternalState getInternalState() SAL_OVERRIDE; virtual RTFInternalState getInternalState() SAL_OVERRIDE;
virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE; virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE;
virtual bool getSkipUnknown() SAL_OVERRIDE; virtual bool getSkipUnknown() SAL_OVERRIDE;
......
...@@ -55,8 +55,8 @@ public: ...@@ -55,8 +55,8 @@ public:
virtual RTFError pushState() = 0; virtual RTFError pushState() = 0;
virtual RTFError popState() = 0; virtual RTFError popState() = 0;
virtual RTFDestinationState getDestinationState() = 0; virtual Destination getDestination() = 0;
virtual void setDestinationState(RTFDestinationState nDestinationState) = 0; virtual void setDestination(Destination eDestination) = 0;
virtual RTFInternalState getInternalState() = 0; virtual RTFInternalState getInternalState() = 0;
virtual void setInternalState(RTFInternalState nInternalState) = 0; virtual void setInternalState(RTFInternalState nInternalState) = 0;
virtual bool getSkipUnknown() = 0; virtual bool getSkipUnknown() = 0;
......
...@@ -81,12 +81,12 @@ RTFError RTFLookahead::popState() ...@@ -81,12 +81,12 @@ RTFError RTFLookahead::popState()
return RTFError::OK; return RTFError::OK;
} }
RTFDestinationState RTFLookahead::getDestinationState() Destination RTFLookahead::getDestination()
{ {
return DESTINATION_NORMAL; return Destination::NORMAL;
} }
void RTFLookahead::setDestinationState(RTFDestinationState /*nDestinationState*/) void RTFLookahead::setDestination(Destination /*eDestination*/)
{ {
} }
......
...@@ -37,8 +37,8 @@ public: ...@@ -37,8 +37,8 @@ public:
virtual RTFError resolveChars(char ch) SAL_OVERRIDE; virtual RTFError resolveChars(char ch) SAL_OVERRIDE;
virtual RTFError pushState() SAL_OVERRIDE; virtual RTFError pushState() SAL_OVERRIDE;
virtual RTFError popState() SAL_OVERRIDE; virtual RTFError popState() SAL_OVERRIDE;
virtual RTFDestinationState getDestinationState() SAL_OVERRIDE; virtual Destination getDestination() SAL_OVERRIDE;
virtual void setDestinationState(RTFDestinationState nDestinationState) SAL_OVERRIDE; virtual void setDestination(Destination eDestination) SAL_OVERRIDE;
virtual RTFInternalState getInternalState() SAL_OVERRIDE; virtual RTFInternalState getInternalState() SAL_OVERRIDE;
virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE; virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE;
virtual bool getSkipUnknown() SAL_OVERRIDE; virtual bool getSkipUnknown() SAL_OVERRIDE;
......
...@@ -30,7 +30,7 @@ RTFSkipDestination::~RTFSkipDestination() ...@@ -30,7 +30,7 @@ RTFSkipDestination::~RTFSkipDestination()
if (!m_bParsed) if (!m_bParsed)
{ {
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": skipping destination"); SAL_INFO("writerfilter", OSL_THIS_FUNC << ": skipping destination");
m_rImport.setDestinationState(DESTINATION_SKIP); m_rImport.setDestination(Destination::SKIP);
} }
m_rImport.setSkipUnknown(false); m_rImport.setSkipUnknown(false);
} }
......
...@@ -282,7 +282,7 @@ bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol) ...@@ -282,7 +282,7 @@ bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol)
RTFError RTFTokenizer::dispatchKeyword(OString& rKeyword, bool bParam, int nParam) RTFError RTFTokenizer::dispatchKeyword(OString& rKeyword, bool bParam, int nParam)
{ {
if (m_rImport.getDestinationState() == DESTINATION_SKIP) if (m_rImport.getDestination() == Destination::SKIP)
return RTFError::OK; return RTFError::OK;
SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": keyword '\\" << rKeyword.getStr() << SAL_INFO("writerfilter.rtf", OSL_THIS_FUNC << ": keyword '\\" << rKeyword.getStr() <<
"' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'"); "' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment