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 INCLUDED_PACKAGE_INC_ZIPPACKAGEFOLDER_HXX
20 #define INCLUDED_PACKAGE_INC_ZIPPACKAGEFOLDER_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 <com/sun/star/uno/XComponentContext.hpp>
26 #include <HashMaps.hxx>
27 #include <ZipPackageEntry.hxx>
28 #include <cppuhelper/implbase.hxx>
31 class ZipOutputStream
;
34 class ZipPackageFolder
: public cppu::ImplInheritanceHelper
37 css::container::XNameContainer
,
38 css::container::XEnumerationAccess
42 ContentHash maContents
;
47 ZipPackageFolder( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
49 bool bAllowRemoveOnInsert
);
50 virtual ~ZipPackageFolder() override
;
52 const OUString
& GetVersion() const { return m_sVersion
; }
53 void SetVersion( const OUString
& aVersion
) { m_sVersion
= aVersion
; }
55 bool LookForUnexpectedODF12Streams( const OUString
& aPath
);
57 void setChildStreamsTypeByExtension( const css::beans::StringPair
& aPair
);
59 /// @throws css::lang::IllegalArgumentException
60 /// @throws css::container::ElementExistException
61 /// @throws css::lang::WrappedTargetException
62 /// @throws css::uno::RuntimeException
63 void doInsertByName ( ZipPackageEntry
*pEntry
, bool bSetParent
);
65 ZipContentInfo
& doGetByName( const OUString
& aName
);
67 static css::uno::Sequence
< sal_Int8
> static_getImplementationId();
69 void setPackageFormat_Impl( sal_Int32 nFormat
) { m_nFormat
= nFormat
; }
70 void setRemoveOnInsertMode_Impl( bool bRemove
) { mbAllowRemoveOnInsert
= bRemove
; }
72 virtual bool saveChild( const OUString
&rPath
,
73 std::vector
< css::uno::Sequence
< css::beans::PropertyValue
> > &rManList
,
74 ZipOutputStream
& rZipOut
,
75 const css::uno::Sequence
< sal_Int8
>& rEncryptionKey
,
76 const rtlRandomPool
&rRandomPool
) override
;
78 // Recursive functions
79 /// @throws css::uno::RuntimeException
81 const OUString
&rPath
,
82 std::vector
< css::uno::Sequence
< css::beans::PropertyValue
> > &rManList
,
83 ZipOutputStream
& rZipOut
,
84 const css::uno::Sequence
< sal_Int8
> &rEncryptionKey
,
85 const rtlRandomPool
& rRandomPool
) const;
88 virtual void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
89 virtual void SAL_CALL
removeByName( const OUString
& Name
) override
;
92 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
createEnumeration( ) override
;
95 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
96 virtual sal_Bool SAL_CALL
hasElements( ) override
;
99 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
100 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames( ) override
;
101 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
104 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
107 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
108 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
111 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
114 virtual OUString SAL_CALL
getImplementationName( ) override
;
115 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
116 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */