LibreOffice Module sw (master) 1
SwXMLBlockImport.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <xmloff/xmlimp.hxx>
24#include <xmloff/xmltoken.hxx>
25#include <com/sun/star/xml/sax/FastToken.hpp>
26#include <sax/fastattribs.hxx>
27
28namespace com::sun::star::xml::sax { class XFastTokenHandler; }
29
30using namespace css::xml::sax;
31using namespace xmloff::token;
32
33class SwXMLTextBlocks;
35{
36private:
38
39 // This method is called after the namespace map has been updated, but
40 // before a context for the current element has been pushed.
41 virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element,
42 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
43
44public:
46 const css::uno::Reference< css::uno::XComponentContext >& rContext,
47 SwXMLTextBlocks &rBlocks );
48
50 {
51 return m_rBlockList;
52 }
53 virtual ~SwXMLBlockListImport()
54 noexcept override;
55};
56
58{
59 // This method is called after the namespace map has been updated, but
60 // before a context for the current element has been pushed.
61 virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element,
62 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
63
64public:
66 OUString &m_rText;
68 const css::uno::Reference< css::uno::XComponentContext >& rContext,
69 OUString &rNewText, bool bNewTextOnly );
70
71 virtual ~SwXMLTextBlockImport()
72 noexcept override;
73 virtual void SAL_CALL endDocument() override;
74};
75
76enum SwXMLTextBlockToken : sal_Int32
77{
78 OFFICE_BODY = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_BODY,
79 OFFICE_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_TEXT,
82 TEXT_P = FastToken::NAMESPACE | XML_NAMESPACE_TEXT | XML_P
83};
84
87{
88public:
90 virtual ~SwXMLTextBlockTokenHandler() override;
91
92 //XFastTokenHandler
93 sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
94 css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
95
96 //Much fast direct C++ shortcut to the method that matters
97 virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
98};
99
100enum SwXMLBlockListToken : sal_Int32
101{
103 BLOCK = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK,
106 NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_NAME,
110
113{
114public:
116 virtual ~SwXMLBlockListTokenHandler() override;
117
118 //XFastTokenHandler
119 sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
120 css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
121
122 //Much fast direct C++ shortcut to the method that matters
123 virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
124};
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BLOCK
NAME
SwXMLTextBlockToken
@ OFFICE_DOCUMENT_CONTENT
@ OFFICE_DOCUMENT
@ OFFICE_BODY
@ TEXT_P
@ OFFICE_TEXT
SwXMLBlockListToken
@ PACKAGE_NAME
@ UNFORMATTED_TEXT
@ LIST_NAME
@ BLOCK_LIST
@ ABBREVIATED_NAME
virtual void SAL_CALL endDocument() override
virtual ~SwXMLBlockListImport() noexcept override
SwXMLTextBlocks & m_rBlockList
virtual SvXMLImportContext * CreateFastContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
SwXMLBlockListImport(const css::uno::Reference< css::uno::XComponentContext > &rContext, SwXMLTextBlocks &rBlocks)
SwXMLTextBlocks & getBlockList()
XML_BLOCK
XML_DOCUMENT
XML_PACKAGE_NAME
XML_TEXT
XML_NAME
XML_P
XML_BLOCK_LIST
XML_UNFORMATTED_TEXT
XML_BODY
XML_ABBREVIATED_NAME
XML_LIST_NAME
XML_DOCUMENT_CONTENT
constexpr sal_uInt16 XML_NAMESPACE_BLOCKLIST
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
sal_Int32 nLength