xref: /aoo41x/main/package/inc/zipfileaccess.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _ZIPFILEACCESS_HXX_
29 #define _ZIPFILEACCESS_HXX_
30 
31 #include <com/sun/star/packages/zip/XZipFileAccess.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/lang/XComponent.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/container/XNameAccess.hpp>
37 
38 #include <cppuhelper/interfacecontainer.h>
39 #include <cppuhelper/implbase5.hxx>
40 
41 #include <mutexholder.hxx>
42 
43 #include <ZipFile.hxx>
44 #include <HashMaps.hxx>
45 
46 class OZipFileAccess : public ::cppu::WeakImplHelper5<
47 						::com::sun::star::packages::zip::XZipFileAccess,
48 						::com::sun::star::container::XNameAccess,
49 						::com::sun::star::lang::XInitialization,
50 						::com::sun::star::lang::XComponent,
51 						::com::sun::star::lang::XServiceInfo >
52 {
53     SotMutexHolderRef m_aMutexHolder;
54 
55 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
56 
57 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xContentStream;
58 	ZipFile* m_pZipFile;
59 
60 	::cppu::OInterfaceContainerHelper* m_pListenersContainer;
61 
62 	sal_Bool m_bDisposed;
63 
64 public:
65 	OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
66 
67 	virtual ~OZipFileAccess();
68 
69 	::com::sun::star::uno::Sequence< ::rtl::OUString > GetPatternsFromString_Impl( const ::rtl::OUString& aString );
70 
71 	sal_Bool StringGoodForPattern_Impl( const ::rtl::OUString& aString,
72 										const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPattern );
73 
74 
75 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
76 
77 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
78 
79 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_staticCreateSelfInstance(
80 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
81 
82 
83 	// XInitialization
84     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
85 
86 	// XNameAccess
87     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
88     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException);
89     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
90     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
91     virtual sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
92 
93 	// XZipFileAccess
94     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getStreamByPattern( const ::rtl::OUString& aPattern ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
95 
96 	// XComponent
97     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
98     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
99     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
100 
101 	// XServiceInfo
102     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
103     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
104     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
105 
106 };
107 
108 #endif
109 
110