1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _ZIP_PACKAGE_FOLDER_HXX
20 #define _ZIP_PACKAGE_FOLDER_HXX
22 #include <com/sun/star/container/XNameContainer.hpp>
23 #include <com/sun/star/container/XEnumerationAccess.hpp>
24 #include <com/sun/star/beans/StringPair.hpp>
25 #include <HashMaps.hxx>
26 #include <ZipPackageEntry.hxx>
27 #include <cppuhelper/implbase2.hxx>
30 namespace com
{ namespace sun
{ namespace star
{
41 class ZipOutputStream
;
43 typedef void* rtlRandomPool
;
45 class ZipPackageFolder
: public cppu::ImplInheritanceHelper2
48 ::com::sun::star::container::XNameContainer
,
49 ::com::sun::star::container::XEnumerationAccess
53 ContentHash maContents
;
59 ZipPackageFolder( sal_Int32 nFormat
,
60 sal_Bool bAllowRemoveOnInsert
);
61 virtual ~ZipPackageFolder();
63 OUString
& GetVersion() { return m_sVersion
; }
64 void SetVersion( const OUString
& aVersion
) { m_sVersion
= aVersion
; }
66 sal_Bool
LookForUnexpectedODF12Streams( const OUString
& aPath
);
68 void setChildStreamsTypeByExtension( const ::com::sun::star::beans::StringPair
& aPair
);
70 void doInsertByName ( ZipPackageEntry
*pEntry
, sal_Bool bSetParent
)
71 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
73 com::sun::star::packages::ContentInfo
& doGetByName( const OUString
& aName
)
74 throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
76 static void copyZipEntry( ZipEntry
&rDest
, const ZipEntry
&rSource
);
77 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& static_getImplementationId();
79 void setPackageFormat_Impl( sal_Int32 nFormat
) { m_nFormat
= nFormat
; }
80 void setRemoveOnInsertMode_Impl( sal_Bool bRemove
) { this->mbAllowRemoveOnInsert
= bRemove
; }
82 bool saveChild(const OUString
&rShortName
, const com::sun::star::packages::ContentInfo
&rInfo
, OUString
&rPath
, std::vector
< com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> > &rManList
, ZipOutputStream
& rZipOut
, const com::sun::star::uno::Sequence
< sal_Int8
>& rEncryptionKey
, rtlRandomPool
& rRandomPool
);
84 // Recursive functions
85 void saveContents(OUString
&rPath
, std::vector
< com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> > &rManList
, ZipOutputStream
& rZipOut
, const com::sun::star::uno::Sequence
< sal_Int8
> &rEncryptionKey
, rtlRandomPool
& rRandomPool
)
86 throw(::com::sun::star::uno::RuntimeException
);
87 void releaseUpwardRef();
90 virtual void SAL_CALL
insertByName( const OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
91 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
92 virtual void SAL_CALL
removeByName( const OUString
& Name
)
93 throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
createEnumeration( )
97 throw(::com::sun::star::uno::RuntimeException
);
100 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( )
101 throw(::com::sun::star::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
hasElements( )
103 throw(::com::sun::star::uno::RuntimeException
);
106 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
107 throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames( )
109 throw(::com::sun::star::uno::RuntimeException
);
110 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
111 throw(::com::sun::star::uno::RuntimeException
);
114 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
115 throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
118 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
119 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
);
120 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
121 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
124 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
)
125 throw(::com::sun::star::uno::RuntimeException
);
128 virtual OUString SAL_CALL
getImplementationName( )
129 throw (::com::sun::star::uno::RuntimeException
);
130 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
131 throw (::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
133 throw (::com::sun::star::uno::RuntimeException
);
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */