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