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_ZIPOUTPUTENTRY_HXX
20 #define INCLUDED_PACKAGE_INC_ZIPOUTPUTENTRY_HXX
22 #include <com/sun/star/io/XOutputStream.hpp>
23 #include <com/sun/star/io/XTempFile.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/xml/crypto/XCipherContext.hpp>
27 #include <com/sun/star/xml/crypto/XDigestContext.hpp>
29 #include <package/Deflater.hxx>
34 class ZipPackageBuffer
;
35 class ZipPackageStream
;
39 // allow only DeflateThread to change m_bFinished using setFinished()
40 friend class DeflateThread
;
42 css::uno::Sequence
< sal_Int8
> m_aDeflateBuffer
;
43 ZipUtils::Deflater m_aDeflater
;
44 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
46 css::uno::Reference
< css::io::XOutputStream
> m_xOutStream
;
48 css::uno::Reference
< css::xml::crypto::XCipherContext
> m_xCipherContext
;
49 css::uno::Reference
< css::xml::crypto::XDigestContext
> m_xDigestContext
;
50 std::exception_ptr m_aParallelDeflateException
;
53 ZipEntry
*m_pCurrentEntry
;
54 sal_Int16 m_nDigested
;
55 ZipPackageStream
* m_pCurrentStream
;
56 bool const m_bEncryptCurrentEntry
;
57 std::atomic
<bool> m_bFinished
;
61 const css::uno::Reference
< css::io::XOutputStream
>& rxOutStream
,
62 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
63 ZipEntry
& rEntry
, ZipPackageStream
* pStream
, bool bEncrypt
);
67 /* This block of methods is for threaded zipping, where we compress to a temp stream, whose
68 data is retrieved via getData */
70 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
71 ZipEntry
& rEntry
, ZipPackageStream
* pStream
, bool bEncrypt
);
72 void createBufferFile();
73 void setParallelDeflateException(const std::exception_ptr
& exception
) { m_aParallelDeflateException
= exception
; }
74 css::uno::Reference
< css::io::XInputStream
> getData() const;
75 const std::exception_ptr
& getParallelDeflateException() const { return m_aParallelDeflateException
; }
76 void closeBufferFile();
77 void deleteBufferFile();
79 ZipEntry
* getZipEntry() { return m_pCurrentEntry
; }
80 ZipPackageStream
* getZipPackageStream() { return m_pCurrentStream
; }
81 bool isEncrypt() { return m_bEncryptCurrentEntry
; }
84 void write(const css::uno::Sequence
< sal_Int8
>& rBuffer
);
86 bool isFinished() const { return m_bFinished
; }
89 void setFinished() { m_bFinished
= true; }
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */