diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-09 21:05:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-10 10:09:28 +0000 |
commit | 3c62fbcdd78e472d3dde604eff33be54cb3e21be (patch) | |
tree | 12a45fa393c2ce35a1fdff7efc0a63ef7600b7cd /unotools/source | |
parent | ffbd3846d40eaf3dc8e8fa37e57d48ff7da88a5b (diff) |
simplify LocalFileHelper::ConvertURLToPhysicalName
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/config/defaultoptions.cxx | 4 | ||||
-rw-r--r-- | unotools/source/config/pathoptions.cxx | 14 | ||||
-rw-r--r-- | unotools/source/ucbhelper/localfilehelper.cxx | 30 | ||||
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 2 |
4 files changed, 23 insertions, 27 deletions
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index eb8c60068604..1b9d386c1bc1 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -199,7 +199,7 @@ void SvtDefaultOptions_Impl::Commit() String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const { - String aRet; + rtl::OUString aRet; sal_uInt16 nIdx = 0; while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK ) @@ -213,7 +213,7 @@ String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const nId == SvtPathOptions::PATH_MODULE || nId == SvtPathOptions::PATH_PLUGIN ) { - String aTmp; + rtl::OUString aTmp; ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aRet, aTmp ); aRet = aTmp; } diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 74f19ddaeef3..3be2d1ccea02 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -255,7 +255,7 @@ const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath ) try { OUString aPathValue; - String aResult; + OUString aResult; sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ]; // Substitution is done by the service itself using the substition service @@ -290,7 +290,7 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& r if ( ePath < SvtPathOptions::PATH_COUNT ) { - String aResult; + OUString aResult; OUString aNewValue; Any a; @@ -413,7 +413,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const if ( bConvertLocal ) { // Convert the URL to a system path for special path variables - String aReturn; + rtl::OUString aReturn; utl::LocalFileHelper::ConvertURLToPhysicalName( aWorkText, aReturn ); return aReturn; } @@ -949,7 +949,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) if ( aObj.HasError() ) { bIsURL = sal_False; - String aURL; + rtl::OUString aURL; if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) ) aObj.SetURL( aURL ); } @@ -978,8 +978,12 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) if ( bRet ) { if ( !bIsURL ) + { + rtl::OUString sTmp(rIniFile); ::utl::LocalFileHelper::ConvertURLToPhysicalName( - aObj.GetMainURL( INetURLObject::NO_DECODE ), rIniFile ); + aObj.GetMainURL( INetURLObject::NO_DECODE ), sTmp ); + rIniFile = sTmp; + } else rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE ); break; diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx index b2c14cf268af..2d28dac1adc8 100644 --- a/unotools/source/ucbhelper/localfilehelper.cxx +++ b/unotools/source/ucbhelper/localfilehelper.cxx @@ -100,7 +100,7 @@ sal_Bool LocalFileHelper::ConvertURLToSystemPath( const String& rName, String& r return ( rReturn.Len() != 0 ); } -sal_Bool LocalFileHelper::ConvertPhysicalNameToURL( const String& rName, String& rReturn ) +bool LocalFileHelper::ConvertPhysicalNameToURL(const rtl::OUString& rName, rtl::OUString& rReturn) { rReturn = ::rtl::OUString(); ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); @@ -120,23 +120,15 @@ sal_Bool LocalFileHelper::ConvertPhysicalNameToURL( const String& rName, String& rtl::OUString aBase( ::ucbhelper::getLocalFileURL( xManager ) ); rReturn = ::ucbhelper::getFileURLFromSystemPath( xManager, aBase, rName ); } - catch ( ::com::sun::star::uno::RuntimeException& ) + catch (const ::com::sun::star::uno::RuntimeException&) { } } - return ( rReturn.Len() != 0 ); -} - -bool LocalFileHelper::ConvertURLToPhysicalName( const rtl::OUString& rName, rtl::OUString& rReturn ) -{ - String aReturn; - bool bReturn = ConvertURLToPhysicalName( rName, aReturn ); - rReturn = rtl::OUString( aReturn ); - return bReturn; + return !rReturn.isEmpty(); } -sal_Bool LocalFileHelper::ConvertURLToPhysicalName( const String& rName, String& rReturn ) +bool LocalFileHelper::ConvertURLToPhysicalName(const rtl::OUString& rName, rtl::OUString& rReturn) { rReturn = ::rtl::OUString(); ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); @@ -157,24 +149,24 @@ sal_Bool LocalFileHelper::ConvertURLToPhysicalName( const String& rName, String& if ( aObj.GetProtocol() == aLocal.GetProtocol() ) rReturn = ::ucbhelper::getSystemPathFromFileURL( xManager, rName ); } - catch ( ::com::sun::star::uno::RuntimeException& ) + catch (const ::com::sun::star::uno::RuntimeException&) { } } - return ( rReturn.Len() != 0 ); + return !rReturn.isEmpty(); } -sal_Bool LocalFileHelper::IsLocalFile( const String& rName ) +sal_Bool LocalFileHelper::IsLocalFile(const rtl::OUString& rName) { - String aTmp; - return ConvertURLToPhysicalName( rName, aTmp ); + rtl::OUString aTmp; + return ConvertURLToPhysicalName(rName, aTmp); } -sal_Bool LocalFileHelper::IsFileContent( const String& rName ) +sal_Bool LocalFileHelper::IsFileContent(const rtl::OUString& rName) { String aTmp; - return ConvertURLToSystemPath( rName, aTmp ); + return ConvertURLToSystemPath(rName, aTmp); } typedef ::std::vector< ::rtl::OUString* > StringList_Impl; diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 74c3c53db259..cc70904f55d4 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -411,7 +411,7 @@ String TempFile::GetURL() const { if ( !pImp->aURL.Len() ) { - String aTmp; + rtl::OUString aTmp; LocalFileHelper::ConvertPhysicalNameToURL( GetFileName(), aTmp ); pImp->aURL = aTmp; } |