diff options
-rw-r--r-- | comphelper/inc/comphelper/storagehelper.hxx | 9 | ||||
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 27 |
2 files changed, 30 insertions, 6 deletions
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 796c0ad47142..b613ddd2c5f1 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -136,7 +136,8 @@ public: 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 >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > @@ -144,7 +145,8 @@ public: 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 >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > @@ -153,7 +155,8 @@ public: 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 >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed ); diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index eda42ec98abb..e2557523f674 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -328,12 +328,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( const ::rtl::OUString& aFormat, const ::rtl::OUString& aURL, sal_Int32 nStorageMode, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= aURL; @@ -352,12 +359,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStream( const ::rtl::OUString& aFormat, const uno::Reference < io::XInputStream >& xStream, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= xStream; @@ -377,12 +391,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( const ::rtl::OUString& aFormat, const uno::Reference < io::XStream >& xStream, sal_Int32 nStorageMode, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= xStream; |