Bump version to 6.4-15
[LibreOffice.git] / include / oox / vml / vmlinputstream.hxx
blobf9b40ec71d779b53091de7861d66fe06e686ba4b
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 .
20 #ifndef INCLUDED_OOX_VML_VMLINPUTSTREAM_HXX
21 #define INCLUDED_OOX_VML_VMLINPUTSTREAM_HXX
23 #include <com/sun/star/io/XInputStream.hpp>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <cppuhelper/implbase.hxx>
28 #include <rtl/string.hxx>
29 #include <sal/types.h>
31 namespace com { namespace sun { namespace star {
32 namespace io { class XTextInputStream2; }
33 namespace uno { class XComponentContext; }
34 } } }
36 namespace oox {
37 namespace vml {
40 /** An input stream class for VML streams, implementing the UNO interface
41 com.sun.star.io.XInputStream needed by the Expat XML parsers.
43 This stream reads the data from the input stream passed to the constructor,
44 and parses all XML elements for features unsupported by the current Expat
45 XML parser:
47 1) All elements that have the form '<![inst]>' where 'inst' is any string
48 not containing the characters '<' and '>' are stripped from the input
49 stream.
51 2) Multiple occurrences of the same attribute in an element but the last
52 are removed.
54 3) Line breaks represented by a single <br> element (without matching
55 </br> element) are replaced by a literal LF character.
57 class InputStream final : public ::cppu::WeakImplHelper< css::io::XInputStream >
59 public:
60 explicit InputStream(
61 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
62 const css::uno::Reference< css::io::XInputStream >& rxInStrm );
63 virtual ~InputStream() override;
65 virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) override;
66 virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) override;
67 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
68 virtual sal_Int32 SAL_CALL available() override;
69 virtual void SAL_CALL closeInput() override;
71 private:
72 /// @throws css::io::IOException
73 /// @throws css::uno::RuntimeException
74 void updateBuffer();
75 /// @throws css::io::IOException
76 /// @throws css::uno::RuntimeException
77 OString readToElementBegin();
78 /// @throws css::io::IOException
79 /// @throws css::uno::RuntimeException
80 OString readToElementEnd();
82 private:
83 css::uno::Reference< css::io::XTextInputStream2 >
84 mxTextStrm;
85 css::uno::Sequence< sal_Unicode > maOpeningBracket;
86 css::uno::Sequence< sal_Unicode > maClosingBracket;
87 OString maBuffer;
88 sal_Int32 mnBufferPos;
92 } // namespace vml
93 } // namespace oox
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */