update dev300-m58
[ooovba.git] / package / inc / ZipPackageFolder.hxx
blob7ebe6682079c84a1f1ecc342efc0c044eaaef173
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ZipPackageFolder.hxx,v $
10 * $Revision: 1.39 $
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 ************************************************************************/
30 #ifndef _ZIP_PACKAGE_FOLDER_HXX
31 #define _ZIP_PACKAGE_FOLDER_HXX
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/container/XEnumerationAccess.hpp>
35 #include <com/sun/star/beans/StringPair.hpp>
36 #include <HashMaps.hxx>
37 #include <ZipPackageEntry.hxx>
38 #include <cppuhelper/implbase2.hxx>
40 namespace com { namespace sun { namespace star {
41 namespace beans
43 struct PropertyValue;
45 } } }
46 class ZipFile;
47 class ZipPackage;
48 class ZipOutputStream;
49 struct ZipEntry;
50 typedef void* rtlRandomPool;
52 class ZipPackageFolder : public cppu::ImplInheritanceHelper2
54 ZipPackageEntry,
55 ::com::sun::star::container::XNameContainer,
56 ::com::sun::star::container::XEnumerationAccess
59 static com::sun::star::uno::Sequence < sal_Int8 > aImplementationId;
61 protected:
62 ContentHash maContents;
63 const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
64 sal_Int16 m_nFormat;
65 ::rtl::OUString m_sVersion;
67 public:
69 ZipPackageFolder( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory,
70 sal_Int16 nFormat,
71 sal_Bool bAllowRemoveOnInsert );
72 virtual ~ZipPackageFolder();
74 ::rtl::OUString& GetVersion() { return m_sVersion; }
75 void SetVersion( const ::rtl::OUString& aVersion ) { m_sVersion = aVersion; }
77 void setChildStreamsTypeByExtension( const ::com::sun::star::beans::StringPair& aPair );
79 void doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent )
80 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
82 com::sun::star::packages::ContentInfo & doGetByName( const ::rtl::OUString& aName )
83 throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
85 static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource);
86 static ::com::sun::star::uno::Sequence < sal_Int8 > static_getImplementationId()
88 return aImplementationId;
91 void setPackageFormat_Impl( sal_Int16 nFormat ) { m_nFormat = nFormat; }
92 void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
94 // Recursive functions
95 void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
96 throw(::com::sun::star::uno::RuntimeException);
97 void releaseUpwardRef();
99 // XNameContainer
100 virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
101 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
102 virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
103 throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
105 // XEnumerationAccess
106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( )
107 throw(::com::sun::star::uno::RuntimeException);
109 // XElementAccess
110 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
111 throw(::com::sun::star::uno::RuntimeException);
112 virtual sal_Bool SAL_CALL hasElements( )
113 throw(::com::sun::star::uno::RuntimeException);
115 // XNameAccess
116 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
117 throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
118 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
119 throw(::com::sun::star::uno::RuntimeException);
120 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
121 throw(::com::sun::star::uno::RuntimeException);
123 // XNameReplace
124 virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
125 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
127 // XPropertySet
128 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
129 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
130 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
131 throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
133 // XUnoTunnel
134 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
135 throw(::com::sun::star::uno::RuntimeException);
137 // XServiceInfo
138 virtual ::rtl::OUString SAL_CALL getImplementationName( )
139 throw (::com::sun::star::uno::RuntimeException);
140 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
141 throw (::com::sun::star::uno::RuntimeException);
142 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
143 throw (::com::sun::star::uno::RuntimeException);
145 #endif