String to rtl::OUString.

This commit is contained in:
Kohei Yoshida 2011-08-17 00:48:43 -04:00
parent ba0cd69676
commit 7a6d9e1ae6
3 changed files with 20 additions and 19 deletions

View file

@ -103,7 +103,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
bool bBuiltIn = ::get_flag( nFlags, EXC_NAME_BUILTIN );
// special case for BIFF5 filter range - name appears as plain text without built-in flag
if( (GetBiff() == EXC_BIFF5) && (maXclName == XclTools::GetXclBuiltInDefName( EXC_BUILTIN_FILTERDATABASE )) )
if( (GetBiff() == EXC_BIFF5) && (maXclName.Equals(XclTools::GetXclBuiltInDefName(EXC_BUILTIN_FILTERDATABASE))) )
{
bBuiltIn = true;
maXclName.Assign( EXC_BUILTIN_FILTERDATABASE );

View file

@ -456,13 +456,11 @@ sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc )
// font names -----------------------------------------------------------------
String XclTools::GetXclFontName( const String& rFontName )
OUString XclTools::GetXclFontName( const OUString& rFontName )
{
// substitute with MS fonts
String aNewName( GetSubsFontName( rFontName, SUBSFONT_ONLYONE | SUBSFONT_MS ) );
if( aNewName.Len() )
return aNewName;
return rFontName;
OUString aNewName = GetSubsFontName(rFontName, SUBSFONT_ONLYONE | SUBSFONT_MS);
return aNewName.isEmpty() ? rFontName : aNewName;
}
// built-in defined names -----------------------------------------------------
@ -489,26 +487,29 @@ static const sal_Char* const ppcDefNames[] =
"_FilterDatabase"
};
String XclTools::GetXclBuiltInDefName( sal_Unicode cBuiltIn )
OUString XclTools::GetXclBuiltInDefName( sal_Unicode cBuiltIn )
{
OSL_ENSURE( SAL_N_ELEMENTS( ppcDefNames ) == EXC_BUILTIN_UNKNOWN,
"XclTools::GetXclBuiltInDefName - built-in defined name list modified" );
String aDefName;
if( cBuiltIn < SAL_N_ELEMENTS( ppcDefNames ) )
aDefName.AssignAscii( ppcDefNames[ cBuiltIn ] );
return rtl::OUString::createFromAscii(ppcDefNames[cBuiltIn]);
else
aDefName = String::CreateFromInt32( cBuiltIn );
return aDefName;
return rtl::OUString::valueOf(static_cast<sal_Int32>(cBuiltIn));
}
String XclTools::GetBuiltInDefName( sal_Unicode cBuiltIn )
OUString XclTools::GetBuiltInDefName( sal_Unicode cBuiltIn )
{
return String( maDefNamePrefix ).Append( GetXclBuiltInDefName( cBuiltIn ) );
rtl::OUStringBuffer aBuf(maDefNamePrefix);
aBuf.append(GetXclBuiltInDefName(cBuiltIn));
return aBuf.makeStringAndClear();
}
String XclTools::GetBuiltInDefNameXml( sal_Unicode cBuiltIn )
OUString XclTools::GetBuiltInDefNameXml( sal_Unicode cBuiltIn )
{
return String( maDefNamePrefixXml ).Append( GetXclBuiltInDefName( cBuiltIn ) );
rtl::OUStringBuffer aBuf(maDefNamePrefixXml);
aBuf.append(GetXclBuiltInDefName(cBuiltIn));
return aBuf.makeStringAndClear();
}
sal_Unicode XclTools::GetBuiltInDefNameIndex( const OUString& rDefName )

View file

@ -176,21 +176,21 @@ public:
// font names -------------------------------------------------------------
/** Returns the matching Excel font name for a passed Calc font name. */
static String GetXclFontName( const String& rFontName );
static rtl::OUString GetXclFontName( const rtl::OUString& rFontName );
// built-in defined names -------------------------------------------------
/** Returns the raw English UI representation of a built-in defined name used in NAME records.
@param cBuiltIn Excel index of the built-in name. */
static String GetXclBuiltInDefName( sal_Unicode cBuiltIn );
static rtl::OUString GetXclBuiltInDefName( sal_Unicode cBuiltIn );
/** Returns the Calc UI representation of a built-in defined name used in NAME records.
@descr Adds a prefix to the representation returned by GetXclBuiltInDefName().
@param cBuiltIn Excel index of the built-in name. */
static String GetBuiltInDefName( sal_Unicode cBuiltIn );
static rtl::OUString GetBuiltInDefName( sal_Unicode cBuiltIn );
/** Returns the Excel built-in name with OOXML prefix
@descr Adds the "_xlnm." prefix to the representation returned by GetXclBuiltInDefName()
@param cBuiltIn Excel index of the built in name.*/
static String GetBuiltInDefNameXml( sal_Unicode cBuiltIn );
static rtl::OUString GetBuiltInDefNameXml( sal_Unicode cBuiltIn );
/** Returns the Excel built-in name index of the passed defined name from Calc.
@descr Ignores any characters following a valid representation of a built-in name.
@param pcBuiltIn (out-param) If not 0, the index of the built-in name will be returned here.