diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-08-19 10:43:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-08-19 10:48:42 +0200 |
commit | 236714e86c1c517d84d38395efabaf6e3793d196 (patch) | |
tree | 32c17d639ef464fba371d7d3a02afac18af8bfdb /sfx2 | |
parent | e87c08babed9e3ac34908771fc95cab5386f01a2 (diff) |
Clean up remaining utl::LocalFileHelper::Convert...
together with 58d68a1bc9146334376206ae7ba8b1a6594a1040
"ConvertURLToSystemPath->getSystemPathFromFileURL" and
28f3464a571a23a2c16bd0980e9021b95d011511
"ConvertSystemPathToURL->getFileURLFromSystemPath," this replaces all those
Convert... functionality with direct calls to the corresponding osl::FileBase
functions.
Change-Id: I2876171cd337a5eb939d25d8cf1e0c1253ff73a7
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/appl/linkmgr2.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/docfac.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 29 | ||||
-rw-r--r-- | sfx2/source/doc/new.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/inet/inettbc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 5 |
10 files changed, 42 insertions, 39 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index f7b541433c4b..54cd1528c4bb 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XFlushable.hpp> +#include <osl/file.hxx> #include <stdlib.h> #include <vcl/msgbox.hxx> @@ -51,7 +52,6 @@ #include <unotools/pathoptions.hxx> #include <svtools/miscopt.hxx> #include <vcl/toolbox.hxx> -#include <unotools/localfilehelper.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/idle.hxx> @@ -448,7 +448,7 @@ bool SfxApplication::GetOptions( SfxItemSet& rSet ) OUString aValue; switch ( nProp ) { - case SvtPathOptions::PATH_ADDIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetAddinPath(), aValue ); break; + case SvtPathOptions::PATH_ADDIN: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetAddinPath(), aValue ); break; case SvtPathOptions::PATH_AUTOCORRECT: aValue = aPathCfg.GetAutoCorrectPath(); break; case SvtPathOptions::PATH_AUTOTEXT: aValue = aPathCfg.GetAutoTextPath(); break; case SvtPathOptions::PATH_BACKUP: aValue = aPathCfg.GetBackupPath(); break; @@ -457,15 +457,15 @@ bool SfxApplication::GetOptions( SfxItemSet& rSet ) case SvtPathOptions::PATH_CONFIG: aValue = aPathCfg.GetConfigPath(); break; case SvtPathOptions::PATH_DICTIONARY: aValue = aPathCfg.GetDictionaryPath(); break; case SvtPathOptions::PATH_FAVORITES: aValue = aPathCfg.GetFavoritesPath(); break; - case SvtPathOptions::PATH_FILTER: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetFilterPath(), aValue ); break; + case SvtPathOptions::PATH_FILTER: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetFilterPath(), aValue ); break; case SvtPathOptions::PATH_GALLERY: aValue = aPathCfg.GetGalleryPath(); break; case SvtPathOptions::PATH_GRAPHIC: aValue = aPathCfg.GetGraphicPath(); break; - case SvtPathOptions::PATH_HELP: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetHelpPath(), aValue ); break; + case SvtPathOptions::PATH_HELP: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetHelpPath(), aValue ); break; case SvtPathOptions::PATH_LINGUISTIC: aValue = aPathCfg.GetLinguisticPath(); break; - case SvtPathOptions::PATH_MODULE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetModulePath(), aValue ); break; + case SvtPathOptions::PATH_MODULE: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetModulePath(), aValue ); break; case SvtPathOptions::PATH_PALETTE: aValue = aPathCfg.GetPalettePath(); break; - case SvtPathOptions::PATH_PLUGIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetPluginPath(), aValue ); break; - case SvtPathOptions::PATH_STORAGE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetStoragePath(), aValue ); break; + case SvtPathOptions::PATH_PLUGIN: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetPluginPath(), aValue ); break; + case SvtPathOptions::PATH_STORAGE: osl::FileBase::getFileURLFromSystemPath( aPathCfg.GetStoragePath(), aValue ); break; case SvtPathOptions::PATH_TEMP: aValue = aPathCfg.GetTempPath(); break; case SvtPathOptions::PATH_TEMPLATE: aValue = aPathCfg.GetTemplatePath(); break; case SvtPathOptions::PATH_USERCONFIG: aValue = aPathCfg.GetUserConfigPath(); break; @@ -798,7 +798,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_ADDIN: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetAddinPath( aTmp ); break; } @@ -814,7 +814,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_FILTER: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetFilterPath( aTmp ); break; } @@ -823,7 +823,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_HELP: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetHelpPath( aTmp ); break; } @@ -832,7 +832,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_MODULE: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetModulePath( aTmp ); break; } @@ -841,7 +841,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_PLUGIN: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetPluginPath( aTmp ); break; } @@ -849,7 +849,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_STORAGE: { OUString aTmp; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) + if( osl::FileBase::getSystemPathFromFileURL( sValue, aTmp ) == osl::FileBase::E_None ) aPathOptions.SetStoragePath( aTmp ); break; } diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 6a934f31c6a8..3fa3e4665fdf 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -34,7 +34,6 @@ #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> -#include <unotools/localfilehelper.hxx> #include <i18nlangtag/languagetag.hxx> #include <sfx2/request.hxx> #include <vcl/dibtools.hxx> @@ -431,7 +430,8 @@ void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer) OUString aTmp; OUString aURL = aFile; - if (utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp)) + if (osl::FileBase::getFileURLFromSystemPath(aFile, aTmp) + == osl::FileBase::E_None) aURL = aTmp; if (!aURL.equalsIgnoreAsciiCase(pMed->GetName())) diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index ba2ff680d591..4243181297f1 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -29,7 +29,6 @@ #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/ucbstreamhelper.hxx> -#include <unotools/localfilehelper.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/configurationhelper.hxx> @@ -203,7 +202,7 @@ void SfxObjectFactory::SetSystemTemplate( const OUString& rServiceName, const OU sal_Unicode aPathBuffer[nMaxPathSize]; if ( SystemPath::GetUserTemplateLocation( aPathBuffer, nMaxPathSize )) sPath = OUString( aPathBuffer ); - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, sURL ); + osl::FileBase::getFileURLFromSystemPath( sPath, sURL ); OUString aUserTemplateURL( sURL ); if ( !aUserTemplateURL.isEmpty()) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index e04b3ce22d54..cb7b20bc79a8 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -433,7 +433,7 @@ Reference < XContent > SfxMedium::GetContent() const // TODO: SAL_WARN( "sfx.doc", "SfxMedium::GetContent()\nCreate Content? This code exists as fallback only. Please clarify, why its used."); OUString aURL; if ( !pImp->m_aName.isEmpty() ) - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aURL ); + osl::FileBase::getFileURLFromSystemPath( pImp->m_aName, aURL ); else if ( !pImp->m_aLogicName.isEmpty() ) aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); if (!aURL.isEmpty() ) @@ -685,7 +685,8 @@ bool SfxMedium::IsStorage() if ( pImp->pTempFile ) { OUString aURL; - if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aURL ) ) + if ( osl::FileBase::getFileURLFromSystemPath( pImp->m_aName, aURL ) + == osl::FileBase::E_None ) { SAL_WARN( "sfx.doc", "Physical name not convertible!"); } @@ -999,7 +1000,8 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) // the file is not readonly, check the ACL OUString aPhysPath; - if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) + if ( osl::FileBase::getSystemPathFromFileURL( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) + == osl::FileBase::E_None ) bContentReadonly = IsReadonlyAccordingACL( aPhysPath.getStr() ); } #endif @@ -1316,7 +1318,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo ) pImp->xStorage = comphelper::OStorageHelper::GetStorageFromURL( aTmpName, embed::ElementModes::READ ); pImp->bStorageBasedOnInStream = false; OUString aTemp; - ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpName, aTemp ); + osl::FileBase::getSystemPathFromFileURL( aTmpName, aTemp ); SetPhysicalName_Impl( aTemp ); pImp->bIsTemp = true; @@ -1732,7 +1734,8 @@ void SfxMedium::Transfer_Impl() else if ( !pImp->m_aLogicName.isEmpty() && pImp->m_bSalvageMode ) { // makes sense only in case logic name is set - if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aNameURL ) ) + if ( osl::FileBase::getFileURLFromSystemPath( pImp->m_aName, aNameURL ) + != osl::FileBase::E_None ) SAL_WARN( "sfx.doc", "The medium name is not convertible!" ); } @@ -2011,8 +2014,12 @@ void SfxMedium::Transfer_Impl() if ( ( !pImp->m_eError || (pImp->m_eError & ERRCODE_WARNING_MASK) ) && !pImp->pTempFile ) { // without a TempFile the physical and logical name should be the same after successful transfer - ::utl::LocalFileHelper::ConvertURLToPhysicalName( - GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName ); + if (osl::FileBase::getSystemPathFromFileURL( + GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName ) + != osl::FileBase::E_None) + { + pImp->m_aName.clear(); + } pImp->m_bSalvageMode = false; } } @@ -2248,7 +2255,8 @@ void SfxMedium::GetMedium_Impl() OUString aFileName; if (!pImp->m_aName.isEmpty()) { - if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aFileName ) ) + if ( osl::FileBase::getFileURLFromSystemPath( pImp->m_aName, aFileName ) + != osl::FileBase::E_None ) { SAL_WARN( "sfx.doc", "Physical name not convertible!"); } @@ -2425,7 +2433,7 @@ void SfxMedium::Init_Impl() // try to convert the URL into a physical name - but never change a physical name // physical name may be set if the logical name is changed after construction if ( pImp->m_aName.isEmpty() ) - ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName ); + osl::FileBase::getSystemPathFromFileURL( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), pImp->m_aName ); else { DBG_ASSERT( pSalvageItem, "Suspicious change of logical name!" ); @@ -2932,7 +2940,8 @@ SfxMedium::~SfxMedium() if( pImp->bIsTemp && !pImp->m_aName.isEmpty() ) { OUString aTemp; - if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->m_aName, aTemp )) + if ( osl::FileBase::getFileURLFromSystemPath( pImp->m_aName, aTemp ) + != osl::FileBase::E_None ) { SAL_WARN( "sfx.doc", "Physical name not convertible!"); } diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 29561b0ef791..ac71fd744cbf 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -18,6 +18,7 @@ */ #include <comphelper/string.hxx> +#include <osl/file.hxx> #include <sfx2/new.hxx> #include <vcl/builderfactory.hxx> #include <vcl/layout.hxx> @@ -29,7 +30,6 @@ #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> #include <tools/urlobj.hxx> -#include <unotools/localfilehelper.hxx> #include "doc.hrc" #include <sfx2/app.hxx> @@ -196,7 +196,7 @@ IMPL_LINK_NOARG_TYPED(SfxNewFileDialog_Impl, Update, Idle*, void) // temp. fix until Templates are managed by UCB compatible service // does NOT work with locally cached components ! OUString aTemp; - utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aTemp ); + osl::FileBase::getFileURLFromSystemPath( aFileName, aTemp ); aFileName = aTemp; } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 2baa124f7b95..73ab864526f8 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -82,7 +82,6 @@ #include <unotools/pathoptions.hxx> #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> -#include <unotools/localfilehelper.hxx> #include <unotools/ucbhelper.hxx> #include <unotools/tempfile.hxx> #include <unotools/docinfohelper.hxx> @@ -651,7 +650,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) if ( pSalvageItem ) { OUString aName( pMed->GetPhysicalName() ); - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aBaseURL ); + osl::FileBase::getFileURLFromSystemPath( aName, aBaseURL ); } else aBaseURL = pMed->GetBaseURL(); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 45fd2e8271e7..0a198b61c271 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XTitle.hpp> +#include <osl/file.hxx> #include <osl/mutex.hxx> #include <rtl/instance.hxx> #include <vcl/msgbox.hxx> @@ -66,7 +67,6 @@ #include <svl/urihelper.hxx> #include <unotools/pathoptions.hxx> #include <svl/sharecontrolfile.hxx> -#include <unotools/localfilehelper.hxx> #include <unotools/ucbhelper.hxx> #include <svtools/asynclink.hxx> #include <tools/diagnose_ex.h> @@ -398,7 +398,7 @@ SfxObjectShell::~SfxObjectShell() if ( !pImp->aTempName.isEmpty() ) { OUString aTmp; - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->aTempName, aTmp ); + osl::FileBase::getFileURLFromSystemPath( pImp->aTempName, aTmp ); ::utl::UCBContentHelper::Kill( aTmp ); } diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 9e5c69132f64..660c52127733 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -36,7 +36,6 @@ #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <unotools/tempfile.hxx> -#include <unotools/localfilehelper.hxx> #include <osl/file.hxx> #include <osl/thread.hxx> #include <tools/urlobj.hxx> diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index f23ec36d29b0..fc85b0055cff 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -36,11 +36,9 @@ #include <svl/itemset.hxx> #include <svl/urihelper.hxx> -#include <unotools/pathoptions.hxx> #include <svtools/asynclink.hxx> #include <svtools/inettbc.hxx> -#include <unotools/localfilehelper.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/sfx.hrc> diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d15134eb7bd0..b693a5736a59 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -18,7 +18,7 @@ */ #include <config_features.h> - +#include <osl/file.hxx> #include <sfx2/infobar.hxx> #include <sfx2/viewfrm.hxx> #include <com/sun/star/document/MacroExecMode.hpp> @@ -67,7 +67,6 @@ #include <com/sun/star/task/InteractionHandler.hpp> #include <rtl/ustrbuf.hxx> -#include <unotools/localfilehelper.hxx> #include <unotools/ucbhelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/namedvaluecollection.hxx> @@ -426,7 +425,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // doing OUString aTemp; - utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); + osl::FileBase::getFileURLFromSystemPath( pMed->GetPhysicalName(), aTemp ); INetURLObject aPhysObj( aTemp ); SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pVersionItem, SfxInt16Item, SID_VERSION, false ); |