diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-08-19 12:24:37 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-08-19 12:24:37 +0200 |
commit | 5da0dce19caaf87a6fe53750a7e9ea5d564d6a12 (patch) | |
tree | 52028a1384c5074886fdd1722f71c32f3970146f /filter | |
parent | 520053459aa6a34b6d9ad52d97704399e5138d3d (diff) |
Consolidate isFileUrl checks
Change-Id: I1b74fdfaa09c4d0d6c296253958e83e78b546a9a
Diffstat (limited to 'filter')
5 files changed, 8 insertions, 17 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 42b609c09bab..16f204d95bab 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -31,7 +31,7 @@ #include <rtl/ustrbuf.hxx> #include <framework/interaction.hxx> #include <tools/urlobj.hxx> -#include <unotools/localfilehelper.hxx> +#include <comphelper/fileurl.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> @@ -1136,7 +1136,7 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) bool bSuccess = false; OUString sURL = rDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL(), OUString() ); bool bRequestedReadOnly = rDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_READONLY(), false ); - if ( utl::LocalFileHelper::IsFileUrl( sURL ) ) + if ( comphelper::isFileUrl( sURL ) ) { // OOo uses own file locking mechanics in case of local file bSuccess = rDescriptor.addInputStreamOwnLock(); diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index afd728eb411a..56db0c1cc2ea 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/XStyleLoader.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <comphelper/fileurl.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/mediadescriptor.hxx> @@ -141,7 +142,7 @@ bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star::be Sequence<com::sun::star::beans::PropertyValue> pValue=xstyleLoader->getStyleLoaderOptions(); //Load the Styles from the Template URL Supplied in the TypeDetection file - if(msTemplateName.indexOf("file:")==-1) + if(!comphelper::isFileUrl(msTemplateName)) { SvtPathOptions aOptions; OUString PathString = aOptions.SubstituteVariable(OUString("$(progurl)")); diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 59523ce4b8ec..9db846a8b6e2 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -33,12 +33,6 @@ extern OUString string_encode( const OUString & rText ); extern OUString string_decode( const OUString & rText ); - - -extern bool isFileURL( const OUString & rURL ); - - - bool copyStreams( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xIS, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOS ); bool createDirectory( OUString& rURL ); diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 7fcbaaae7ac0..c937e3f4029a 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1622,11 +1622,6 @@ OUString string_decode( const OUString & rText ) return Uri::decode( rText, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); } -bool isFileURL( const OUString & rURL ) -{ - return rURL.startsWith("file:"); -} - bool copyStreams( Reference< XInputStream > xIS, Reference< XOutputStream > xOS ) { try diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 9309ef173b1b..1511f12ba39f 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/fileurl.hxx> #include <tools/resid.hxx> #include <vcl/layout.hxx> #include <osl/file.hxx> @@ -193,7 +194,7 @@ bool XMLFilterTabDialog::onOk() if( 0 == nErrorId ) { // 4. see if the export xslt is valid - if( (mpNewInfo->maExportXSLT != mpOldInfo->maExportXSLT) && isFileURL( mpNewInfo->maExportXSLT ) ) + if( (mpNewInfo->maExportXSLT != mpOldInfo->maExportXSLT) && comphelper::isFileUrl( mpNewInfo->maExportXSLT ) ) { osl::File aFile( mpNewInfo->maExportXSLT ); osl::File::RC aRC = aFile.open( osl_File_OpenFlag_Read ); @@ -209,7 +210,7 @@ bool XMLFilterTabDialog::onOk() if( 0 == nErrorId ) { // 5. see if the import xslt is valid - if( (mpNewInfo->maImportXSLT != mpOldInfo->maImportXSLT) && isFileURL( mpNewInfo->maImportXSLT ) ) + if( (mpNewInfo->maImportXSLT != mpOldInfo->maImportXSLT) && comphelper::isFileUrl( mpNewInfo->maImportXSLT ) ) { osl::File aFile( mpNewInfo->maImportXSLT ); osl::File::RC aRC = aFile.open( osl_File_OpenFlag_Read ); @@ -233,7 +234,7 @@ bool XMLFilterTabDialog::onOk() if( 0 == nErrorId ) { // 6. see if the import template is valid - if( (mpNewInfo->maImportTemplate != mpOldInfo->maImportTemplate) && isFileURL( mpNewInfo->maImportTemplate ) ) + if( (mpNewInfo->maImportTemplate != mpOldInfo->maImportTemplate) && comphelper::isFileUrl( mpNewInfo->maImportTemplate ) ) { osl::File aFile( mpNewInfo->maImportTemplate ); osl::File::RC aRC = aFile.open( osl_File_OpenFlag_Read ); |