Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_PACKAGES_ZIP_ZIPFILEACCESS_HPP
2 : #define INCLUDED_COM_SUN_STAR_PACKAGES_ZIP_ZIPFILEACCESS_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/io/IOException.hpp"
9 : #include "com/sun/star/packages/zip/XZipFileAccess2.hpp"
10 : #include "com/sun/star/packages/zip/ZipException.hpp"
11 : #include "com/sun/star/ucb/ContentCreationException.hpp"
12 : #include "com/sun/star/ucb/InteractiveIOException.hpp"
13 : #include "com/sun/star/uno/DeploymentException.hpp"
14 : #include "com/sun/star/uno/Exception.hpp"
15 : #include "com/sun/star/uno/RuntimeException.hpp"
16 : #include "com/sun/star/uno/XComponentContext.hpp"
17 : #include "com/sun/star/uno/Any.hxx"
18 : #include "com/sun/star/uno/Reference.hxx"
19 : #include "com/sun/star/uno/Sequence.hxx"
20 : #include "cppu/unotype.hxx"
21 : #include "rtl/ustring.h"
22 : #include "rtl/ustring.hxx"
23 :
24 : namespace com { namespace sun { namespace star { namespace packages { namespace zip {
25 :
26 : class ZipFileAccess {
27 : public:
28 2030 : static ::com::sun::star::uno::Reference< css::packages::zip::XZipFileAccess2 > createWithURL(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& URL) {
29 : assert(the_context.is());
30 2030 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
31 2030 : the_arguments[0] <<= URL;
32 2030 : ::com::sun::star::uno::Reference< css::packages::zip::XZipFileAccess2 > the_instance;
33 : try {
34 2030 : the_instance = ::com::sun::star::uno::Reference< css::packages::zip::XZipFileAccess2 >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.packages.zip.ZipFileAccess" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
35 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
36 0 : throw;
37 0 : } catch (const css::io::IOException &) {
38 0 : throw;
39 0 : } catch (const css::ucb::ContentCreationException &) {
40 0 : throw;
41 3992 : } catch (const css::ucb::InteractiveIOException &) {
42 1996 : throw;
43 0 : } catch (const css::packages::zip::ZipException &) {
44 0 : throw;
45 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
46 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.packages.zip.ZipFileAccess of type com.sun.star.packages.zip.XZipFileAccess2: " ) + the_exception.Message, the_context);
47 : }
48 34 : if (!the_instance.is()) {
49 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.packages.zip.ZipFileAccess of type com.sun.star.packages.zip.XZipFileAccess2" ), the_context);
50 : }
51 2030 : return the_instance;
52 : }
53 :
54 : private:
55 : ZipFileAccess(); // not implemented
56 : ZipFileAccess(ZipFileAccess &); // not implemented
57 : ~ZipFileAccess(); // not implemented
58 : void operator =(ZipFileAccess); // not implemented
59 : };
60 :
61 : } } } } }
62 :
63 : #endif // INCLUDED_COM_SUN_STAR_PACKAGES_ZIP_ZIPFILEACCESS_HPP
|