diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2012-08-16 19:05:36 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2012-08-16 20:47:15 +0200 |
commit | 72777a66bb8d9e71c4786c282c7971d7ededa729 (patch) | |
tree | 8a69a5cc936a7e215a1ea9699ab26916b5da1b2c /comphelper/inc | |
parent | c13c0c7d76d9ef7fa475590f5ec9fae185752f79 (diff) |
Cleanup comphelper::storagehelper
Change-Id: I04313cf4235ce3db20ff340474691435e9b440b6
Diffstat (limited to 'comphelper/inc')
-rw-r--r-- | comphelper/inc/comphelper/storagehelper.hxx | 177 |
1 files changed, 86 insertions, 91 deletions
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index f255dc842fb5..5e4916ef4e2b 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -33,14 +33,20 @@ #include <com/sun/star/io/XStream.hpp> #include "comphelper/comphelperdllapi.h" +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::embed; +using namespace com::sun::star::io; +using namespace com::sun::star::beans; +using rtl::OUString; -#define PACKAGE_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageFormat" ) ) -#define ZIP_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZipFormat" ) ) -#define OFOPXML_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ) +#define PACKAGE_STORAGE_FORMAT_STRING OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageFormat" ) ) +#define ZIP_STORAGE_FORMAT_STRING OUString( RTL_CONSTASCII_USTRINGPARAM( "ZipFormat" ) ) +#define OFOPXML_STORAGE_FORMAT_STRING OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ) -#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA256UTF8EncryptionKey" ) ) -#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1UTF8EncryptionKey" ) ) -#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1MS1252EncryptionKey" ) ) +#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA256UTF8EncryptionKey" ) ) +#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1UTF8EncryptionKey" ) ) +#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1MS1252EncryptionKey" ) ) namespace comphelper { @@ -63,131 +69,120 @@ public: class COMPHELPER_DLLPUBLIC OStorageHelper { public: - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > + static Reference< XSingleServiceFactory > GetStorageFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSF - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XMultiServiceFactory >& xSF = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > + static Reference< XSingleServiceFactory > GetFileSystemStorageFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSF - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XMultiServiceFactory >& xSF = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetTemporaryStorage( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - /// this one will only return Storage - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + // this one will only return Storage + static Reference< XStorage > GetStorageFromURL( - const ::rtl::OUString& aURL, - sal_Int32 nStorageMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const OUString& aURL, sal_Int32 nStorageMode, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - /// this one will return either Storage or FileSystemStorage - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + // this one will return either Storage or FileSystemStorage + static Reference< XStorage > GetStorageFromURL2( - const ::rtl::OUString& aURL, - sal_Int32 nStorageMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - - throw ( ::com::sun::star::uno::Exception ); + const OUString& aURL, sal_Int32 nStorageMode, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetStorageFromInputStream( - const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const Reference < XInputStream >& xStream, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetStorageFromStream( - const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream, - sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const Reference < XStream >& xStream, + sal_Int32 nStorageMode = ElementModes::READWRITE, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); static void CopyInputToOutput( - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XInputStream >& xInput, + const Reference< XOutputStream >& xOutput ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > + static Reference< XInputStream > GetInputStreamFromURL( - const ::rtl::OUString& aURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) - throw ( ::com::sun::star::uno::Exception ); + const OUString& aURL, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >() ) + throw ( Exception ); static void SetCommonStorageEncryptionData( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XStorage >& xStorage, + const Sequence< NamedValue >& aEncryptionData ) + throw ( Exception ); // the following method supports only storages of OOo formats static sal_Int32 GetXStorageFormat( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) - throw ( ::com::sun::star::uno::Exception ); + const Reference< XStorage >& xStorage ) + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetStorageOfFormatFromURL( - const ::rtl::OUString& aFormat, - const ::rtl::OUString& aURL, + const OUString& aFormat, + const OUString& aURL, sal_Int32 nStorageMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + const Reference< XMultiServiceFactory >& xFactory + = Reference< XMultiServiceFactory >(), sal_Bool bRepairStorage = sal_False ) - throw ( ::com::sun::star::uno::Exception ); + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetStorageOfFormatFromInputStream( - const ::rtl::OUString& aFormat, - const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + const OUString& aFormat, + const Reference < XInputStream >& xStream, + const Reference< XMultiServiceFactory >& xFactory + = Reference< XMultiServiceFactory >(), sal_Bool bRepairStorage = sal_False ) - throw ( ::com::sun::star::uno::Exception ); + throw ( Exception ); - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + static Reference< XStorage > GetStorageOfFormatFromStream( - const ::rtl::OUString& aFormat, - const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream, - sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + const OUString& aFormat, + const Reference < XStream >& xStream, + sal_Int32 nStorageMode = ElementModes::READWRITE, + const Reference< XMultiServiceFactory >& xFactory = Reference< XMultiServiceFactory >(), sal_Bool bRepairStorage = sal_False ) - throw ( ::com::sun::star::uno::Exception ); + throw ( Exception ); - static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + static Sequence< NamedValue > CreatePackageEncryptionData( - const ::rtl::OUString& aPassword, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSF - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); + const OUString& aPassword, + const Reference< XMultiServiceFactory >& xSF = Reference< XMultiServiceFactory >() ); - static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed ); + static sal_Bool IsValidZipEntryFileName( const OUString& aName, sal_Bool bSlashAllowed ); static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed ); - static sal_Bool PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment ); + static sal_Bool PathHasSegment( const OUString& aPath, const OUString& aSegment ); // Methods to allow easy use of hierachical names inside storages - static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageAtPath( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage, - const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness ); - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPath( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage, - const ::rtl::OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness ); - static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPackageURL( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage, - const ::rtl::OUString& rURL, sal_uInt32 const nOpenMode, + static Reference< XStorage > GetStorageAtPath( + const Reference< XStorage > &xStorage, + const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness ); + + static Reference< XStream > GetStreamAtPath( + const Reference< XStorage > &xStorage, + const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness ); + + static Reference< XStream > GetStreamAtPackageURL( + const Reference< XStorage > &xStorage, + const OUString& rURL, sal_uInt32 const nOpenMode, LifecycleProxy & rNastiness ); }; |