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