1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
30 #define _XMLOFF_XMLTEXTMARKIMPORTCONTEXT_HXX
31 
32 #include <xmloff/xmlictxt.hxx>
33 #include <com/sun/star/uno/Reference.h>
34 
35 
36 namespace com { namespace sun { namespace star {
37 	namespace text {
38 		class XTextRange;
39         class XTextContent;
40 	}
41 	namespace xml { namespace sax {
42 		class XAttributeList;
43 	} }
44 } } }
45 namespace rtl {
46 	class OUString;
47 }
48 class XMLTextImportHelper;
49 
50 class XMLFieldParamImportContext : public SvXMLImportContext
51 {
52 	XMLTextImportHelper& rHelper;
53 public:
54 	XMLFieldParamImportContext(
55 		SvXMLImport& rImport,
56 		XMLTextImportHelper& rHlp,
57 		sal_uInt16 nPrfx,
58 		const ::rtl::OUString& rLocalName );
59 
60 	virtual void StartElement(
61 		const ::com::sun::star::uno::Reference<
62 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
63 };
64 
65 
66 /**
67  * import bookmarks and reference marks
68  * ( <bookmark>, <bookmark-start>, <bookmark-end>,
69  *   <reference>, <reference-start>, <reference-end> )
70  *
71  * All elements are handled by the same class due to their similarities.
72  */
73 class XMLTextMarkImportContext : public SvXMLImportContext
74 {
75 
76     XMLTextImportHelper & m_rHelper;
77     ::rtl::OUString m_sBookmarkName;
78     ::rtl::OUString m_sFieldName;
79     ::rtl::OUString m_sXmlId;
80     // RDFa
81     bool m_bHaveAbout;
82     ::rtl::OUString m_sAbout;
83     ::rtl::OUString m_sProperty;
84     ::rtl::OUString m_sContent;
85     ::rtl::OUString m_sDatatype;
86 
87 public:
88 
89 	TYPEINFO();
90 
91 	XMLTextMarkImportContext(
92 		SvXMLImport& rImport,
93 		XMLTextImportHelper& rHlp,
94 		sal_uInt16 nPrfx,
95 		const ::rtl::OUString& rLocalName );
96 
97 protected:
98 
99 	virtual void StartElement(
100 		const ::com::sun::star::uno::Reference<
101 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
102 	virtual void EndElement();
103 
104     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
105                                                     const ::rtl::OUString& rLocalName,
106                                                     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
107 
108 public:
109     static ::com::sun::star::uno::Reference<
110             ::com::sun::star::text::XTextContent > CreateAndInsertMark(
111 		SvXMLImport& rImport,
112 		const ::rtl::OUString& sServiceName,
113 		const ::rtl::OUString& sMarkName,
114 		const ::com::sun::star::uno::Reference<
115 			::com::sun::star::text::XTextRange> & rRange,
116         const ::rtl::OUString& i_rXmlId = ::rtl::OUString());
117 
118     sal_Bool FindName(
119 		SvXMLImport& rImport,
120 		const ::com::sun::star::uno::Reference<
121         ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
122 };
123 
124 #endif
125