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_XMLLINENUMBERINGIMPORTCONTEXT_HXX_
29 #define _XMLOFF_XMLLINENUMBERINGIMPORTCONTEXT_HXX_
30 
31 #include <xmloff/xmlstyle.hxx>
32 #include <rtl/ustring.hxx>
33 #include <com/sun/star/uno/Reference.h>
34 
35 namespace com { namespace sun { namespace star {
36 	namespace xml { namespace sax { class XAttributeList; } }
37 } } }
38 
39 
40 enum LineNumberingToken
41 {
42 	XML_TOK_LINENUMBERING_STYLE_NAME,
43 	XML_TOK_LINENUMBERING_NUMBER_LINES,
44 	XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES,
45 	XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES,
46 	XML_TOK_LINENUMBERING_RESTART_NUMBERING,
47 	XML_TOK_LINENUMBERING_OFFSET,
48 	XML_TOK_LINENUMBERING_NUM_FORMAT,
49 	XML_TOK_LINENUMBERING_NUM_LETTER_SYNC,
50 	XML_TOK_LINENUMBERING_NUMBER_POSITION,
51 	XML_TOK_LINENUMBERING_INCREMENT
52 //	XML_TOK_LINENUMBERING_LINENUMBERING_CONFIGURATION,
53 //	XML_TOK_LINENUMBERING_INCREMENT,
54 //	XML_TOK_LINENUMBERING_LINENUMBERING_SEPARATOR,
55 };
56 
57 
58 /** import <text:linenumbering-configuration> elements */
59 class XMLLineNumberingImportContext : public SvXMLStyleContext
60 {
61 	const ::rtl::OUString sCharStyleName;
62 	const ::rtl::OUString sCountEmptyLines;
63 	const ::rtl::OUString sCountLinesInFrames;
64 	const ::rtl::OUString sDistance;
65 	const ::rtl::OUString sInterval;
66 	const ::rtl::OUString sSeparatorText;
67 	const ::rtl::OUString sNumberPosition;
68 	const ::rtl::OUString sNumberingType;
69 	const ::rtl::OUString sIsOn;
70 	const ::rtl::OUString sRestartAtEachPage;
71 	const ::rtl::OUString sSeparatorInterval;
72 
73 	::rtl::OUString sStyleName;
74 	::rtl::OUString sNumFormat;
75 	::rtl::OUString sNumLetterSync;
76 	::rtl::OUString sSeparator;
77 	sal_Int32 nOffset;
78 	sal_Int16 nNumberPosition;
79 	sal_Int16 nIncrement;
80 	sal_Int16 nSeparatorIncrement;
81 	sal_Bool bNumberLines;
82 	sal_Bool bCountEmptyLines;
83 	sal_Bool bCountInFloatingFrames;
84 	sal_Bool bRestartNumbering;
85 
86 public:
87 
88 	TYPEINFO();
89 
90 	XMLLineNumberingImportContext(
91 		SvXMLImport& rImport,
92 		sal_uInt16 nPrfx,
93 		const ::rtl::OUString& rLocalName,
94 		const ::com::sun::star::uno::Reference<
95 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
96 
97 	~XMLLineNumberingImportContext();
98 
99 	// to be used by child context: set separator info
100 	void SetSeparatorText(const ::rtl::OUString& sText);
101 	void SetSeparatorIncrement(sal_Int16 nIncr);
102 
103 protected:
104 
105 	virtual void StartElement(
106 		const ::com::sun::star::uno::Reference<
107 			::com::sun::star::xml::sax::XAttributeList> & xAttrList);
108 
109 	void ProcessAttribute(
110 		enum LineNumberingToken eToken,
111 		::rtl::OUString sValue);
112 
113 	virtual void CreateAndInsert(sal_Bool bOverwrite);
114 
115 	virtual SvXMLImportContext *CreateChildContext(
116 		sal_uInt16 nPrefix,
117 		const ::rtl::OUString& rLocalName,
118 		const ::com::sun::star::uno::Reference<
119 			::com::sun::star::xml::sax::XAttributeList> & xAttrList );
120 
121 	void ProcessAttribute(
122 		const ::rtl::OUString sLocalName,
123 		const ::rtl::OUString sValue);
124 };
125 
126 #endif
127