Kaydet (Commit) fc455629 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

svl: Use appropriate OUString functions on string constants

Change-Id: I8d8528c74bae3de67a0a9bdd727cd0d8c8304d3e
üst ba7605c8
......@@ -123,22 +123,6 @@
#define INETTYPE_URL_PROT_MAILTO "mailto"
#define INETTYPE_URL_PROT_PRIVATE "private"
#define INETTYPE_URL_SUB_FACTORY "factory"
#define INETTYPE_URL_SUB_HELPID "helpid"
#define INETTYPE_URL_SSUB_FRAMESET "frameset"
#define INETTYPE_URL_SSUB_SCALC "scalc"
#define INETTYPE_URL_SSUB_SCHART "schart"
#define INETTYPE_URL_SSUB_SDRAW "sdraw"
#define INETTYPE_URL_SSUB_SIMAGE "simage"
#define INETTYPE_URL_SSUB_SIMPRESS "simpress"
#define INETTYPE_URL_SSUB_SMATH "smath"
#define INETTYPE_URL_SSUB_SWRITER "swriter"
#define INETTYPE_URL_SSSUB_GLOB "GlobalDocument"
#define INETTYPE_URL_SSSUB_WEB "web"
enum INetContentType
{
CONTENT_TYPE_UNKNOWN,
......
......@@ -713,34 +713,34 @@ INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL)
{
OUString aSecondPart = rURL.getToken(1, ':');
aToken = aSecondPart.getToken(0, '/');
if (aToken.equalsAscii(INETTYPE_URL_SUB_FACTORY))
if (aToken == "factory")
{
aToken = aSecondPart.getToken(1, '/');
if (aToken.equalsAscii(INETTYPE_URL_SSUB_SWRITER))
if (aToken == "swriter")
{
aToken = aSecondPart.getToken(2, '/');
eTypeID = aToken.equalsAscii(INETTYPE_URL_SSSUB_WEB) ?
eTypeID = aToken == "web" ?
CONTENT_TYPE_APP_VND_WRITER_WEB :
aToken.equalsAscii(INETTYPE_URL_SSSUB_GLOB) ?
aToken == "GlobalDocument" ?
CONTENT_TYPE_APP_VND_WRITER_GLOBAL :
CONTENT_TYPE_APP_VND_WRITER;
}
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SCALC))
else if (aToken == "scalc")
eTypeID = CONTENT_TYPE_APP_VND_CALC;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SDRAW))
else if (aToken == "sdraw")
eTypeID = CONTENT_TYPE_APP_VND_DRAW;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SIMPRESS))
else if (aToken == "simpress")
eTypeID = CONTENT_TYPE_APP_VND_IMPRESS;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SCHART))
else if (aToken == "schart")
eTypeID = CONTENT_TYPE_APP_VND_CHART;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SIMAGE))
else if (aToken == "simage")
eTypeID = CONTENT_TYPE_APP_VND_IMAGE;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SMATH))
else if (aToken == "smath")
eTypeID = CONTENT_TYPE_APP_VND_MATH;
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_FRAMESET))
else if (aToken == "frameset")
eTypeID = CONTENT_TYPE_APP_FRAMESET;
}
else if (aToken.equalsAscii(INETTYPE_URL_SUB_HELPID))
else if (aToken == "helpid")
eTypeID = CONTENT_TYPE_APP_STARHELP;
}
else if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_MAILTO))
......
......@@ -731,67 +731,67 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty
bool bThousand, bRed;
sal_uInt16 nDecimals, nLeading;
if (aPropertyName.equalsAscii( PROPERTYNAME_FMTSTR ))
if (aPropertyName == PROPERTYNAME_FMTSTR)
{
aRet <<= OUString( pFormat->GetFormatstring() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_LOCALE ))
else if (aPropertyName == PROPERTYNAME_LOCALE)
{
lang::Locale aLocale( LanguageTag( pFormat->GetLanguage()).getLocale());
aRet <<= aLocale;
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_TYPE ))
else if (aPropertyName == PROPERTYNAME_TYPE)
{
aRet <<= (sal_Int16)( pFormat->GetType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_COMMENT ))
else if (aPropertyName == PROPERTYNAME_COMMENT)
{
aRet <<= OUString( pFormat->GetComment() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_STDFORM ))
else if (aPropertyName == PROPERTYNAME_STDFORM)
{
//! Pass through SvNumberformat Member bStandard?
sal_Bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
aRet.setValue( &bStandard, getBooleanCppuType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_USERDEF ))
else if (aPropertyName == PROPERTYNAME_USERDEF)
{
sal_Bool bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 );
aRet.setValue( &bUserDef, getBooleanCppuType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_DECIMALS ))
else if (aPropertyName == PROPERTYNAME_DECIMALS)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
aRet <<= (sal_Int16)( nDecimals );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_LEADING ))
else if (aPropertyName == PROPERTYNAME_LEADING)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
aRet <<= (sal_Int16)( nLeading );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_NEGRED ))
else if (aPropertyName == PROPERTYNAME_NEGRED)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
aRet.setValue( &bRed, getBooleanCppuType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_THOUS ))
else if (aPropertyName == PROPERTYNAME_THOUS)
{
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
aRet.setValue( &bThousand, getBooleanCppuType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_CURRSYM ))
else if (aPropertyName == PROPERTYNAME_CURRSYM)
{
OUString aSymbol, aExt;
pFormat->GetNewCurrencySymbol( aSymbol, aExt );
aRet <<= aSymbol;
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_CURREXT ))
else if (aPropertyName == PROPERTYNAME_CURREXT)
{
OUString aSymbol, aExt;
pFormat->GetNewCurrencySymbol( aSymbol, aExt );
aRet <<= aExt;
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_CURRABB ))
else if (aPropertyName == PROPERTYNAME_CURRABB)
{
OUString aSymbol, aExt;
bool bBank = false;
......@@ -975,25 +975,25 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const OUString& aProp
SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
if (pFormatter)
{
if (aPropertyName.equalsAscii( PROPERTYNAME_NOZERO ))
if (aPropertyName == PROPERTYNAME_NOZERO)
{
// operator >>= shouldn't be used for bool (?)
if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN )
pFormatter->SetNoZero( *(sal_Bool*)aValue.getValue() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_NULLDATE ))
else if (aPropertyName == PROPERTYNAME_NULLDATE)
{
util::Date aDate;
if ( aValue >>= aDate )
pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_STDDEC ))
else if (aPropertyName == PROPERTYNAME_STDDEC)
{
sal_Int16 nInt16 = sal_Int16();
if ( aValue >>= nInt16 )
pFormatter->ChangeStandardPrec( nInt16 );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_TWODIGIT ))
else if (aPropertyName == PROPERTYNAME_TWODIGIT)
{
sal_Int16 nInt16 = sal_Int16();
if ( aValue >>= nInt16 )
......@@ -1018,12 +1018,12 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a
SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
if (pFormatter)
{
if (aPropertyName.equalsAscii( PROPERTYNAME_NOZERO ))
if (aPropertyName == PROPERTYNAME_NOZERO)
{
sal_Bool bNoZero = pFormatter->GetNoZero();
aRet.setValue( &bNoZero, getBooleanCppuType() );
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_NULLDATE ))
else if (aPropertyName == PROPERTYNAME_NULLDATE)
{
Date* pDate = pFormatter->GetNullDate();
if (pDate)
......@@ -1032,9 +1032,9 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a
aRet <<= aUnoDate;
}
}
else if (aPropertyName.equalsAscii( PROPERTYNAME_STDDEC ))
else if (aPropertyName == PROPERTYNAME_STDDEC)
aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() );
else if (aPropertyName.equalsAscii( PROPERTYNAME_TWODIGIT ))
else if (aPropertyName == PROPERTYNAME_TWODIGIT)
aRet <<= (sal_Int16)( pFormatter->GetYear2000() );
else
throw beans::UnknownPropertyException();
......
......@@ -4540,7 +4540,7 @@ bool SvNumberformat::HasPositiveBracketPlaceholder() const
{
sal_uInt16 nAnz = NumFor[0].GetCount();
OUString *tmpStr = NumFor[0].Info().sStrArray;
return (tmpStr[nAnz-1].equalsAscii( "_)" ));
return tmpStr[nAnz-1] == "_)";
}
DateFormat SvNumberformat::GetDateOrder() const
......@@ -4837,7 +4837,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
break;
case NF_SYMBOLTYPE_CALDEL :
if ( pStr[j+1].equalsAscii("buddhist") )
if ( pStr[j+1] == "buddhist" )
{
aStr.insert( 0, "[$-" );
if ( rNum.IsSet() && rNum.GetNatNum() == 1 &&
......@@ -4862,7 +4862,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
// The Thai T NatNum modifier during Xcl export.
if (rNum.IsSet() && rNum.GetNatNum() == 1 &&
rKeywords[NF_KEY_THAI_T].equalsAscii( "T") &&
rKeywords[NF_KEY_THAI_T] == "T" &&
MsLangId::getRealLanguage( rNum.GetLang()) ==
LANGUAGE_THAI && !LCIDInserted )
{
......
......@@ -22,6 +22,7 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
......@@ -45,7 +46,7 @@ public:
const OUString & rName)
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE
{
return rName.equalsAscii("com.sun.star.config.SpecialConfigManager");
return cppu::supportsService(this, rName);
}
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
......
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