[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Aug 16 21:48:43 PDT 2011


 sc/source/filter/excel/xiname.cxx  |    2 +-
 sc/source/filter/excel/xltools.cxx |   29 +++++++++++++++--------------
 sc/source/filter/inc/xltools.hxx   |    8 ++++----
 3 files changed, 20 insertions(+), 19 deletions(-)

New commits:
commit 7a6d9e1ae64b6c30d23d862327a20ef82a9f0e86
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Aug 17 00:48:43 2011 -0400

    String to rtl::OUString.

diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 19e18d9..1b3b56f 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -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 );
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index 3737116..8a15e68 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -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 )
diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx
index e219cb6..92e4fac 100644
--- a/sc/source/filter/inc/xltools.hxx
+++ b/sc/source/filter/inc/xltools.hxx
@@ -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.


More information about the Libreoffice-commits mailing list