Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4256
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/56/4256/1
String=>OUString : svtools inettbc
Change-Id: I457834f2c7eef221db97387410115600748f1375
---
M include/svtools/helpopt.hxx
M include/svtools/inettbc.hxx
M svtools/source/config/helpopt.cxx
M svtools/source/control/inettbc.cxx
4 files changed, 167 insertions(+), 156 deletions(-)
diff --git a/include/svtools/helpopt.hxx b/include/svtools/helpopt.hxx
index 938bd22..36f3227 100644
--- a/include/svtools/helpopt.hxx
+++ b/include/svtools/helpopt.hxx
@@ -19,10 +19,10 @@
#ifndef INCLUDED_SVTOOLS_HELPOPT_HXX
#define INCLUDED_SVTOOLS_HELPOPT_HXX
+#include <rtl/ustring.hxx>
#include "svtools/svtdllapi.h"
#include <list>
-#include <tools/string.hxx>
#include <unotools/options.hxx>
typedef std::list< sal_Int32 > IdList;
@@ -42,13 +42,13 @@
void SetHelpTips( sal_Bool b );
sal_Bool IsHelpTips() const;
- const String& GetHelpStyleSheet()const;
- void SetHelpStyleSheet(const String& rStyleSheet);
+ const OUString& GetHelpStyleSheet()const;
+ void SetHelpStyleSheet(const OUString& rStyleSheet);
void SetWelcomeScreen( sal_Bool b );
sal_Bool IsWelcomeScreen() const;
- String GetSystem() const;
+ OUString GetSystem() const;
};
#endif
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index 3b8dbca..5cc0c52 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -34,8 +34,8 @@
friend class SvtMatchContext_Impl;
friend class SvtURLBox_Impl;
Link aOpenHdl;
- String aBaseURL;
- String aPlaceHolder;
+ OUString aBaseURL;
+ OUString aPlaceHolder;
rtl::Reference< SvtMatchContext_Impl > pCtx;
SvtURLBox_Impl* pImp;
INetProtocol eSmartProtocol;
@@ -46,10 +46,10 @@
sal_Bool bNoSelection : 1;
sal_Bool bIsAutoCompleteEnabled : 1;
- SVT_DLLPRIVATE sal_Bool ProcessKey( const KeyCode& rCode );
- SVT_DLLPRIVATE void TryAutoComplete();
- SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
- DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl, void* );
+ SVT_DLLPRIVATE sal_Bool ProcessKey( const KeyCode& rCode );
+ SVT_DLLPRIVATE void TryAutoComplete();
+ SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
+ DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl, void* );
SVT_DLLPRIVATE void Init(bool bSetDefaultHelpID);
protected:
@@ -64,30 +64,30 @@
SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol
eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
~SvtURLBox();
- void SetBaseURL( const String& rURL );
- const String& GetBaseURL() const { return aBaseURL; }
+ void SetBaseURL( const OUString& rURL );
+ const OUString& GetBaseURL() const { return aBaseURL; }
void SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; }
const Link& GetOpenHdl() const { return aOpenHdl; }
void SetOnlyDirectories( sal_Bool bDir = sal_True );
void SetNoURLSelection( sal_Bool bSet = sal_True );
INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
void SetSmartProtocol( INetProtocol eProt );
- sal_Bool IsCtrlOpen()
+ sal_Bool IsCtrlOpen()
{ return bCtrlClick; }
- String GetURL();
+ OUString GetURL();
void DisableHistory();
void UpdatePickList( );
- static String ParseSmart( String aText, String aBaseURL, String aWorkDir );
+ static OUString ParseSmart( OUString aText, OUString aBaseURL, OUString
aWorkDir );
- void SetFilter(const String& _sFilter);
+ void SetFilter(const OUString& _sFilter);
inline void EnableAutocompletion( sal_Bool _bEnable = sal_True )
{ bIsAutoCompleteEnabled = _bEnable; }
- void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
- String GetPlaceHolder() { return aPlaceHolder; }
- bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && (
aPlaceHolder == sToMatch ) ); }
+ void SetPlaceHolder( const OUString& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
+ OUString GetPlaceHolder() { return aPlaceHolder; }
+ bool MatchesPlaceHolder( const OUString& sToMatch ) { return ( !aPlaceHolder.isEmpty() && (
aPlaceHolder == sToMatch ) ); }
};
#endif
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index a51ed04..063dbda 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -50,9 +50,9 @@
sal_Bool bExtendedHelp;
sal_Bool bHelpTips;
sal_Bool bWelcomeScreen;
- String aLocale;
- String aSystem;
- String sHelpStyleSheet;
+ OUString aLocale;
+ OUString aSystem;
+ OUString sHelpStyleSheet;
DECLARE_STL_USTRINGACCESS_MAP( sal_Int32, MapString2Int );
MapString2Int aURLIgnoreCounters;
@@ -74,11 +74,11 @@
void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); }
sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; }
- String GetLocale() const { return aLocale; }
- String GetSystem() const { return aSystem; }
+ OUString GetLocale() const { return aLocale; }
+ OUString GetSystem() const { return aSystem; }
- const String& GetHelpStyleSheet()const{return sHelpStyleSheet;}
- void SetHelpStyleSheet(const String& rStyleSheet){sHelpStyleSheet = rStyleSheet;
SetModified();}
+ const OUString& GetHelpStyleSheet()const{return sHelpStyleSheet;}
+ void SetHelpStyleSheet(const OUString& rStyleSheet){sHelpStyleSheet = rStyleSheet;
SetModified();}
static ::osl::Mutex & getInitMutex();
};
@@ -318,17 +318,17 @@
return pImp->IsWelcomeScreen();
}
-String SvtHelpOptions::GetSystem() const
+OUString SvtHelpOptions::GetSystem() const
{
return pImp->GetSystem();
}
-const String& SvtHelpOptions::GetHelpStyleSheet()const
+const OUString& SvtHelpOptions::GetHelpStyleSheet()const
{
return pImp->GetHelpStyleSheet();
}
-void SvtHelpOptions::SetHelpStyleSheet(const String& rStyleSheet)
+void SvtHelpOptions::SetHelpStyleSheet(const OUString& rStyleSheet)
{
pImp->SetHelpStyleSheet(rStyleSheet);
}
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 917639d..0c90e42 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -81,11 +81,11 @@
std::vector<OUString> aCompletions;
::std::vector< WildCard > m_aFilters;
- static sal_Bool TildeParsing( String& aText, String& aBaseUrl );
+ static sal_Bool TildeParsing( OUString& aText, OUString& aBaseUrl );
inline SvtURLBox_Impl( )
{
- FilterMatch::createWildCardFilterList(String(),m_aFilters);
+ FilterMatch::createWildCardFilterList(OUString(),m_aFilters);
}
};
@@ -97,8 +97,8 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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,14 +286,14 @@
}
//-------------------------------------------------------------------------
-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 )
{
// avoid doubles
- if(find(aCompletions.begin(), aCompletions.end(), OUString(rCompletion)) !=
aCompletions.end())
+ if(find(aCompletions.begin(), aCompletions.end(), rCompletion) != aCompletions.end())
return;
}
@@ -303,33 +302,32 @@
}
//-------------------------------------------------------------------------
-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
if( !UCBContentHelper::IsFolder( rURL ) )
return;
- sal_Bool bPureHomePath = sal_False;
+ bool bPureHomePath = 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);
+ sal_Bool bExectMatch = bPureHomePath || aText == "."
+ || (aText.getLength() > 1 && aText.copy( aText.getLength() - 2, 2 ) == "/.")
+ || (aText.getLength() > 2 && aText.copy( aText.getLength() - 3, 3 ) == "/.." );
// 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 +335,23 @@
// 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();
+ sal_Int32 nMatchLen = aMatchName.getLength();
INetURLObject aFolderObj( rURL );
DBG_ASSERT( aFolderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
@@ -408,17 +408,17 @@
{
while ( schedule() && xResultSet->next() )
{
- String aURL = xContentAccess->queryContentIdentifierString();
- String aTitle = xRow->getString(1);
+ 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 +432,20 @@
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 (bPureHomePath || (!aText.isEmpty() && aText[aText.getLength() - 1]
== '.'))
{
// 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 +453,7 @@
// folders should get a final slash automatically
if ( bIsFolder )
- aInput += aDelimiter;
+ aInput += OUString(aDelimiter);
Insert( aInput, aObj.GetMainURL( INetURLObject::NO_DECODE ), sal_True );
}
@@ -470,28 +470,28 @@
}
//-------------------------------------------------------------------------
-String SvtURLBox::ParseSmart( String aText, String aBaseURL, String aWorkDir )
+OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, OUString aWorkDir )
{
- String aMatch;
+ OUString aMatch;
// parse ~ for Unix systems
// does nothing for Windows
if( !SvtURLBox_Impl::TildeParsing( aText, aBaseURL ) )
- return String();
+ return OUString();
INetURLObject aURLObject;
- if( aBaseURL.Len() )
+ if( !aBaseURL.isEmpty() )
{
INetProtocol eBaseProt = INetURLObject::CompareProtocolScheme( aBaseURL );
// if a base URL is set the string may be parsed relative
- if( aText.Search( '/' ) == 0 )
+ 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;
@@ -501,7 +501,7 @@
}
else
{
- String aSmart( aText );
+ OUString aSmart( aText );
INetURLObject aObj( aBaseURL );
// HRO: I suppose this hack should only be done for Windows !!!???
@@ -509,15 +509,15 @@
// HRO: INetURLObject::smatRel2Abs does not recognize '\\' as a relative path
// but in case of "\\\\" INetURLObject is right - this is an absolute path !
- if( aText.Search( '\\' ) == 0 && (aText.Len() < 2 || aText.GetChar( 1 ) != '\\') )
+ if( aText.indexOf( '\\' ) == 0 && (aText.getLength() < 2 || aText[ 1 ] != '\\') )
{
// cut to first segment
- String aTmp = INetURLObject::GetScheme( eBaseProt );
- aTmp += '/';
- aTmp += String(aObj.getName( 0, true, INetURLObject::DECODE_WITH_CHARSET ));
+ OUString aTmp = INetURLObject::GetScheme( eBaseProt );
+ aTmp += "/";
+ aTmp += aObj.getName( 0, true, INetURLObject::DECODE_WITH_CHARSET );
aObj.SetURL( aTmp );
- aSmart.Erase(0,1);
+ aSmart = aSmar.copy(1);
}
#endif
// base URL must be a directory !
@@ -536,7 +536,7 @@
INetURLObject aTmp( aObj.smartRel2Abs( aSmart, bWasAbsolute ) );
#endif
- if ( aText.GetChar( aText.Len() - 1 ) == '.' )
+ if ( aText[ aText.getLength() - 1 ] == '.' )
// INetURLObject appends a final slash for the directories "." and "..", this is a
bug!
// Remove it as a workaround
aTmp.removeFinalSlash();
@@ -547,7 +547,7 @@
else
{
OUString aTmpMatch;
- ::utl::LocalFileHelper::ConvertSystemPathToURL( OUString(aText), OUString(aWorkDir),
aTmpMatch );
+ ::utl::LocalFileHelper::ConvertSystemPathToURL( aText, aWorkDir, aTmpMatch );
aMatch = aTmpMatch;
}
@@ -571,20 +571,22 @@
aURLs.clear();
// check for input
- sal_uInt16 nTextLen = aText.Len();
+ sal_Int32 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();
// if the user input is a valid URL, go on with it
@@ -599,17 +601,17 @@
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 +709,7 @@
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 +743,8 @@
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 ( (aText.getLength() < aScheme.getLength()) &&
(aText.compareToIgnoreAsciiCase( aScheme.copy(0, aText.getLength())) == 0))
{
if( bFull )
aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE );
@@ -758,10 +760,10 @@
}
// now try smart matching
- aCurString.Erase( 0, aScheme.Len() );
+ aCurString = aCurString.copy(aScheme.getLength());
}
- if( aText.CompareIgnoreCaseToAscii( aCurString, aText.Len() )== COMPARE_EQUAL )
+ if( aCurString.getLength() >= aText.getLength() &&
aText.compareToIgnoreAsciiCase( aCurString.copy(0, aText.getLength() )) == 0 )
{
if( bFull )
aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE );
@@ -773,11 +775,11 @@
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(sal::static_int_cast< xub_StrLen
(INetURLObject::GetScheme( aCurObj.GetProtocol() ).getLength()) );
- if( aText.Len() < aMatch.Len() )
+ if( aText.getLength() < aMatch.getLength() )
Insert( aMatch, aURL );
continue;
@@ -789,9 +791,9 @@
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 +816,13 @@
{
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 )
+ sal_Int32 nLen = aSelection.Min();
+ aCurText = aCurText.copy(0, nLen);
+ if( !aCurText.isEmpty() && bIsAutoCompleteEnabled )
{
if ( pCtx.is() )
{
@@ -925,8 +927,8 @@
pCtx.clear();
}
- String sText = GetText();
- if ( sText.Len() && bIsAutoCompleteEnabled )
+ OUString sText = GetText();
+ if ( !sText.isEmpty() && bIsAutoCompleteEnabled )
{
pCtx = new SvtMatchContext_Impl( this, sText );
pCtx->launch();
@@ -973,27 +975,25 @@
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.toAsciiUpperCase() );
- bFound
- = (::std::find_if(
- pImp->m_aFilters.begin(),
- pImp->m_aFilters.end(),
- FilterMatch( aUpperURL ) )
- != pImp->m_aFilters.end());
+ bFound = (::std::find_if(
+ pImp->m_aFilters.begin(),
+ pImp->m_aFilters.end(),
+ FilterMatch( aUpperURL ) )
+ != pImp->m_aFilters.end());
}
if ( bFound )
{
OUString aFile;
- if (::utl::LocalFileHelper::ConvertURLToSystemPath(aURL,aFile))
+ if (::utl::LocalFileHelper::ConvertURLToSystemPath(aURL, aFile))
InsertEntry(aFile);
else
InsertEntry(aURL);
@@ -1185,12 +1185,12 @@
}
//-------------------------------------------------------------------------
-String SvtURLBox::GetURL()
+OUString SvtURLBox::GetURL()
{
// wait for end of autocompletion
::osl::MutexGuard aGuard( theSvtMatchContextMutex::get() );
- String aText( GetText() );
+ OUString aText( GetText() );
if ( MatchesPlaceHolder( aText ) )
return aPlaceHolder;
@@ -1205,13 +1205,13 @@
// erase trailing spaces on Windows since thay are invalid on this OS and
// most of the time they are inserted by accident via copy / paste
aText = comphelper::string::stripEnd(aText, ' ');
- if ( !aText.Len() )
+ if ( aText.isEmpty() )
return aText;
// #i9739#
#endif
INetURLObject aObj( aText );
- if( aText.Search( '*' ) != STRING_NOTFOUND || aText.Search( '?' ) != STRING_NOTFOUND )
+ if( aText.indexOf( '*' ) != -1 || aText.indexOf( '?' ) != -1 )
{
// no autocompletion for wildcards
INetURLObject aTempObj;
@@ -1243,20 +1243,23 @@
sal_Bool success = (aAny >>= aFileURL);
OUString aTitle;
if(success)
- aTitle = String(
- INetURLObject(aFileURL).getName(
+ {
+ aTitle = INetURLObject(aFileURL).getName(
INetURLObject::LAST_SEGMENT,
true,
- INetURLObject::DECODE_WITH_CHARSET ));
+ INetURLObject::DECODE_WITH_CHARSET );
+ }
else
- success =
- UCBContentHelper::GetTitle(aURL,&aTitle);
-
+ {
+ success = UCBContentHelper::GetTitle(aURL,&aTitle);
+ }
if( success && aTitle != "/" && aTitle != "." )
{
- aObj.SetName( aTitle );
- if ( bSlash )
- aObj.setFinalSlash();
+ aObj.SetName( aTitle );
+ if ( bSlash )
+ {
+ aObj.setFinalSlash();
+ }
}
}
}
@@ -1270,7 +1273,7 @@
UpdatePicklistForSmartProtocol_Impl();
}
-void SvtURLBox::SetBaseURL( const String& rURL )
+void SvtURLBox::SetBaseURL( const OUString& rURL )
{
::osl::MutexGuard aGuard( theSvtMatchContextMutex::get() );
@@ -1285,23 +1288,23 @@
does nothing for Windows
*/
sal_Bool SvtURLBox_Impl::TildeParsing(
- String&
+ OUString&
#ifdef UNX
aText
#endif
- , String&
+ , OUString&
#ifdef UNX
aBaseURL
#endif
)
{
#ifdef UNX
- if( aText.Search( '~' ) == 0 )
+ if( aText.indexOf( '~' ) == 0 )
{
- String aParseTilde;
+ OUString aParseTilde;
sal_Bool bTrailingSlash = sal_True; // use trailing slash
- if( aText.Len() == 1 || aText.GetChar( 1 ) == '/' )
+ if( aText.getLength() == 1 || aText[ 1 ] == '/' )
{
// covers "~" or "~/..." cases
const char* aHomeLocation = getenv( "HOME" );
@@ -1312,14 +1315,14 @@
// in case the whole path is just "~" then there should
// be no trailing slash at the end
- if( aText.Len() == 1 )
+ if( aText.getLength() == 1 )
bTrailingSlash = sal_False;
}
else
{
// covers "~username" and "~username/..." cases
- xub_StrLen nNameEnd = aText.Search( '/' );
- OUString aUserName = aText.Copy( 1, ( nNameEnd != STRING_NOTFOUND ) ? nNameEnd : (
aText.Len() - 1 ) );
+ sal_Int32 nNameEnd = aText.indexOf( '/' );
+ OUString aUserName = aText.copy( 1, ( nNameEnd != -1 ) ? nNameEnd : (
aText.getLength() - 1 ) );
struct passwd* pPasswd = NULL;
#ifdef SOLARIS
@@ -1331,15 +1334,23 @@
1024,
&pPasswd );
if( !nRes && pPasswd )
+ {
aParseTilde = OUString::createFromAscii(pPasswd->pw_dir);
+ }
else
+ {
return sal_False; // no such user
+ }
#else
pPasswd = getpwnam( OUStringToOString( aUserName, RTL_TEXTENCODING_ASCII_US ).getStr()
);
if( pPasswd )
+ {
aParseTilde = OUString::createFromAscii(pPasswd->pw_dir);
+ }
else
+ {
return sal_False; // no such user
+ }
#endif
// in case the path is "~username" then there should
@@ -1350,10 +1361,10 @@
if( !bTrailingSlash )
{
- if( !aParseTilde.Len() || aParseTilde.EqualsAscii( "/" ) )
+ if( aParseTilde.isEmpty() || aParseTilde == "/")
{
// "/" path should be converted to "/."
- aParseTilde = OUString("/.");
+ aParseTilde = "/.";
}
else
{
@@ -1363,21 +1374,21 @@
}
else
{
- if( aParseTilde.GetChar( aParseTilde.Len() - 1 ) != '/' )
- aParseTilde += '/';
- if( aText.Len() > 2 )
- aParseTilde += aText.Copy( 2 );
+ if( aParseTilde[ aParseTilde.getLength() - 1 ] != '/' )
+ aParseTilde += "/";
+ if( aText.getLength() > 2 )
+ aParseTilde += aText.copy( 2 );
}
aText = aParseTilde;
- aBaseURL = String(); // tilde provide absolute path
+ aBaseURL = OUString(); // tilde provide absolute path
}
#endif
return sal_True;
}
-void SvtURLBox::SetFilter(const String& _sFilter)
+void SvtURLBox::SetFilter(const OUString& _sFilter)
{
pImp->m_aFilters.clear();
FilterMatch::createWildCardFilterList(_sFilter,pImp->m_aFilters);
--
To view, visit https://gerrit.libreoffice.org/4256
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I457834f2c7eef221db97387410115600748f1375
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>
Context
- [PATCH] String=>OUString : svtools inettbc · Norbert Thiebaud (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.