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