From b0cf3aba085373d84a55ef144b273a8a89d017af Mon Sep 17 00:00:00 2001 From: elixir Date: Thu, 14 Mar 2013 13:57:57 +0530 Subject: fdo#38838: Replaced some (Uni)String to OUString in core/sc Change-Id: I4fa27b933c5b3cf2645b139bf6349b90f613feab Reviewed-on: https://gerrit.libreoffice.org/2735 Reviewed-by: Fridrich Strba Tested-by: Fridrich Strba --- sc/inc/global.hxx | 4 +-- sc/inc/stringutil.hxx | 6 ++-- sc/source/core/data/global.cxx | 12 ++++---- sc/source/core/tool/stringutil.cxx | 52 +++++++++++++++++----------------- sc/source/filter/excel/xecontent.cxx | 5 ++-- sc/source/filter/excel/xicontent.cxx | 12 ++++---- sc/source/filter/ftools/ftools.cxx | 54 ++++++++++++++++++------------------ sc/source/filter/inc/ftools.hxx | 18 ++++++------ sc/source/ui/dbgui/validate.cxx | 32 ++++++++++----------- sc/source/ui/inc/validate.hxx | 2 +- 10 files changed, 99 insertions(+), 98 deletions(-) (limited to 'sc') diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 978985a47cdb..b1dd688a4cb7 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -635,14 +635,14 @@ public: @param bEscapeEmbedded If , embedded quote characters are escaped by doubling them. */ -SC_DLLPUBLIC static void AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true ); +SC_DLLPUBLIC static void AddQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true ); /** Erases the character cQuote from rString, if it exists at beginning AND end. @param bUnescapeEmbedded If , embedded doubled quote characters are unescaped by replacing them with a single instance. */ -SC_DLLPUBLIC static void EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true ); +SC_DLLPUBLIC static void EraseQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true ); /** Finds an unquoted instance of cChar in rString, starting at offset nStart. Unquoted instances may occur when concatenating two diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx index 48c94f523949..988dea2da23e 100644 --- a/sc/inc/stringutil.hxx +++ b/sc/inc/stringutil.hxx @@ -106,9 +106,9 @@ public: static bool parseSimpleNumber( const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal); - static xub_StrLen SC_DLLPUBLIC GetQuotedTokenCount(const UniString &rIn, const UniString& rQuotedPairs, sal_Unicode cTok = ';' ); - static UniString SC_DLLPUBLIC GetQuotedToken(const UniString &rIn, xub_StrLen nToken, const UniString& rQuotedPairs, - sal_Unicode cTok, xub_StrLen& rIndex ); + static sal_Int32 SC_DLLPUBLIC GetQuotedTokenCount(const OUString &rIn, const OUString& rQuotedPairs, sal_Unicode cTok = ';' ); + static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs, + sal_Unicode cTok, sal_Int32& rIndex ); }; diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 22fc87cbc4ef..52aeae808c14 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -814,7 +814,7 @@ bool ScGlobal::IsQuoted( const String& rString, sal_Unicode cQuote ) return (rString.Len() >= 2) && (rString.GetChar( 0 ) == cQuote) && (rString.GetChar( rString.Len() - 1 ) == cQuote); } -void ScGlobal::AddQuotes( String& rString, sal_Unicode cQuote, bool bEscapeEmbedded ) +void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded ) { if (bEscapeEmbedded) { @@ -822,23 +822,23 @@ void ScGlobal::AddQuotes( String& rString, sal_Unicode cQuote, bool bEscapeEmbed pQ[0] = pQ[1] = cQuote; pQ[2] = 0; rtl::OUString aQuotes( pQ ); - rString.SearchAndReplaceAll( rtl::OUString(cQuote), aQuotes); + rString.replaceAll( OUString(cQuote), aQuotes); } - rString.Insert( cQuote, 0 ).Append( cQuote ); + rString = OUString( cQuote ) + OUString( cQuote ); } -void ScGlobal::EraseQuotes( String& rString, sal_Unicode cQuote, bool bUnescapeEmbedded ) +void ScGlobal::EraseQuotes( OUString& rString, sal_Unicode cQuote, bool bUnescapeEmbedded ) { if ( IsQuoted( rString, cQuote ) ) { - rString.Erase( rString.Len() - 1 ).Erase( 0, 1 ); + rString = rString.copy( 0, rString.getLength() - 1 ).copy( 1 ); if (bUnescapeEmbedded) { sal_Unicode pQ[3]; pQ[0] = pQ[1] = cQuote; pQ[2] = 0; rtl::OUString aQuotes( pQ ); - rString.SearchAndReplaceAll( aQuotes, rtl::OUString(cQuote)); + rString.replaceAll( aQuotes, OUString(cQuote)); } } } diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index 62e480410ed1..e196d6592502 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -183,22 +183,22 @@ bool ScStringUtil::parseSimpleNumber( return true; } -xub_StrLen ScStringUtil::GetQuotedTokenCount(const UniString &rIn, const UniString& rQuotedPairs, sal_Unicode cTok ) +sal_Int32 ScStringUtil::GetQuotedTokenCount(const OUString &rIn, const OUString& rQuotedPairs, sal_Unicode cTok ) { - assert( !(rQuotedPairs.Len()%2) ); - assert( rQuotedPairs.Search(cTok) ); + assert( !(rQuotedPairs.getLength()%2) ); + assert( rQuotedPairs.indexOf(cTok) ); // empty string: TokenCount is 0 per definition - if ( !rIn.Len() ) + if ( rIn.isEmpty() ) return 0; - xub_StrLen nTokCount = 1; - sal_Int32 nLen = rIn.Len(); - xub_StrLen nQuotedLen = rQuotedPairs.Len(); + sal_Int32 nTokCount = 1; + sal_Int32 nLen = rIn.getLength(); + sal_Int32 nQuotedLen = rQuotedPairs.getLength(); sal_Unicode cQuotedEndChar = 0; - const sal_Unicode* pQuotedStr = rQuotedPairs.GetBuffer(); - const sal_Unicode* pStr = rIn.GetBuffer(); - sal_Int32 nIndex = 0; + const sal_Unicode* pQuotedStr = rQuotedPairs.getStr(); + const sal_Unicode* pStr = rIn.getStr(); + sal_Int32 nIndex = 0; while ( nIndex < nLen ) { sal_Unicode c = *pStr; @@ -211,7 +211,7 @@ xub_StrLen ScStringUtil::GetQuotedTokenCount(const UniString &rIn, const UniStri else { // Is the char a quote-beginn char ? - xub_StrLen nQuoteIndex = 0; + sal_Int32 nQuoteIndex = 0; while ( nQuoteIndex < nQuotedLen ) { if ( pQuotedStr[nQuoteIndex] == c ) @@ -235,20 +235,20 @@ xub_StrLen ScStringUtil::GetQuotedTokenCount(const UniString &rIn, const UniStri return nTokCount; } -UniString ScStringUtil::GetQuotedToken(const UniString &rIn, xub_StrLen nToken, const UniString& rQuotedPairs, - sal_Unicode cTok, xub_StrLen& rIndex ) +OUString ScStringUtil::GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString& rQuotedPairs, + sal_Unicode cTok, sal_Int32& rIndex ) { assert( !(rQuotedPairs.Len()%2) ); - assert( rQuotedPairs.Search(cTok) == STRING_NOTFOUND ); + assert( rQuotedPairs.indexOf(cTok) == -1 ); - const sal_Unicode* pStr = rIn.GetBuffer(); - const sal_Unicode* pQuotedStr = rQuotedPairs.GetBuffer(); + const sal_Unicode* pStr = rIn.getStr(); + const sal_Unicode* pQuotedStr = rQuotedPairs.getStr(); sal_Unicode cQuotedEndChar = 0; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - xub_StrLen nLen = rIn.Len(); - xub_StrLen nTok = 0; - xub_StrLen nFirstChar = rIndex; - xub_StrLen i = nFirstChar; + sal_Int32 nQuotedLen = rQuotedPairs.getLength(); + sal_Int32 nLen = rIn.getLength(); + sal_Int32 nTok = 0; + sal_Int32 nFirstChar = rIndex; + sal_Int32 i = nFirstChar; // detect token position and length pStr += i; @@ -264,7 +264,7 @@ UniString ScStringUtil::GetQuotedToken(const UniString &rIn, xub_StrLen nToken, else { // Is the char a quote-begin char ? - xub_StrLen nQuoteIndex = 0; + sal_Int32 nQuoteIndex = 0; while ( nQuoteIndex < nQuotedLen ) { if ( pQuotedStr[nQuoteIndex] == c ) @@ -300,13 +300,13 @@ UniString ScStringUtil::GetQuotedToken(const UniString &rIn, xub_StrLen nToken, if ( i < nLen ) rIndex = i+1; else - rIndex = STRING_NOTFOUND; - return rIn.Copy( nFirstChar, i-nFirstChar ); + rIndex = -1; + return rIn.copy( nFirstChar, i-nFirstChar ); } else { - rIndex = STRING_NOTFOUND; - return UniString(); + rIndex = -1; + return OUString(); } } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 1ff94415f3f2..a3f4d3271f61 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1797,12 +1797,13 @@ XclExpWebQuery::XclExpWebQuery( { // comma separated list of HTML table names or indexes xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rSource, ';'); - String aNewTables, aAppendTable; + String aNewTables; + OUString aAppendTable; sal_Int32 nStringIx = 0; bool bExitLoop = false; for( xub_StrLen nToken = 0; (nToken < nTokenCnt) && !bExitLoop; ++nToken ) { - String aToken( rSource.GetToken( 0, ';', nStringIx ) ); + OUString aToken( rSource.GetToken( 0, ';', nStringIx ) ); mbEntireDoc = ScfTools::IsHTMLDocName( aToken ); bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken ); if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) ) diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 55779cb11b9b..fef829bedcff 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -939,23 +939,23 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) if( meMode == xlWQSpecTables ) { rStrm.Ignore( 4 ); - String aTables( rStrm.ReadUniString() ); + OUString aTables( rStrm.ReadUniString() ); const sal_Unicode cSep = ';'; - String aQuotedPairs( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) ); + OUString aQuotedPairs( "\"\"" ); xub_StrLen nTokenCnt = ScStringUtil::GetQuotedTokenCount( aTables, aQuotedPairs, ',' ); maTables.Erase(); - xub_StrLen nStringIx = 0; + sal_Int32 nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { - String aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) ); - sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0; + OUString aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) ); + sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.toInt32() : 0; if( nTabNum > 0 ) maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); else { ScGlobal::EraseQuotes( aToken, '"', false ); - if( aToken.Len() ) + if( aToken.getLength() ) maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep ); } } diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 5b88cecd237e..569d3a4e56ca 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -114,15 +114,15 @@ rtl_TextEncoding ScfTools::GetSystemTextEncoding() return osl_getThreadTextEncoding(); } -String ScfTools::GetHexStr( sal_uInt16 nValue ) +OUString ScfTools::GetHexStr( sal_uInt16 nValue ) { const sal_Char pHex[] = "0123456789ABCDEF"; - String aStr; + OUString aStr; - aStr += pHex[ nValue >> 12 ]; - aStr += pHex[ (nValue >> 8) & 0x000F ]; - aStr += pHex[ (nValue >> 4) & 0x000F ]; - aStr += pHex[ nValue & 0x000F ]; + aStr += OUString( pHex[ nValue >> 12 ] ); + aStr += OUString( pHex[ (nValue >> 8) & 0x000F ] ); + aStr += OUString( pHex[ (nValue >> 4) & 0x000F ] ); + aStr += OUString( pHex[ nValue & 0x000F ] ); return aStr; } @@ -223,17 +223,17 @@ void ScfTools::PutItem( SfxItemSet& rItemSet, const SfxPoolItem& rItem, bool bSk namespace { -ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const String& rStyleName, SfxStyleFamily eFamily, bool bForceName ) +ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, SfxStyleFamily eFamily, bool bForceName ) { // find an unused name - String aNewName( rStyleName ); + OUString aNewName( rStyleName ); sal_Int32 nIndex = 0; SfxStyleSheetBase* pOldStyleSheet = 0; while( SfxStyleSheetBase* pStyleSheet = rPool.Find( aNewName, eFamily ) ) { if( !pOldStyleSheet ) pOldStyleSheet = pStyleSheet; - aNewName.Assign( rStyleName ).Append( ' ' ).Append( OUString::number( ++nIndex ) ); + aNewName = rStyleName + " " + OUString::number( ++nIndex ); } // rename existing style @@ -249,12 +249,12 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const String& rStyleNa } // namespace -ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const String& rStyleName, bool bForceName ) +ScStyleSheet& ScfTools::MakeCellStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) { return lclMakeStyleSheet( rPool, rStyleName, SFX_STYLE_FAMILY_PARA, bForceName ); } -ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const String& rStyleName, bool bForceName ) +ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyleName, bool bForceName ) { return lclMakeStyleSheet( rPool, rStyleName, SFX_STYLE_FAMILY_PAGE, bForceName ); } @@ -277,32 +277,32 @@ void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding // *** HTML table names <-> named range names *** ----------------------------- -const String& ScfTools::GetHTMLDocName() +const OUString& ScfTools::GetHTMLDocName() { - static const String saHTMLDoc( RTL_CONSTASCII_USTRINGPARAM( "HTML_all" ) ); + static const OUString saHTMLDoc( "HTML_all" ); return saHTMLDoc; } -const String& ScfTools::GetHTMLTablesName() +const OUString& ScfTools::GetHTMLTablesName() { - static const String saHTMLTables( RTL_CONSTASCII_USTRINGPARAM( "HTML_tables" ) ); + static const OUString saHTMLTables( "HTML_tables" ); return saHTMLTables; } const String& ScfTools::GetHTMLIndexPrefix() { - static const String saHTMLIndexPrefix( RTL_CONSTASCII_USTRINGPARAM( "HTML_" ) ); + static const String saHTMLIndexPrefix( "HTML_" ); return saHTMLIndexPrefix; } const String& ScfTools::GetHTMLNamePrefix() { - static const String saHTMLNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "HTML__" ) ); + static const String saHTMLNamePrefix( "HTML__" ); return saHTMLNamePrefix; } -String ScfTools::GetNameFromHTMLIndex( sal_uInt32 nIndex ) +OUString ScfTools::GetNameFromHTMLIndex( sal_uInt32 nIndex ) { OUString aName = GetHTMLIndexPrefix() + OUString::number( static_cast< sal_Int32 >( nIndex ) ); @@ -316,19 +316,19 @@ String ScfTools::GetNameFromHTMLName( const String& rTabName ) return aName; } -bool ScfTools::IsHTMLDocName( const String& rSource ) +bool ScfTools::IsHTMLDocName( const OUString& rSource ) { - return rSource.EqualsIgnoreCaseAscii( GetHTMLDocName() ); + return rSource.equalsIgnoreAsciiCase( GetHTMLDocName() ); } -bool ScfTools::IsHTMLTablesName( const String& rSource ) +bool ScfTools::IsHTMLTablesName( const OUString& rSource ) { - return rSource.EqualsIgnoreCaseAscii( GetHTMLTablesName() ); + return rSource.equalsIgnoreAsciiCase( GetHTMLTablesName() ); } -bool ScfTools::GetHTMLNameFromName( const String& rSource, String& rName ) +bool ScfTools::GetHTMLNameFromName( const String& rSource, OUString& rName ) { - rName.Erase(); + rName = ""; if( rSource.EqualsIgnoreCaseAscii( GetHTMLNamePrefix(), 0, GetHTMLNamePrefix().Len() ) ) { rName = rSource.Copy( GetHTMLNamePrefix().Len() ); @@ -336,11 +336,11 @@ bool ScfTools::GetHTMLNameFromName( const String& rSource, String& rName ) } else if( rSource.EqualsIgnoreCaseAscii( GetHTMLIndexPrefix(), 0, GetHTMLIndexPrefix().Len() ) ) { - String aIndex( rSource.Copy( GetHTMLIndexPrefix().Len() ) ); - if( CharClass::isAsciiNumeric( aIndex ) && (aIndex.ToInt32() > 0) ) + OUString aIndex( rSource.Copy( GetHTMLIndexPrefix().Len() ) ); + if( CharClass::isAsciiNumeric( aIndex ) && (aIndex.toInt32() > 0) ) rName = aIndex; } - return rName.Len() > 0; + return rName.getLength() > 0; } ScFormatFilterPluginImpl::ScFormatFilterPluginImpl() {} diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index a428cd96a096..fa5aee6d13fe 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -146,7 +146,7 @@ public: /** Returns system text encoding for byte string conversion. */ static rtl_TextEncoding GetSystemTextEncoding(); /** Returns a string representing the hexadecimal value of nValue. */ - static String GetHexStr( sal_uInt16 nValue ); + static OUString GetHexStr( sal_uInt16 nValue ); /** Mixes RGB components with given transparence. @param nTrans Foreground transparence (0x00 == full nFore ... 0x80 = full nBack). */ @@ -212,14 +212,14 @@ public: true = Old existing style will be renamed; false = New style gets another name. */ static ScStyleSheet& MakeCellStyleSheet( ScStyleSheetPool& rPool, - const String& rStyleName, bool bForceName ); + const OUString& rStyleName, bool bForceName ); /** Creates and returns a page style sheet and inserts it into the pool. @descr If the style sheet is already in the pool, another unused style name is used. @param bForceName Controls behaviour, if the style already exists: true = Old existing style will be renamed; false = New style gets another name. */ static ScStyleSheet& MakePageStyleSheet( ScStyleSheetPool& rPool, - const String& rStyleName, bool bForceName ); + const OUString& rStyleName, bool bForceName ); // *** byte string import operations *** -------------------------------------- @@ -237,23 +237,23 @@ public: // *** HTML table names <-> named range names *** ----------------------------- /** Returns the built-in range name for an HTML document. */ - static const String& GetHTMLDocName(); + static const OUString& GetHTMLDocName(); /** Returns the built-in range name for all HTML tables. */ - static const String& GetHTMLTablesName(); + static const OUString& GetHTMLTablesName(); /** Returns the built-in range name for an HTML table, specified by table index. */ - static String GetNameFromHTMLIndex( sal_uInt32 nIndex ); + static OUString GetNameFromHTMLIndex( sal_uInt32 nIndex ); /** Returns the built-in range name for an HTML table, specified by table name. */ static String GetNameFromHTMLName( const String& rTabName ); /** Returns true, if rSource is the built-in range name for an HTML document. */ - static bool IsHTMLDocName( const String& rSource ); + static bool IsHTMLDocName( const OUString& rSource ); /** Returns true, if rSource is the built-in range name for all HTML tables. */ - static bool IsHTMLTablesName( const String& rSource ); + static bool IsHTMLTablesName( const OUString& rSource ); /** Converts a built-in range name to an HTML table name. @param rSource The string to be determined. @param rName The HTML table name. @return true, if conversion was successful. */ - static bool GetHTMLNameFromName( const String& rSource, String& rName ); + static bool GetHTMLNameFromName( const String& rSource, OUString& rName ); private: /** Returns the prefix for table index names. */ diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index f6ad414259eb..e66c5da4ff31 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -88,7 +88,7 @@ void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pD if ( m_pRefEdit ) { - String aStr; + OUString aStr; rRange.Format( aStr, SCR_ABS_3D, pDoc ); m_pRefEdit->SetRefString( aStr ); } @@ -250,18 +250,18 @@ ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos ) @descr Keeps all empty strings. Example: abc\ndef\n\nghi -> "abc";"def";"";"ghi". @param rFmlaStr (out-param) The converted formula string. */ -void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, sal_Unicode cFmlaSep ) +void lclGetFormulaFromStringList( OUString& rFmlaStr, const OUString& rStringList, sal_Unicode cFmlaSep ) { - rFmlaStr.Erase(); + rFmlaStr = ""; xub_StrLen nTokenCnt = comphelper::string::getTokenCount(rStringList, '\n'); for( sal_Int32 nToken = 0, nStringIx = 0; nToken < (sal_Int32) nTokenCnt; ++nToken ) { - String aToken( rStringList.GetToken( 0, '\n', nStringIx ) ); + OUString aToken( rStringList.getToken( 0, '\n', nStringIx ) ); ScGlobal::AddQuotes( aToken, '"' ); rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); } - if( !rFmlaStr.Len() ) - rFmlaStr.AssignAscii( "\"\"" ); + if( rFmlaStr.isEmpty() ) + rFmlaStr = "\"\""; } @@ -270,20 +270,20 @@ void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, s Example: "abc";;;"def";"";"ghi" -> abc\ndef\n\nghi. @param rStringList (out-param) The converted line feed separated string list. @return true = Conversion successful. */ -bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, sal_Unicode cFmlaSep ) +bool lclGetStringListFromFormula( OUString& rStringList, const OUString& rFmlaStr, sal_Unicode cFmlaSep ) { - String aQuotes( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) ); - xub_StrLen nTokenCnt = ScStringUtil::GetQuotedTokenCount(rFmlaStr, aQuotes, cFmlaSep ); + OUString aQuotes( "\"\"" ); + sal_Int32 nTokenCnt = ScStringUtil::GetQuotedTokenCount(rFmlaStr, aQuotes, cFmlaSep ); - rStringList.Erase(); + rStringList=""; bool bIsStringList = (nTokenCnt > 0); bool bTokenAdded = false; - for( xub_StrLen nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken ) + for( sal_Int32 nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken ) { - String aToken( ScStringUtil::GetQuotedToken(rFmlaStr, 0, aQuotes, cFmlaSep, nStringIx ) ); + OUString aToken( ScStringUtil::GetQuotedToken(rFmlaStr, 0, aQuotes, cFmlaSep, nStringIx ) ); aToken = comphelper::string::strip(aToken, ' '); - if( aToken.Len() ) // ignore empty tokens, i.e. "a";;"b" + if( aToken.getLength() ) // ignore empty tokens, i.e. "a";;"b" { bIsStringList = ScGlobal::IsQuoted( aToken, '"' ); if( bIsStringList ) @@ -430,7 +430,7 @@ sal_Bool ScTPValidationValue::FillItemSet( SfxItemSet& rArgSet ) String ScTPValidationValue::GetFirstFormula() const { - String aFmlaStr; + OUString aFmlaStr; if( maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_LIST ) lclGetFormulaFromStringList( aFmlaStr, maEdList.GetText(), mcFmlaSep ); else @@ -443,10 +443,10 @@ String ScTPValidationValue::GetSecondFormula() const return maEdMax.GetText(); } -void ScTPValidationValue::SetFirstFormula( const String& rFmlaStr ) +void ScTPValidationValue::SetFirstFormula( const OUString& rFmlaStr ) { // try if formula is a string list, validation mode must already be set - String aStringList; + OUString aStringList; if( (maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_RANGE) && lclGetStringListFromFormula( aStringList, rFmlaStr, mcFmlaSep ) ) { diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index 6527bb4fcc85..bab50175a1a1 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -187,7 +187,7 @@ private: String GetFirstFormula() const; String GetSecondFormula() const; - void SetFirstFormula( const String& rFmlaStr ); + void SetFirstFormula( const OUString& rFmlaStr ); void SetSecondFormula( const String& rFmlaStr ); DECL_LINK(SelectHdl, void *); -- cgit v1.2.3