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 #ifndef _XMLOFF_XMLINDEXTOCCONTEXT_HXX_
25 #define _XMLOFF_XMLINDEXTOCCONTEXT_HXX_
26 
27 #include <xmloff/xmlictxt.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 
30 
31 namespace com { namespace sun { namespace star {
32 	namespace xml { namespace sax { class XAttributeList; } }
33 	namespace beans { class XPropertySet; }
34 } } }
35 namespace rtl {	class OUString; }
36 
37 
38 enum IndexTypeEnum
39 {
40 	TEXT_INDEX_TOC,
41 	TEXT_INDEX_ALPHABETICAL,
42 	TEXT_INDEX_TABLE,
43 	TEXT_INDEX_OBJECT,
44 	TEXT_INDEX_BIBLIOGRAPHY,
45 	TEXT_INDEX_USER,
46 	TEXT_INDEX_ILLUSTRATION,
47 
48 	TEXT_INDEX_UNKNOWN
49 };
50 
51 
52 /**
53  * Import all indices.
54  *
55  * Originally, this class would import only the TOC (table of
56  * content), but now it's role has been expanded to handle all
57  * indices, and hence is named inappropriately. Depending on the
58  * element name it decides which index source element context to create.
59  */
60 class XMLIndexTOCContext : public SvXMLImportContext
61 {
62 	const ::rtl::OUString sTitle;
63     const ::rtl::OUString sIsProtected;
64     const ::rtl::OUString sName;
65 
66 	/** XPropertySet of the index */
67 	::com::sun::star::uno::Reference<
68 		::com::sun::star::beans::XPropertySet> xTOCPropertySet;
69 
70 	enum IndexTypeEnum eIndexType;
71 
72 	sal_Bool bValid;
73 
74     SvXMLImportContextRef xBodyContextRef;
75 
76 public:
77 
78 	TYPEINFO();
79 
80 	XMLIndexTOCContext(
81 		SvXMLImport& rImport,
82 		sal_uInt16 nPrfx,
83 		const ::rtl::OUString& rLocalName );
84 
85 	~XMLIndexTOCContext();
86 
87 protected:
88 
89 	virtual void StartElement(
90 		const ::com::sun::star::uno::Reference<
91 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
92 
93 	virtual void EndElement();
94 
95 	virtual SvXMLImportContext *CreateChildContext(
96 		sal_uInt16 nPrefix,
97 		const ::rtl::OUString& rLocalName,
98 		const ::com::sun::star::uno::Reference<
99 			::com::sun::star::xml::sax::XAttributeList> & xAttrList );
100 };
101 
102 #endif
103