convert HTMLScriptLanguage to scoped enum

Change-Id: If87863b520da704410a6ad261330bbde7ef8008c
This commit is contained in:
Noel Grandin
2017-03-06 09:30:34 +02:00
parent 24ae6e8667
commit 1cbef3eb08
4 changed files with 13 additions and 13 deletions

View File

@@ -65,11 +65,11 @@ enum HTMLInputType
HTML_IT_BUTTON = 0x0c HTML_IT_BUTTON = 0x0c
}; };
enum HTMLScriptLanguage enum class HTMLScriptLanguage
{ {
HTML_SL_STARBASIC, StarBasic,
HTML_SL_JAVASCRIPT, JavaScript,
HTML_SL_UNKNOWN Unknown
}; };
template<typename EnumT> template<typename EnumT>

View File

@@ -28,10 +28,10 @@
// Table for converting option values into strings // Table for converting option values into strings
static HTMLOptionEnum<HTMLScriptLanguage> const aScriptLangOptEnums[] = static HTMLOptionEnum<HTMLScriptLanguage> const aScriptLangOptEnums[] =
{ {
{ OOO_STRING_SVTOOLS_HTML_LG_starbasic, HTML_SL_STARBASIC }, { OOO_STRING_SVTOOLS_HTML_LG_starbasic, HTMLScriptLanguage::StarBasic },
{ OOO_STRING_SVTOOLS_HTML_LG_javascript, HTML_SL_JAVASCRIPT }, { OOO_STRING_SVTOOLS_HTML_LG_javascript, HTMLScriptLanguage::JavaScript },
{ OOO_STRING_SVTOOLS_HTML_LG_javascript11, HTML_SL_JAVASCRIPT }, { OOO_STRING_SVTOOLS_HTML_LG_javascript11, HTMLScriptLanguage::JavaScript },
{ OOO_STRING_SVTOOLS_HTML_LG_livescript, HTML_SL_JAVASCRIPT }, { OOO_STRING_SVTOOLS_HTML_LG_livescript, HTMLScriptLanguage::JavaScript },
{ nullptr, (HTMLScriptLanguage)0 } { nullptr, (HTMLScriptLanguage)0 }
}; };
@@ -44,7 +44,7 @@ void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBas
const HTMLOptions& aScriptOptions = GetOptions(); const HTMLOptions& aScriptOptions = GetOptions();
rLangString.clear(); rLangString.clear();
rLang = HTML_SL_JAVASCRIPT; rLang = HTMLScriptLanguage::JavaScript;
rSrc.clear(); rSrc.clear();
rLibrary.clear(); rLibrary.clear();
rModule.clear(); rModule.clear();
@@ -61,7 +61,7 @@ void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBas
if( aOption.GetEnum( nLang, aScriptLangOptEnums ) ) if( aOption.GetEnum( nLang, aScriptLangOptEnums ) )
rLang = (HTMLScriptLanguage)nLang; rLang = (HTMLScriptLanguage)nLang;
else else
rLang = HTML_SL_UNKNOWN; rLang = HTMLScriptLanguage::Unknown;
} }
break; break;

View File

@@ -77,7 +77,7 @@ void SwHTMLParser::EndScript()
switch( m_eScriptLang ) switch( m_eScriptLang )
{ {
case HTML_SL_STARBASIC: case HTMLScriptLanguage::StarBasic:
bInsIntoBasic = true; bInsIntoBasic = true;
break; break;
default: default:
@@ -184,7 +184,7 @@ void SwHTMLParser::AddScriptSource()
{ {
// We'll just remember a few strings here // We'll just remember a few strings here
if( aToken.getLength() > 2 && if( aToken.getLength() > 2 &&
(HTML_SL_STARBASIC==m_eScriptLang && aToken[ 0 ] == '\'') ) (HTMLScriptLanguage::StarBasic==m_eScriptLang && aToken[ 0 ] == '\'') )
{ {
sal_Int32 nPos = -1; sal_Int32 nPos = -1;
if( m_aBasicLib.isEmpty() ) if( m_aBasicLib.isEmpty() )

View File

@@ -301,7 +301,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn,
m_nEventId = nullptr; m_nEventId = nullptr;
m_bUpperSpace = m_bViewCreated = m_bChkJumpMark = false; m_bUpperSpace = m_bViewCreated = m_bChkJumpMark = false;
m_eScriptLang = HTML_SL_UNKNOWN; m_eScriptLang = HTMLScriptLanguage::Unknown;
rCursor.DeleteMark(); rCursor.DeleteMark();
m_pPam = &rCursor; // re-use existing cursor: avoids spurious ~SwIndexReg assert m_pPam = &rCursor; // re-use existing cursor: avoids spurious ~SwIndexReg assert