loplugin:unusedenumconstants in oox

Convert FragmentHandler2::MCE_STATE to scoped enum and drop MCE_UNUSED
constant

Change-Id: Id0b3a81e61d77af5d3837527b008e196835f57cd
Reviewed-on: https://gerrit.libreoffice.org/33954
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-02-06 11:42:25 +02:00
parent 3ea39bda0e
commit fde0b8df30
4 changed files with 13 additions and 11 deletions

View File

@@ -91,12 +91,15 @@ for d in definitionSet:
"vcl/source/fontsubset/cff.cxx", "vcl/source/fontsubset/cff.cxx",
"include/vcl/settings.hxx", # stored in a setting, can't remove it without potentially triggering UBSAN "include/vcl/settings.hxx", # stored in a setting, can't remove it without potentially triggering UBSAN
"basic/source/inc/opcodes.hxx", # can't touch this without breaking unit tests, not sure why "basic/source/inc/opcodes.hxx", # can't touch this without breaking unit tests, not sure why
"include/unotools/securityoptions.hxx", # comes from the UI
# unit test code # unit test code
"cppu/source/uno/check.cxx", "cppu/source/uno/check.cxx",
# general weird nonsense going on # general weird nonsense going on
"framework/inc/helper/mischelper.hxx" "framework/inc/helper/mischelper.hxx"
"include/sfx2/shell.hxx", "include/sfx2/shell.hxx",
"framework/inc/helper/mischelper.hxx", "framework/inc/helper/mischelper.hxx",
"include/svtools/htmltokn.h",
"include/sfx2/shell.hxx",
# Windows or OSX only # Windows or OSX only
"include/canvas/rendering/icolorbuffer.hxx", "include/canvas/rendering/icolorbuffer.hxx",
"include/vcl/commandevent.hxx", "include/vcl/commandevent.hxx",

View File

@@ -52,11 +52,10 @@ class XmlFilterBase;
class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
{ {
protected: protected:
enum MCE_STATE enum class MCE_STATE
{ {
MCE_UNUSED, Started,
MCE_STARTED, FoundChoice
MCE_FOUND_CHOICE
}; };
::std::vector<MCE_STATE> aMceState; ::std::vector<MCE_STATE> aMceState;

View File

@@ -58,12 +58,12 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
switch( nElement ) switch( nElement )
{ {
case MCE_TOKEN( AlternateContent ): case MCE_TOKEN( AlternateContent ):
aMceState.push_back( MCE_STARTED ); aMceState.push_back( MCE_STATE::Started );
break; break;
case MCE_TOKEN( Choice ): case MCE_TOKEN( Choice ):
{ {
if (aMceState.empty() || aMceState.back() != MCE_STARTED) if (aMceState.empty() || aMceState.back() != MCE_STATE::Started)
return false; return false;
OUString aRequires = rAttribs.getString( (XML_Requires ), "none" ); OUString aRequires = rAttribs.getString( (XML_Requires ), "none" );
@@ -80,14 +80,14 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
}; };
if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end()) if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end())
aMceState.back() = MCE_FOUND_CHOICE; aMceState.back() = MCE_STATE::FoundChoice;
else else
return false; return false;
} }
break; break;
case MCE_TOKEN( Fallback ): case MCE_TOKEN( Fallback ):
if( !aMceState.empty() && aMceState.back() == MCE_STARTED ) if( !aMceState.empty() && aMceState.back() == MCE_STATE::Started )
break; break;
return false; return false;
default: default:

View File

@@ -466,17 +466,17 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const
case XLS_TOKEN( oleObjects ): case XLS_TOKEN( oleObjects ):
if ( getCurrentElement() == XLS_TOKEN( controls ) ) if ( getCurrentElement() == XLS_TOKEN( controls ) )
{ {
if( aMceState.empty() || aMceState.back() == MCE_STARTED ) if( aMceState.empty() || aMceState.back() == MCE_STATE::Started )
{ {
if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs ); if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs );
else else
importControl( rAttribs ); importControl( rAttribs );
} }
else if ( !aMceState.empty() && aMceState.back() == MCE_FOUND_CHOICE ) else if ( !aMceState.empty() && aMceState.back() == MCE_STATE::FoundChoice )
{ {
// reset the handling within 'Choice' // reset the handling within 'Choice'
// this will force attempted handling in Fallback // this will force attempted handling in Fallback
aMceState.back() = MCE_STARTED; aMceState.back() = MCE_STATE::Started;
} }
} }
break; break;