nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / core / inc / SwXMLBlockImport.hxx
blob178ab57b7b25fdf54841c75bb4b8624a854420f4
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_SW_SOURCE_CORE_INC_SWXMLBLOCKIMPORT_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWXMLBLOCKIMPORT_HXX
23 #include <xmloff/xmlimp.hxx>
24 #include <xmloff/xmlnamespace.hxx>
25 #include <com/sun/star/xml/sax/FastToken.hpp>
26 #include <sax/fastattribs.hxx>
27 #include <cppuhelper/implbase.hxx>
29 namespace com::sun::star::xml::sax { class XFastTokenHandler; }
31 using namespace css::xml::sax;
32 using namespace xmloff::token;
34 class SwXMLTextBlocks;
35 class SwXMLBlockListImport : public SvXMLImport
37 private:
38 SwXMLTextBlocks &rBlockList;
40 protected:
41 // This method is called after the namespace map has been updated, but
42 // before a context for the current element has been pushed.
43 virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element,
44 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
46 public:
47 SwXMLBlockListImport(
48 const css::uno::Reference< css::uno::XComponentContext >& rContext,
49 SwXMLTextBlocks &rBlocks );
51 SwXMLTextBlocks& getBlockList()
53 return rBlockList;
55 virtual ~SwXMLBlockListImport()
56 throw() override;
59 class SwXMLTextBlockImport : public SvXMLImport
61 protected:
62 // This method is called after the namespace map has been updated, but
63 // before a context for the current element has been pushed.
64 virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element,
65 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
67 public:
68 bool bTextOnly;
69 OUString &m_rText;
70 SwXMLTextBlockImport(
71 const css::uno::Reference< css::uno::XComponentContext >& rContext,
72 OUString &rNewText, bool bNewTextOnly );
74 virtual ~SwXMLTextBlockImport()
75 throw() override;
76 virtual void SAL_CALL endDocument() override;
79 enum SwXMLTextBlockToken : sal_Int32
81 OFFICE_BODY = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_BODY,
82 OFFICE_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_TEXT,
83 OFFICE_DOCUMENT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_DOCUMENT,
84 OFFICE_DOCUMENT_CONTENT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_DOCUMENT_CONTENT,
85 TEXT_P = FastToken::NAMESPACE | XML_NAMESPACE_TEXT | XML_P
88 class SwXMLTextBlockTokenHandler :
89 public sax_fastparser::FastTokenHandlerBase
91 public:
92 SwXMLTextBlockTokenHandler();
93 virtual ~SwXMLTextBlockTokenHandler() override;
95 //XFastTokenHandler
96 sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
97 css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
99 //Much fast direct C++ shortcut to the method that matters
100 virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
103 enum SwXMLBlockListToken : sal_Int32
105 ABBREVIATED_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_ABBREVIATED_NAME,
106 BLOCK = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK,
107 BLOCK_LIST = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK_LIST,
108 LIST_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_LIST_NAME,
109 NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_NAME,
110 PACKAGE_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_PACKAGE_NAME,
111 UNFORMATTED_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_UNFORMATTED_TEXT
114 class SwXMLBlockListTokenHandler :
115 public sax_fastparser::FastTokenHandlerBase
117 public:
118 SwXMLBlockListTokenHandler();
119 virtual ~SwXMLBlockListTokenHandler() override;
121 //XFastTokenHandler
122 sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
123 css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
125 //Much fast direct C++ shortcut to the method that matters
126 virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
129 #endif
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */