convert SWHTML_OPTTYPE #defines to enum

Change-Id: I847c7c116984817c7d66d44431db0601f0a27209
This commit is contained in:
Noel Grandin 2014-10-10 08:55:04 +02:00
parent 8ab1e7cdec
commit f453dc0327
4 changed files with 32 additions and 30 deletions

View file

@ -22,10 +22,12 @@
#include <config_features.h>
#define SWHTML_OPTTYPE_IGNORE 0
#define SWHTML_OPTTYPE_TAG 1
#define SWHTML_OPTTYPE_PARAM 2
#define SWHTML_OPTTYPE_SIZE 3
enum class SwHtmlOptType {
IGNORE = 0,
TAG = 1,
PARAM = 2,
SIZE = 3
};
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@ -49,7 +51,7 @@ class SwApplet_Impl
OUString sAlt;
public:
static sal_uInt16 GetOptionType( const OUString& rName, bool bApplet );
static SwHtmlOptType GetOptionType( const OUString& rName, bool bApplet );
SwApplet_Impl( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
SwApplet_Impl( SfxItemSet& rSet ): aItemSet ( rSet) {}
~SwApplet_Impl();

View file

@ -38,9 +38,9 @@ static char const sHTML_O_Object[] = "OBJECT";
}
sal_uInt16 SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
SwHtmlOptType SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
{
sal_uInt16 nType = bApplet ? SWHTML_OPTTYPE_PARAM : SWHTML_OPTTYPE_TAG;
SwHtmlOptType nType = bApplet ? SwHtmlOptType::PARAM : SwHtmlOptType::TAG;
switch( rName.toChar() )
{
@ -48,67 +48,67 @@ sal_uInt16 SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
case 'a':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_align ) ||
rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_alt ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
else if( bApplet &&
(rName.equalsIgnoreAsciiCaseAscii( sHTML_O_archive ) ||
rName.equalsIgnoreAsciiCaseAscii( sHTML_O_Archives )) )
nType = SWHTML_OPTTYPE_TAG;
nType = SwHtmlOptType::TAG;
break;
case 'C':
case 'c':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_class ) ||
(bApplet && (rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_code ) ||
rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_codebase ))) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'H':
case 'h':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_height ) )
nType = SWHTML_OPTTYPE_SIZE;
nType = SwHtmlOptType::SIZE;
else if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_hspace ) ||
(!bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SW_HTML_O_Hidden )) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'I':
case 'i':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_id ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'M':
case 'm':
if( bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_mayscript ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'N':
case 'n':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_name ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'O':
case 'o':
if( bApplet && rName.equalsIgnoreAsciiCaseAscii( sHTML_O_Object ) )
nType = SWHTML_OPTTYPE_TAG;
nType = SwHtmlOptType::TAG;
break;
case 'S':
case 's':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_style ) ||
(!bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_src )) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'T':
case 't':
if( !bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_type ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'V':
case 'v':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_vspace ) )
nType = SWHTML_OPTTYPE_IGNORE;
nType = SwHtmlOptType::IGNORE;
break;
case 'W':
case 'w':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_width ) )
nType = SWHTML_OPTTYPE_SIZE;
nType = SwHtmlOptType::SIZE;
break;
}

View file

@ -1164,8 +1164,8 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
{
const SvCommand& rCommand = aCommands[ --i ];
const OUString& rName = rCommand.GetCommand();
sal_uInt16 nType = SwApplet_Impl::GetOptionType( rName, true );
if( SWHTML_OPTTYPE_TAG == nType )
SwHtmlOptType nType = SwApplet_Impl::GetOptionType( rName, true );
if( SwHtmlOptType::TAG == nType )
{
const OUString& rValue = rCommand.GetArgument();
rWrt.Strm().WriteChar( ' ' );
@ -1173,7 +1173,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
rWrt.Strm().WriteCharPtr( "=\"" );
HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ).WriteChar( '\"' );
}
else if( SWHTML_OPTTYPE_PARAM == nType )
else if( SwHtmlOptType::PARAM == nType )
{
aParams.push_back( i );
}
@ -1222,7 +1222,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
const SvCommand& rCommand = aCommands[ i ];
const OUString& rName = rCommand.GetCommand();
if( SwApplet_Impl::GetOptionType( rName, false ) == SWHTML_OPTTYPE_TAG )
if( SwApplet_Impl::GetOptionType( rName, false ) == SwHtmlOptType::TAG )
{
const OUString& rValue = rCommand.GetArgument();
rWrt.Strm().WriteChar( ' ' );

View file

@ -565,8 +565,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
if ( nType2 == SWHTML_OPTTYPE_TAG)
const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
if ( nType2 == SwHtmlOptType::TAG)
{
OUString aStr2;
aProp.Value >>= aStr2;
@ -660,8 +660,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
if (SWHTML_OPTTYPE_PARAM == nType2 || SWHTML_OPTTYPE_SIZE == nType2 )
const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
if (SwHtmlOptType::PARAM == nType2 || SwHtmlOptType::SIZE == nType2 )
{
OUString aStr;
aProp.Value >>= aStr;
@ -686,8 +686,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, false );
if ( nType2 == SWHTML_OPTTYPE_TAG)
const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, false );
if ( nType2 == SwHtmlOptType::TAG)
{
OUString aStr;
aProp.Value >>= aStr;