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_XMLINDEXSOURCEBASECONTEXT_HXX_
25 #define _XMLOFF_XMLINDEXSOURCEBASECONTEXT_HXX_
26 
27 #include <xmloff/xmlictxt.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <rtl/ustring.hxx>
30 
31 
32 namespace com { namespace sun { namespace star {
33 	namespace xml { namespace sax { class XAttributeList; } }
34 	namespace beans { class XPropertySet; }
35 } } }
36 
37 enum IndexSourceParamEnum
38 {
39 	XML_TOK_INDEXSOURCE_OUTLINE_LEVEL,
40 	XML_TOK_INDEXSOURCE_USE_INDEX_MARKS,
41 	XML_TOK_INDEXSOURCE_INDEX_SCOPE,
42 	XML_TOK_INDEXSOURCE_RELATIVE_TABS,
43 	XML_TOK_INDEXSOURCE_USE_OTHER_OBJECTS,
44 	XML_TOK_INDEXSOURCE_USE_SHEET,
45 	XML_TOK_INDEXSOURCE_USE_CHART,
46 	XML_TOK_INDEXSOURCE_USE_DRAW,
47 	XML_TOK_INDEXSOURCE_USE_IMAGE,
48 	XML_TOK_INDEXSOURCE_USE_MATH,
49 	XML_TOK_INDEXSOURCE_MAIN_ENTRY_STYLE,
50 	XML_TOK_INDEXSOURCE_IGNORE_CASE,
51 	XML_TOK_INDEXSOURCE_SEPARATORS,
52 	XML_TOK_INDEXSOURCE_COMBINE_ENTRIES,
53 	XML_TOK_INDEXSOURCE_COMBINE_WITH_DASH,
54 	XML_TOK_INDEXSOURCE_KEYS_AS_ENTRIES,
55 	XML_TOK_INDEXSOURCE_COMBINE_WITH_PP,
56 	XML_TOK_INDEXSOURCE_CAPITALIZE,
57 	XML_TOK_INDEXSOURCE_USE_OBJECTS,
58 	XML_TOK_INDEXSOURCE_USE_GRAPHICS,
59 	XML_TOK_INDEXSOURCE_USE_TABLES,
60 	XML_TOK_INDEXSOURCE_USE_FRAMES,
61 	XML_TOK_INDEXSOURCE_COPY_OUTLINE_LEVELS,
62 	XML_TOK_INDEXSOURCE_USE_CAPTION,
63 	XML_TOK_INDEXSOURCE_SEQUENCE_NAME,
64 	XML_TOK_INDEXSOURCE_SEQUENCE_FORMAT,
65 	XML_TOK_INDEXSOURCE_COMMA_SEPARATED,
66 	XML_TOK_INDEXSOURCE_USE_INDEX_SOURCE_STYLES,
67     XML_TOK_INDEXSOURCE_SORT_ALGORITHM,
68     XML_TOK_INDEXSOURCE_LANGUAGE,
69     XML_TOK_INDEXSOURCE_COUNTRY,
70     XML_TOK_INDEXSOURCE_USER_INDEX_NAME,
71     XML_TOK_INDEXSOURCE_USE_OUTLINE_LEVEL
72 };
73 
74 
75 /**
76  * Superclass for index source elements
77  */
78 class XMLIndexSourceBaseContext : public SvXMLImportContext
79 {
80 	const ::rtl::OUString sCreateFromChapter;
81 	const ::rtl::OUString sIsRelativeTabstops;
82 
83 	sal_Bool bUseLevelFormats;
84 
85 	sal_Bool bChapterIndex;		/// chapter-wise or document index?
86 	sal_Bool bRelativeTabs;		/// tab stops relative to margin or indent?
87 
88 protected:
89 
90 	/// property set of index; must be accessible to subclasses
91 	::com::sun::star::uno::Reference<
92 		::com::sun::star::beans::XPropertySet> & rIndexPropertySet;
93 
94 public:
95 
96 	TYPEINFO();
97 
98 	XMLIndexSourceBaseContext(
99 		SvXMLImport& rImport,
100 		sal_uInt16 nPrfx,
101 		const ::rtl::OUString& rLocalName,
102 		::com::sun::star::uno::Reference<
103 			::com::sun::star::beans::XPropertySet> & rPropSet,
104 		sal_Bool bLevelFormats);
105 
106 	~XMLIndexSourceBaseContext();
107 
108 protected:
109 
110 	virtual void StartElement(
111 		const ::com::sun::star::uno::Reference<
112 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
113 
114 	virtual void ProcessAttribute(
115 		enum IndexSourceParamEnum eParam,
116 		const ::rtl::OUString& rValue);
117 
118 	virtual void EndElement();
119 
120 	virtual SvXMLImportContext* CreateChildContext(
121 		sal_uInt16 nPrefix,
122 		const ::rtl::OUString& rLocalName,
123 		const ::com::sun::star::uno::Reference<
124 			::com::sun::star::xml::sax::XAttributeList> & xAttrList );
125 };
126 
127 #endif
128