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/.
12 #include <librevenge-stream/librevenge-stream.h>
13 #include <com/sun/star/uno/Reference.h>
14 #include <tools/long.hxx>
15 #include "writerperfectdllapi.h"
17 #include <tools/stream.hxx>
18 #include <sot/storage.hxx>
20 namespace com::sun::star::io
26 namespace writerperfect
28 struct OLEStorageImpl
;
29 struct ZipStorageImpl
;
31 class SAL_DLLPUBLIC_RTTI WPXSvInputStream final
: public librevenge::RVNGInputStream
34 WRITERPERFECT_DLLPUBLIC
35 WPXSvInputStream(css::uno::Reference
<css::io::XInputStream
> const& xStream
);
36 WRITERPERFECT_DLLPUBLIC
virtual ~WPXSvInputStream() override
;
38 virtual bool isStructured() override
;
39 virtual unsigned subStreamCount() override
;
40 virtual const char* subStreamName(unsigned id
) override
;
41 virtual bool existsSubStream(const char* name
) override
;
42 virtual librevenge::RVNGInputStream
* getSubStreamByName(const char* name
) override
;
43 virtual librevenge::RVNGInputStream
* getSubStreamById(unsigned id
) override
;
45 WRITERPERFECT_DLLPUBLIC
virtual const unsigned char* read(unsigned long numBytes
,
46 unsigned long& numBytesRead
) override
;
47 WRITERPERFECT_DLLPUBLIC
virtual int seek(long offset
,
48 librevenge::RVNG_SEEK_TYPE seekType
) override
;
49 virtual long tell() override
;
50 virtual bool isEnd() override
;
53 tools::Long
tellImpl();
54 int seek(tools::Long offset
);
56 void ensureOLEIsInitialized();
58 void ensureZipIsInitialized();
59 static librevenge::RVNGInputStream
*
60 createWPXStream(const rtl::Reference
<SotStorageStream
>& rxStorage
);
61 static librevenge::RVNGInputStream
*
62 createWPXStream(const css::uno::Reference
<css::io::XInputStream
>& rxStream
);
64 css::uno::Reference
<css::io::XInputStream
> mxStream
;
65 css::uno::Reference
<css::io::XSeekable
> mxSeekable
;
66 css::uno::Sequence
<sal_Int8
> maData
;
67 std::unique_ptr
<OLEStorageImpl
> mpOLEStorage
;
68 std::unique_ptr
<ZipStorageImpl
> mpZipStorage
;
70 unsigned long mnReadBufferPos
;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */