1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
26 #define _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
27 
28 #include <xmloff/xmlictxt.hxx>
29 #include <com/sun/star/uno/Reference.h>
30 
31 
32 namespace com { namespace sun { namespace star {
33 	namespace text {
34 		class XTextRange;
35         class XTextContent;
36 	}
37 	namespace xml { namespace sax {
38 		class XAttributeList;
39 	} }
40 } } }
41 namespace rtl {
42 	class OUString;
43 }
44 class XMLTextImportHelper;
45 
46 class XMLFieldParamImportContext : public SvXMLImportContext
47 {
48 	XMLTextImportHelper& rHelper;
49 public:
50 	XMLFieldParamImportContext(
51 		SvXMLImport& rImport,
52 		XMLTextImportHelper& rHlp,
53 		sal_uInt16 nPrfx,
54 		const ::rtl::OUString& rLocalName );
55 
56 	virtual void StartElement(
57 		const ::com::sun::star::uno::Reference<
58 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
59 };
60 
61 
62 /**
63  * import bookmarks and reference marks
64  * ( <bookmark>, <bookmark-start>, <bookmark-end>,
65  *   <reference>, <reference-start>, <reference-end> )
66  *
67  * All elements are handled by the same class due to their similarities.
68  */
69 class XMLTextMarkImportContext : public SvXMLImportContext
70 {
71 
72     XMLTextImportHelper & m_rHelper;
73     ::rtl::OUString m_sBookmarkName;
74     ::rtl::OUString m_sFieldName;
75     ::rtl::OUString m_sXmlId;
76     // RDFa
77     bool m_bHaveAbout;
78     ::rtl::OUString m_sAbout;
79     ::rtl::OUString m_sProperty;
80     ::rtl::OUString m_sContent;
81     ::rtl::OUString m_sDatatype;
82 
83 public:
84 
85 	TYPEINFO();
86 
87 	XMLTextMarkImportContext(
88 		SvXMLImport& rImport,
89 		XMLTextImportHelper& rHlp,
90 		sal_uInt16 nPrfx,
91 		const ::rtl::OUString& rLocalName );
92 
93 protected:
94 
95 	virtual void StartElement(
96 		const ::com::sun::star::uno::Reference<
97 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
98 	virtual void EndElement();
99 
100     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
101                                                     const ::rtl::OUString& rLocalName,
102                                                     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
103 
104 public:
105     static ::com::sun::star::uno::Reference<
106             ::com::sun::star::text::XTextContent > CreateAndInsertMark(
107 		SvXMLImport& rImport,
108 		const ::rtl::OUString& sServiceName,
109 		const ::rtl::OUString& sMarkName,
110 		const ::com::sun::star::uno::Reference<
111 			::com::sun::star::text::XTextRange> & rRange,
112         const ::rtl::OUString& i_rXmlId = ::rtl::OUString());
113 
114     sal_Bool FindName(
115 		SvXMLImport& rImport,
116 		const ::com::sun::star::uno::Reference<
117         ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
118 };
119 
120 #endif
121