tdf#161411 - UI: Add Better wording for ASCII-only characters
[LibreOffice.git] / include / oox / core / fastparser.hxx
blobc3a85ef1f8548787a93c908519989c45cd0eb697
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_CORE_FASTPARSER_HXX
21 #define INCLUDED_OOX_CORE_FASTPARSER_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <rtl/ustring.hxx>
25 #include <rtl/ref.hxx>
26 #include <sal/types.h>
27 #include <oox/dllapi.h>
29 namespace com::sun::star {
30 namespace io { class XInputStream; }
31 namespace xml::sax { class XFastDocumentHandler; }
32 namespace xml::sax { class XFastTokenHandler; }
33 namespace xml::sax { struct InputSource; }
36 namespace oox {
37 struct NamespaceMap;
38 class StorageBase;
41 namespace sax_fastparser {
42 class FastSaxParser;
45 namespace oox::core {
48 /** Wrapper for a fast SAX parser that works on automatically generated OOXML
49 token and namespace identifiers.
51 class OOX_DLLPUBLIC FastParser
53 public:
54 /// @throws css::uno::RuntimeException
55 explicit FastParser();
57 FastParser(const FastParser&) = delete;
58 FastParser& operator=(const FastParser&) = delete;
60 ~FastParser();
62 /** Registers an OOXML namespace at the parser.
63 @throws css::lang::IllegalArgumentException
64 @throws css::uno::RuntimeException
66 void registerNamespace( sal_Int32 nNamespaceId );
68 /** Sets the passed document handler that will receive the SAX parser events.
69 @throws css::uno::RuntimeException
71 void setDocumentHandler(
72 const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& rxDocHandler );
74 void clearDocumentHandler();
76 /** Parses the passed SAX input source.
77 @param bCloseStream True = closes the stream in the input source after parsing.
78 @throws css::xml::sax::SAXException
79 @throws css::io::IOException
80 @throws css::uno::RuntimeException
82 void parseStream( const css::xml::sax::InputSource& rInputSource, bool bCloseStream = false );
84 /** Parses the passed input stream.
85 @param bCloseStream True = closes the passed stream after parsing.
86 @throws css::xml::sax::SAXException
87 @throws css::io::IOException
88 @throws css::uno::RuntimeException
90 void parseStream(
91 const css::uno::Reference< css::io::XInputStream >& rxInStream,
92 const OUString& rStreamName );
94 /** Parses a stream from the passed storage with the specified name.
95 @param bCloseStream True = closes the stream after parsing.
96 @throws css::xml::sax::SAXException
97 @throws css::io::IOException
98 @throws css::uno::RuntimeException
100 void parseStream( StorageBase& rStorage, const OUString& rStreamName );
102 const css::uno::Reference< css::xml::sax::XFastTokenHandler >&
103 getTokenHandler() const { return mxTokenHandler; }
105 private:
106 css::uno::Reference<css::xml::sax::XFastTokenHandler> mxTokenHandler;
107 const NamespaceMap& mrNamespaceMap;
108 rtl::Reference<sax_fastparser::FastSaxParser> mxParser;
112 } // namespace oox::core
114 #endif
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */