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 
21 #ifndef INCLUDED_XMLOFF_SOURCE_TEXT_XMLTEXTMARKIMPORTCONTEXT_HXX
22 #define INCLUDED_XMLOFF_SOURCE_TEXT_XMLTEXTMARKIMPORTCONTEXT_HXX
23 
24 #include <xmloff/xmlictxt.hxx>
25 #include <com/sun/star/uno/Reference.h>
26 
27 
28 namespace com { namespace sun { namespace star {
29     namespace text {
30         class XTextRange;
31         class XTextContent;
32     }
33     namespace xml { namespace sax {
34         class XAttributeList;
35     } }
36 } } }
37 class XMLTextImportHelper;
38 
39 class XMLFieldParamImportContext : public SvXMLImportContext
40 {
41     XMLTextImportHelper& rHelper;
42 public:
43     XMLFieldParamImportContext(
44         SvXMLImport& rImport,
45         XMLTextImportHelper& rHlp,
46         sal_uInt16 nPrfx,
47         const OUString& rLocalName );
48 
49     virtual void StartElement(
50         const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
51 };
52 
53 
54 /**
55  * import bookmarks and reference marks
56  * ( <bookmark>, <bookmark-start>, <bookmark-end>,
57  *   <reference>, <reference-start>, <reference-end> )
58  *
59  * All elements are handled by the same class due to their similarities.
60  */
61 class XMLTextMarkImportContext : public SvXMLImportContext
62 {
63 private:
64     XMLTextImportHelper & m_rHelper;
65 
66     css::uno::Reference<css::uno::XInterface> & m_rxCrossRefHeadingBookmark;
67 
68     OUString m_sBookmarkName;
69     OUString m_sFieldName;
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;
77 
78 public:
79 
80     XMLTextMarkImportContext(
81         SvXMLImport& rImport,
82         XMLTextImportHelper& rHlp,
83         css::uno::Reference<css::uno::XInterface> & io_rxCrossRefHeadingBookmark,
84         sal_uInt16 nPrfx,
85         const OUString& rLocalName );
86 
87 protected:
88 
89     virtual void StartElement(
90         const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
91     virtual void EndElement() override;
92 
93     virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
94                                                     const OUString& rLocalName,
95                                                     const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
96 
97 public:
98     static css::uno::Reference< css::text::XTextContent > CreateAndInsertMark(
99         SvXMLImport& rImport,
100         const OUString& sServiceName,
101         const OUString& sMarkName,
102         const css::uno::Reference<css::text::XTextRange> & rRange,
103         const OUString& i_rXmlId = OUString());
104 
105     bool FindName(
106         SvXMLImport& rImport,
107         const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList);
108 };
109 
110 #endif
111 
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
113