diff options
Diffstat (limited to 'filter/source/xsltdialog/xmlfilterjar.cxx')
-rw-r--r-- | filter/source/xsltdialog/xmlfilterjar.cxx | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index e3c8d6239a83..01ec7af8ccd8 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -37,7 +37,7 @@ #include <unotools/streamwrap.hxx> #include <unotools/tempfile.hxx> #include <svl/urihelper.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/stream.hxx> #include <tools/urlobj.hxx> @@ -60,7 +60,7 @@ using namespace com::sun::star::io; using ::rtl::Uri; -constexpr OUStringLiteral sVndSunStarPackage(u"vnd.sun.star.Package:"); +constexpr OUString sVndSunStarPackage(u"vnd.sun.star.Package:"_ustr); XMLFilterJarHelper::XMLFilterJarHelper( const Reference< XComponentContext >& rxContext ) : mxContext( rxContext ), @@ -109,7 +109,7 @@ static void addFile_( Reference< XInterface > const & xRootFolder, Reference< XS if( xSink.is() && xTunnel.is()) { Reference< XNameContainer > xNameContainer(xRootFolder, UNO_QUERY ); - xNameContainer->insertByName(encodeZipUri( aName ), makeAny(xTunnel)); + xNameContainer->insertByName(encodeZipUri( aName ), Any(xTunnel)); xSink->setInputStream( xInput ); } } @@ -149,7 +149,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const std::ve Sequence< Any > aArguments{ Any(rPackageURL), // let ZipPackage be used ( no manifest.xml is required ) Any(beans::NamedValue( - "StorageFormat", Any(OUString(ZIP_STORAGE_FORMAT_STRING)))) }; + "StorageFormat", Any(ZIP_STORAGE_FORMAT_STRING))) }; Reference< XHierarchicalNameAccess > xIfc( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( @@ -191,20 +191,18 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const std::ve } // create TypeDetection.xcu - utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); - OUString aTempFileURL( aTempFile.GetURL() ); + utl::TempFileFast aTempFile; + SvStream* pStream = aTempFile.GetStream(StreamMode::READWRITE); { - osl::File aOutputFile( aTempFileURL ); - (void)aOutputFile.open(osl_File_OpenFlag_Write); - Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) ); + Reference< XOutputStream > xOS( new ::utl::OOutputStreamWrapper( *pStream ) ); TypeDetectionExporter aExporter( mxContext ); aExporter.doExport(xOS,rFilters); } - Reference< XInputStream > XIS( new utl::OSeekableInputStreamWrapper( new SvFileStream(aTempFileURL, StreamMode::READ ), true ) ); + pStream->Seek(0); + Reference< XInputStream > XIS( new utl::OSeekableInputStreamWrapper( *pStream ) ); addFile_( xRootFolder, xFactory, XIS, "TypeDetection.xcu" ); Reference< XChangesBatch > xBatch( xIfc, UNO_QUERY ); @@ -235,7 +233,7 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, // let ZipPackage be used ( no manifest.xml is required ) beans::NamedValue aArg; aArg.Name = "StorageFormat"; - aArg.Value <<= OUString(ZIP_STORAGE_FORMAT_STRING); + aArg.Value <<= ZIP_STORAGE_FORMAT_STRING; Sequence< Any > aArguments{ Any(rPackageURL), Any(aArg) }; Reference< XHierarchicalNameAccess > xIfc( @@ -299,7 +297,7 @@ bool XMLFilterJarHelper::copyFiles( const Reference< XHierarchicalNameAccess >& return bOk; } -bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& xIfc, OUString& rURL, const OUString& rTargetURL ) +bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& xIfc, OUString& rURL, std::u16string_view rTargetURL ) { if( !rURL.matchIgnoreAsciiCase( sVndSunStarPackage ) ) return true; @@ -308,8 +306,8 @@ bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& x { OUString szPackagePath( encodeZipUri( rURL.copy( sVndSunStarPackage.getLength() ) ) ); - if ( ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, ".." ) - || ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, "." ) ) + if ( ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, u".." ) + || ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, u"." ) ) throw lang::IllegalArgumentException(); if( xIfc->hasByHierarchicalName( szPackagePath ) ) |