Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / text / XMLTextMarkImportContext.hxx
blobda05f524083e41577dc9fb143b460a0fcfd61adf
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 .
21 #pragma once
23 #include <xmloff/xmlictxt.hxx>
24 #include <com/sun/star/uno/Reference.h>
27 namespace com::sun::star {
28 namespace text {
29 class XTextRange;
30 class XTextContent;
32 namespace xml::sax {
33 class XAttributeList;
36 class XMLTextImportHelper;
38 class XMLFieldParamImportContext : public SvXMLImportContext
40 XMLTextImportHelper& rHelper;
41 public:
42 XMLFieldParamImportContext(
43 SvXMLImport& rImport,
44 XMLTextImportHelper& rHlp );
46 virtual void SAL_CALL startFastElement(
47 sal_Int32 nElement,
48 const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
52 /**
53 * import bookmarks and reference marks
54 * ( <bookmark>, <bookmark-start>, <bookmark-end>,
55 * <reference>, <reference-start>, <reference-end> )
57 * All elements are handled by the same class due to their similarities.
59 class XMLTextMarkImportContext final : public SvXMLImportContext
61 private:
62 XMLTextImportHelper & m_rHelper;
64 css::uno::Reference<css::uno::XInterface> & m_rxCrossRefHeadingBookmark;
66 OUString m_sBookmarkName;
67 OUString m_sFieldName;
68 bool m_isHidden;
69 OUString m_sCondition;
70 OUString m_sXmlId;
71 // RDFa
72 bool m_bHaveAbout;
73 OUString m_sAbout;
74 OUString m_sProperty;
75 OUString m_sContent;
76 OUString m_sDatatype;
78 public:
80 XMLTextMarkImportContext(
81 SvXMLImport& rImport,
82 XMLTextImportHelper& rHlp,
83 css::uno::Reference<css::uno::XInterface> & io_rxCrossRefHeadingBookmark );
85 virtual void SAL_CALL startFastElement( sal_Int32 nElement,
86 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
87 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
89 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
90 sal_Int32 nElement,
91 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
93 public:
94 static css::uno::Reference< css::text::XTextContent > CreateAndInsertMark(
95 SvXMLImport& rImport,
96 const OUString& sServiceName,
97 const OUString& sMarkName,
98 const css::uno::Reference<css::text::XTextRange> & rRange,
99 const OUString& i_rXmlId = OUString(),
100 bool const isFieldmarkSeparatorMissing = false);
102 bool FindName(
103 const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList);
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */