1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: zipfileaccess.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _ZIPFILEACCESS_HXX_
32 #define _ZIPFILEACCESS_HXX_
34 #include <com/sun/star/packages/zip/XZipFileAccess.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/container/XNameAccess.hpp>
41 #include <cppuhelper/interfacecontainer.h>
42 #include <cppuhelper/implbase5.hxx>
43 #include <osl/mutex.hxx>
45 #include <ZipFile.hxx>
46 #include <HashMaps.hxx>
48 class OZipFileAccess
: public ::cppu::WeakImplHelper5
<
49 ::com::sun::star::packages::zip::XZipFileAccess
,
50 ::com::sun::star::container::XNameAccess
,
51 ::com::sun::star::lang::XInitialization
,
52 ::com::sun::star::lang::XComponent
,
53 ::com::sun::star::lang::XServiceInfo
>
55 ::osl::Mutex m_aMutex
;
56 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
58 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xContentStream
;
61 ::cppu::OInterfaceContainerHelper
* m_pListenersContainer
;
66 OZipFileAccess( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
);
68 virtual ~OZipFileAccess();
70 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> GetPatternsFromString_Impl( const ::rtl::OUString
& aString
);
72 sal_Bool
StringGoodForPattern_Impl( const ::rtl::OUString
& aString
,
73 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aPattern
);
76 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
impl_staticGetSupportedServiceNames();
78 static ::rtl::OUString SAL_CALL
impl_staticGetImplementationName();
80 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
impl_staticCreateSelfInstance(
81 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xServiceManager
);
85 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
);
88 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
);
89 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
);
90 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);
91 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
);
92 virtual sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
);
95 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
);
98 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
103 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw (::com::sun::star::uno::RuntimeException
);
104 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
105 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);