Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_PACKAGE_INC_ZIPOUTPUTENTRY_HXX
20 : #define INCLUDED_PACKAGE_INC_ZIPOUTPUTENTRY_HXX
21 :
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>
28 :
29 : #include <package/Deflater.hxx>
30 : #include <CRC32.hxx>
31 :
32 : struct ZipEntry;
33 : class ZipPackageBuffer;
34 : class ZipPackageStream;
35 :
36 : class ZipOutputEntry
37 : {
38 : ::com::sun::star::uno::Sequence< sal_Int8 > m_aDeflateBuffer;
39 : ZipUtils::Deflater m_aDeflater;
40 : css::uno::Reference< css::io::XTempFile > m_xTempFile;
41 : css::uno::Reference< css::io::XOutputStream > m_xOutStream;
42 :
43 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
44 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext;
45 : ::css::uno::Any m_aParallelDeflateException;
46 :
47 : CRC32 m_aCRC;
48 : ZipEntry *m_pCurrentEntry;
49 : sal_Int16 m_nDigested;
50 : bool m_bEncryptCurrentEntry;
51 : ZipPackageStream* m_pCurrentStream;
52 :
53 : public:
54 : ZipOutputEntry(
55 : const css::uno::Reference< css::io::XOutputStream >& rxOutStream,
56 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
57 : ZipEntry& rEntry, ZipPackageStream* pStream, bool bEncrypt = false);
58 :
59 : ~ZipOutputEntry();
60 :
61 : css::uno::Reference< css::io::XInputStream > getData();
62 88 : ZipEntry* getZipEntry() { return m_pCurrentEntry; }
63 44 : ZipPackageStream* getZipPackageStream() { return m_pCurrentStream; }
64 88 : bool isEncrypt() { return m_bEncryptCurrentEntry; }
65 :
66 0 : void setParallelDeflateException(const ::css::uno::Any &rAny) { m_aParallelDeflateException = rAny; }
67 44 : ::css::uno::Any getParallelDeflateException() const { return m_aParallelDeflateException; }
68 :
69 : void closeEntry();
70 : void write(const css::uno::Sequence< sal_Int8 >& rBuffer);
71 :
72 : private:
73 : void doDeflate();
74 : };
75 :
76 : #endif
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|