diff options
author | Mathias Bauer <mba@openoffice.org> | 2000-12-07 10:29:57 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2000-12-07 10:29:57 +0000 |
commit | 3bb9abc0ae8b1915eccd3fe415bb8473162b419c (patch) | |
tree | 8268820ac54b6bc6f2dc12afb34e21850df18bc9 /unotools/source/ucbhelper/localfilehelper.cxx | |
parent | cb6d3ff7ea5b0e019978316641dc7ac97433fb85 (diff) |
#80466#: new helper methods to convert filenames
Diffstat (limited to 'unotools/source/ucbhelper/localfilehelper.cxx')
-rw-r--r-- | unotools/source/ucbhelper/localfilehelper.cxx | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx index 3aea48144da2..5c36857e4b55 100644 --- a/unotools/source/ucbhelper/localfilehelper.cxx +++ b/unotools/source/ucbhelper/localfilehelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: localfilehelper.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: vg $ $Date: 2000-12-04 10:50:59 $ + * last change: $Author: mba $ $Date: 2000-12-07 11:29:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,6 +87,48 @@ using namespace ::com::sun::star::ucb; namespace utl { +sal_Bool LocalFileHelper::ConvertSystemPathToURL( const String& rName, const String& rBaseURL, String& rReturn ) +{ + rtl::OUString aRet; + ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get(); + if ( !pBroker ) + { + ::rtl::OUString aTmp; + FileBase::normalizePath( rName, aTmp ); + FileBase::getFileURLFromNormalizedPath( aTmp, aRet ); + } + else + { + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager = + pBroker->getContentProviderManagerInterface(); + aRet = ::ucb::getFileURLFromSystemPath( xManager, rBaseURL, aRet ); + } + + rReturn = aRet; + return ( aRet.getLength() != 0 ); +} + +sal_Bool LocalFileHelper::ConvertURLToSystemPath( const String& rName, String& rReturn ) +{ + rtl::OUString aRet; + ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get(); + if ( !pBroker ) + { + ::rtl::OUString aTmp; + FileBase::getNormalizedPathFromFileURL( rName, aTmp ); + FileBase::getSystemPathFromNormalizedPath( aTmp, aRet ); + } + else + { + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProviderManager > xManager = + pBroker->getContentProviderManagerInterface(); + aRet = ::ucb::getSystemPathFromFileURL( xManager, rName, rName ); + } + + rReturn = aRet; + return sal_True; +} + sal_Bool LocalFileHelper::ConvertPhysicalNameToURL( const String& rName, String& rReturn ) { rtl::OUString aRet; |