xref: /aoo42x/main/package/inc/zipfileaccess.hxx (revision f319bb99)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _ZIPFILEACCESS_HXX_
25 #define _ZIPFILEACCESS_HXX_
26 
27 #include <com/sun/star/packages/zip/XZipFileAccess.hpp>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 
34 #include <cppuhelper/interfacecontainer.h>
35 #include <cppuhelper/implbase5.hxx>
36 
37 #include <mutexholder.hxx>
38 
39 #include <ZipFile.hxx>
40 #include <HashMaps.hxx>
41 
42 class OZipFileAccess : public ::cppu::WeakImplHelper5<
43 						::com::sun::star::packages::zip::XZipFileAccess,
44 						::com::sun::star::container::XNameAccess,
45 						::com::sun::star::lang::XInitialization,
46 						::com::sun::star::lang::XComponent,
47 						::com::sun::star::lang::XServiceInfo >
48 {
49     SotMutexHolderRef m_aMutexHolder;
50 
51 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
52 
53 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xContentStream;
54 	ZipFile* m_pZipFile;
55 
56 	::cppu::OInterfaceContainerHelper* m_pListenersContainer;
57 
58 	sal_Bool m_bDisposed;
59 
60 public:
61 	OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
62 
63 	virtual ~OZipFileAccess();
64 
65 	::com::sun::star::uno::Sequence< ::rtl::OUString > GetPatternsFromString_Impl( const ::rtl::OUString& aString );
66 
67 	sal_Bool StringGoodForPattern_Impl( const ::rtl::OUString& aString,
68 										const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPattern );
69 
70 
71 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
72 
73 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
74 
75 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_staticCreateSelfInstance(
76 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
77 
78 
79 	// XInitialization
80     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);
81 
82 	// XNameAccess
83     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);
84     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException);
85     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
86     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
87     virtual sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
88 
89 	// XZipFileAccess
90     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);
91 
92 	// XComponent
93     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
94     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
95     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
96 
97 	// XServiceInfo
98     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
99     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
100     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
101 
102 };
103 
104 #endif
105 
106