summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-08 14:13:54 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-08 16:05:24 +0100
commit669128178f4697f4fba746f1ece1c18b0056022a (patch)
treec742a7c7654ae302ad39b616a7bb80149fd68ca8
parentfa7085bd182e1968237b742c544de3ff0a5b9742 (diff)
Make INetURLObject-from-OUString ctor explicit
...and clean up call sites. Change-Id: I7219a33652835e82fdc44e9e801a7e62868e4f38
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx4
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.cxx2
-rw-r--r--include/tools/urlobj.hxx7
-rw-r--r--sfx2/source/appl/appopen.cxx2
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/doc/docfile.cxx3
-rw-r--r--svl/source/fsstor/fsstorage.cxx24
-rw-r--r--svx/source/gallery2/galtheme.cxx2
-rw-r--r--svx/source/gengal/gengal.cxx23
10 files changed, 36 insertions, 37 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 2c8d085d9594..86e405832478 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -316,7 +316,7 @@ void TakeThread::execute()
{
SolarMutexGuard aGuard;
- mpProgress->SetFile( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+ mpProgress->SetFile( aURL );
pStatusProgress->Update( i, nEntries - 1 );
mpProgress->Sync();
pThm->InsertURL( aURL );
@@ -1008,7 +1008,7 @@ void TPGalleryThemeProperties::SearchFiles()
aLbxFound.Clear();
pProgress->SetFileType( aCbbFileType.GetText() );
- pProgress->SetDirectory( OUString() );
+ pProgress->SetDirectory( INetURLObject() );
pProgress->Update();
pProgress->StartExecuteModal( LINK( this, TPGalleryThemeProperties, EndSearchProgressHdl ) );
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index 0e0dd4cbbde5..edb18f7d4047 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -127,7 +127,7 @@ void XMLFilterJarHelper::addFile( Reference< XInterface > xRootFolder, Reference
if( !aFileURL.matchIgnoreAsciiCase( OUString("file://") ) )
{
- aFileURL = URIHelper::SmartRel2Abs( sProgPath, aFileURL, Link(), false );
+ aFileURL = URIHelper::SmartRel2Abs( INetURLObject(sProgPath), aFileURL, Link(), false );
}
INetURLObject aURL( aFileURL );
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
index 317dba8a3839..edb9ffe896eb 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -113,7 +113,7 @@ void XMLFilterTabPageXSLT::SetURL( SvtURLBox* rURLBox, const OUString& rURL )
else if( !rURL.isEmpty() )
{
OUString aURL( rURL );
- aURL = URIHelper::SmartRel2Abs( sInstPath, aURL, Link(), false );
+ aURL = URIHelper::SmartRel2Abs( INetURLObject(sInstPath), aURL, Link(), false );
osl::FileBase::getSystemPathFromFileURL( aURL, aPath );
rURLBox->SetBaseURL( aURL );
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index ab2ed5107c98..4d9bd10fe0c2 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -222,9 +222,10 @@ public:
// Strict Parsing:
- inline INetURLObject(OUString const & rTheAbsURIRef,
- EncodeMechanism eMechanism = WAS_ENCODED,
- rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+ inline explicit INetURLObject(
+ OUString const & rTheAbsURIRef,
+ EncodeMechanism eMechanism = WAS_ENCODED,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
inline bool SetURL(OUString const & rTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED,
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index a758478d36b1..111257331899 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -933,7 +933,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
sal_Bool bLoadInternal = sal_False;
// security reservation: => we have to check the referer before executing
- if (SFX_APP()->IsSecureURL(OUString(), &aReferer))
+ if (SFX_APP()->IsSecureURL(INetURLObject(), &aReferer))
{
try
{
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 06383d852283..289446b0d67e 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1278,7 +1278,7 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
RemoveEntry( nPos );
OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( *pURL ).GetHost();
- nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( aImageURL, false ) );
+ nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( *pURL ) ) );
SelectEntryPos( nPos );
delete pURL;
@@ -1451,7 +1451,7 @@ void BookmarksTabPage_Impl::AddBookmarks( const OUString& rTitle, const OUString
{
OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( rURL ).GetHost();
- sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( aImageURL, false ) );
+ sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
aBookmarksBox.SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( rURL ) ) );
}
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 95ff9dd888c4..a8125d20c992 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2994,8 +2994,7 @@ const INetURLObject& SfxMedium::GetURLObject() const
if (!pImp->m_pURLObj)
{
pImp->m_pURLObj = new INetURLObject( pImp->m_aLogicName );
- if (pImp->m_pURLObj->HasMark())
- *pImp->m_pURLObj = INetURLObject( pImp->m_aLogicName ).GetURLNoMark();
+ pImp->m_pURLObj->SetMark("");
}
return *pImp->m_pURLObj;
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index a1a7d40667de..f59ca366559e 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -1379,15 +1379,15 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
if ( !aBaseURL.setFinalSlash() )
throw uno::RuntimeException();
- INetURLObject aFileURL = INetURLObject::GetAbsURL(
+ OUString aFileURL = INetURLObject::GetAbsURL(
aBaseURL.GetMainURL( INetURLObject::NO_DECODE ),
sStreamPath );
- if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ if ( ::utl::UCBContentHelper::IsFolder( aFileURL ) )
throw io::IOException();
if ( ( nOpenMode & embed::ElementModes::NOCREATE )
- && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ && !::utl::UCBContentHelper::IsDocument( aFileURL ) )
throw io::IOException(); // TODO:
uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any
@@ -1396,19 +1396,19 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
{
if ( nOpenMode & embed::ElementModes::WRITE )
{
- if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ if ( isLocalFile_Impl( aFileURL ) )
{
uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess(
ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) );
uno::Reference< io::XStream > xStream =
- xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ xSimpleFileAccess->openFileReadWrite( aFileURL );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
}
else
{
// TODO: test whether it really works for http and fwp
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ),
+ SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL,
STREAM_STD_WRITE );
if ( pStream )
{
@@ -1435,10 +1435,10 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
else
{
if ( ( nOpenMode & embed::ElementModes::TRUNCATE )
- || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ || !::utl::UCBContentHelper::IsDocument( aFileURL ) )
throw io::IOException(); // TODO: access denied
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
+ ::ucbhelper::Content aResultContent( aFileURL, xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
}
@@ -1511,19 +1511,19 @@ void SAL_CALL FSStorage::removeStreamElementByHierarchicalName( const OUString&
if ( !aBaseURL.setFinalSlash() )
throw uno::RuntimeException();
- INetURLObject aFileURL = INetURLObject::GetAbsURL(
+ OUString aFileURL = INetURLObject::GetAbsURL(
aBaseURL.GetMainURL( INetURLObject::NO_DECODE ),
sStreamPath );
- if ( !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ if ( !::utl::UCBContentHelper::IsDocument( aFileURL ) )
{
- if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ if ( ::utl::UCBContentHelper::IsFolder( aFileURL ) )
throw lang::IllegalArgumentException();
else
throw container::NoSuchElementException(); // TODO:
}
- if ( !::utl::UCBContentHelper::Kill( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
+ if ( !::utl::UCBContentHelper::Kill( aFileURL ) )
throw io::IOException(); // TODO: error handling
}
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index bcc4e5a27a5d..e52fafc50d7b 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -915,7 +915,7 @@ sal_Bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInse
if( bRet )
{
- const SgaObjectBmp aObjBmp( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ const SgaObjectBmp aObjBmp( aURL );
InsertObject( aObjBmp, nInsertPos );
}
}
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index 355e006deddb..2305d3b08f54 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -18,7 +18,7 @@
#include <unistd.h>
#endif
-#include <list>
+#include <vector>
#include <unotools/streamwrap.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -43,8 +43,6 @@
using namespace ::com::sun::star;
-typedef ::std::list<OUString> FileNameList;
-
class GalApp : public Application
{
bool mbInBuildTree;
@@ -72,7 +70,7 @@ void disposeGallery( Gallery* pGallery )
}
static void createTheme( OUString aThemeName, OUString aGalleryURL,
- OUString aDestDir, FileNameList &rFiles,
+ OUString aDestDir, std::vector<INetURLObject> &rFiles,
bool bRelativeURLs )
{
Gallery* pGallery;
@@ -111,7 +109,7 @@ static void createTheme( OUString aThemeName, OUString aGalleryURL,
OUStringToOString( aDestDir, RTL_TEXTENCODING_UTF8 ).getStr() );
pGalTheme->SetDestDir( aDestDir, bRelativeURLs );
- FileNameList::const_iterator aIter;
+ std::vector<INetURLObject>::const_iterator aIter;
for( aIter = rFiles.begin(); aIter != rFiles.end(); ++aIter )
{
@@ -123,10 +121,10 @@ static void createTheme( OUString aThemeName, OUString aGalleryURL,
if ( ! pGalTheme->InsertURL( *aIter ) )
fprintf( stderr, "Failed to import '%s'\n",
- OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OUStringToOString( aIter->GetMainURL(INetURLObject::NO_DECODE), RTL_TEXTENCODING_UTF8 ).getStr() );
else
fprintf( stderr, "Imported file '%s' (%" SAL_PRI_SIZET "u)\n",
- OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ).getStr(),
+ OUStringToOString( aIter->GetMainURL(INetURLObject::NO_DECODE), RTL_TEXTENCODING_UTF8 ).getStr(),
pGalTheme->GetObjectCount() );
}
@@ -162,11 +160,11 @@ static int PrintHelp()
return EXIT_SUCCESS;
}
-static OUString Smartify( const OUString &rPath )
+static INetURLObject Smartify( const OUString &rPath )
{
INetURLObject aURL;
aURL.SetSmartURL( rPath );
- return aURL.GetMainURL( INetURLObject::NO_DECODE );
+ return aURL;
}
void GalApp::Init()
@@ -214,7 +212,7 @@ int GalApp::Main()
{
OUString aPath, aDestDir;
OUString aName( "Default name" );
- FileNameList aFiles;
+ std::vector<INetURLObject> aFiles;
for( sal_uInt32 i = 0; i < GetCommandLineParamCount(); i++ )
{
@@ -232,7 +230,8 @@ int GalApp::Main()
else if ( aParam == "--name" )
aName = GetCommandLineParam( ++i );
else if ( aParam == "--path" )
- aPath = Smartify( GetCommandLineParam( ++i ) );
+ aPath = Smartify( GetCommandLineParam( ++i ) ).
+ GetMainURL(INetURLObject::NO_DECODE);
else if ( aParam == "--destdir" )
aDestDir = GetCommandLineParam( ++i );
else if ( aParam == "--relative-urls" )
@@ -244,7 +243,7 @@ int GalApp::Main()
aFiles.push_back( Smartify( aParam ) );
}
- if( aFiles.size() < 1 )
+ if( aFiles.empty() )
return PrintHelp();
createTheme( aName, aPath, aDestDir, aFiles, mbRelativeURLs );