tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / package / source / zipapi / XUnbufferedStream.hxx
blobf3efe0aaecceefd864daa17830dd3fb1d1db700b
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_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
20 #define INCLUDED_PACKAGE_SOURCE_ZIPAPI_XUNBUFFEREDSTREAM_HXX
22 #include <optional>
24 #include <com/sun/star/io/XSeekable.hpp>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/xml/crypto/XCipherContext.hpp>
28 #include <comphelper/refcountedmutex.hxx>
29 #include <cppuhelper/implbase.hxx>
30 #include <rtl/ref.hxx>
31 #include <package/Inflater.hxx>
32 #include <ZipEntry.hxx>
33 #include <CRC32.hxx>
35 namespace com::sun::star::uno {
36 class XComponentContext;
39 #define UNBUFF_STREAM_DATA 0
40 #define UNBUFF_STREAM_RAW 1
41 #define UNBUFF_STREAM_WRAPPEDRAW 2
43 class EncryptionData;
44 class XUnbufferedStream final : public cppu::WeakImplHelper
46 css::io::XInputStream
49 rtl::Reference<comphelper::RefCountedMutex> maMutexHolder;
51 css::uno::Reference < css::io::XInputStream > mxZipStream;
52 css::uno::Reference < css::io::XSeekable > mxZipSeek;
53 css::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
54 ZipEntry maEntry;
55 sal_Int32 mnBlockSize;
56 css::uno::Reference< css::xml::crypto::XCipherContext > m_xCipherContext;
57 ZipUtils::Inflater maInflater;
58 bool mbRawStream, mbWrappedRaw;
59 sal_Int16 mnHeaderToRead;
60 sal_Int64 mnZipCurrent, mnZipEnd, mnZipSize, mnMyCurrent;
61 CRC32 maCRC;
62 bool mbCheckCRC;
64 public:
65 XUnbufferedStream(
66 const css::uno::Reference< css::uno::XComponentContext >& xContext,
67 rtl::Reference<comphelper::RefCountedMutex> aMutexHolder,
68 ZipEntry const & rEntry,
69 css::uno::Reference < css::io::XInputStream > const & xNewZipStream,
70 const ::rtl::Reference< EncryptionData >& rData,
71 sal_Int8 nStreamMode,
72 ::std::optional<sal_Int64> oDecryptedSize,
73 const OUString& aMediaType,
74 bool bRecoveryMode );
76 // allows to read package raw stream
77 XUnbufferedStream(
78 rtl::Reference<comphelper::RefCountedMutex> aMutexHolder,
79 const css::uno::Reference < css::io::XInputStream >& xRawStream,
80 const ::rtl::Reference< EncryptionData >& rData );
82 sal_Int64 getSize() const { return mnZipSize; }
84 virtual ~XUnbufferedStream() override;
86 // XInputStream
87 virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override;
88 virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) override;
89 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
90 virtual sal_Int32 SAL_CALL available( ) override;
91 virtual void SAL_CALL closeInput( ) override;
93 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */