diff options
author | Noel Grandin <noel@peralex.com> | 2013-08-21 11:13:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-08-22 10:49:32 +0200 |
commit | 23cafe3f1d619f715efc421de8abc0403a84f6b4 (patch) | |
tree | 6160fe83b9f61c161c5748131071070ab0701604 /svtools | |
parent | d71c8d1ed412dcf2a6a8111bc9007bc6dc73073e (diff) |
convert svtools/source/control/* from String to OUString
Change-Id: I32e411801d3754ca635cfc3ed9529b8ea43ffa3c
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/calendar.cxx | 8 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 10 | ||||
-rw-r--r-- | svtools/source/control/ctrltool.cxx | 8 | ||||
-rw-r--r-- | svtools/source/control/fileurlbox.cxx | 4 | ||||
-rw-r--r-- | svtools/source/control/fmtfield.cxx | 40 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 170 | ||||
-rw-r--r-- | svtools/source/control/stdmenu.cxx | 8 | ||||
-rw-r--r-- | svtools/source/control/tabbar.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/toolbarmenuacc.cxx | 6 | ||||
-rw-r--r-- | svtools/source/control/valueacc.cxx | 6 |
10 files changed, 130 insertions, 132 deletions
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index d7c1993125a0..c82664055cf0 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -403,7 +403,7 @@ void Calendar::ImplFormat() for ( sal_Int16 nDayOfWeek = 0; nDayOfWeek < 7; nDayOfWeek++ ) { // Use narrow name. - String aDayOfWeek( maCalendarWrapper.getDisplayName( + OUString aDayOfWeek( maCalendarWrapper.getDisplayName( i18n::CalendarDisplayIndex::DAY, nDay, 2)); long nOffX = (mnDayWidth-GetTextWidth( aDayOfWeek ))/2; if ( mnWinStyle & WB_BOLDTEXT ) @@ -883,9 +883,9 @@ void Calendar::ImplDraw( sal_Bool bPaint ) // Monat in der Titleleiste ausgeben nDeltaX = nX; nDeltaY = nY+TITLE_BORDERY; - String aMonthText( maCalendarWrapper.getDisplayName( + OUString aMonthText( maCalendarWrapper.getDisplayName( i18n::CalendarDisplayIndex::MONTH, nMonth-1, 1)); - aMonthText += ' '; + aMonthText += " "; aMonthText += OUString::number(nYear); long nMonthTextWidth = GetTextWidth( aMonthText ); long nMonthOffX1 = 0; @@ -903,7 +903,7 @@ void Calendar::ImplDraw( sal_Bool bPaint ) // Abbreviated month name. aMonthText = maCalendarWrapper.getDisplayName( i18n::CalendarDisplayIndex::MONTH, nMonth-1, 0); - aMonthText += ' '; + aMonthText += " "; aMonthText += OUString::number(nYear); nMonthTextWidth = GetTextWidth( aMonthText ); } diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 743d0657cce4..cefcc0317c5d 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1810,7 +1810,7 @@ void FontSizeBox::Fill( const FontInfo* pInfo, const FontList* pList ) sal_uLong nCount = aFontSizeNames.Count(); for( sal_uLong i = 0; i < nCount; i++ ) { - String aSizeName = aFontSizeNames.GetIndexName( i ); + OUString aSizeName = aFontSizeNames.GetIndexName( i ); sal_IntPtr nSize = aFontSizeNames.GetIndexSize( i ); ComboBox::InsertEntry( aSizeName, nPos ); ComboBox::SetEntryData( nPos, (void*)(-nSize) ); // mark as special @@ -1823,8 +1823,8 @@ void FontSizeBox::Fill( const FontInfo* pInfo, const FontList* pList ) pTempAry = pAry; while ( *pTempAry ) { - String aSizeName = aFontSizeNames.Size2Name( *pTempAry ); - if ( aSizeName.Len() ) + OUString aSizeName = aFontSizeNames.Size2Name( *pTempAry ); + if ( !aSizeName.isEmpty() ) { ComboBox::InsertEntry( aSizeName, nPos ); ComboBox::SetEntryData( nPos, (void*)(-(*pTempAry)) ); // mark as special @@ -1955,8 +1955,8 @@ void FontSizeBox::SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ) FontSizeNames aFontSizeNames( GetSettings().GetUILanguageTag().getLanguageType() ); // conversion loses precision; however font sizes should // never have a problem with that - String aName = aFontSizeNames.Size2Name( static_cast<long>(nTempValue) ); - if ( aName.Len() && (GetEntryPos( aName ) != LISTBOX_ENTRY_NOTFOUND) ) + OUString aName = aFontSizeNames.Size2Name( static_cast<long>(nTempValue) ); + if ( !aName.isEmpty() && (GetEntryPos( aName ) != LISTBOX_ENTRY_NOTFOUND) ) { mnLastValue = nTempValue; SetText( aName ); diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 5adcc8d1c5a5..af0f2f9b6eaa 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -896,7 +896,7 @@ long FontSizeNames::Name2Size( const OUString& rName ) const OUString FontSizeNames::Size2Name( long nValue ) const { - String aStr; + OUString aStr; // binary search for( long lower = 0, upper = mnElem - 1; lower <= upper; ) @@ -904,7 +904,7 @@ OUString FontSizeNames::Size2Name( long nValue ) const long mid = (upper + lower) >> 1; if ( nValue == mpArray[mid].mnSize ) { - aStr = String( mpArray[mid].mszUtf8Name, RTL_TEXTENCODING_UTF8 ); + aStr = OUString( mpArray[mid].mszUtf8Name, strlen(mpArray[mid].mszUtf8Name), RTL_TEXTENCODING_UTF8 ); break; } else if ( nValue < mpArray[mid].mnSize ) @@ -920,10 +920,10 @@ OUString FontSizeNames::Size2Name( long nValue ) const OUString FontSizeNames::GetIndexName( sal_uLong nIndex ) const { - String aStr; + OUString aStr; if ( nIndex < mnElem ) - aStr = String( mpArray[nIndex].mszUtf8Name, RTL_TEXTENCODING_UTF8 ); + aStr = OUString( mpArray[nIndex].mszUtf8Name, strlen(mpArray[nIndex].mszUtf8Name), RTL_TEXTENCODING_UTF8 ); return aStr; } diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index f62dae2d7d6c..b0279228eecb 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -39,10 +39,10 @@ namespace svt //--------------------------------------------------------------------- void FileURLBox::DisplayURL( const OUString& _rURL ) { - String sOldText = GetText(); + OUString sOldText = GetText(); OFileNotation aTransformer( _rURL, OFileNotation::N_URL ); - String sNewText = aTransformer.get( OFileNotation::N_SYSTEM ); + OUString sNewText = aTransformer.get( OFileNotation::N_SYSTEM ); SetText( sNewText ); if ( sOldText != sNewText ) diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 515e32e7ca50..f897d9197149 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -81,10 +81,10 @@ namespace validation public: NumberValidator( const sal_Unicode _cThSep, const sal_Unicode _cDecSep ); - sal_Bool isValidNumericFragment( const String& _rText ); + sal_Bool isValidNumericFragment( const OUString& _rText ); private: - sal_Bool implValidateNormalized( const String& _rText ); + sal_Bool implValidateNormalized( const OUString& _rText ); }; //-------------------------------------------------------------------------- @@ -219,9 +219,9 @@ namespace validation } //-------------------------------------------------------------------------- - sal_Bool NumberValidator::implValidateNormalized( const String& _rText ) + sal_Bool NumberValidator::implValidateNormalized( const OUString& _rText ) { - const sal_Unicode* pCheckPos = _rText.GetBuffer(); + const sal_Unicode* pCheckPos = _rText.getStr(); State eCurrentState = START; while ( END != eCurrentState ) @@ -259,16 +259,16 @@ namespace validation } //-------------------------------------------------------------------------- - sal_Bool NumberValidator::isValidNumericFragment( const String& _rText ) + sal_Bool NumberValidator::isValidNumericFragment( const OUString& _rText ) { - if ( !_rText.Len() ) + if ( _rText.isEmpty() ) // empty strings are always allowed return sal_True; // normalize the string - String sNormalized( RTL_CONSTASCII_USTRINGPARAM("_") ); - sNormalized.Append( _rText ); - sNormalized.AppendAscii( "_" ); + OUString sNormalized( "_" ); + sNormalized += _rText; + sNormalized += "_"; return implValidateNormalized( sNormalized ); } @@ -499,7 +499,7 @@ void FormattedField::impl_Modify(bool makeValueDirty) return; } - String sCheck = GetText(); + OUString sCheck = GetText(); if (CheckText(sCheck)) { m_sLastValidText = sCheck; @@ -879,8 +879,8 @@ long FormattedField::Notify(NotifyEvent& rNEvt) } else { - String sNew = GetTextValue(); - if (sNew.Len()) + OUString sNew = GetTextValue(); + if (!sNew.isEmpty()) SetTextFormatted(sNew); else SetTextFormatted(m_sDefaultText); @@ -996,8 +996,8 @@ sal_Bool FormattedField::ImplGetValue(double& dNewVal) return sal_True; dNewVal = m_dDefaultValue; - String sText(GetText()); - if (!sText.Len()) + OUString sText(GetText()); + if (sText.isEmpty()) return sal_True; DBG_ASSERT(ImplGetFormatter() != NULL, "FormattedField::ImplGetValue : can't give you a current value without a formatter !"); @@ -1022,7 +1022,7 @@ sal_Bool FormattedField::ImplGetValue(double& dNewVal) NUMBERFORMAT_NUMBER == m_pFormatter->GetType(nTempFormat)) // der String entspricht einer Number-Formatierung, hat also nur kein % // -> append it - sText += '%'; + sText += "%"; // (with this, a input of '3' becomes '3%', which then by the formatter is translated // into 0.03. Without this, the formatter would give us the double 3 for an input '3', // which equals 300 percent. @@ -1161,13 +1161,13 @@ void DoubleNumericField::ResetConformanceTester() { LocaleDataWrapper aLocaleInfo( LanguageTag( pFormatEntry->GetLanguage()) ); - String sSeparator = aLocaleInfo.getNumThousandSep(); - if (sSeparator.Len()) - cSeparatorThousand = sSeparator.GetBuffer()[0]; + OUString sSeparator = aLocaleInfo.getNumThousandSep(); + if (!sSeparator.isEmpty()) + cSeparatorThousand = sSeparator[0]; sSeparator = aLocaleInfo.getNumDecimalSep(); - if (sSeparator.Len()) - cSeparatorDecimal = sSeparator.GetBuffer()[0]; + if (!sSeparator.isEmpty()) + cSeparatorDecimal = sSeparator[0]; } delete m_pNumberValidator; diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index f1ce85d3f165..4b9783e54d70 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -97,8 +97,8 @@ class SvtMatchContext_Impl: public salhelper::Thread std::vector<OUString> aCompletions; std::vector<OUString> aURLs; svtools::AsynchronLink aLink; - String aBaseURL; - String aText; + OUString aBaseURL; + OUString aText; SvtURLBox* pBox; sal_Bool bOnlyDirectories; sal_Bool bNoSelection; @@ -113,12 +113,12 @@ class SvtMatchContext_Impl: public salhelper::Thread virtual ~SvtMatchContext_Impl(); virtual void execute(); void doExecute(); - void Insert( const String& rCompletion, const String& rURL, sal_Bool bForce = sal_False); - void ReadFolder( const String& rURL, const String& rMatch, sal_Bool bSmart ); + void Insert( const OUString& rCompletion, const OUString& rURL, sal_Bool bForce = sal_False); + void ReadFolder( const OUString& rURL, const OUString& rMatch, sal_Bool bSmart ); void FillPicklist(std::vector<OUString>& rPickList); public: - SvtMatchContext_Impl( SvtURLBox* pBoxP, const String& rText ); + SvtMatchContext_Impl( SvtURLBox* pBoxP, const OUString& rText ); void Stop(); }; @@ -129,7 +129,7 @@ namespace } SvtMatchContext_Impl::SvtMatchContext_Impl( - SvtURLBox* pBoxP, const String& rText ) + SvtURLBox* pBoxP, const OUString& rText ) : Thread( "SvtMatchContext_Impl" ) , aLink( STATIC_LINK( this, SvtMatchContext_Impl, Select_Impl ) ) , aBaseURL( pBoxP->aBaseURL ) @@ -232,7 +232,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, ) for(std::vector<OUString>::iterator i = pThis->aCompletions.begin(); i != pThis->aCompletions.end(); ++i) { - String sCompletion(*i); + OUString sCompletion(*i); // convert the file into an URL OUString sURL( sCompletion ); @@ -242,8 +242,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, ) if ( !sURL.isEmpty() && ( sURL[sURL.getLength()-1] != '/' )) { - String sUpperURL( sURL ); - sUpperURL.ToUpperAscii(); + OUString sUpperURL( sURL.toAsciiUpperCase() ); ::std::vector< WildCard >::const_iterator aMatchingFilter = ::std::find_if( @@ -265,9 +264,9 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, ) if( !pThis->bNoSelection && !pThis->aCompletions.empty() && !bValidCompletionsFiltered ) { // select the first one - String aTmp( pBox->GetEntry(0) ); + OUString aTmp( pBox->GetEntry(0) ); pBox->SetText( aTmp ); - pBox->SetSelection( Selection( pThis->aText.Len(), aTmp.Len() ) ); + pBox->SetSelection( Selection( pThis->aText.getLength(), aTmp.getLength() ) ); } // transfer string lists to listbox and forget them @@ -287,8 +286,8 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, ) } //------------------------------------------------------------------------- -void SvtMatchContext_Impl::Insert( const String& rCompletion, - const String& rURL, +void SvtMatchContext_Impl::Insert( const OUString& rCompletion, + const OUString& rURL, sal_Bool bForce ) { if( !bForce ) @@ -303,8 +302,8 @@ void SvtMatchContext_Impl::Insert( const String& rCompletion, } //------------------------------------------------------------------------- -void SvtMatchContext_Impl::ReadFolder( const String& rURL, - const String& rMatch, +void SvtMatchContext_Impl::ReadFolder( const OUString& rURL, + const OUString& rMatch, sal_Bool bSmart ) { // check folder to scan @@ -313,23 +312,23 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, sal_Bool bPureHomePath = sal_False; #ifdef UNX - bPureHomePath = aText.Search( '~' ) == 0 && aText.Search( '/' ) == STRING_NOTFOUND; + bPureHomePath = aText.indexOf( '~' ) == 0 && aText.indexOf( '/' ) == -1; #endif sal_Bool bExectMatch = bPureHomePath - || aText.CompareToAscii( "." ) == COMPARE_EQUAL - || (aText.Len() > 1 && aText.Copy( aText.Len() - 2, 2 ).CompareToAscii( "/." ) == COMPARE_EQUAL) - || (aText.Len() > 2 && aText.Copy( aText.Len() - 3, 3 ).CompareToAscii( "/.." ) == COMPARE_EQUAL); + || aText.compareTo( "." ) == 0 + || (aText.getLength() > 1 && aText.copy( aText.getLength() - 2, 2 ).compareTo( "/." ) == 0) + || (aText.getLength() > 2 && aText.copy( aText.getLength() - 3, 3 ).compareTo( "/.." ) == 0); // for pure home paths ( ~username ) the '.' at the end of rMatch // means that it poits to root catalog // this is done only for file contents since home paths parsing is useful only for them - if ( bPureHomePath && rMatch.Equals( OUString("file:///.") ) ) + if ( bPureHomePath && rMatch == "file:///." ) { // a home that refers to / - String aNewText( aText ); - aNewText += '/'; + OUString aNewText( aText ); + aNewText += "/"; Insert( aNewText, rURL, sal_True ); return; @@ -337,21 +336,21 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, // string to match with INetURLObject aMatchObj( rMatch ); - String aMatchName; + OUString aMatchName; - if ( rURL != String(aMatchObj.GetMainURL( INetURLObject::NO_DECODE ) )) + if ( rURL != aMatchObj.GetMainURL( INetURLObject::NO_DECODE ) ) { aMatchName = aMatchObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); // matching is always done case insensitive, but completion will be case sensitive and case preserving - aMatchName.ToLowerAscii(); + aMatchName = aMatchName.toAsciiLowerCase(); // if the matchstring ends with a slash, we must search for this also - if ( rMatch.GetChar(rMatch.Len()-1) == '/' ) - aMatchName += '/'; + if ( rMatch[ rMatch.getLength()-1 ] == '/' ) + aMatchName += "/"; } - xub_StrLen nMatchLen = aMatchName.Len(); + xub_StrLen nMatchLen = aMatchName.getLength(); INetURLObject aFolderObj( rURL ); DBG_ASSERT( aFolderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); @@ -408,17 +407,17 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, { while ( schedule() && xResultSet->next() ) { - String aURL = xContentAccess->queryContentIdentifierString(); - String aTitle = xRow->getString(1); - sal_Bool bIsFolder = xRow->getBoolean(2); + OUString aURL = xContentAccess->queryContentIdentifierString(); + OUString aTitle = xRow->getString(1); + sal_Bool bIsFolder = xRow->getBoolean(2); // matching is always done case insensitive, but completion will be case sensitive and case preserving - aTitle.ToLowerAscii(); + aTitle = aTitle.toAsciiLowerCase(); if ( !nMatchLen || - (bExectMatch && aMatchName.Equals(aTitle)) || - (!bExectMatch && aMatchName.CompareTo(aTitle, nMatchLen) == COMPARE_EQUAL) + (bExectMatch && aMatchName == aTitle) || + (!bExectMatch && aMatchName.compareTo(aTitle, nMatchLen) == 0) ) { // all names fit if matchstring is empty @@ -432,20 +431,20 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, aObj.setFinalSlash(); // get the last name of the URL - String aMatch = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - String aInput( aText ); + OUString aMatch = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + OUString aInput( aText ); if ( nMatchLen ) { - if ((aText.Len() && aText.GetChar(aText.Len() - 1) == '.') || bPureHomePath) + if ((aText.getLength() && aText[ aText.getLength() - 1 ] == '.') || bPureHomePath) { // if a "special folder" URL was typed, don't touch the user input - aMatch.Erase( 0, nMatchLen ); + aMatch = aMatch.copy( nMatchLen ); } else { // make the user input case preserving - DBG_ASSERT( aInput.Len() >= nMatchLen, "Suspicious Matching!" ); - aInput.Erase( aInput.Len() - nMatchLen ); + DBG_ASSERT( aInput.getLength() >= nMatchLen, "Suspicious Matching!" ); + aInput = aInput.copy( 0, aInput.getLength() - nMatchLen ); } } @@ -453,7 +452,7 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, // folders should get a final slash automatically if ( bIsFolder ) - aInput += aDelimiter; + aInput += OUString(aDelimiter); Insert( aInput, aObj.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); } @@ -472,7 +471,7 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, //------------------------------------------------------------------------- OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUString& aWorkDir ) { - String aMatch; + OUString aMatch; // parse ~ for Unix systems // does nothing for Windows @@ -488,10 +487,10 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin if( aText.indexOf( '/' ) == 0 ) { // text starting with slashes means absolute file URLs - String aTemp = INetURLObject::GetScheme( eBaseProt ); + OUString aTemp = INetURLObject::GetScheme( eBaseProt ); // file URL must be correctly encoded! - String aTextURL = INetURLObject::encode( aText, INetURLObject::PART_FPATH, + OUString aTextURL = INetURLObject::encode( aText, INetURLObject::PART_FPATH, '%', INetURLObject::ENCODE_ALL ); aTemp += aTextURL; @@ -512,9 +511,9 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin if( aText.indexOf( '\\' ) == 0 && (aText.getLength() < 2 || aText[ 1 ] != '\\') ) { // cut to first segment - String aTmp = INetURLObject::GetScheme( eBaseProt ); + OUString aTmp = INetURLObject::GetScheme( eBaseProt ); aTmp += '/'; - aTmp += String(aObj.getName( 0, true, INetURLObject::DECODE_WITH_CHARSET )); + aTmp += aObj.getName( 0, true, INetURLObject::DECODE_WITH_CHARSET ); aObj.SetURL( aTmp ); aSmart = aSmart.copy(1); @@ -571,19 +570,19 @@ void SvtMatchContext_Impl::doExecute() aURLs.clear(); // check for input - sal_uInt16 nTextLen = aText.Len(); + sal_uInt16 nTextLen = aText.getLength(); if ( !nTextLen ) return; - if( aText.Search( '*' ) != STRING_NOTFOUND || aText.Search( '?' ) != STRING_NOTFOUND ) + if( aText.indexOf( '*' ) != -1 || aText.indexOf( '?' ) != -1 ) // no autocompletion for wildcards return; - String aMatch; - String aWorkDir( SvtPathOptions().GetWorkPath() ); + OUString aMatch; + OUString aWorkDir( SvtPathOptions().GetWorkPath() ); INetProtocol eProt = INetURLObject::CompareProtocolScheme( aText ); INetProtocol eBaseProt = INetURLObject::CompareProtocolScheme( aBaseURL ); - if ( !aBaseURL.Len() ) + if ( aBaseURL.isEmpty() ) eBaseProt = INetURLObject::CompareProtocolScheme( aWorkDir ); INetProtocol eSmartProt = pBox->GetSmartProtocol(); @@ -599,17 +598,17 @@ void SvtMatchContext_Impl::doExecute() aMatch = SvtURLBox::ParseSmart( aText, aBaseURL, aWorkDir ); else aMatch = aText; - if ( aMatch.Len() ) + if ( !aMatch.isEmpty() ) { INetURLObject aURLObject( aMatch ); - String aMainURL( aURLObject.GetMainURL( INetURLObject::NO_DECODE ) ); + OUString aMainURL( aURLObject.GetMainURL( INetURLObject::NO_DECODE ) ); // Disable autocompletion for anything but the (local) file // system (for which access is hopefully fast), as the logic of // how SvtMatchContext_Impl is used requires this code to run to // completion before further user input is processed, and even // SvtMatchContext_Impl::Stop does not guarantee a speedy // return: - if ( aMainURL.Len() + if ( !aMainURL.isEmpty() && aURLObject.GetProtocol() == INET_PROT_FILE ) { // if text input is a directory, it must be part of the match list! Until then it is scanned @@ -707,7 +706,7 @@ void SvtMatchContext_Impl::doExecute() sal_Bool bFull = sal_False; INetURLObject aCurObj; - String aEmpty, aCurString, aCurMainURL; + OUString aEmpty, aCurString, aCurMainURL; INetURLObject aObj; aObj.SetSmartProtocol( eSmartProt == INET_PROT_NOT_VALID ? INET_PROT_HTTP : eSmartProt ); for( ;; ) @@ -741,8 +740,8 @@ void SvtMatchContext_Impl::doExecute() if( eProt == INET_PROT_NOT_VALID ) { // try if text matches the scheme - String aScheme( INetURLObject::GetScheme( aCurObj.GetProtocol() ) ); - if ( aText.CompareIgnoreCaseToAscii( aScheme, aText.Len() ) == COMPARE_EQUAL && aText.Len() < aScheme.Len() ) + OUString aScheme( INetURLObject::GetScheme( aCurObj.GetProtocol() ) ); + if ( aScheme.startsWithIgnoreAsciiCase( aText ) && aText.getLength() < aScheme.getLength() ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -758,10 +757,10 @@ void SvtMatchContext_Impl::doExecute() } // now try smart matching - aCurString.Erase( 0, aScheme.Len() ); + aCurString = aCurString.copy( aScheme.getLength() ); } - if( aText.CompareIgnoreCaseToAscii( aCurString, aText.Len() )== COMPARE_EQUAL ) + if( aCurString.startsWithIgnoreAsciiCase( aText ) ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -773,11 +772,11 @@ void SvtMatchContext_Impl::doExecute() aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); } - String aURL( aMatch ); + OUString aURL( aMatch ); if( eProt == INET_PROT_NOT_VALID ) - aMatch.Erase( 0, sal::static_int_cast< xub_StrLen >(INetURLObject::GetScheme( aCurObj.GetProtocol() ).getLength()) ); + aMatch = aMatch.copy( INetURLObject::GetScheme( aCurObj.GetProtocol() ).getLength() ); - if( aText.Len() < aMatch.Len() ) + if( aText.getLength() < aMatch.getLength() ) Insert( aMatch, aURL ); continue; @@ -789,9 +788,9 @@ void SvtMatchContext_Impl::doExecute() if( bFull ) continue; - if( aText.CompareTo( aCurMainURL, aText.Len() ) == COMPARE_EQUAL ) + if( aText.compareTo( aCurMainURL, aText.getLength() ) == 0 ) { - if( aText.Len() < aCurMainURL.Len() ) + if( aText.getLength() < aCurMainURL.getLength() ) Insert( aCurMainURL, aCurMainURL ); continue; @@ -814,13 +813,13 @@ void SvtURLBox::TryAutoComplete() { if( Application::AnyInput( VCL_INPUT_KEYBOARD ) ) return; - String aCurText = GetText(); + OUString aCurText = GetText(); Selection aSelection( GetSelection() ); - if( aSelection.Max() != aCurText.Len() ) + if( aSelection.Max() != aCurText.getLength() ) return; sal_uInt16 nLen = (sal_uInt16)aSelection.Min(); - aCurText.Erase( nLen ); - if( aCurText.Len() && bIsAutoCompleteEnabled ) + aCurText = aCurText.copy( 0, nLen ); + if( !aCurText.isEmpty() && bIsAutoCompleteEnabled ) { if ( pCtx.is() ) { @@ -927,8 +926,8 @@ void SvtURLBox::UpdatePickList( ) pCtx.clear(); } - String sText = GetText(); - if ( sText.Len() && bIsAutoCompleteEnabled ) + OUString sText = GetText(); + if ( !sText.isEmpty() && bIsAutoCompleteEnabled ) { pCtx = new SvtMatchContext_Impl( this, sText ); pCtx->launch(); @@ -975,15 +974,15 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl() break; } - String aURL( aCurObj.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); + OUString aURL( aCurObj.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); - if ( aURL.Len() ) + if ( !aURL.isEmpty() ) { - sal_Bool bFound = (aURL.GetChar(aURL.Len()-1) == '/' ); + sal_Bool bFound = aURL[aURL.getLength()-1] == '/' ; if ( !bFound ) { - String aUpperURL( aURL ); - aUpperURL.ToUpperAscii(); + OUString aUpperURL( aURL ); + aUpperURL = aUpperURL.toAsciiUpperCase(); bFound = (::std::find_if( @@ -1245,11 +1244,10 @@ OUString SvtURLBox::GetURL() sal_Bool success = (aAny >>= aFileURL); OUString aTitle; if(success) - aTitle = String( - INetURLObject(aFileURL).getName( - INetURLObject::LAST_SEGMENT, - true, - INetURLObject::DECODE_WITH_CHARSET )); + aTitle = INetURLObject(aFileURL).getName( + INetURLObject::LAST_SEGMENT, + true, + INetURLObject::DECODE_WITH_CHARSET ); else success = UCBContentHelper::GetTitle(aURL,&aTitle); @@ -1300,7 +1298,7 @@ sal_Bool SvtURLBox_Impl::TildeParsing( #ifdef UNX if( aText.indexOf( '~' ) == 0 ) { - String aParseTilde; + OUString aParseTilde; sal_Bool bTrailingSlash = sal_True; // use trailing slash if( aText.getLength() == 1 || aText[ 1 ] == '/' ) @@ -1352,10 +1350,10 @@ sal_Bool SvtURLBox_Impl::TildeParsing( if( !bTrailingSlash ) { - if( !aParseTilde.Len() || aParseTilde.EqualsAscii( "/" ) ) + if( aParseTilde.isEmpty() || aParseTilde == "/" ) { // "/" path should be converted to "/." - aParseTilde = OUString("/."); + aParseTilde = "/."; } else { @@ -1365,14 +1363,14 @@ sal_Bool SvtURLBox_Impl::TildeParsing( } else { - if( aParseTilde.GetChar( aParseTilde.Len() - 1 ) != '/' ) - aParseTilde += '/'; + if( aParseTilde[ aParseTilde.getLength() - 1 ] != '/' ) + aParseTilde += "/"; if( aText.getLength() > 2 ) aParseTilde += aText.copy( 2 ); } aText = aParseTilde; - aBaseURL = String(); // tilde provide absolute path + aBaseURL = ""; // tilde provide absolute path } #endif diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 3a192a19b540..f579dc2bd83d 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -186,8 +186,8 @@ void FontSizeMenu::Fill( const FontInfo& rInfo, const FontList* pList ) sal_uLong nCount = aFontSizeNames.Count(); for( sal_uLong i = 0; i < nCount; i++ ) { - String aSizeName = aFontSizeNames.GetIndexName( i ); - long nSize = aFontSizeNames.GetIndexSize( i ); + OUString aSizeName = aFontSizeNames.GetIndexName( i ); + long nSize = aFontSizeNames.GetIndexSize( i ); mpHeightAry[nPos] = nSize; nPos++; // Id is nPos+1 InsertItem( nPos, aSizeName, MIB_RADIOCHECK | MIB_AUTOCHECK ); @@ -199,8 +199,8 @@ void FontSizeMenu::Fill( const FontInfo& rInfo, const FontList* pList ) pTempAry = pAry; while ( *pTempAry ) { - String aSizeName = aFontSizeNames.Size2Name( *pTempAry ); - if ( aSizeName.Len() ) + OUString aSizeName = aFontSizeNames.Size2Name( *pTempAry ); + if ( !aSizeName.isEmpty() ) { mpHeightAry[nPos] = *pTempAry; nPos++; // Id is nPos+1 diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index e10bb9621246..4152f9d01764 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1157,7 +1157,7 @@ public: } } - void drawText(const String& aText) + void drawText(const OUString& aText) { Rectangle aRect = maRect; long nTextWidth = mrParent.GetTextWidth(aText); diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index c7f008e8e87a..8c35f91c885b 100644 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -736,15 +736,15 @@ OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (Runtime OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException) { const SolarMutexGuard aSolarGuard; - String aRet; + OUString aRet; if( mpParent ) { aRet = mpParent->maText; - if( !aRet.Len() ) + if( aRet.isEmpty() ) { - aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) ); + aRet = "Item "; aRet += OUString::number( mpParent->mnEntryId ); } } diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 1bef13a9a1ef..985f9fb586e7 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -268,7 +268,7 @@ OUString SAL_CALL ValueSetAcc::getAccessibleDescription() { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) ); + OUString aRet( "ValueSet" ); return aRet; } @@ -280,12 +280,12 @@ OUString SAL_CALL ValueSetAcc::getAccessibleName() { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - String aRet; + OUString aRet; if ( mpParent ) aRet = mpParent->GetAccessibleName(); - if ( !aRet.Len() ) + if ( aRet.isEmpty() ) { Window* pLabel = mpParent->GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != mpParent ) |