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 /sfx2 | |
parent | ffbd3846d40eaf3dc8e8fa37e57d48ff7da88a5b (diff) |
simplify LocalFileHelper::ConvertURLToPhysicalName
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/docfile.hxx | 6 | ||||
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/appl/fileobj.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/linkmgr2.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfac.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 45 | ||||
-rw-r--r-- | sfx2/source/doc/new.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
10 files changed, 41 insertions, 40 deletions
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 62f93ee93050..f05e7e4e01a0 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -89,7 +89,7 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase bTriedStorage; StreamMode nStorOpenMode; INetURLObject* pURLObj; - String aName; + rtl::OUString aName; SvGlobalName aFilterClass; SvStream* pInStream; SvStream* pOutStream; @@ -164,7 +164,7 @@ public: ::com::sun::star::util::DateTime GetInitFileDate( sal_Bool bIgnoreOldValue ); ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > GetContent() const; - const String& GetPhysicalName() const; + const rtl::OUString& GetPhysicalName() const; sal_Bool IsRemote(); sal_Bool IsOpen() const; // { return aStorage.Is() || pInStream; } void DownLoad( const Link& aLink = Link()); @@ -267,7 +267,7 @@ public: SAL_DLLPRIVATE sal_Bool IsPreview_Impl(); SAL_DLLPRIVATE void ClearBackup_Impl(); SAL_DLLPRIVATE void Done_Impl( ErrCode ); - SAL_DLLPRIVATE void SetPhysicalName_Impl(const String& rName); + SAL_DLLPRIVATE void SetPhysicalName_Impl(const rtl::OUString& rName); SAL_DLLPRIVATE void CanDisposeStorage_Impl( sal_Bool bDisposeStorage ); SAL_DLLPRIVATE sal_Bool WillDisposeStorageOnClose_Impl(); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index ca9060a89573..2a17778d7039 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -445,7 +445,7 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) { const String aName( SfxResId( CONFIG_PATH_START + nProp ) ); aNames.InsertValue( nProp, aName ); - String aValue; + rtl::OUString aValue; switch ( nProp ) { case SvtPathOptions::PATH_ADDIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetAddinPath(), aValue ); break; @@ -816,7 +816,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) { case SvtPathOptions::PATH_ADDIN: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetAddinPath( aTmp ); break; @@ -832,7 +832,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_FAVORITES: aPathOptions.SetFavoritesPath( sValue );break; case SvtPathOptions::PATH_FILTER: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetFilterPath( aTmp ); break; @@ -841,7 +841,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_GRAPHIC: aPathOptions.SetGraphicPath( sValue );break; case SvtPathOptions::PATH_HELP: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetHelpPath( aTmp ); break; @@ -850,7 +850,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_LINGUISTIC: aPathOptions.SetLinguisticPath( sValue );break; case SvtPathOptions::PATH_MODULE: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetModulePath( aTmp ); break; @@ -859,7 +859,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_PALETTE: aPathOptions.SetPalettePath( sValue );break; case SvtPathOptions::PATH_PLUGIN: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetPluginPath( aTmp ); break; @@ -867,7 +867,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) case SvtPathOptions::PATH_STORAGE: { - String aTmp; + rtl::OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetStoragePath( aTmp ); break; diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 1b982526eafa..7cddda525b5b 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -371,7 +371,7 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) { DBG_WARNING3( "Graphic error [%d] - [%s] URL[%s]", nRes, - xMed->GetPhysicalName().GetBuffer(), + xMed->GetPhysicalName().getStr(), sFileNm.GetBuffer() ); } else diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 2a2fb434f7c7..1f4842035ec1 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -427,7 +427,7 @@ void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer) // DDE connections between OOo apps are always named 'soffice'. continue; - String aTmp; + rtl::OUString aTmp; OUString aURL = aFile; if (utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp)) aURL = aTmp; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 4fe3e04607fa..78768582c1df 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -222,7 +222,7 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri static ::rtl::OUString DEF_TPL_STR(RTL_CONSTASCII_USTRINGPARAM("/soffice.")); - String sURL; + rtl::OUString sURL; String sPath; sal_Unicode aPathBuffer[nMaxPathSize]; if ( SystemPath::GetUserTemplateLocation( aPathBuffer, nMaxPathSize )) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 033249394657..250f58606b12 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -516,12 +516,12 @@ Reference < XContent > SfxMedium::GetContent() const else { // TODO: OSL_FAIL("SfxMedium::GetContent()\nCreate Content? This code exists as fallback only. Please clarify, why its used."); - String aURL; - if ( aName.Len() ) + rtl::OUString aURL; + if ( !aName.isEmpty() ) ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ); else if ( aLogicName.Len() ) aURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); - if ( aURL.Len() ) + if (!aURL.isEmpty() ) ::ucbhelper::Content::create( aURL, xEnv, pImp->aContent ); } } @@ -690,9 +690,9 @@ sal_Bool SfxMedium::CloseOutStream_Impl() } //------------------------------------------------------------------ -const String& SfxMedium::GetPhysicalName() const +const rtl::OUString& SfxMedium::GetPhysicalName() const { - if ( !aName.Len() && aLogicName.Len() ) + if ( aName.isEmpty() && aLogicName.Len() ) (( SfxMedium*)this)->CreateFileStream(); // return the name then @@ -749,7 +749,7 @@ sal_Bool SfxMedium::IsStorage() if ( pImp->pTempFile ) { - String aURL; + rtl::OUString aURL; if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aURL ) ) { OSL_FAIL("Physical name not convertable!"); @@ -1366,7 +1366,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf nStorOpenMode = SFX_STREAM_READONLY; pImp->xStorage = comphelper::OStorageHelper::GetStorageFromURL( aTmpName, embed::ElementModes::READ ); pImp->bStorageBasedOnInStream = sal_False; - String aTemp; + rtl::OUString aTemp; ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpName, aTemp ); SetPhysicalName_Impl( aTemp ); @@ -1560,7 +1560,7 @@ sal_Bool SfxMedium::StorageCommit_Impl() // connect the medium to the temporary file of the storage pImp->aContent = ::ucbhelper::Content(); aName = aBackupExc.TemporaryFileURL; - OSL_ENSURE( aName.Len(), "The exception _must_ contain the temporary URL!\n" ); + OSL_ENSURE( !aName.isEmpty(), "The exception _must_ contain the temporary URL!\n" ); } } @@ -1779,7 +1779,7 @@ sal_Bool SfxMedium::TryDirectTransfer( const ::rtl::OUString& aURL, SfxItemSet& void SfxMedium::Transfer_Impl() { // The transfer is required only in two cases: either if there is a temporary file or if there is a salvage item - String aNameURL; + rtl::OUString aNameURL; if ( pImp->pTempFile ) aNameURL = pImp->pTempFile->GetURL(); else if ( aLogicName.Len() && pImp->m_bSalvageMode ) @@ -1789,7 +1789,7 @@ void SfxMedium::Transfer_Impl() OSL_FAIL( "The medium name is not convertable!\n" ); } - if ( aNameURL.Len() && ( !eError || (eError & ERRCODE_WARNING_MASK) ) ) + if ( !aNameURL.isEmpty() && ( !eError || (eError & ERRCODE_WARNING_MASK) ) ) { RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxMedium::Transfer_Impl, copying to target" ); @@ -2191,7 +2191,7 @@ void SfxMedium::GetLockingStream_Impl() aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->m_xLockingStream; aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream; - if ( !pImp->pTempFile && !aName.Len() ) + if ( !pImp->pTempFile && aName.isEmpty() ) { // the medium is still based on the original file, it makes sence to initialize the streams if ( pImp->m_xLockingStream.is() ) @@ -2235,8 +2235,8 @@ void SfxMedium::GetMedium_Impl() else { uno::Sequence < beans::PropertyValue > xProps; - String aFileName; - if ( aName.Len() ) + rtl::OUString aFileName; + if (!aName.isEmpty()) { if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aFileName ) ) { @@ -2418,9 +2418,10 @@ 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 ( !aName.Len() ) + if ( aName.isEmpty() ) ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aName ); - else { + else + { DBG_ASSERT( pSalvageItem, "Suspicious change of logical name!" ); } } @@ -2735,7 +2736,7 @@ const String& SfxMedium::GetOrigURL() const //---------------------------------------------------------------- -void SfxMedium::SetPhysicalName_Impl( const String& rNameP ) +void SfxMedium::SetPhysicalName_Impl( const rtl::OUString& rNameP ) { if ( rNameP != aName ) { @@ -2745,7 +2746,7 @@ void SfxMedium::SetPhysicalName_Impl( const String& rNameP ) pImp->pTempFile = NULL; } - if ( aName.Len() || rNameP.Len() ) + if ( !aName.isEmpty() || !rNameP.isEmpty() ) pImp->aContent = ::ucbhelper::Content(); aName = rNameP; @@ -2909,9 +2910,9 @@ SfxMedium::~SfxMedium() delete pSet; - if( pImp->bIsTemp && aName.Len() ) + if( pImp->bIsTemp && !aName.isEmpty() ) { - String aTemp; + rtl::OUString aTemp; if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aTemp )) { OSL_FAIL("Physical name not convertable!"); @@ -3053,7 +3054,7 @@ const uno::Sequence < util::RevisionTag >& SfxMedium::GetVersionList( bool _bNoR { // if the medium has no name, then this medium should represent a new document and can have no version info if ( ( !_bNoReload || !pImp->m_bVersionsAlreadyLoaded ) && !pImp->aVersions.getLength() && - ( aName.Len() || aLogicName.Len() ) && GetStorage().is() ) + ( !aName.isEmpty() || aLogicName.Len() ) && GetStorage().is() ) { uno::Reference < document::XDocumentRevisionListPersistence > xReader( comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")) ), uno::UNO_QUERY ); @@ -3255,7 +3256,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace ) pImp->pTempFile->EnableKillingFile( sal_True ); aName = pImp->pTempFile->GetFileName(); ::rtl::OUString aTmpURL = pImp->pTempFile->GetURL(); - if ( !aName.Len() || !aTmpURL.getLength() ) + if ( aName.isEmpty() || aTmpURL.isEmpty() ) { SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); return; @@ -3352,7 +3353,7 @@ void SfxMedium::CreateTempFileNoCopy() pImp->pTempFile = new ::utl::TempFile(); pImp->pTempFile->EnableKillingFile( sal_True ); aName = pImp->pTempFile->GetFileName(); - if ( !aName.Len() ) + if ( aName.isEmpty() ) { SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); return; diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 94e6326ff54b..6938099ae553 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -254,7 +254,7 @@ IMPL_LINK( SfxNewFileDialog_Impl, Update, void *, EMPTYARG ) { // temp. fix until Templates are managed by UCB compatible service // does NOT work with locally cached components ! - String aTemp; + rtl::OUString aTemp; utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aTemp ); aFileName = aTemp; } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 8355ebd57e6a..20f56e3258b1 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -603,7 +603,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) SFX_ITEMSET_ARG( pSet, pBaseItem, SfxStringItem, SID_BASEURL, sal_False); - String aBaseURL; + rtl::OUString aBaseURL; SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False); if( pBaseItem ) aBaseURL = pBaseItem->GetValue(); @@ -611,7 +611,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) { if ( pSalvageItem ) { - String aName( pMed->GetPhysicalName() ); + rtl::OUString aName( pMed->GetPhysicalName() ); ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aBaseURL ); } else diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 47105d766e68..01087cd39a53 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -409,7 +409,7 @@ SfxObjectShell::~SfxObjectShell() // The removing of the temporary file must be done as the latest step in the document destruction if ( pImp->aTempName.Len() ) { - String aTmp; + rtl::OUString aTmp; ::utl::LocalFileHelper::ConvertPhysicalNameToURL( pImp->aTempName, aTmp ); ::utl::UCBContentHelper::Kill( aTmp ); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e55e43ab69be..8e123e3d9d3d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -445,7 +445,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // doing - String aTemp; + rtl::OUString aTemp; utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); INetURLObject aPhysObj( aTemp ); SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), |