convert SbxNameType to scoped enum

and drop unused enumerators

Change-Id: I2b47828b2146fcda335f1dc1c1f61a1139abbe19
This commit is contained in:
Noel Grandin
2017-02-16 13:45:37 +02:00
parent fb4bf69399
commit f1421a3e12
5 changed files with 22 additions and 35 deletions

View File

@@ -764,7 +764,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
SbxVariable* pVar = r.get();
if( pVar )
{
OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES );
OUString aLine = aIndent + " - " + pVar->GetName( SbxNameType::ShortTypes );
OUString aAttrs2;
if( CollectAttrs( pVar, aAttrs2 ) )
{
@@ -801,7 +801,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
SbxVariable* pVar = r.get();
if( pVar )
{
OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES );
OUString aLine = aIndent + " - " + pVar->GetName( SbxNameType::ShortTypes );
OUString aAttrs3;
if( CollectAttrs( pVar, aAttrs3 ) )
{

View File

@@ -232,7 +232,7 @@ void SbxVariable::SetName( const OUString& rName )
const OUString& SbxVariable::GetName( SbxNameType t ) const
{
static const char cSuffixes[] = " %&!#@ $";
if( t == SbxNAME_NONE )
if( t == SbxNameType::NONE )
{
return maName;
}
@@ -247,7 +247,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
OUString aTmp( maName );
// short type? Then fetch it, possible this is 0.
SbxDataType et = GetType();
if( t == SbxNAME_SHORT_TYPES )
if( t == SbxNameType::ShortTypes )
{
if( et <= SbxSTRING )
{
@@ -279,7 +279,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
aTmp += i->aName;
cType = ' ';
// short type? Then fetch it, possible this is 0.
if( t == SbxNAME_SHORT_TYPES )
if( t == SbxNameType::ShortTypes )
{
if( nt <= SbxSTRING )
{
@@ -301,34 +301,18 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
aTmp += "()";
}
// long type?
if( t != SbxNAME_SHORT )
aTmp += GetSbxRes( StringId::As );
if( nt < 32 )
{
aTmp += GetSbxRes( StringId::As );
if( nt < 32 )
{
aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
}
else
{
aTmp += GetSbxRes( StringId::Any );
}
aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
}
else
{
aTmp += GetSbxRes( StringId::Any );
}
}
}
aTmp += ")";
// Long type? Then fetch it
if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
{
aTmp += GetSbxRes( StringId::As );
if( et < 32 )
{
aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + et ) );
}
else
{
aTmp += GetSbxRes( StringId::Any );
}
}
const_cast<SbxVariable*>(this)->aToolString = aTmp;
return aToolString;
}
@@ -699,7 +683,7 @@ void SbxAlias::Notify( SfxBroadcaster&, const SfxHint& rHint )
void SbxVariable::Dump( SvStream& rStrm, bool bFill )
{
OString aBNameStr(OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US));
OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), RTL_TEXTENCODING_ASCII_US));
rStrm.WriteCharPtr( "Variable( " )
.WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(this)).getStr() ).WriteCharPtr( "==" )
.WriteCharPtr( aBNameStr.getStr() );

View File

@@ -114,6 +114,7 @@ for d in definitionSet:
"sd/source/filter/eppt/epptbase.hxx", # PPTExTextAttr
"sc/source/filter/inc/tokstack.hxx", # E_TYPE
"filter/source/graphicfilter/icgm/cgmtypes.hxx",
":basic/source/inc/filefmt.hxx", # FileOffset
# unit test code
"cppu/source/uno/check.cxx",
# general weird nonsense going on
@@ -137,6 +138,9 @@ for d in definitionSet:
"cppcanvas/source/mtfrenderer/emfpbrush.hxx", # EmfPlusHatchStyle
"include/filter/msfilter/svdfppt.hxx", # PptPlaceholder, PptSlideLayout
"include/filter/msfilter/escherex.hxx", # various
"basic/source/inc/opcodes.hxx", # SbiOpcode
"basic/source/inc/token.hxx", # SbiToken
"binaryurp/source/specialfunctionids.hxx", # binaryurp::SpecialFunctionIds
# Windows or OSX only
"include/canvas/rendering/icolorbuffer.hxx",
"include/vcl/commandevent.hxx",
@@ -170,6 +174,7 @@ for d in definitionSet:
"cui/source/tabpages/tparea.cxx", # FillType (from UI)
"include/editeng/svxenum.hxx", # css::style::NumberingType
"include/editeng/bulletitem.hxx", # css::style::NumberingType
":basic/source/sbx/sbxdec.hxx", # SbxDecimal::CmpResult, must match some Windows API
# represents constants from an external API
"opencl/inc/opencl_device_selection.h",
"vcl/inc/sft.hxx",

View File

@@ -119,11 +119,9 @@ enum SbxOperator {
SbxGE // this >= var
};
enum SbxNameType { // Type of the questioned name of a variable
SbxNAME_NONE, // plain name
SbxNAME_SHORT, // Name(A,B)
SbxNAME_SHORT_TYPES, // Name%(A%,B$)
SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer
enum class SbxNameType { // Type of the questioned name of a variable
NONE, // plain name
ShortTypes, // Name%(A%,B$)
};
// from 1996/3/20: New error messages

View File

@@ -249,7 +249,7 @@ public:
void Dump( SvStream&, bool bDumpAll );
void SetName( const OUString& );
const OUString& GetName( SbxNameType = SbxNAME_NONE ) const;
const OUString& GetName( SbxNameType = SbxNameType::NONE ) const;
sal_uInt16 GetHashCode() const { return nHash; }
virtual void SetModified( bool ) override;