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>
23 #include <xmloff/xmlnamespace.hxx>
24 #include <com/sun/star/xml/sax/FastToken.hpp>
25 #include <sax/fastattribs.hxx>
26 
27 namespace com::sun::star::xml::sax { class XFastTokenHandler; }
28 
29 using namespace css::xml::sax;
30 using namespace xmloff::token;
31 
32 class SwXMLTextBlocks;
34 {
35 private:
37 
38 protected:
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 
44 public:
46  const css::uno::Reference< css::uno::XComponentContext >& rContext,
47  SwXMLTextBlocks &rBlocks );
48 
50  {
51  return m_rBlockList;
52  }
53  virtual ~SwXMLBlockListImport()
54  throw() override;
55 };
56 
58 {
59 protected:
60  // This method is called after the namespace map has been updated, but
61  // before a context for the current element has been pushed.
62  virtual SvXMLImportContext* CreateFastContext( sal_Int32 Element,
63  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
64 
65 public:
67  OUString &m_rText;
69  const css::uno::Reference< css::uno::XComponentContext >& rContext,
70  OUString &rNewText, bool bNewTextOnly );
71 
72  virtual ~SwXMLTextBlockImport()
73  throw() override;
74  virtual void SAL_CALL endDocument() override;
75 };
76 
77 enum SwXMLTextBlockToken : sal_Int32
78 {
79  OFFICE_BODY = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_BODY,
80  OFFICE_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_TEXT,
83  TEXT_P = FastToken::NAMESPACE | XML_NAMESPACE_TEXT | XML_P
84 };
85 
88 {
89 public:
91  virtual ~SwXMLTextBlockTokenHandler() override;
92 
93  //XFastTokenHandler
94  sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
95  css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
96 
97  //Much fast direct C++ shortcut to the method that matters
98  virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
99 };
100 
101 enum SwXMLBlockListToken : sal_Int32
102 {
104  BLOCK = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_BLOCK,
106  LIST_NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_LIST_NAME,
107  NAME = FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST | XML_NAME,
110 };
111 
114 {
115 public:
117  virtual ~SwXMLBlockListTokenHandler() override;
118 
119  //XFastTokenHandler
120  sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override;
121  css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 Token ) override;
122 
123  //Much fast direct C++ shortcut to the method that matters
124  virtual sal_Int32 getTokenDirect( const char *pTag, sal_Int32 nLength ) const override;
125 };
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
NAME
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
XML_NAME
XML_UNFORMATTED_TEXT
XML_ABBREVIATED_NAME
XML_BODY
SwXMLTextBlocks & m_rBlockList
XML_PACKAGE_NAME
constexpr sal_uInt16 XML_NAMESPACE_BLOCKLIST
XML_LIST_NAME
constexpr sal_uInt16 XML_NAMESPACE_TEXT
SwXMLTextBlockToken
XML_TEXT
SwXMLTextBlocks & getBlockList()
SwXMLBlockListToken
XML_BLOCK_LIST
XML_DOCUMENT
XML_DOCUMENT_CONTENT
XML_BLOCK
XML_P
sal_Int32 nLength
BLOCK