summaryrefslogtreecommitdiff
path: root/sfx2/source/doc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-09 21:05:46 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-10 10:09:28 +0000
commit3c62fbcdd78e472d3dde604eff33be54cb3e21be (patch)
tree12a45fa393c2ce35a1fdff7efc0a63ef7600b7cd /sfx2/source/doc
parentffbd3846d40eaf3dc8e8fa37e57d48ff7da88a5b (diff)
simplify LocalFileHelper::ConvertURLToPhysicalName
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r--sfx2/source/doc/docfac.cxx2
-rw-r--r--sfx2/source/doc/docfile.cxx45
-rw-r--r--sfx2/source/doc/new.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx4
-rw-r--r--sfx2/source/doc/objxtor.cxx2
5 files changed, 28 insertions, 27 deletions
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 );
}