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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 #include <rtl/uuid.h>
31 #include <rtl/ustrbuf.hxx>
32 #include <comphelper/processfactory.hxx>
33 #include <xmloff/nmspmap.hxx>
34 #include "xmloff/xmlnmspe.hxx"
35 #include <xmloff/xmltoken.hxx>
36 #include "MutableAttrList.hxx"
37 #include "DeepTContext.hxx"
38 #include "StyleOOoTContext.hxx"
39 #include "FrameOOoTContext.hxx"
40 #include "EventOOoTContext.hxx"
41 #include "ControlOOoTContext.hxx"
42 #include "FormPropOOoTContext.hxx"
43 #include "ChartOOoTContext.hxx"
44 #include "ChartPlotAreaOOoTContext.hxx"
45 #include "ElemTransformerAction.hxx"
46 #include "AttrTransformerAction.hxx"
47 #include "PropertyActionsOOo.hxx"
48 #include "TransformerActions.hxx"
49 #include <xmloff/xmluconv.hxx>
50 #ifndef _XMLOFF_OOO2OOO_HXX
51 #include "OOo2Oasis.hxx"
52 #endif
53 
54 using ::rtl::OUString;
55 using namespace ::xmloff::token;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::lang;
58 using namespace ::com::sun::star::xml::sax;
59 using namespace ::com::sun::star::beans;
60 
61 OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw();
62 
63 enum XMLUserDefinedTransformerAction
64 {
65 	XML_ETACTION_DOCUMENT=XML_ETACTION_USER_DEFINED,
66 	XML_ETACTION_BODY,
67 	XML_ETACTION_STYLE,
68 	XML_ETACTION_STYLE_RENAME,
69 	XML_ETACTION_FRAME,
70 	XML_ETACTION_EVENT,
71 	XML_ETACTION_TAB_STOP,
72 	XML_ETACTION_FORM_CONTROL,
73 	XML_ETACTION_FORM_PROPERTY,
74 	XML_ETACTION_CHART,
75 	XML_ETACTION_TRACKED_CHANGES,
76     XML_ETACTION_CHART_PLOT_AREA,
77 	XML_ETACTION_DOCUMENT_RENAME,
78     XML_ETACTION_TABLE
79 };
80 
81 #define ENTRY3( n, l, a, p1, p2, p3 ) \
82 	{ XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
83 #define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \
84 	ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
85 			XMLTransformerActionInit::QNameParam( n2, l2 ), p3 )
86 
87 #define ENTRY2( n, l, a, p1, p2 ) \
88 	ENTRY3( n, l, a, p1, p2, 0 )
89 #define ENTRY2QQ( n, l, a, n1, l1, n2, l2 ) \
90 	ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
91 			XMLTransformerActionInit::QNameParam( n2, l2 ) )
92 #define ENTRY2QN( n, l, a, n1, l1, p2 ) \
93 	ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), p2 )
94 
95 #define ENTRY1( n, l, a, p1 ) \
96 	ENTRY3( n, l, a, p1, 0, 0 )
97 #define ENTRY1Q( n, l, a, n1, l1 ) \
98 	ENTRY1( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ) )
99 
100 #define ENTRY0( n, l, a ) \
101 	ENTRY3( n, l, a, 0, 0, 0 )
102 
103 // BM: a macro to put two tokens into one sal_Int32 for the action
104 // XML_ATACTION_RENAME_ATTRIBUTE
105 #define RENAME_ENTRY( f, s ) \
106     (static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16))
107 
108 static XMLTransformerActionInit aActionTable[] =
109 {
110 	// remove office:class from <office:document> and <office:document-content>
111 	ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ),
112 	ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ),
113 	ENTRY0( OFFICE, DOCUMENT_STYLES, XML_ETACTION_DOCUMENT ),
114 	ENTRY0( OFFICE, DOCUMENT_SETTINGS, XML_ETACTION_DOCUMENT ),
115 	ENTRY1Q( OFFICE, AUTO_TEXT_EVENTS, XML_ETACTION_DOCUMENT_RENAME,
116 						  XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
117 
118 	// remove <meta:keywords>
119 	ENTRY0( META, KEYWORDS, XML_ETACTION_COPY_CONTENT ),
120 
121     // rename <office:script> to <office:scripts>
122     ENTRY1Q( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM,
123                         XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
124 
125     // rename <office:script-data> to <office:script> and process attributes
126     ENTRY2QN( OFFICE, SCRIPT_DATA, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
127                         XML_NAMESPACE_OFFICE, XML_SCRIPT,
128                         OOO_SCRIPT_ACTIONS ),
129 
130     // rename <script:libraries> to <ooo:libraries>
131     ENTRY1Q( SCRIPT, LIBRARIES, XML_ETACTION_RENAME_ELEM,
132                         XML_NAMESPACE_OOO, XML_LIBRARIES ),
133 
134     // rename <script:library-linked> to <ooo:library-linked> and process attributes
135     ENTRY2QN( SCRIPT, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
136                         XML_NAMESPACE_OOO, XML_LIBRARY_LINKED,
137                         OOO_SCRIPT_ACTIONS ),
138 
139     // rename <script:library-embedded> to <ooo:library-embedded> and process attributes
140     ENTRY2QN( SCRIPT, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
141                         XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED,
142                         OOO_SCRIPT_ACTIONS ),
143 
144     // rename <script:module> to <ooo:module> and process attributes
145     ENTRY2QN( SCRIPT, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
146                         XML_NAMESPACE_OOO, XML_MODULE,
147                         OOO_SCRIPT_ACTIONS ),
148 
149     // rename <script:source-code> to <ooo:source-code>
150     ENTRY1Q( SCRIPT, SOURCE_CODE, XML_ETACTION_RENAME_ELEM,
151                         XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
152 
153 	// rename <office:font-decls> to <office:font-face-decl>,
154 	// rename <style:font-decl> to <style:font-face>, process attrs
155 	ENTRY1Q( OFFICE, FONT_DECLS, XML_ETACTION_RENAME_ELEM,
156 						XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS ),
157 	ENTRY2QN( STYLE, FONT_DECL, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
158 						XML_NAMESPACE_STYLE, XML_FONT_FACE,
159 		   				OOO_FONT_DECL_ACTIONS ),
160 
161 	// add genre element
162 	ENTRY0( OFFICE, BODY, XML_ETACTION_BODY ),
163 
164 	// rename <style:page-master> to <style:page-layout>
165 	ENTRY2QN( STYLE, PAGE_MASTER, XML_ETACTION_STYLE_RENAME,
166 						XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT,
167 		   				XML_FAMILY_TYPE_PAGE_LAYOUT	),
168 	ENTRY1( STYLE, MASTER_PAGE, XML_ETACTION_PROC_ATTRS,
169 						OOO_MASTER_PAGE_ACTIONS ),
170 
171 	// split <style:properties> into <style:*-properties> and do other
172 	// styles processing
173 	ENTRY1( STYLE, STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ),
174 	ENTRY1( STYLE, DEFAULT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ),
175 	ENTRY1( NUMBER, NUMBER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
176 	ENTRY1( NUMBER, CURRENCY_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
177 	ENTRY1( NUMBER, PERCENTAGE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
178 	ENTRY1( NUMBER, DATE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
179 	ENTRY1( NUMBER, TIME_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
180 	ENTRY1( NUMBER, BOOLEAN_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
181 	ENTRY1( NUMBER, TEXT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ),
182 	ENTRY1( TEXT, LIST_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
183 //	ENTRY0( TEXT, OUTLINE_STYLE, STYLE ),
184 	ENTRY1( STYLE, HEADER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ),
185 	ENTRY1( STYLE, FOOTER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ),
186 	ENTRY1( TEXT, LIST_LEVEL_STYLE_NUMBER, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
187 	ENTRY1( TEXT, LIST_LEVEL_STYLE_BULLET, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
188 	ENTRY1( TEXT, LIST_LEVEL_STYLE_IMAGE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
189 	ENTRY1( TEXT, OUTLINE_LEVEL_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ),
190 	ENTRY1( DRAW, GRADIENT, XML_ETACTION_STYLE,
191 		 		XML_FAMILY_TYPE_GRADIENT ),
192 	ENTRY1( DRAW, FILL_IMAGE, XML_ETACTION_STYLE,
193 		 		XML_FAMILY_TYPE_FILL_IMAGE ),
194 	ENTRY2QN( DRAW, TRANSPARENCY, XML_ETACTION_STYLE_RENAME,
195 				XML_NAMESPACE_DRAW, XML_OPACITY,
196 		 		XML_FAMILY_TYPE_GRADIENT ),
197 	ENTRY1( DRAW, MARKER, XML_ETACTION_STYLE,
198 		 		XML_FAMILY_TYPE_MARKER ),
199 	ENTRY1( DRAW, HATCH, XML_ETACTION_STYLE,
200 		 		XML_FAMILY_TYPE_HATCH ),
201 	ENTRY1( DRAW, STROKE_DASH, XML_ETACTION_STYLE,
202 		 		XML_FAMILY_TYPE_STROKE_DASH ),
203 
204 	// rename <text:h>'s text:level to text:outline-level
205 	// process <text:h/p>: process style-name attributes,
206 	ENTRY1( TEXT, H, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ),
207 	ENTRY1( TEXT, P, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ),
208 
209 	// rename <text:ordered-list> and <text:unordered-list> to <text:list>
210 	ENTRY2QN( TEXT, UNORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
211 						XML_NAMESPACE_TEXT, XML_LIST,
212 		  				OOO_STYLE_REF_ACTIONS ),
213 	ENTRY2QN( TEXT, ORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
214 						XML_NAMESPACE_TEXT, XML_LIST,
215 		  				OOO_STYLE_REF_ACTIONS ),
216 
217 	// rename <text:footnote*> to <text:note*>
218 	ENTRY3QQN( TEXT, FOOTNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
219 						XML_NAMESPACE_TEXT, XML_NOTE,
220 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ),
221 	ENTRY1Q( TEXT, FOOTNOTE_BODY, XML_ETACTION_RENAME_ELEM,
222 						XML_NAMESPACE_TEXT, XML_NOTE_BODY ),
223 	ENTRY1Q( TEXT, FOOTNOTE_CITATION, XML_ETACTION_RENAME_ELEM,
224 						XML_NAMESPACE_TEXT, XML_NOTE_CITATION ),
225 	ENTRY3QQN( TEXT, FOOTNOTES_CONFIGURATION,
226 						XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR,
227 						XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION,
228 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
229 						XML_FOOTNOTE | (OOO_STYLE_REF_ACTIONS << 16) ),
230 
231 	// rename <text:endnote*> to <text:endnote*>
232 	ENTRY3QQN( TEXT, ENDNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
233 						XML_NAMESPACE_TEXT, XML_NOTE,
234 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ),
235 	ENTRY1Q( TEXT, ENDNOTE_BODY, XML_ETACTION_RENAME_ELEM,
236 						XML_NAMESPACE_TEXT, XML_NOTE_BODY ),
237 	ENTRY1Q( TEXT, ENDNOTE_CITATION, XML_ETACTION_RENAME_ELEM,
238 						XML_NAMESPACE_TEXT, XML_NOTE_CITATION ),
239 	ENTRY3QQN( TEXT, ENDNOTES_CONFIGURATION,
240 						XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR,
241 						XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION,
242 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
243 						XML_ENDNOTE | (OOO_STYLE_REF_ACTIONS << 16) ),
244 
245 	// rename <text:footnote> and <text:endnote> to <text:note>
246 	ENTRY3QQN( TEXT, ENDNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
247 						XML_NAMESPACE_TEXT, XML_NOTE_REF,
248 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ),
249 	ENTRY3QQN( TEXT, FOOTNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
250 						XML_NAMESPACE_TEXT, XML_NOTE_REF,
251 		   				XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ),
252 
253 	// rename <text:tab-stop> to <text:tab>
254 	ENTRY1Q( TEXT, TAB_STOP, XML_ETACTION_RENAME_ELEM,
255 						XML_NAMESPACE_TEXT, XML_TAB ),
256 
257 	// replace <table:sub-table> with <table:table table:is-sub-table>
258 	ENTRY3QQN( TABLE, SUB_TABLE, XML_ETACTION_RENAME_ELEM_ADD_ATTR,
259 						XML_NAMESPACE_TABLE, XML_TABLE,
260 		   				XML_NAMESPACE_TABLE, XML_IS_SUB_TABLE, XML_TRUE ),
261 
262 	// process *:style-name attributes
263 	ENTRY1( TEXT, SECTION, XML_ETACTION_PROC_ATTRS,
264 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
265 	ENTRY1( TEXT, SPAN, XML_ETACTION_PROC_ATTRS,
266 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
267 	ENTRY1( TEXT, A, XML_ETACTION_PROC_ATTRS,
268 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
269 	ENTRY1( TEXT, RUBY, XML_ETACTION_PROC_ATTRS,
270 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
271 	ENTRY1( TEXT, RUBY_TEXT, XML_ETACTION_PROC_ATTRS,
272 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
273 	ENTRY1( TEXT, DATE, XML_ETACTION_PROC_ATTRS,
274 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
275 	ENTRY1( TEXT, TIME, XML_ETACTION_PROC_ATTRS,
276 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
277 	ENTRY1( TEXT, VARIABLE_GET, XML_ETACTION_PROC_ATTRS,
278 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
279 	ENTRY1( TEXT, USER_FIELD_GET, XML_ETACTION_PROC_ATTRS,
280 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
281 	ENTRY1( TEXT, USER_FIELD_INPUT, XML_ETACTION_PROC_ATTRS,
282 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
283 	ENTRY1( TEXT, CREATION_DATE, XML_ETACTION_PROC_ATTRS,
284 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
285 	ENTRY1( TEXT, CREATION_TIME, XML_ETACTION_PROC_ATTRS,
286 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
287 	ENTRY1( TEXT, PRINT_TIME, XML_ETACTION_PROC_ATTRS,
288 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
289 	ENTRY1( TEXT, PRINT_DATE, XML_ETACTION_PROC_ATTRS,
290 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
291 	ENTRY1( TEXT, EDITING_DURATION, XML_ETACTION_PROC_ATTRS,
292 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
293 	ENTRY1( TEXT, MODIFICATION_TIME, XML_ETACTION_PROC_ATTRS,
294 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
295 	ENTRY1( TEXT, MODIFICATION_DATE, XML_ETACTION_PROC_ATTRS,
296 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
297 	ENTRY1( TEXT, DATABASE_DISPLAY, XML_ETACTION_PROC_ATTRS,
298 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
299 	ENTRY1( TEXT, TABLE_FORMULA, XML_ETACTION_PROC_ATTRS,
300 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
301 	ENTRY1( TEXT, INDEX_TITLE, XML_ETACTION_PROC_ATTRS,
302 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
303 	ENTRY1( TEXT, TABLE_OF_CONTENT, XML_ETACTION_PROC_ATTRS,
304 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
305 	ENTRY1( TEXT, TABLE_OF_CONTENT_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
306 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
307 	ENTRY1( TEXT, ILLUSTRATION_INDEX, XML_ETACTION_PROC_ATTRS,
308 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
309 	ENTRY1( TEXT, ILLUSTRATION_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
310 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
311 	ENTRY1( TEXT, TABLE_INDEX, XML_ETACTION_PROC_ATTRS,
312 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
313 	ENTRY1( TEXT, TABLE_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
314 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
315 	ENTRY1( TEXT, OBJECT_INDEX, XML_ETACTION_PROC_ATTRS,
316 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
317 	ENTRY1( TEXT, OBJECT_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
318 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
319 	ENTRY1( TEXT, USER_INDEX, XML_ETACTION_PROC_ATTRS,
320 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
321 	ENTRY1( TEXT, USER_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
322 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
323 	ENTRY1( TEXT, ALPHABETICAL_INDEX, XML_ETACTION_PROC_ATTRS,
324 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
325 	ENTRY1( TEXT, ALPHABETICAL_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
326 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
327 	ENTRY1( TEXT, BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS,
328 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
329 	ENTRY1( TEXT, BIBLIOGRAPHY_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS,
330 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
331 	ENTRY1( TEXT, INDEX_SOURCE_STYLE, XML_ETACTION_PROC_ATTRS,
332 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
333 	ENTRY1( TEXT, INDEX_TITLE_TEMPLATE, XML_ETACTION_PROC_ATTRS,
334 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
335 	ENTRY1( TEXT, INDEX_ENTRY_CHAPTER, XML_ETACTION_PROC_ATTRS,
336 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
337 	ENTRY2QN( TEXT, INDEX_ENTRY_CHAPTER_NUMBER,
338 			XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
339 			XML_NAMESPACE_TEXT, XML_INDEX_ENTRY_CHAPTER,
340 			OOO_STYLE_REF_ACTIONS ), /* generated entry */
341 	ENTRY1( TEXT, INDEX_ENTRY_TEXT, XML_ETACTION_PROC_ATTRS,
342 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
343 	ENTRY1( TEXT, INDEX_ENTRY_PAGE_NUMBER, XML_ETACTION_PROC_ATTRS,
344 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
345 	ENTRY1( TEXT, INDEX_ENTRY_SPAN, XML_ETACTION_PROC_ATTRS,
346 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
347 	ENTRY1( TEXT, INDEX_ENTRY_BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS,
348 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
349 	ENTRY1( TEXT, INDEX_ENTRY_LINK_START, XML_ETACTION_PROC_ATTRS,
350 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
351 	ENTRY1( TEXT, INDEX_ENTRY_LINK_END, XML_ETACTION_PROC_ATTRS,
352 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
353 	ENTRY1( STYLE, HANDOUT_MASTER, XML_ETACTION_PROC_ATTRS,
354 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
355 	ENTRY1( DRAW, PAGE, XML_ETACTION_PROC_ATTRS,
356 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
357 	ENTRY1( STYLE, MAP, XML_ETACTION_PROC_ATTRS,
358 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
359 	ENTRY1( PRESENTATION, NOTES, XML_ETACTION_PROC_ATTRS,
360 		OOO_STYLE_REF_ACTIONS ), /* generated entry */
361 	ENTRY1( STYLE, PRESENTATION_PAGE_LAYOUT, XML_ETACTION_PROC_ATTRS,
362 						OOO_MASTER_PAGE_ACTIONS ),
363     // --> OD 2005-01-10 #i40011#, #i40015#
364     // - consider also attribute table:style-name for <table:table>,
365     //   <table:table-row> and <table:table-column>.
366 //    ENTRY1( TABLE, TABLE, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ),
367 	ENTRY0( TABLE, TABLE, XML_ETACTION_TABLE ),
368 
369     ENTRY1( TABLE, TABLE_ROW, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ),
370     ENTRY1( TABLE, TABLE_COLUMN, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ),
371     // <--
372 
373 	// split frame elements
374 	ENTRY0( DRAW, TEXT_BOX, XML_ETACTION_FRAME ),
375 	ENTRY0( DRAW, IMAGE, XML_ETACTION_FRAME ),
376 	ENTRY0( DRAW, OBJECT, XML_ETACTION_FRAME ),
377 	ENTRY0( DRAW, OBJECT_OLE, XML_ETACTION_FRAME ),
378 	ENTRY0( DRAW, APPLET, XML_ETACTION_FRAME ),
379 	ENTRY0( DRAW, PLUGIN, XML_ETACTION_FRAME ),
380 	ENTRY0( DRAW, FLOATING_FRAME, XML_ETACTION_FRAME ),
381 	ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ),
382 
383 	// process events
384 	ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM,
385 		  			XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ),
386 	ENTRY0( SCRIPT, EVENT, XML_ETACTION_EVENT ),
387 	ENTRY0( PRESENTATION, EVENT, XML_ETACTION_EVENT ),
388 
389 	// process length attributes
390 	ENTRY1( DRAW, RECT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
391 	ENTRY1( DRAW, LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
392 	ENTRY1( DRAW, POLYLINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
393 	ENTRY1( DRAW, POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
394 	ENTRY1( DRAW, PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
395 	ENTRY1( DRAW, CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
396 	ENTRY1( DRAW, ELLIPSE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
397 	ENTRY1( DRAW, CONNECTOR, XML_ETACTION_PROC_ATTRS, OOO_CONNECTOR_ACTIONS ),
398 	ENTRY1( DRAW, CAPTION, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
399 	ENTRY1( DRAW, CONTROL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
400 	ENTRY1( DRAW, PAGE_THUMBNAIL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
401 	ENTRY1( DRAW, MEASURE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
402 	ENTRY1( DRAW, G, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
403 //	ENTRY1( DRAW, TEXT_BOX, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
404 	ENTRY1( PRESENTATION, PLACEHOLDER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
405 	ENTRY1( DRAW, CONTOUR_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
406 	ENTRY1( DRAW, CONTOUR_PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
407 	ENTRY1( DRAW, AREA_RECTANGLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
408 	ENTRY1( DRAW, AREA_CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
409 	ENTRY1( DRAW, AREA_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_DRAW_AREA_POLYGON_ACTIONS ),
410 	ENTRY1( DRAW, GLUE_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
411 	ENTRY1( DR3D, SCENE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
412 	ENTRY1( DR3D, CUBE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
413 	ENTRY1( DR3D, SPHERE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
414 	ENTRY1( DR3D, EXTRUDE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
415 	ENTRY1( DR3D, ROTATE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
416 	ENTRY1( CHART, TITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
417 	ENTRY1( CHART, SUBTITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
418 	ENTRY1( CHART, FOOTER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
419 	ENTRY1( CHART, LEGEND, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
420 	ENTRY1( CHART, WALL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
421 	ENTRY1( CHART, FLOOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
422 	ENTRY1( CHART, AXIS, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
423 	ENTRY1( CHART, GRID, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
424 	ENTRY1( CHART, SERIES, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
425 	ENTRY1( CHART, DATA_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
426 	ENTRY1( CHART, MEAN_VALUE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
427 	ENTRY1( CHART, ERROR_INDICATOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
428 	ENTRY1( CHART, REGRESSION_CURVE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
429 	ENTRY1( CHART, STOCK_GAIN_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
430 	ENTRY1( CHART, STOCK_LOSS_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
431 	ENTRY1( CHART, STOCK_RANGE_LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ),
432 
433 	ENTRY0( CHART, CHART, XML_ETACTION_CHART ),
434     ENTRY0( CHART, PLOT_AREA, XML_ETACTION_CHART_PLOT_AREA ),
435 
436 	ENTRY1Q( TEXT, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
437 						XML_NAMESPACE_TEXT, XML_PROTECTION_KEY ),
438 	ENTRY1Q( TABLE, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES,
439 						XML_NAMESPACE_TABLE, XML_PROTECTION_KEY ),
440 
441 	ENTRY1( TEXT, INDEX_ENTRY_TAB_STOP, XML_ETACTION_PROC_ATTRS,
442 				  OOO_INDEX_ENTRY_TAB_STOP_ACTIONS ),
443 	ENTRY0( STYLE, TAB_STOP, XML_ETACTION_TAB_STOP ),
444 	ENTRY1( STYLE, BACKGROUND_IMAGE, XML_ETACTION_PROC_ATTRS,
445 		 			OOO_BACKGROUND_IMAGE_ACTIONS  ),
446 	ENTRY1( TEXT, LINENUMBERING_CONFIGURATION, XML_ETACTION_PROC_ATTRS,
447 				  OOO_LINENUMBERING_ACTIONS ),
448 	ENTRY1( STYLE, FOOTNOTE_SEP, XML_ETACTION_PROC_ATTRS,
449 				   OOO_FOOTNOTE_SEP_ACTIONS ),
450 	ENTRY1( STYLE, DROP_CAP, XML_ETACTION_PROC_ATTRS, OOO_DROP_CAP_ACTIONS ),
451 	ENTRY1( STYLE, COLUMNS, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ),
452 	ENTRY1( STYLE, COLUMN, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ),
453 
454 	// rename office:value-* to *:value-*
455 	ENTRY1( TEXT, VARIABLE_DECL, XML_ETACTION_PROC_ATTRS,
456 			OOO_TEXT_VALUE_TYPE_ACTIONS ), /* generated entry */
457 	ENTRY1( TEXT, VARIABLE_SET, XML_ETACTION_PROC_ATTRS,
458 			OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
459 	ENTRY1( TEXT, VARIABLE_INPUT, XML_ETACTION_PROC_ATTRS,
460 			OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
461 	ENTRY1( TEXT, USER_FIELD_DECL, XML_ETACTION_PROC_ATTRS,
462 			OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
463 	ENTRY1( TEXT, EXPRESSION, XML_ETACTION_PROC_ATTRS,
464 			OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */
465 //	ENTRY1( TEXT, USER_DEFINED, XML_ETACTION_PROC_ATTRS,
466 //			OOO_TEXT_VALUE_TYPE_ACTIONS), /* text:user-defined has no attrs so far */
467 	ENTRY1( TABLE, TABLE_CELL, XML_ETACTION_PROC_ATTRS,
468 			OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
469 	ENTRY1( TABLE, COVERED_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
470 			OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
471 	ENTRY1( TABLE, CHANGE_TRACK_TABLE_CELL, XML_ETACTION_PROC_ATTRS,
472 			OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */
473 //	ENTRY1( FORM, PROPERTY, XML_ETACTION_PROC_ATTRS,
474 //			OOO_VALUE_TYPE_ACTIONS), /* TODO: generated entry */
475 //	ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_PROC_ATTRS,
476 //			OOO_VALUE_TYPE_ACTIONS), /* generated entry */
477 
478 	ENTRY1( OFFICE, ANNOTATION, XML_ETACTION_MOVE_ATTRS_TO_ELEMS,
479 			OOO_ANNOTATION_ACTIONS ), /* generated entry */
480 	ENTRY1( OFFICE, CHANGE_INFO, XML_ETACTION_MOVE_ATTRS_TO_ELEMS,
481 			OOO_CHANGE_INFO_ACTIONS ), /* generated entry */
482 
483 	ENTRY1( TEXT, DDE_CONNECTION_DECL, XML_ETACTION_PROC_ATTRS,
484 		 			OOO_DDE_CONNECTION_DECL_ACTIONS  ),
485 
486 	ENTRY0( FORM, CONTROL, XML_ETACTION_FORM_CONTROL ),
487 	ENTRY1( FORM, COLUMN, XML_ETACTION_PROC_ATTRS,
488 		 			OOO_FORM_COLUMN_ACTIONS  ),
489 	ENTRY0( FORM, PROPERTY, XML_ETACTION_FORM_PROPERTY ),
490 
491 	// process xlink:href
492 	ENTRY1( META, TEMPLATE, XML_ETACTION_PROC_ATTRS,
493 		OOO_XLINK_ACTIONS ), /* generated entry */
494 	ENTRY1( META, AUTO_RELOAD, XML_ETACTION_PROC_ATTRS,
495 		OOO_XLINK_ACTIONS ), /* generated entry */
496 	ENTRY1( TEXT, SECTION_SOURCE, XML_ETACTION_PROC_ATTRS,
497 		OOO_XLINK_ACTIONS ), /* generated entry */
498 	ENTRY1( TEXT, SCRIPT, XML_ETACTION_PROC_ATTRS,
499 		OOO_XLINK_ACTIONS ), /* generated entry */
500 	ENTRY1( TEXT, ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ETACTION_PROC_ATTRS,
501 		OOO_XLINK_ACTIONS ), /* generated entry */
502 	ENTRY1( TABLE, TABLE_SOURCE, XML_ETACTION_PROC_ATTRS,
503 		OOO_XLINK_ACTIONS ), /* generated entry */
504 	ENTRY1( TABLE, CELL_RANGE_SOURCE, XML_ETACTION_PROC_ATTRS,
505 		OOO_XLINK_ACTIONS ), /* generated entry */
506 	ENTRY1( DRAW, A, XML_ETACTION_PROC_ATTRS,
507 		OOO_XLINK_ACTIONS ), /* generated entry */
508 	ENTRY1( PRESENTATION, SOUND, XML_ETACTION_PROC_ATTRS,
509 		OOO_XLINK_ACTIONS ), /* generated entry */
510 	ENTRY1( FORM, FORM, XML_ETACTION_PROC_ATTRS,
511 		OOO_FORM_CONTROL_ACTIONS ),
512     ENTRY2QN( STYLE, SYMBOL_IMAGE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
513               XML_NAMESPACE_CHART, XML_SYMBOL_IMAGE,
514               OOO_BACKGROUND_IMAGE_ACTIONS ),
515 
516 	ENTRY2QN( CONFIG, CONFIG_ITEM_SET, XML_ETACTION_PROC_ATTRS_COND,
517 		XML_NAMESPACE_OFFICE, XML_SETTINGS,
518 		OOO_CONFIG_ITEM_SET_ACTIONS ),
519 
520 	// add namespace prefix
521 	//  text:formula
522 	ENTRY1( TEXT, SEQUENCE, XML_ETACTION_PROC_ATTRS,
523 		OOO_FORMULA_ACTIONS ), /* generated entry */
524 	//  text:condition
525 	ENTRY1( TEXT, DATABASE_NEXT, XML_ETACTION_PROC_ATTRS,
526 		OOO_FORMULA_ACTIONS ), /* generated entry */
527 	//  text:condition
528 	ENTRY2QN( TEXT, DATABASE_SELECT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
529 				XML_NAMESPACE_TEXT, XML_DATABASE_ROW_SELECT,
530 		OOO_FORMULA_ACTIONS ),
531 	//  text:condition
532 	ENTRY1( TEXT, CONDITIONAL_TEXT, XML_ETACTION_PROC_ATTRS,
533 		OOO_FORMULA_ACTIONS ), /* generated entry */
534 	//  text:condition
535 	ENTRY1( TEXT, HIDDEN_TEXT, XML_ETACTION_PROC_ATTRS,
536 		OOO_FORMULA_ACTIONS ), /* generated entry */
537 	//  text:condition
538 	ENTRY1( TEXT, HIDDEN_PARAGRAPH, XML_ETACTION_PROC_ATTRS,
539 		OOO_FORMULA_ACTIONS ), /* generated entry */
540 	//  table:condition
541 	ENTRY1( TABLE, CONTENT_VALIDATION, XML_ETACTION_PROC_ATTRS,
542 		OOO_FORMULA_ACTIONS ), /* generated entry */
543 
544 	// rename <table:dependences> to <table:dependencies>
545 	ENTRY1Q( TABLE, DEPENDENCES, XML_ETACTION_RENAME_ELEM,
546 						XML_NAMESPACE_TABLE, XML_DEPENDENCIES ),
547     ENTRY1Q( TABLE, DEPENDENCE, XML_ETACTION_RENAME_ELEM,
548                         XML_NAMESPACE_TABLE, XML_DEPENDENCY ),
549 
550     // process table::error-macro
551 	ENTRY1( TABLE, ERROR_MACRO, XML_ETACTION_PROC_ATTRS,
552 			OOO_ERROR_MACRO_ACTIONS ),
553 
554     // process table::conversion-mode
555 	ENTRY1( TABLE, CONVERSION_MODE, XML_ETACTION_PROC_ATTRS,
556 			OOO_DDE_CONV_MODE_ACTIONS ),
557 
558     // fix <text:alphabatical-index-mark text:main-etry>
559 	ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK, XML_ETACTION_PROC_ATTRS,
560             OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ),
561 	ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK_START, XML_ETACTION_PROC_ATTRS,
562             OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ),
563 
564     // process table::data-pilot-member
565 	ENTRY1( TABLE, DATA_PILOT_MEMBER, XML_ETACTION_PROC_ATTRS,
566 			OOO_DATAPILOT_MEMBER_ACTIONS ),
567 
568     // process table::data-pilot-level
569 	ENTRY1( TABLE, DATA_PILOT_LEVEL, XML_ETACTION_PROC_ATTRS,
570 			OOO_DATAPILOT_LEVEL_ACTIONS ),
571 
572     // process table::source-service
573 	ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS,
574 			OOO_SOURCE_SERVICE_ACTIONS ),
575 
576 	// fix id strings in old animation elements
577 	ENTRY1( PRESENTATION, DIM, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
578 	ENTRY1( PRESENTATION, PLAY, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
579 	ENTRY1( PRESENTATION, SHOW_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
580 	ENTRY1( PRESENTATION, SHOW_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
581 	ENTRY1( PRESENTATION, HIDE_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
582 	ENTRY1( PRESENTATION, HIDE_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ),
583 
584     ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT )
585 };
586 
587 // XML_ETACTION_STYLE
588 static XMLTransformerActionInit aStyleActionTable[] =
589 {
590 	ENTRY0( STYLE, FAMILY, XML_ATACTION_STYLE_FAMILY ),
591 	ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
592 	ENTRY0( STYLE, PARENT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
593 	ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
594 	ENTRY0( STYLE, LIST_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
595 	ENTRY0( STYLE, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
596 	ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
597 	ENTRY0( DRAW, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
598 	ENTRY0( DRAW, DISTANCE, XML_ATACTION_INCH2IN ),
599 	ENTRY0( DRAW, DOTS1_LENGTH, XML_ATACTION_INCH2IN ),
600 	ENTRY0( DRAW, DOTS2_LENGTH, XML_ATACTION_INCH2IN ),
601 	ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
602 	ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
603 	ENTRY0( DRAW, START, XML_ATACTION_NEG_PERCENT ),
604 	ENTRY0( DRAW, END, XML_ATACTION_NEG_PERCENT ),
605 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
606 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
607 };
608 
609 // OOO_FRAME_ELEM_ACTIONS
610 static XMLTransformerActionInit aFrameElemActionTable[] =
611 {
612 	ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM,
613 		  			XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ),
614 	ENTRY0( DRAW, GLUE_POINT, XML_ETACTION_COPY ),
615 	ENTRY0( DRAW, IMAGE_MAP, XML_ETACTION_COPY ),
616 	ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ),
617 	ENTRY0( DRAW, CONTOUR_POLYGON, XML_ETACTION_COPY ),
618 	ENTRY0( DRAW, CONTOUR_PATH, XML_ETACTION_COPY ),
619 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT )
620 };
621 
622 // OOO_FRAME_ATTR_ACTIONS
623 static XMLTransformerActionInit aFrameAttrActionTable[] =
624 {
625 	ENTRY0( DRAW, ZINDEX, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
626 	ENTRY0( DRAW, ID, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
627 	ENTRY0( DRAW, LAYER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
628 	ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
629 	ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
630 	ENTRY0( DRAW, TRANSFORM, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
631 	ENTRY0( DRAW, NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
632 	ENTRY0( TABLE, END_CELL_ADDRESS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
633 	ENTRY0( TABLE, END_X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
634 	ENTRY0( TABLE, END_Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
635 	ENTRY0( TABLE, TABLE_BACKGROUND, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
636 	ENTRY0( TEXT, ANCHOR_TYPE, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
637 	ENTRY0( TEXT, ANCHOR_PAGE_NUMBER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
638 	ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
639 	ENTRY0( SVG, X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
640 	ENTRY0( SVG, Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
641 	ENTRY0( SVG, WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
642 	ENTRY0( SVG, HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
643 	ENTRY0( STYLE, REL_WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
644 	ENTRY0( STYLE, REL_HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
645 	ENTRY0( PRESENTATION, CLASS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
646 	ENTRY0( PRESENTATION, PLACEHOLDER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
647 	ENTRY0( PRESENTATION, USER_TRANSFORMED, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */
648 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
649 };
650 
651 // OOO_EVENT_ELEM_ACTIONS
652 static XMLTransformerActionInit aEventActionTable[] =
653 {
654 	ENTRY0( XLINK, HREF, XML_ATACTION_HREF ),
655 	ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX,
656 					XML_NAMESPACE_OOO ),
657 	ENTRY0( SCRIPT, EVENT_NAME, XML_ATACTION_EVENT_NAME ),
658 	ENTRY0( SCRIPT, MACRO_NAME, XML_ATACTION_MACRO_NAME ),
659 	ENTRY0( SCRIPT, LOCATION, XML_ATACTION_MACRO_LOCATION ),
660 	ENTRY0( SCRIPT, LIBRARY, XML_ATACTION_MACRO_LOCATION ), // bug in draw
661 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
662 };
663 
664 
665 // action table for OOO_MASTER_PAGE_ACTIONS
666 static XMLTransformerActionInit aMasterPageActionTable[] =
667 {
668 	ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ),
669 	ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
670 	ENTRY1Q( STYLE, PAGE_MASTER_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF,
671 						XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME ),
672 	ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
673 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
674 };
675 
676 static XMLTransformerActionInit aFontDeclActionTable[] =
677 {
678 	ENTRY1Q( FO, FONT_FAMILY, XML_ATACTION_RENAME,
679 						XML_NAMESPACE_SVG, XML_FONT_FAMILY ),
680 	ENTRY1Q( STYLE, FONT_STYLE_NAME, XML_ATACTION_RENAME,
681 						XML_NAMESPACE_STYLE, XML_FONT_ADORNMENTS ),
682 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
683 };
684 
685 // action table for OOO_PARA_ACTIONS
686 static XMLTransformerActionInit aParaActionTable[] =
687 {
688 	ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
689 	ENTRY0( TEXT, COND_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
690 //	ENTRY0( TEXT, CLASS_NAMES, XML_ATACTION_REMOVE ),
691 	ENTRY1Q( TEXT, LEVEL, XML_ATACTION_RENAME,
692 						XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL ),
693 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
694 };
695 
696 // action table for OOO_STYLE_REF_ACTIONS
697 static XMLTransformerActionInit aStyleRefActionTable[] =
698 {
699 	ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
700 	ENTRY0( TEXT, VISITED_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
701 	ENTRY0( TEXT, MAIN_ENTRY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
702 	ENTRY0( TEXT, CITATION_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
703 	ENTRY0( TEXT, CITATION_BODY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
704 	ENTRY0( TEXT, DEFAULT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
705 	ENTRY0( TEXT, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
706 	ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
707 	ENTRY0( STYLE, APPLY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
708 	ENTRY0( STYLE, PAGE_LAYOUT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
709 	ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
710 	ENTRY0( TABLE, DEFAULT_CELL_STYLE_NAME,
711 			XML_ATACTION_ENCODE_STYLE_NAME_REF ),
712 	ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
713 	ENTRY0( DRAW, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
714 	ENTRY0( PRESENTATION, PRESENTATION_PAGE_LAYOUT_NAME,
715 			XML_ATACTION_ENCODE_STYLE_NAME_REF ),
716 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
717 	ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX,
718 		 			XML_NAMESPACE_OOOW ),
719 	ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
720 		 			XML_NAMESPACE_OOOW ),
721 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
722 };
723 
724 // OOO_SHAPE_ACTIONS
725 // !!ATTENTION!! If you change something here, please also change
726 // aConnectorActionTable if apropriate
727 static XMLTransformerActionInit aShapeActionTable[] =
728 {
729 	ENTRY0( SVG, X, XML_ATACTION_INCH2IN ),
730 	ENTRY0( SVG, Y, XML_ATACTION_INCH2IN ),
731 	ENTRY0( SVG, X1, XML_ATACTION_INCH2IN ),
732 	ENTRY0( SVG, Y1, XML_ATACTION_INCH2IN ),
733 	ENTRY0( SVG, X2, XML_ATACTION_INCH2IN ),
734 	ENTRY0( SVG, Y2, XML_ATACTION_INCH2IN ),
735 	ENTRY0( SVG, CX, XML_ATACTION_INCH2IN ),
736 	ENTRY0( SVG, CY, XML_ATACTION_INCH2IN ),
737 	ENTRY0( SVG, R, XML_ATACTION_INCH2IN ),
738 	ENTRY0( SVG, RX, XML_ATACTION_INCH2IN ),
739 	ENTRY0( SVG, RY, XML_ATACTION_INCH2IN ),
740 	ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
741 	ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
742 	ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ),
743 	ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ),
744 	ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ),
745 	ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ),
746 	ENTRY0( DRAW, CORNER_RADIUS, XML_ATACTION_INCH2IN ),
747 	ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INCHS2INS ),
748 	ENTRY0( DRAW, CAPTION_POINT_X, XML_ATACTION_INCH2IN ),
749 	ENTRY0( DRAW, CAPTION_POINT_Y, XML_ATACTION_INCH2IN ),
750 	ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
751 	ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
752 	ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ),
753 	ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ),
754 	ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
755 	ENTRY0( DR3D, DISTANCE, XML_ATACTION_INCH2IN ),
756 	ENTRY0( DR3D, FOCAL_LENGTH, XML_ATACTION_INCH2IN ),
757 	ENTRY1Q( FORM, ID, XML_ATACTION_RENAME,
758 					XML_NAMESPACE_DRAW, XML_CONTROL ),
759 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
760 
761     // BM: needed by chart:legend.  The legend needs also the draw actions.  As
762     // there is no merge mechanism, all actions have to be in the same table
763     ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE,
764             RENAME_ENTRY( XML_LEFT, XML_START ),
765             RENAME_ENTRY( XML_RIGHT, XML_END )),
766 	ENTRY0( DRAW, ID, XML_ATACTION_SHAPEID ),
767 	ENTRY0( DRAW, START_SHAPE, XML_ATACTION_SHAPEID ),
768 	ENTRY0( DRAW, END_SHAPE, XML_ATACTION_SHAPEID ),
769 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
770 };
771 
772 static XMLTransformerActionInit aConnectorActionTable[] =
773 {
774 	ENTRY0( SVG, X1, XML_ATACTION_TWIPS2IN ),
775 	ENTRY0( SVG, Y1, XML_ATACTION_TWIPS2IN ),
776 	ENTRY0( SVG, X2, XML_ATACTION_TWIPS2IN ),
777 	ENTRY0( SVG, Y2, XML_ATACTION_TWIPS2IN ),
778 	ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
779 	ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ),
780 	ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ),
781 	ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ),
782 	ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ),
783 	ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ),
784 	ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
785 	ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
786 	ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ),
787 	ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ),
788 	ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
789 	ENTRY1Q( FORM, ID, XML_ATACTION_RENAME,
790 					XML_NAMESPACE_DRAW, XML_CONTROL ),
791 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
792 	ENTRY0( DRAW, ID, XML_ATACTION_SHAPEID ),
793 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
794 };
795 
796 // OOO_INDEX_ENTRY_TAB_STOP_ACTIONS
797 static XMLTransformerActionInit aIndexEntryTabStopActionTable[] =
798 {
799 	ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ),
800 	ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
801 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
802 };
803 
804 // OOO_TAB_STOP_ACTIONS
805 static XMLTransformerActionInit aTabStopActionTable[] =
806 {
807 	ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ),
808 	ENTRY1Q( STYLE, LEADER_CHAR, XML_ATACTION_RENAME,
809 					XML_NAMESPACE_STYLE, XML_LEADER_TEXT ),
810 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
811 };
812 
813 // OOO_LINENUMBERING_ACTIONS
814 static XMLTransformerActionInit aLineNumberingActionTable[] =
815 {
816 	ENTRY0( TEXT, OFFSET, XML_ATACTION_INCH2IN ),
817 	ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
818 	ENTRY1Q( TEXT, COUNT_IN_FLOATING_FRAMES, XML_ATACTION_RENAME,
819 					XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES ),
820 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
821 };
822 
823 static XMLTransformerActionInit aFootnoteSepActionTable[] =
824 {
825 	ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ),
826 	ENTRY0( STYLE, DISTANCE_BEFORE_SEP, XML_ATACTION_INCH2IN ),
827 	ENTRY0( STYLE, DISTANCE_AFTER_SEP, XML_ATACTION_INCH2IN ),
828 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
829 };
830 
831 // OOO_DROP_CAP_ACTIONS
832 static XMLTransformerActionInit aDropCapActionTable[] =
833 {
834 	ENTRY0( STYLE, DISTANCE, XML_ATACTION_INCH2IN ),
835 	ENTRY0( STYLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
836 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
837 };
838 
839 static XMLTransformerActionInit aColumnsActionTable[] =
840 {
841 	ENTRY0( STYLE, COLUMN_GAP, XML_ATACTION_INCH2IN ),
842 //	ENTRY0( STYLE, SPACE_BEFORE, XML_ATACTION_INCH2IN ),
843 //	ENTRY0( STYLE, SPACE_AFTER, XML_ATACTION_INCH2IN ),
844 	ENTRY1Q( FO, MARGIN_LEFT, XML_ATACTION_RENAME_INCH2IN,
845 		   XML_NAMESPACE_FO, XML_START_INDENT ),
846 	ENTRY1Q( FO, MARGIN_RIGHT, XML_ATACTION_RENAME_INCH2IN,
847 		   XML_NAMESPACE_FO, XML_END_INDENT ),
848 	ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ),
849 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
850 };
851 
852 // OOO_TEXT_VALUE_TYPE_ACTIONS
853 static XMLTransformerActionInit aTextValueTypeActionTable[] =
854 {
855 	ENTRY1Q( TEXT, VALUE_TYPE, XML_ATACTION_RENAME,
856 		   XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
857 	ENTRY1Q( TEXT, VALUE, XML_ATACTION_RENAME,
858 		   XML_NAMESPACE_OFFICE, XML_VALUE ),
859 	ENTRY1Q( TEXT, CURRENCY, XML_ATACTION_RENAME,
860 		   XML_NAMESPACE_OFFICE, XML_CURRENCY ),
861 	ENTRY1Q( TEXT, DATE_VALUE, XML_ATACTION_RENAME,
862 		   XML_NAMESPACE_OFFICE, XML_DATE_VALUE ),
863 	ENTRY1Q( TEXT, TIME_VALUE, XML_ATACTION_RENAME,
864 		   XML_NAMESPACE_OFFICE, XML_TIME_VALUE ),
865 	ENTRY1Q( TEXT, BOOLEAN_VALUE, XML_ATACTION_RENAME,
866 		   XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ),
867 	ENTRY1Q( TEXT, STRING_VALUE, XML_ATACTION_RENAME,
868 		   XML_NAMESPACE_OFFICE, XML_STRING_VALUE ),
869 	ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
870 	ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
871 		 			XML_NAMESPACE_OOOW ),
872 	ENTRY0( TEXT, TOKEN_INVALID, XML_ATACTION_EOT )
873 };
874 
875 // OOO_TABLE_VALUE_TYPE_ACTIONS
876 static XMLTransformerActionInit aTableValueTypeActionTable[] =
877 {
878 	ENTRY1Q( TABLE, VALUE_TYPE, XML_ATACTION_RENAME,
879 		   XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
880 	ENTRY1Q( TABLE, VALUE, XML_ATACTION_RENAME,
881 		   XML_NAMESPACE_OFFICE, XML_VALUE ),
882 	ENTRY1Q( TABLE, CURRENCY, XML_ATACTION_RENAME,
883 		   XML_NAMESPACE_OFFICE, XML_CURRENCY ),
884 	ENTRY1Q( TABLE, DATE_VALUE, XML_ATACTION_RENAME,
885 		   XML_NAMESPACE_OFFICE, XML_DATE_VALUE ),
886 	ENTRY1Q( TABLE, TIME_VALUE, XML_ATACTION_RENAME,
887 		   XML_NAMESPACE_OFFICE, XML_TIME_VALUE ),
888 	ENTRY1Q( TABLE, BOOLEAN_VALUE, XML_ATACTION_RENAME,
889 		   XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ),
890 	ENTRY1Q( TABLE, STRING_VALUE, XML_ATACTION_RENAME,
891 		   XML_NAMESPACE_OFFICE, XML_STRING_VALUE ),
892 	ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
893 	ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
894 		 			XML_NAMESPACE_OOOW ),
895 	ENTRY1Q( TABLE, VALIDATION_NAME, XML_ATACTION_RENAME,
896 		   XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME ),
897 	ENTRY0( TABLE, TOKEN_INVALID, XML_ATACTION_EOT )
898 };
899 
900 // action table for OOO_ANNOTATION_ACTIONS
901 static XMLTransformerActionInit aAnnotationActionTable[] =
902 {
903 	ENTRY1Q( OFFICE, AUTHOR, XML_ATACTION_MOVE_TO_ELEM,
904 				XML_NAMESPACE_DC, XML_CREATOR ),
905 	ENTRY1Q( OFFICE, CREATE_DATE, XML_ATACTION_MOVE_TO_ELEM,
906 				XML_NAMESPACE_DC, XML_DATE ),
907 	ENTRY1Q( OFFICE, CREATE_DATE_STRING, XML_ATACTION_MOVE_TO_ELEM,
908 				XML_NAMESPACE_META, XML_DATE_STRING ),
909 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
910 };
911 
912 // action table for OOO_CHANGE_INFO_ACTIONS
913 static XMLTransformerActionInit aChangeInfoActionTable[] =
914 {
915 	ENTRY1Q( OFFICE, CHG_AUTHOR, XML_ATACTION_MOVE_TO_ELEM,
916 				XML_NAMESPACE_DC, XML_CREATOR ),
917 	ENTRY1Q( OFFICE, CHG_DATE_TIME, XML_ATACTION_MOVE_TO_ELEM,
918 				XML_NAMESPACE_DC, XML_DATE ),
919 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
920 };
921 
922 // OOO_BACKGROUND_IMAGE_ACTIONS
923 static XMLTransformerActionInit aBackgroundImageActionTable[] =
924 {
925 	ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_RENAME_NEG_PERCENT,
926 		 			XML_NAMESPACE_DRAW, XML_OPACITY ),
927 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
928 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
929 };
930 
931 // --> OD 2005-06-10 #i50322#
932 // OOO_BACKGROUND_IMAGE_ACTIONS for OpenOffice.org text documents
933 // OpenOffice.org text documents, written by OpenOffice.org, contain
934 // wrong value for the transparency of the background graphic
935 static XMLTransformerActionInit aWriterBackgroundImageActionTable[] =
936 {
937     ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY, XML_NAMESPACE_DRAW, XML_OPACITY ),
938     ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ),
939     ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
940 };
941 // <--
942 
943 // OOO_DDE_CONNECTION_DECL
944 static XMLTransformerActionInit aDDEConnectionDeclActionTable[] =
945 {
946 	ENTRY1Q( TEXT, NAME, XML_ATACTION_RENAME,
947 		 			XML_NAMESPACE_OFFICE, XML_NAME ),
948 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
949 };
950 
951 // OOO_FORM_CONTROL_ACTIONS
952 static XMLTransformerActionInit aFormControlActionTable[] =
953 {
954 	ENTRY2QN( FORM, SERVICE_NAME,
955 					XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX,
956 		   			XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION,
957 					XML_NAMESPACE_OOO ),
958 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
959 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
960 };
961 
962 // OOO_FORM_COLUMN_ACTIONS
963 static XMLTransformerActionInit aFormColumnActionTable[] =
964 {
965 	ENTRY1Q( FORM, COLUMN_STYLE_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF,
966 						XML_NAMESPACE_FORM, XML_TEXT_STYLE_NAME ),
967 	ENTRY2QN( FORM, SERVICE_NAME,
968 					XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX,
969 		   			XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION,
970 					XML_NAMESPACE_OOO ),
971 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
972 };
973 
974 // OOO_FORM_PROP_ACTIONS
975 static XMLTransformerActionInit aFormPropActionTable[] =
976 {
977 	ENTRY1Q( FORM, PROPERTY_TYPE, XML_ATACTION_RENAME,
978 		  				XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ),
979 	ENTRY0( FORM, PROPERTY_IS_LIST, XML_ATACTION_REMOVE ),
980 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
981 };
982 
983 // OOO_XLINK_ACTIONS
984 static XMLTransformerActionInit aXLinkActionTable[] =
985 {
986 	ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ),
987 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
988 };
989 
990 // OOO_CONFIG_ITEM_SET_ACTIONS
991 static XMLTransformerActionInit aConfigItemSetActionTable[] =
992 {
993 	ENTRY1( CONFIG, NAME, XML_ATACTION_ADD_NAMESPACE_PREFIX,
994 					XML_NAMESPACE_OOO ),
995 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
996 };
997 
998 // OASIS_FORMULA_ACTIONS
999 static XMLTransformerActionInit aFormulaActionTable[] =
1000 {
1001 	ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX,
1002 		 			XML_NAMESPACE_OOOW ),
1003 	ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX,
1004 		 			XML_NAMESPACE_OOOW ),
1005 	ENTRY1( TABLE, CONDITION, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
1006 		 			XML_NAMESPACE_OOOW ),
1007 	ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX,
1008 		 			XML_NAMESPACE_OOOW ),
1009 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1010 };
1011 
1012 // OOO_ERROR_MACRO_ACTIONS
1013 static XMLTransformerActionInit aErrorMacroActionTable[] =
1014 {
1015 	ENTRY0( TABLE, NAME, XML_ATACTION_REMOVE ),
1016 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1017 };
1018 
1019 // OOO_DDE_CONV_MODE_ACTIONS
1020 static XMLTransformerActionInit aDDEConvModeActionTable[] =
1021 {
1022 	ENTRY1Q( TABLE, LET_TEXT, XML_ATACTION_RENAME,
1023 						XML_NAMESPACE_TABLE, XML_KEEP_TEXT ),
1024 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1025 };
1026 
1027 // OOO_DATAPILOT_MEMBER_ACTIONS
1028 static XMLTransformerActionInit aDataPilotMemberActionTable[] =
1029 {
1030 	ENTRY1Q( TABLE, DISPLAY_DETAILS, XML_ATACTION_RENAME,
1031 						XML_NAMESPACE_TABLE, XML_SHOW_DETAILS ),
1032 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1033 };
1034 
1035 // OOO_DATAPILOT_LEVEL_ACTIONS
1036 static XMLTransformerActionInit aDataPilotLevelActionTable[] =
1037 {
1038 	ENTRY1Q( TABLE, DISPLAY_EMPTY, XML_ATACTION_RENAME,
1039 						XML_NAMESPACE_TABLE, XML_SHOW_EMPTY ),
1040 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1041 };
1042 
1043 // OOO_SOURCE_SERVICE_ACTIONS
1044 static XMLTransformerActionInit aSourceServiceActionTable[] =
1045 {
1046 	ENTRY1Q( TABLE, USERNAME, XML_ATACTION_RENAME,
1047 						XML_NAMESPACE_TABLE, XML_USER_NAME ),
1048 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1049 };
1050 
1051 // OOO_ANIMATION_ACTIONS
1052 static XMLTransformerActionInit aAnimationsActionTable[] =
1053 {
1054 	ENTRY0( DRAW, SHAPE_ID, XML_ATACTION_SHAPEID ),
1055 	ENTRY0( PRESENTATION, PATH_ID, XML_ATACTION_SHAPEID ),
1056 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1057 };
1058 
1059 // OOO_DRAW_AREA_POLYGON_ACTIONS (to be added to OOO_SHAPE_ACTIONS)
1060 static XMLTransformerActionInit aDrawAreaPolygonActionTable[] =
1061 {
1062 	ENTRY1Q( SVG, POINTS, XML_ATACTION_RENAME,
1063              XML_NAMESPACE_DRAW, XML_POINTS ),
1064 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1065 };
1066 
1067 // OOO_CHART_ACTIONS
1068 static XMLTransformerActionInit aChartActionTable[] =
1069 {
1070 	ENTRY1( CHART, CLASS, XML_ATACTION_ADD_NAMESPACE_PREFIX,
1071 		 			XML_NAMESPACE_CHART ),
1072 	ENTRY0( CHART, ADD_IN_NAME, XML_ATACTION_REMOVE ),
1073 	ENTRY0( SVG, WIDTH, XML_ATACTION_INCH2IN ),
1074 	ENTRY0( SVG, HEIGHT, XML_ATACTION_INCH2IN ),
1075 	ENTRY0( CHART, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ),
1076 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1077 };
1078 
1079 // OOO_ALPHABETICAL_INDEX_MARK_ACTIONS
1080 static XMLTransformerActionInit aAlphabeticalIndexMarkActionTable[] =
1081 {
1082 	ENTRY1Q( TEXT, MAIN_ETRY, XML_ATACTION_RENAME,
1083              XML_NAMESPACE_TEXT, XML_MAIN_ENTRY ),
1084 	ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1085 };
1086 
1087 // OOO_SCRIPT_ACTIONS
1088 static XMLTransformerActionInit aScriptActionTable[] =
1089 {
1090     ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX, XML_NAMESPACE_OOO ),
1091     ENTRY1Q( SCRIPT, NAME, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_NAME ),
1092     ENTRY1Q( SCRIPT, READONLY, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_READONLY ),
1093     ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT )
1094 };
1095 
1096 static XMLTokenEnum aTokenMap[] =
1097 {
1098 	XML_NONE, XML_SINGLE, XML_DOUBLE, XML_BOLD, XML_BOLD_DOTTED,
1099 	XML_BOLD_DASH, XML_BOLD_LONG_DASH, XML_BOLD_DOT_DASH,
1100 	XML_BOLD_DOT_DOT_DASH, XML_BOLD_WAVE, XML_DOUBLE_WAVE,
1101 	XML_SINGLE_LINE, XML_DOUBLE_LINE, XML_THICK_LINE, XML_SLASH, XML_uX,
1102 	XML_TOKEN_END
1103 };
1104 
1105 //-----------------------------------------------------------------------------
1106 
1107 class XMLDocumentTransformerContext_Impl : public XMLTransformerContext
1108 {
1109 	::rtl::OUString m_aElemQName;
1110 	::rtl::OUString m_aOldClass;
1111 
1112 public:
1113 	TYPEINFO();
1114 
1115 	XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer,
1116 						   const ::rtl::OUString& rQName );
1117 	XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer,
1118 						   const ::rtl::OUString& rQName,
1119 		   				   sal_uInt16 nPrefix,
1120 		   				   ::xmloff::token::XMLTokenEnum eToken	);
1121 
1122 	virtual ~XMLDocumentTransformerContext_Impl();
1123 
1124 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1125 	virtual void EndElement();
1126 };
1127 
1128 TYPEINIT1( XMLDocumentTransformerContext_Impl, XMLTransformerContext );
1129 
1130 XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl(
1131 		XMLTransformerBase& rImp,
1132 		const OUString& rQName ) :
1133 	XMLTransformerContext( rImp, rQName ),
1134 	m_aElemQName( rQName )
1135 {
1136 }
1137 XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl(
1138 		XMLTransformerBase& rImp,
1139 		const OUString& rQName ,
1140 	    sal_uInt16 nPrefix,
1141 		::xmloff::token::XMLTokenEnum eToken) :
1142 	XMLTransformerContext( rImp, rQName ),
1143 	m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
1144 							::xmloff::token::GetXMLToken( eToken ) ) )
1145 {
1146 }
1147 
1148 XMLDocumentTransformerContext_Impl::~XMLDocumentTransformerContext_Impl()
1149 {
1150 }
1151 
1152 void XMLDocumentTransformerContext_Impl::StartElement(
1153 		const Reference< XAttributeList >& rAttrList )
1154 {
1155 	Reference< XAttributeList > xAttrList( rAttrList );
1156 
1157 	m_aOldClass = GetTransformer().GetClass();
1158 
1159 	XMLMutableAttributeList *pMutableAttrList = 0;
1160 	sal_Bool bOOo = sal_False, bOOoW = sal_False, bOOoC = sal_False,
1161 			 bDOM=sal_False, bDC = sal_False, bSVG = sal_False;
1162 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1163 	for( sal_Int16 i=0; i < nAttrCount; i++ )
1164 	{
1165 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
1166 		OUString aLocalName;
1167 		sal_uInt16 nPrefix =
1168 			GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
1169 																 &aLocalName );
1170 		if( XML_NAMESPACE_OFFICE == nPrefix &&
1171 			IsXMLToken( aLocalName, XML_CLASS ) )
1172 		{
1173 			const OUString& rValue = xAttrList->getValueByIndex( i );
1174 			GetTransformer().SetClass( rValue );
1175 
1176 			pMutableAttrList = new XMLMutableAttributeList( xAttrList );
1177 			xAttrList = pMutableAttrList;
1178 			OUString sMime(RTL_CONSTASCII_USTRINGPARAM("application/vnd.oasis.opendocument.") );
1179 			sMime += rValue;
1180 			pMutableAttrList->SetValueByIndex( i, sMime );
1181 			OUString aNewAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, ::xmloff::token::GetXMLToken( XML_MIMETYPE ) ) );
1182 			pMutableAttrList->RenameAttributeByIndex(i, aNewAttrQName );
1183 			break;
1184 		}
1185 		else if( XML_NAMESPACE_XMLNS == nPrefix )
1186 		{
1187 			const OUString& rAttrValue = xAttrList->getValueByIndex( i );
1188 			if( IsXMLToken( rAttrValue, XML_N_OOO ) )
1189 				bOOo = sal_True;
1190 			else if( IsXMLToken( rAttrValue, XML_N_OOOW ) )
1191 				bOOoW = sal_True;
1192 			else if( IsXMLToken( rAttrValue, XML_N_OOOC ) )
1193 				bOOoC = sal_True;
1194 			else if( IsXMLToken( rAttrValue, XML_N_DOM ) )
1195 				bDOM = sal_True;
1196 			else if( IsXMLToken( rAttrValue, XML_N_DC ) )
1197 				bDC = sal_True;
1198 			else if( IsXMLToken( rAttrValue, XML_N_SVG ) )
1199 				bSVG = sal_True;
1200 		}
1201 	}
1202 	if( !(bOOo && bOOoW && bOOoC && bDOM && bDC && bSVG) )
1203 	{
1204 		if( !pMutableAttrList  )
1205 		{
1206 			pMutableAttrList = new XMLMutableAttributeList( xAttrList );
1207 			xAttrList = pMutableAttrList;
1208 		}
1209 		if( !bOOo )
1210 			pMutableAttrList->AddAttribute(
1211 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1212 						XML_NAMESPACE_OOO ),
1213 					GetTransformer().GetNamespaceMap().GetNameByKey(
1214 						XML_NAMESPACE_OOO ) );
1215 		if( !bOOoW )
1216 			pMutableAttrList->AddAttribute(
1217 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1218 						XML_NAMESPACE_OOOW ),
1219 					GetTransformer().GetNamespaceMap().GetNameByKey(
1220 						XML_NAMESPACE_OOOW ) );
1221 		if( !bOOoC )
1222 			pMutableAttrList->AddAttribute(
1223 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1224 						XML_NAMESPACE_OOOC ),
1225 					GetTransformer().GetNamespaceMap().GetNameByKey(
1226 						XML_NAMESPACE_OOOC ) );
1227 		if( !bDOM )
1228 			pMutableAttrList->AddAttribute(
1229 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1230 						XML_NAMESPACE_DOM ),
1231 					GetTransformer().GetNamespaceMap().GetNameByKey(
1232 						XML_NAMESPACE_DOM ) );
1233 		if( !bDC )
1234 			pMutableAttrList->AddAttribute(
1235 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1236 						XML_NAMESPACE_DC ),
1237 					GetTransformer().GetNamespaceMap().GetNameByKey(
1238 						XML_NAMESPACE_DC ) );
1239 		if( !bSVG )
1240 			pMutableAttrList->AddAttribute(
1241 					GetTransformer().GetNamespaceMap().GetAttrNameByKey(
1242 						XML_NAMESPACE_SVG ),
1243 					GetTransformer().GetNamespaceMap().GetNameByKey(
1244 						XML_NAMESPACE_SVG ) );
1245 	}
1246 
1247 	GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
1248 }
1249 
1250 void XMLDocumentTransformerContext_Impl::EndElement()
1251 {
1252 	GetTransformer().GetDocHandler()->endElement( m_aElemQName );
1253 
1254 	GetTransformer().SetClass( m_aOldClass );
1255 }
1256 
1257 //-----------------------------------------------------------------------------
1258 
1259 class XMLBodyTransformerContext_Impl : public XMLTransformerContext
1260 {
1261 	OUString m_aClassQName;
1262 
1263 public:
1264 	TYPEINFO();
1265 
1266 	XMLBodyTransformerContext_Impl( XMLTransformerBase& rTransformer,
1267 						   const ::rtl::OUString& rQName );
1268 
1269 	virtual ~XMLBodyTransformerContext_Impl();
1270 
1271 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1272 	virtual void EndElement();
1273 };
1274 
1275 TYPEINIT1( XMLBodyTransformerContext_Impl, XMLTransformerContext );
1276 
1277 XMLBodyTransformerContext_Impl::XMLBodyTransformerContext_Impl(
1278 		XMLTransformerBase& rImp,
1279 		const OUString& rQName ) :
1280 	XMLTransformerContext( rImp, rQName )
1281 {
1282 }
1283 
1284 XMLBodyTransformerContext_Impl::~XMLBodyTransformerContext_Impl()
1285 {
1286 }
1287 
1288 void XMLBodyTransformerContext_Impl::StartElement(
1289 		const Reference< XAttributeList >& rAttrList )
1290 {
1291 	XMLTransformerContext::StartElement( rAttrList );
1292 
1293 	XMLMutableAttributeList *pMutableAttrList =
1294 		new XMLMutableAttributeList( rAttrList );
1295 	Reference< XAttributeList > xAttrList = pMutableAttrList;
1296 	OUString aClass( GetTransformer().GetClass() );
1297 	if( !aClass.getLength() )
1298 	{
1299 		aClass = GetXMLToken( XML_TEXT );
1300 	}
1301 	else if( IsXMLToken( aClass, XML_TEXT_GLOBAL ) )
1302 	{
1303 		OUString aGlobalQName(
1304 				GetTransformer().GetNamespaceMap().GetQNameByKey(
1305 							XML_NAMESPACE_TEXT, GetXMLToken(XML_GLOBAL ) ) );
1306 		pMutableAttrList->AddAttribute( aGlobalQName, GetXMLToken(XML_TRUE) );
1307 
1308 		aClass = GetXMLToken( XML_TEXT );
1309 	}
1310 
1311 	m_aClassQName = GetTransformer().GetNamespaceMap().GetQNameByKey(
1312 						XML_NAMESPACE_OFFICE, aClass );
1313 	GetTransformer().GetDocHandler()->startElement( m_aClassQName,
1314 													xAttrList );
1315 }
1316 
1317 void XMLBodyTransformerContext_Impl::EndElement()
1318 {
1319 	GetTransformer().GetDocHandler()->endElement( m_aClassQName );
1320 	XMLTransformerContext::EndElement();
1321 }
1322 
1323 //-----------------------------------------------------------------------------
1324 
1325 class XMLTabStopOOoTContext_Impl : public XMLPersElemContentTContext
1326 {
1327 public:
1328 	TYPEINFO();
1329 
1330 	XMLTabStopOOoTContext_Impl( XMLTransformerBase& rTransformer,
1331 						   const ::rtl::OUString& rQName );
1332 
1333 	virtual ~XMLTabStopOOoTContext_Impl();
1334 
1335 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1336 };
1337 
1338 TYPEINIT1( XMLTabStopOOoTContext_Impl, XMLPersElemContentTContext );
1339 
1340 XMLTabStopOOoTContext_Impl::XMLTabStopOOoTContext_Impl(
1341 		XMLTransformerBase& rImp,
1342 		const OUString& rQName ) :
1343 	XMLPersElemContentTContext( rImp, rQName )
1344 {
1345 }
1346 
1347 XMLTabStopOOoTContext_Impl::~XMLTabStopOOoTContext_Impl()
1348 {
1349 }
1350 
1351 void XMLTabStopOOoTContext_Impl::StartElement(
1352 		const Reference< XAttributeList >& rAttrList )
1353 {
1354 	XMLTransformerActions *pActions =
1355 		GetTransformer().GetUserDefinedActions( OOO_TAB_STOP_ACTIONS  );
1356 	OSL_ENSURE( pActions, "go no actions" );
1357 
1358 	Reference< XAttributeList > xAttrList( rAttrList );
1359 	XMLMutableAttributeList *pMutableAttrList = 0;
1360 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1361 	for( sal_Int16 i=0; i < nAttrCount; i++ )
1362 	{
1363 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
1364 		OUString aLocalName;
1365 		sal_uInt16 nPrefix =
1366 			GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
1367 																 &aLocalName );
1368 		XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
1369 		XMLTransformerActions::const_iterator aIter =
1370 			pActions->find( aKey );
1371 		if( !(aIter == pActions->end() ) )
1372 		{
1373 			if( !pMutableAttrList )
1374 			{
1375 				pMutableAttrList =
1376 					new XMLMutableAttributeList( xAttrList );
1377 				xAttrList = pMutableAttrList;
1378 			}
1379 			const OUString& rAttrValue = xAttrList->getValueByIndex( i );
1380 			switch( (*aIter).second.m_nActionType )
1381 			{
1382 			case XML_ATACTION_RENAME:
1383 				{
1384 					OUString aNewAttrQName(
1385 						GetTransformer().GetNamespaceMap().GetQNameByKey(
1386 							(*aIter).second.GetQNamePrefixFromParam1(),
1387 							::xmloff::token::GetXMLToken(
1388 							(*aIter).second.GetQNameTokenFromParam1()) ) );
1389 					pMutableAttrList->RenameAttributeByIndex( i,
1390 															  aNewAttrQName );
1391 				}
1392 				if( IsXMLToken( aLocalName, XML_LEADER_CHAR ) &&
1393 				 	rAttrValue.getLength() > 0 &&
1394 					rAttrValue[0] != ' ' )
1395 				{
1396 					OUString aNewAttrQName(
1397 						GetTransformer().GetNamespaceMap().GetQNameByKey(
1398 							XML_NAMESPACE_STYLE,
1399 							::xmloff::token::GetXMLToken(XML_LEADER_STYLE) ) );
1400 					pMutableAttrList->AddAttribute( aNewAttrQName,
1401 												 GetXMLToken( XML_SOLID ) );
1402 				}
1403 				break;
1404 			case XML_ATACTION_INCH2IN:
1405 				{
1406 					OUString aAttrValue( rAttrValue );
1407 					if( XMLTransformerBase::ReplaceSingleInchWithIn(
1408 								aAttrValue ) )
1409 						pMutableAttrList->SetValueByIndex( i, aAttrValue );
1410 				}
1411 				break;
1412 			default:
1413 				OSL_ENSURE( !this, "unknown action" );
1414 				break;
1415 			}
1416 		}
1417 	}
1418 
1419 	XMLPersElemContentTContext::StartElement( xAttrList );
1420 }
1421 
1422 // -----------------------------------------------------------------------------
1423 
1424 class XMLTrackedChangesOOoTContext_Impl : public XMLTransformerContext
1425 {
1426 	sal_uInt16 m_nPrefix;
1427 	XMLTokenEnum m_eToken;
1428 
1429 public:
1430 
1431 	TYPEINFO();
1432 
1433 	XMLTrackedChangesOOoTContext_Impl( XMLTransformerBase& rTransformer,
1434 						   const ::rtl::OUString& rQName,
1435 		   					sal_uInt16 nPrefix,
1436 							XMLTokenEnum eToken	);
1437 
1438 	virtual ~XMLTrackedChangesOOoTContext_Impl();
1439 
1440 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1441 };
1442 
1443 TYPEINIT1( XMLTrackedChangesOOoTContext_Impl, XMLTransformerContext );
1444 
1445 XMLTrackedChangesOOoTContext_Impl::XMLTrackedChangesOOoTContext_Impl(
1446 		XMLTransformerBase& rImp,
1447 	    const OUString& rQName,
1448 		sal_uInt16 nPrefix,
1449 		XMLTokenEnum eToken	) :
1450 	XMLTransformerContext( rImp, rQName ),
1451 	m_nPrefix( nPrefix ),
1452 	m_eToken( eToken )
1453 {
1454 }
1455 
1456 XMLTrackedChangesOOoTContext_Impl::~XMLTrackedChangesOOoTContext_Impl()
1457 {
1458 }
1459 
1460 void XMLTrackedChangesOOoTContext_Impl::StartElement(
1461 		const Reference< XAttributeList >& rAttrList )
1462 {
1463 	Reference< XAttributeList > xAttrList( rAttrList );
1464 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1465 	for( sal_Int16 i=0; i < nAttrCount; i++ )
1466 	{
1467 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
1468 		OUString aLocalName;
1469 		sal_uInt16 nPrefix =
1470 			GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
1471 																 &aLocalName );
1472 		if( m_nPrefix == nPrefix && IsXMLToken( aLocalName, m_eToken ) )
1473 		{
1474 			const Reference< XPropertySet > rPropSet =
1475 				GetTransformer().GetPropertySet();
1476 			OSL_ENSURE( rPropSet.is(), "no info property set" );
1477 			if( rPropSet.is() )
1478 			{
1479 				const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey";
1480 				OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey));
1481 				Reference< XPropertySetInfo > xPropSetInfo(
1482 							rPropSet->getPropertySetInfo() );
1483 				if( xPropSetInfo.is() &&
1484 					xPropSetInfo->hasPropertyByName( aPropName ) )
1485 				{
1486 					Sequence < sal_Int8 > aKey;
1487 					SvXMLUnitConverter::decodeBase64( aKey,
1488 										xAttrList->getValueByIndex( i ) );
1489 					rPropSet->setPropertyValue( aPropName, makeAny( aKey ) );
1490 				}
1491 				else
1492 				{
1493 					OSL_ENSURE( !this, "RedineProtectionKey is missing" );
1494 				}
1495 			}
1496 			break;
1497 		}
1498 	}
1499 	XMLTransformerContext::StartElement( xAttrList );
1500 }
1501 
1502 // -----------------------------------------------------------------------------
1503 
1504 class XMLTableOOoTransformerContext_Impl : public XMLTransformerContext
1505 {
1506 	::rtl::OUString m_aElemQName;
1507 
1508 public:
1509 	TYPEINFO();
1510 
1511 	XMLTableOOoTransformerContext_Impl( XMLTransformerBase& rTransformer,
1512 						   const ::rtl::OUString& rQName );
1513 
1514 	virtual ~XMLTableOOoTransformerContext_Impl();
1515 
1516 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1517 	virtual void EndElement();
1518 };
1519 
1520 TYPEINIT1( XMLTableOOoTransformerContext_Impl, XMLTransformerContext );
1521 
1522 XMLTableOOoTransformerContext_Impl::XMLTableOOoTransformerContext_Impl(
1523 		XMLTransformerBase& rImp,
1524 	    const OUString& rQName ) :
1525 	XMLTransformerContext( rImp, rQName ),
1526 	m_aElemQName( rQName )
1527 {
1528 }
1529 
1530 XMLTableOOoTransformerContext_Impl::~XMLTableOOoTransformerContext_Impl()
1531 {
1532 }
1533 
1534 void XMLTableOOoTransformerContext_Impl::StartElement(
1535 		const Reference< XAttributeList >& rAttrList )
1536 {
1537     // --> OD 2005-07-05 #i50521# - perform OOO_STYLE_REF_ACTIONS for all applications
1538     Reference< XAttributeList > xAttrList( rAttrList );
1539     XMLMutableAttributeList* pMutableAttrList =
1540         GetTransformer().ProcessAttrList( xAttrList, OOO_STYLE_REF_ACTIONS, sal_False );
1541     // <--
1542     if( rAttrList->getLength() && IsXMLToken( GetTransformer().GetClass(), XML_SPREADSHEET  ) )
1543     {
1544         sal_Bool bPrintRanges(sal_False);
1545 
1546 	    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1547 	    for( sal_Int16 i=0; i < nAttrCount; i++ )
1548 	    {
1549 		    const OUString& rAttrName = xAttrList->getNameByIndex( i );
1550 		    OUString aLocalName;
1551 		    sal_uInt16 nPrefix =
1552 			    GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
1553 																    &aLocalName );
1554             if( XML_NAMESPACE_TABLE == nPrefix &&
1555                 IsXMLToken( aLocalName, XML_PRINT_RANGES ) )
1556             {
1557                 bPrintRanges = sal_True;
1558             }
1559 	    }
1560         if (!bPrintRanges && pMutableAttrList)
1561         {
1562 			xAttrList = pMutableAttrList;
1563             pMutableAttrList->AddAttribute(GetTransformer().GetNamespaceMap().GetQNameByKey(
1564 								XML_NAMESPACE_TABLE,
1565 								GetXMLToken( XML_PRINT ) ), GetXMLToken ( XML_FALSE ));
1566         }
1567     }
1568 
1569     GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
1570 }
1571 
1572 void XMLTableOOoTransformerContext_Impl::EndElement()
1573 {
1574 	GetTransformer().GetDocHandler()->endElement( m_aElemQName );
1575 }
1576 
1577 
1578 //-----------------------------------------------------------------------------
1579 
1580 XMLTransformerContext *OOo2OasisTransformer::CreateUserDefinedContext(
1581 							  const TransformerAction_Impl& rAction,
1582 							  const OUString& rQName,
1583 	   						  sal_Bool bPersistent	)
1584 {
1585 	switch( rAction.m_nActionType )
1586 	{
1587 	case XML_ETACTION_DOCUMENT:
1588 		return new XMLDocumentTransformerContext_Impl( *this, rQName );
1589 	case XML_ETACTION_DOCUMENT_RENAME:
1590 		return new XMLDocumentTransformerContext_Impl( *this, rQName,
1591 							rAction.GetQNamePrefixFromParam1(),
1592 							rAction.GetQNameTokenFromParam1() );
1593 	case XML_ETACTION_BODY:
1594 		return new XMLBodyTransformerContext_Impl( *this, rQName );
1595 	case XML_ETACTION_STYLE:
1596 		return new XMLStyleOOoTContext( *this, rQName,
1597 			   				static_cast< XMLFamilyType >( rAction.m_nParam1 ),
1598 			   				bPersistent	);
1599 	case XML_ETACTION_STYLE_RENAME:
1600 		return new XMLStyleOOoTContext( *this, rQName,
1601 				    static_cast< XMLFamilyType >( rAction.m_nParam2 ),
1602 					rAction.GetQNamePrefixFromParam1(),
1603 					rAction.GetQNameTokenFromParam1(),
1604 					bPersistent	);
1605 	case XML_ETACTION_FRAME:
1606 		return new XMLFrameOOoTransformerContext( *this, rQName );
1607 	case XML_ETACTION_EVENT:
1608 		return new XMLEventOOoTransformerContext( *this, rQName, bPersistent );
1609 	case XML_ETACTION_TAB_STOP:
1610 		return new XMLTabStopOOoTContext_Impl( *this, rQName );
1611 	case XML_ETACTION_FORM_CONTROL:
1612 		return new XMLControlOOoTransformerContext( *this, rQName );
1613 	case XML_ETACTION_FORM_PROPERTY:
1614 		return new XMLFormPropOOoTransformerContext( *this, rQName );
1615 	case XML_ETACTION_CHART:
1616 		return new XMLChartOOoTransformerContext( *this, rQName );
1617 	case XML_ETACTION_TRACKED_CHANGES:
1618 		return new XMLTrackedChangesOOoTContext_Impl( *this, rQName,
1619 			   				rAction.GetQNamePrefixFromParam1(),
1620 							rAction.GetQNameTokenFromParam1() );
1621     case XML_ETACTION_CHART_PLOT_AREA:
1622         return new XMLChartPlotAreaOOoTContext( *this, rQName );
1623     case XML_ETACTION_TABLE:
1624         return new XMLTableOOoTransformerContext_Impl( *this, rQName );
1625 	default:
1626 		OSL_ENSURE( !this, "no user defined context found!" );
1627 	}
1628 
1629 	// default is copying
1630 	return new XMLTransformerContext( *this, rQName );
1631 }
1632 
1633 XMLTransformerActions *OOo2OasisTransformer::GetUserDefinedActions(
1634 		sal_uInt16 n )
1635 {
1636 	XMLTransformerActions *pActions = 0;
1637 	if( n < MAX_OOO_ACTIONS )
1638 	{
1639 		if( !m_aActions[n] )
1640 		{
1641 			if( n<MAX_OOO_PROP_ACTIONS )
1642 			{
1643 				m_aActions[n] =
1644 					XMLStyleOOoTContext::CreateTransformerActions( n );
1645 			}
1646 			else switch( n )
1647 			{
1648 				case OOO_STYLE_ACTIONS:
1649 					m_aActions[OOO_STYLE_ACTIONS] =
1650 						new XMLTransformerActions( aStyleActionTable );
1651 					break;
1652 				case OOO_FONT_DECL_ACTIONS:
1653 					m_aActions[OOO_FONT_DECL_ACTIONS] =
1654 						new XMLTransformerActions( aFontDeclActionTable );
1655 					break;
1656 				case OOO_SHAPE_ACTIONS:
1657 					m_aActions[OOO_SHAPE_ACTIONS] =
1658 						new XMLTransformerActions( aShapeActionTable );
1659 					break;
1660 				case OOO_CONNECTOR_ACTIONS:
1661 					m_aActions[OOO_CONNECTOR_ACTIONS] =
1662 						new XMLTransformerActions( aConnectorActionTable );
1663 					break;
1664 				case OOO_TAB_STOP_ACTIONS:
1665 					m_aActions[OOO_TAB_STOP_ACTIONS] =
1666 						new XMLTransformerActions( aTabStopActionTable );
1667 					break;
1668 				case OOO_INDEX_ENTRY_TAB_STOP_ACTIONS:
1669 					m_aActions[OOO_INDEX_ENTRY_TAB_STOP_ACTIONS] =
1670 						new XMLTransformerActions( aIndexEntryTabStopActionTable );
1671 					break;
1672 				case OOO_LINENUMBERING_ACTIONS:
1673 					m_aActions[OOO_LINENUMBERING_ACTIONS] =
1674 						new XMLTransformerActions( aLineNumberingActionTable );
1675 					break;
1676 				case OOO_FOOTNOTE_SEP_ACTIONS:
1677 					m_aActions[OOO_FOOTNOTE_SEP_ACTIONS] =
1678 						new XMLTransformerActions( aFootnoteSepActionTable );
1679 					break;
1680 				case OOO_DROP_CAP_ACTIONS:
1681 					m_aActions[OOO_DROP_CAP_ACTIONS] =
1682 						new XMLTransformerActions( aDropCapActionTable );
1683 					break;
1684 				case OOO_COLUMNS_ACTIONS:
1685 					m_aActions[OOO_COLUMNS_ACTIONS] =
1686 						new XMLTransformerActions( aColumnsActionTable );
1687 					break;
1688 				case OOO_TEXT_VALUE_TYPE_ACTIONS:
1689 					m_aActions[OOO_TEXT_VALUE_TYPE_ACTIONS] =
1690 						new XMLTransformerActions( aTextValueTypeActionTable );
1691 					break;
1692 				case OOO_TABLE_VALUE_TYPE_ACTIONS:
1693 					m_aActions[OOO_TABLE_VALUE_TYPE_ACTIONS] =
1694 						new XMLTransformerActions( aTableValueTypeActionTable );
1695 					break;
1696 				case OOO_PARA_ACTIONS:
1697 					m_aActions[OOO_PARA_ACTIONS] =
1698 						new XMLTransformerActions( aParaActionTable );
1699 					break;
1700 				case OOO_STYLE_REF_ACTIONS:
1701 					m_aActions[OOO_STYLE_REF_ACTIONS] =
1702 						new XMLTransformerActions( aStyleRefActionTable );
1703 					break;
1704 				case OOO_MASTER_PAGE_ACTIONS:
1705 					m_aActions[OOO_MASTER_PAGE_ACTIONS] =
1706 						new XMLTransformerActions( aMasterPageActionTable );
1707 					break;
1708 				case OOO_ANNOTATION_ACTIONS:
1709 					m_aActions[OOO_ANNOTATION_ACTIONS] =
1710 						new XMLTransformerActions( aAnnotationActionTable );
1711 					break;
1712 				case OOO_CHANGE_INFO_ACTIONS:
1713 					m_aActions[OOO_CHANGE_INFO_ACTIONS] =
1714 						new XMLTransformerActions( aChangeInfoActionTable );
1715 					break;
1716 				case OOO_FRAME_ELEM_ACTIONS:
1717 					m_aActions[OOO_FRAME_ELEM_ACTIONS] =
1718 						new XMLTransformerActions( aFrameElemActionTable );
1719 					break;
1720 				case OOO_FRAME_ATTR_ACTIONS:
1721 					m_aActions[OOO_FRAME_ATTR_ACTIONS] =
1722 						new XMLTransformerActions( aFrameAttrActionTable );
1723 					break;
1724 				case OOO_BACKGROUND_IMAGE_ACTIONS:
1725                     // --> OD 2005-06-10 #i50322#
1726                     // use special actions for Writer documents.
1727                     m_aActions[OOO_BACKGROUND_IMAGE_ACTIONS] =
1728                         isWriter()
1729                         ? new XMLTransformerActions( aWriterBackgroundImageActionTable )
1730                         : new XMLTransformerActions( aBackgroundImageActionTable );
1731                     // <--
1732 					break;
1733 				case OOO_DDE_CONNECTION_DECL_ACTIONS:
1734 					m_aActions[OOO_DDE_CONNECTION_DECL_ACTIONS] =
1735 						new XMLTransformerActions( aDDEConnectionDeclActionTable );
1736 					break;
1737 				case OOO_EVENT_ACTIONS:
1738 					m_aActions[OOO_EVENT_ACTIONS] =
1739 						new XMLTransformerActions( aEventActionTable );
1740 					break;
1741 				case OOO_FORM_CONTROL_ACTIONS:
1742 					m_aActions[OOO_FORM_CONTROL_ACTIONS] =
1743 						new XMLTransformerActions( aFormControlActionTable );
1744 					break;
1745 				case OOO_FORM_COLUMN_ACTIONS:
1746 					m_aActions[OOO_FORM_COLUMN_ACTIONS] =
1747 						new XMLTransformerActions( aFormColumnActionTable );
1748 					break;
1749 				case OOO_FORM_PROP_ACTIONS:
1750 					m_aActions[OOO_FORM_PROP_ACTIONS] =
1751 						new XMLTransformerActions( aFormPropActionTable );
1752 					break;
1753 				case OOO_XLINK_ACTIONS:
1754 					m_aActions[OOO_XLINK_ACTIONS] =
1755 						new XMLTransformerActions( aXLinkActionTable );
1756 					break;
1757 				case OOO_CONFIG_ITEM_SET_ACTIONS:
1758 					m_aActions[OOO_CONFIG_ITEM_SET_ACTIONS] =
1759 						new XMLTransformerActions( aConfigItemSetActionTable );
1760 					break;
1761 				case OOO_FORMULA_ACTIONS:
1762 					m_aActions[OOO_FORMULA_ACTIONS] =
1763 						new XMLTransformerActions( aFormulaActionTable );
1764 					break;
1765                 case OOO_CHART_ACTIONS:
1766 					m_aActions[OOO_CHART_ACTIONS] =
1767 						new XMLTransformerActions( aChartActionTable );
1768 					break;
1769 				case OOO_ERROR_MACRO_ACTIONS:
1770 					m_aActions[OOO_ERROR_MACRO_ACTIONS] =
1771 						new XMLTransformerActions( aErrorMacroActionTable );
1772 					break;
1773 				case OOO_DDE_CONV_MODE_ACTIONS:
1774 					m_aActions[OOO_DDE_CONV_MODE_ACTIONS] =
1775 						new XMLTransformerActions( aDDEConvModeActionTable );
1776 					break;
1777                 case OOO_ALPHABETICAL_INDEX_MARK_ACTIONS:
1778                     m_aActions[OOO_ALPHABETICAL_INDEX_MARK_ACTIONS] =
1779                         new XMLTransformerActions( aAlphabeticalIndexMarkActionTable );
1780                     break;
1781 			    case OOO_DATAPILOT_MEMBER_ACTIONS:
1782 				    m_aActions[OOO_DATAPILOT_MEMBER_ACTIONS] =
1783 					    new XMLTransformerActions( aDataPilotMemberActionTable );
1784 			    case OOO_DATAPILOT_LEVEL_ACTIONS:
1785 				    m_aActions[OOO_DATAPILOT_LEVEL_ACTIONS] =
1786 					    new XMLTransformerActions( aDataPilotLevelActionTable );
1787 			    case OOO_SOURCE_SERVICE_ACTIONS:
1788 				    m_aActions[OOO_SOURCE_SERVICE_ACTIONS] =
1789 					    new XMLTransformerActions( aSourceServiceActionTable );
1790                 case OOO_DRAW_AREA_POLYGON_ACTIONS:
1791                     m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS] =
1792                         new XMLTransformerActions( aShapeActionTable );
1793                     m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS]
1794                         ->Add( aDrawAreaPolygonActionTable );
1795                     break;
1796                 case OOO_SCRIPT_ACTIONS:
1797                     m_aActions[OOO_SCRIPT_ACTIONS] =
1798                         new XMLTransformerActions( aScriptActionTable );
1799 					break;
1800 				case OOO_ANIMATION_ACTIONS:
1801 					m_aActions[OOO_ANIMATION_ACTIONS] =
1802 						new XMLTransformerActions( aAnimationsActionTable );
1803 					break;
1804 			}
1805 		}
1806 		pActions = m_aActions[n];
1807 	}
1808 
1809 	return pActions;
1810 }
1811 
1812 OUString OOo2OasisTransformer::GetEventName( const OUString& rName, sal_Bool )
1813 {
1814 	if( !m_pEventMap )
1815 		m_pEventMap = XMLEventOOoTransformerContext::CreateEventMap();
1816 
1817 	OUString aNewName;
1818 	sal_uInt16 nPrefix = XMLEventOOoTransformerContext::GetEventName( rName,
1819 													aNewName, *m_pEventMap );
1820 	if( XML_NAMESPACE_UNKNOWN != nPrefix )
1821 		aNewName = GetNamespaceMap().GetQNameByKey( nPrefix, aNewName );
1822 	else
1823 		aNewName = rName;
1824 
1825 	return aNewName;
1826 }
1827 
1828 
1829 OOo2OasisTransformer::OOo2OasisTransformer( const sal_Char *pImplName,
1830 											const sal_Char *pSubServiceName )
1831 		throw() :
1832 	XMLTransformerBase( aActionTable, aTokenMap ),
1833 	m_pEventMap( 0 )
1834 {
1835 	if( pImplName )
1836 		m_aImplName = OUString::createFromAscii( pImplName );
1837 	else
1838 		m_aImplName = OOo2OasisTransformer_getImplementationName();
1839 	if( pSubServiceName )
1840 		m_aSubServiceName = OUString::createFromAscii( pSubServiceName );
1841 
1842 	GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE_OOO), XML_NAMESPACE_OFFICE );
1843 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
1844 
1845 	GetNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META_OOO), XML_NAMESPACE_META );
1846 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
1847 
1848 	GetNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE_OOO), XML_NAMESPACE_STYLE );
1849 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
1850 
1851 	GetNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER_OOO), XML_NAMESPACE_NUMBER );
1852 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
1853 
1854 	GetNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG_OOO), XML_NAMESPACE_CONFIG );
1855 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
1856 
1857 	GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT_OOO), XML_NAMESPACE_TEXT );
1858 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
1859 
1860 	GetNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE_OOO), XML_NAMESPACE_TABLE );
1861 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
1862 
1863 	GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW_OOO), XML_NAMESPACE_DRAW );
1864 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
1865 
1866 	GetNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D_OOO), XML_NAMESPACE_DR3D );
1867 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
1868 
1869 	GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION_OOO), XML_NAMESPACE_PRESENTATION );
1870 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION );
1871 
1872 	GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART_OOO), XML_NAMESPACE_CHART );
1873 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
1874 
1875 	GetNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM_OOO), XML_NAMESPACE_FORM );
1876 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
1877 
1878 	GetNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT_OOO), XML_NAMESPACE_SCRIPT );
1879 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
1880 
1881 	GetNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO), XML_NAMESPACE_FO );
1882 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
1883 
1884 	GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG),  XML_NAMESPACE_SVG );
1885 	GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
1886 
1887 	for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
1888 		m_aActions[i] = 0;
1889 }
1890 
1891 OOo2OasisTransformer::~OOo2OasisTransformer() throw()
1892 {
1893 	for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i )
1894 		delete m_aActions[i];
1895 	XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap );
1896 }
1897 
1898 Any OOo2OasisTransformer::queryInterface( const Type& rType )
1899     throw (RuntimeException)
1900 {
1901     Any aRet;
1902     if ( rType == ::getCppuType((Reference<XImporter> *)0) )
1903     {
1904         Reference<XImporter> xThis( this );
1905        	aRet <<= xThis;
1906     }
1907     else if ( rType == ::getCppuType((Reference<XFilter> *)0) )
1908     {
1909         Reference<XFilter> xThis( this );
1910         aRet <<= xThis;
1911     }
1912     else
1913     {
1914         aRet = XMLTransformerBase::queryInterface(rType);
1915     }
1916 
1917     return aRet;
1918 }
1919 
1920 // XImporter
1921 void SAL_CALL OOo2OasisTransformer::setTargetDocument(
1922 		const Reference< XComponent >& xDoc )
1923 	throw( IllegalArgumentException, RuntimeException)
1924 {
1925 	if( !GetDocHandler().is() )
1926 	{
1927 		// if initialize hasn't been called, then we have to call it now
1928 		// to get the sub component initialized.
1929 		Sequence<Any> aArgs( 0 );
1930 		Initialize( aArgs );
1931 	}
1932 
1933 	mxModel.set( xDoc, UNO_QUERY );
1934 
1935 	Reference< XImporter > xImp( GetDocHandler(), UNO_QUERY );
1936 	OSL_ENSURE( xImp.is(), "doc handler is not an importer" );
1937 	if( xImp.is() )
1938 		xImp->setTargetDocument( xDoc );
1939 }
1940 
1941 // XFilter
1942 sal_Bool SAL_CALL OOo2OasisTransformer::filter(
1943 		const Sequence< PropertyValue >& aDescriptor )
1944     throw ( RuntimeException)
1945 {
1946 	Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY );
1947 	OSL_ENSURE( xFilter.is(), "doc handler is not a filter" );
1948 	if( xFilter.is() )
1949 		return xFilter->filter( aDescriptor );
1950 
1951     return sal_False;
1952 }
1953 
1954 void SAL_CALL OOo2OasisTransformer::cancel(  )
1955     throw ( RuntimeException)
1956 {
1957 	Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY );
1958 	OSL_ENSURE( xFilter.is(), "doc handler is not a filter" );
1959 	if( xFilter.is() )
1960 		xFilter->cancel();
1961 }
1962 
1963 // XInitialize
1964 void SAL_CALL OOo2OasisTransformer::initialize(
1965 				const Sequence< Any >& rArguments )
1966 	throw( Exception, RuntimeException )
1967 {
1968 	Initialize( rArguments );
1969 }
1970 
1971 void SAL_CALL OOo2OasisTransformer::startDocument( void )
1972 	throw( SAXException, RuntimeException )
1973 {
1974 	if( !GetDocHandler().is() )
1975 	{
1976 		// if initialize hasn't been called, then we have to call it now
1977 		// to get the sub component initialized.
1978 		Sequence<Any> aArgs( 0 );
1979 		Initialize( aArgs );
1980 	}
1981 
1982 	XMLTransformerBase::startDocument();
1983 }
1984 
1985 
1986 void SAL_CALL OOo2OasisTransformer::Initialize(
1987 				const Sequence< Any >& rArguments )
1988 	throw( Exception, RuntimeException )
1989 {
1990 	OSL_ENSURE( !GetDocHandler().is(), "duplication initialization" );
1991 
1992 	Reference< XDocumentHandler > xDocHandler;
1993 	if( m_aSubServiceName.getLength() )
1994 	{
1995 		Reference< XMultiServiceFactory > xFactory =
1996 			comphelper::getProcessServiceFactory();
1997 		if( xFactory.is() )
1998 		{
1999 			try
2000 			{
2001 				// get filter component
2002 				xDocHandler = Reference< XDocumentHandler >(
2003 						xFactory->createInstanceWithArguments( m_aSubServiceName,
2004 															   rArguments ),
2005 						UNO_QUERY);
2006 			}
2007 			catch( Exception& )
2008 			{
2009 			}
2010 		}
2011 	}
2012 
2013 	OSL_ENSURE( xDocHandler.is(), "can't instantiate filter component" );
2014 	if( xDocHandler.is() )
2015 	{
2016 		Sequence<Any> aArgs( 1 + rArguments.getLength() );
2017 		aArgs[0] <<= xDocHandler;
2018 		for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
2019 			aArgs[i+1] = rArguments[i];
2020 		XMLTransformerBase::initialize( aArgs );
2021 
2022 		OSL_ENSURE( GetDocHandler() == xDocHandler,
2023 					"duplicate doc handler" );
2024 	}
2025 	else
2026 	{
2027 		XMLTransformerBase::initialize( rArguments );
2028 	}
2029 }
2030 
2031 
2032 Sequence< sal_Int8 >  static CreateUnoTunnelId()
2033 {
2034 	static osl::Mutex aCreateMutex;
2035 	::osl::Guard<osl::Mutex> aGuard( aCreateMutex );
2036 	Sequence< sal_Int8 > aSeq( 16 );
2037     rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0,	sal_True );
2038 	return aSeq;
2039 }
2040 
2041 const Sequence< sal_Int8 > & OOo2OasisTransformer::getUnoTunnelId() throw()
2042 {
2043     static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
2044 	return aSeq;
2045 }
2046 
2047 // XUnoTunnel
2048 sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId )
2049 	throw(RuntimeException)
2050 {
2051     if( rId.getLength() == 16
2052         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
2053 										rId.getConstArray(), 16 ) )
2054     {
2055 		return reinterpret_cast< sal_Int64 >( this );
2056     }
2057 	else
2058 	{
2059 		return (sal_Int64)0;
2060 	}
2061 }
2062 
2063 // XServiceInfo
2064 OUString SAL_CALL OOo2OasisTransformer::getImplementationName()
2065     throw(RuntimeException)
2066 {
2067 	return m_aImplName;
2068 }
2069 
2070 sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& )
2071 	throw(RuntimeException)
2072 {
2073     return sal_False;
2074 }
2075 
2076 Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames(  )
2077 	throw(RuntimeException)
2078 {
2079     Sequence<OUString> aSeq(0);
2080     return aSeq;
2081 }
2082 
2083 // XTypeProvider
2084 Sequence< ::com::sun::star::uno::Type > SAL_CALL
2085 	OOo2OasisTransformer::getTypes() throw(RuntimeException)
2086 {
2087 	Sequence< ::com::sun::star::uno::Type > aTypes(
2088 						XMLTransformerBase::getTypes() );
2089 
2090 	sal_Int32 nIndex = aTypes.getLength();
2091 	aTypes.realloc( nIndex + 2 );
2092 
2093 	::com::sun::star::uno::Type* pTypes = aTypes.getArray();
2094 	pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XImporter > * >( 0 ) );
2095 	pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XFilter > * >( 0 ) );
2096 
2097 	return aTypes;
2098 }
2099 
2100 // Service registration
2101 
2102 OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw()
2103 {
2104 	return OUString( RTL_CONSTASCII_USTRINGPARAM(
2105 		"com.sun.star.comp.OOo2OasisTransformer" ) );
2106 }
2107 
2108 Sequence< OUString > SAL_CALL OOo2OasisTransformer_getSupportedServiceNames() throw()
2109 {
2110 	const OUString aServiceName( OOo2OasisTransformer_getImplementationName() );
2111 	const Sequence< OUString > aSeq( &aServiceName, 1 );
2112 	return aSeq;
2113 }
2114 
2115 Reference< XInterface > SAL_CALL OOo2OasisTransformer_createInstance(
2116 		const Reference< XMultiServiceFactory > & )
2117 	throw( Exception )
2118 {
2119 	return (cppu::OWeakObject*)new OOo2OasisTransformer();
2120 }
2121 
2122 #define OOO_IMPORTER( className, implName, subServiceName ) 			\
2123 OUString SAL_CALL className##_getImplementationName() throw()			\
2124 {																		\
2125 	return OUString( RTL_CONSTASCII_USTRINGPARAM( implName ) );			\
2126 }																		\
2127 																		\
2128 Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw()\
2129 {																		\
2130 	const OUString aServiceName( className##_getImplementationName() );	\
2131 	const Sequence< OUString > aSeq( &aServiceName, 1 );				\
2132 	return aSeq;														\
2133 }																		\
2134 																		\
2135 Reference< XInterface > SAL_CALL className##_createInstance(			\
2136 		const Reference< XMultiServiceFactory > & )      				\
2137 	throw( Exception )													\
2138 {																		\
2139 	return (cppu::OWeakObject*)new OOo2OasisTransformer( implName,		\
2140 										 subServiceName );				\
2141 }
2142 
2143 OOO_IMPORTER( XMLWriterImportOOO,
2144 			  "com.sun.star.comp.Writer.XMLImporter",
2145 			  "com.sun.star.comp.Writer.XMLOasisImporter" )
2146 OOO_IMPORTER( XMLWriterStylesImportOOO,
2147 			  "com.sun.star.comp.Writer.XMLStylesImporter",
2148 			  "com.sun.star.comp.Writer.XMLOasisStylesImporter" )
2149 OOO_IMPORTER( XMLWriterContentImportOOO,
2150 			  "com.sun.star.comp.Writer.XMLContentImporter",
2151 			  "com.sun.star.comp.Writer.XMLOasisContentImporter" )
2152 OOO_IMPORTER( XMLWriterMetaImportOOO,
2153 			  "com.sun.star.comp.Writer.XMLMetaImporter",
2154 			  "com.sun.star.comp.Writer.XMLOasisMetaImporter" )
2155 OOO_IMPORTER( XMLWriterSettingsImportOOO,
2156 			  "com.sun.star.comp.Writer.XMLSettingsImporter",
2157 			  "com.sun.star.comp.Writer.XMLOasisSettingsImporter" )
2158 
2159 OOO_IMPORTER( XMLImpressImportOOO,
2160 			  "com.sun.star.comp.Impress.XMLImporter",
2161 			  "com.sun.star.comp.Impress.XMLOasisImporter" )
2162 OOO_IMPORTER( XMLImpressStylesImportOOO,
2163 			  "com.sun.star.comp.Impress.XMLStylesImporter",
2164 			  "com.sun.star.comp.Impress.XMLOasisStylesImporter" )
2165 OOO_IMPORTER( XMLImpressContentImportOOO,
2166 			  "com.sun.star.comp.Impress.XMLContentImporter",
2167 			  "com.sun.star.comp.Impress.XMLOasisContentImporter" )
2168 OOO_IMPORTER( XMLImpressMetaImportOOO,
2169 			  "com.sun.star.comp.Impress.XMLMetaImporter",
2170 			  "com.sun.star.comp.Impress.XMLOasisMetaImporter" )
2171 OOO_IMPORTER( XMLImpressSettingsImportOOO,
2172 			  "com.sun.star.comp.Impress.XMLSettingsImporter",
2173 			  "com.sun.star.comp.Impress.XMLOasisSettingsImporter" )
2174 
2175 OOO_IMPORTER( XMLDrawImportOOO,
2176 			  "com.sun.star.comp.Draw.XMLImporter",
2177 			  "com.sun.star.comp.Draw.XMLOasisImporter" )
2178 OOO_IMPORTER( XMLDrawStylesImportOOO,
2179 			  "com.sun.star.comp.Draw.XMLStylesImporter",
2180 			  "com.sun.star.comp.Draw.XMLOasisStylesImporter" )
2181 OOO_IMPORTER( XMLDrawContentImportOOO,
2182 			  "com.sun.star.comp.Draw.XMLContentImporter",
2183 			  "com.sun.star.comp.Draw.XMLOasisContentImporter" )
2184 OOO_IMPORTER( XMLDrawMetaImportOOO,
2185 			  "com.sun.star.comp.Draw.XMLMetaImporter",
2186 			  "com.sun.star.comp.Draw.XMLOasisMetaImporter" )
2187 OOO_IMPORTER( XMLDrawSettingsImportOOO,
2188 			  "com.sun.star.comp.Draw.XMLSettingsImporter",
2189 			  "com.sun.star.comp.Draw.XMLOasisSettingsImporter" )
2190 
2191 OOO_IMPORTER( XMLCalcImportOOO,
2192 			  "com.sun.star.comp.Calc.XMLImporter",
2193 			  "com.sun.star.comp.Calc.XMLOasisImporter" )
2194 OOO_IMPORTER( XMLCalcStylesImportOOO,
2195 			  "com.sun.star.comp.Calc.XMLStylesImporter",
2196 			  "com.sun.star.comp.Calc.XMLOasisStylesImporter" )
2197 OOO_IMPORTER( XMLCalcContentImportOOO,
2198 			  "com.sun.star.comp.Calc.XMLContentImporter",
2199 			  "com.sun.star.comp.Calc.XMLOasisContentImporter" )
2200 OOO_IMPORTER( XMLCalcMetaImportOOO,
2201 			  "com.sun.star.comp.Calc.XMLMetaImporter",
2202 			  "com.sun.star.comp.Calc.XMLOasisMetaImporter" )
2203 OOO_IMPORTER( XMLCalcSettingsImportOOO,
2204 			  "com.sun.star.comp.Calc.XMLSettingsImporter",
2205 			  "com.sun.star.comp.Calc.XMLOasisSettingsImporter" )
2206 
2207 OOO_IMPORTER( XMLChartImportOOO,
2208 			  "com.sun.star.comp.Chart.XMLImporter",
2209 			  "com.sun.star.comp.Chart.XMLOasisImporter" )
2210 OOO_IMPORTER( XMLChartStylesImportOOO,
2211 			  "com.sun.star.comp.Chart.XMLStylesImporter",
2212 			  "com.sun.star.comp.Chart.XMLOasisStylesImporter" )
2213 OOO_IMPORTER( XMLChartContentImportOOO,
2214 			  "com.sun.star.comp.Chart.XMLContentImporter",
2215 			  "com.sun.star.comp.Chart.XMLOasisContentImporter" )
2216 
2217 OOO_IMPORTER( XMLMathMetaImportOOO,
2218 			  "com.sun.star.comp.Math.XMLMetaImporter",
2219 			  "com.sun.star.comp.Math.XMLOasisMetaImporter" )
2220 OOO_IMPORTER( XMLMathSettingsImportOOO,
2221 			  "com.sun.star.comp.Math.XMLSettingsImporter",
2222 			  "com.sun.star.comp.Math.XMLOasisSettingsImporter" )
2223 
2224 OOO_IMPORTER( XMLMetaImportOOO,
2225 			  "com.sun.star.document.XMLMetaImporter",
2226 			  "com.sun.star.document.XMLOasisMetaImporter" )
2227 
2228 OOO_IMPORTER( XMLAutoTextEventImportOOO,
2229 			  "com.sun.star.comp.Writer.XMLAutotextEventsImporter",
2230 			  "com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter" )
2231