Get the style color and number just once
[LibreOffice.git] / include / oox / vml / vmlinputstream.hxx
blobdf074834f12880ce8cf28b51831b7b2af617a23e
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::sun::star {
32 namespace io { class XTextInputStream2; }
33 namespace uno { class XComponentContext; }
36 namespace oox::vml {
39 /** An input stream class for VML streams, implementing the UNO interface
40 com.sun.star.io.XInputStream needed by the Expat XML parsers.
42 This stream reads the data from the input stream passed to the constructor,
43 and parses all XML elements for features unsupported by the current Expat
44 XML parser:
46 1) All elements that have the form '<![inst]>' where 'inst' is any string
47 not containing the characters '<' and '>' are stripped from the input
48 stream.
50 2) Multiple occurrences of the same attribute in an element but the last
51 are removed.
53 3) Line breaks represented by a single <br> element (without matching
54 </br> element) are replaced by a literal LF character.
56 class InputStream final : public ::cppu::WeakImplHelper< css::io::XInputStream >
58 public:
59 explicit InputStream(
60 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
61 const css::uno::Reference< css::io::XInputStream >& rxInStrm );
62 virtual ~InputStream() override;
64 virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) override;
65 virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) override;
66 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
67 virtual sal_Int32 SAL_CALL available() override;
68 virtual void SAL_CALL closeInput() override;
70 private:
71 /// @throws css::io::IOException
72 /// @throws css::uno::RuntimeException
73 void updateBuffer();
74 /// @throws css::io::IOException
75 /// @throws css::uno::RuntimeException
76 OString readToElementBegin();
77 /// @throws css::io::IOException
78 /// @throws css::uno::RuntimeException
79 OString readToElementEnd();
81 private:
82 css::uno::Reference< css::io::XTextInputStream2 >
83 mxTextStrm;
84 css::uno::Sequence< sal_Unicode > maOpeningBracket;
85 css::uno::Sequence< sal_Unicode > maClosingBracket;
86 OString maBuffer;
87 sal_Int32 mnBufferPos;
91 } // namespace oox::vml
93 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */