Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / package / inc / ZipPackageFolder.hxx
blobe638cc6a11121a749fde16ecbad5e5f2e20683b9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
29 #include <vector>
31 class ZipOutputStream;
32 struct ZipEntry;
34 class ZipPackageFolder : public cppu::ImplInheritanceHelper
36 ZipPackageEntry,
37 css::container::XNameContainer,
38 css::container::XEnumerationAccess
41 private:
42 ContentHash maContents;
43 OUString m_sVersion;
45 public:
47 ZipPackageFolder( const css::uno::Reference < css::uno::XComponentContext >& xContext,
48 sal_Int32 nFormat,
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
80 void saveContents(
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;
87 // XNameContainer
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;
91 // XEnumerationAccess
92 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
94 // XElementAccess
95 virtual css::uno::Type SAL_CALL getElementType( ) override;
96 virtual sal_Bool SAL_CALL hasElements( ) override;
98 // XNameAccess
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;
103 // XNameReplace
104 virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
106 // XPropertySet
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;
110 // XUnoTunnel
111 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
113 // XServiceInfo
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;
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */