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/.
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 <cppuhelper/implbase1.hxx>
25 #include <rtl/string.hxx>
27 namespace com
{ namespace sun
{ namespace star
{
28 namespace io
{ class XTextInputStream2
; }
29 namespace uno
{ class XComponentContext
; }
37 typedef ::cppu::WeakImplHelper1
< ::com::sun::star::io::XInputStream
> InputStream_BASE
;
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
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
50 2) Multiple occurrences of the same attribute in an element but the last
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
: public InputStream_BASE
60 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& rxInStrm
);
62 virtual ~InputStream();
64 virtual sal_Int32 SAL_CALL
readBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& rData
, sal_Int32 nBytesToRead
)
65 throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual sal_Int32 SAL_CALL
readSomeBytes( ::com::sun::star::uno::Sequence
< sal_Int8
>& rData
, sal_Int32 nMaxBytesToRead
)
67 throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
69 throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::BufferSizeExceededException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 virtual sal_Int32 SAL_CALL
available()
71 throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual void SAL_CALL
closeInput()
73 throw (::com::sun::star::io::NotConnectedException
, ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 void updateBuffer() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
77 OString
readToElementBegin() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
78 OString
readToElementEnd() throw (::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException
);
81 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XTextInputStream2
>
83 ::com::sun::star::uno::Sequence
< sal_Unicode
> maOpeningBracket
;
84 ::com::sun::star::uno::Sequence
< sal_Unicode
> maClosingBracket
;
85 const OString maOpeningCData
;
86 const OString maClosingCData
;
88 sal_Int32 mnBufferPos
;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */