xref: /aoo42x/main/xmloff/inc/txtfldi.hxx (revision cdf0e10c)
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 /** @#file
29  *
30  *  import of all text fields
31  *  (except variable related + database display field: see txtvfldi.hxx)
32  */
33 
34 #ifndef _XMLOFF_TXTFLDI_HXX
35 #define _XMLOFF_TXTFLDI_HXX
36 
37 #include <com/sun/star/uno/Reference.h>
38 #include <com/sun/star/text/PageNumberType.hpp>
39 #include <com/sun/star/util/DateTime.hpp>
40 #include <com/sun/star/util/Date.hpp>
41 #include <xmloff/xmlictxt.hxx>
42 #include <xmloff/txtimp.hxx>
43 #include <rtl/ustrbuf.hxx>
44 #include <tools/debug.hxx>
45 
46 
47 
48 namespace com { namespace sun { namespace star {
49 	namespace xml { namespace sax { class XAttributeList; } }
50 	namespace text { class XTextField; }
51 	namespace beans { class XPropertySet; struct PropertyValue; }
52 } } }
53 
54 namespace rtl
55 {
56 	class OUString;
57 }
58 
59 
60 class SvXMLImport;
61 class XMLTextImportHelper;
62 class SvXMLTokenMap;
63 
64 
65 
66 
67 enum XMLTextFieldAttrTokens
68 {
69 	XML_TOK_TEXTFIELD_FIXED = 0,
70 	XML_TOK_TEXTFIELD_DESCRIPTION,
71     XML_TOK_TEXTFIELD_HELP,
72     XML_TOK_TEXTFIELD_HINT,
73 	XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE,
74 	XML_TOK_TEXTFIELD_TIME_ADJUST,
75 	XML_TOK_TEXTFIELD_DATE_ADJUST,
76 	XML_TOK_TEXTFIELD_PAGE_ADJUST,
77 	XML_TOK_TEXTFIELD_SELECT_PAGE,
78 	XML_TOK_TEXTFIELD_ACTIVE,
79 
80 	XML_TOK_TEXTFIELD_NAME,
81 	XML_TOK_TEXTFIELD_FORMULA,
82 	XML_TOK_TEXTFIELD_NUM_FORMAT,
83 	XML_TOK_TEXTFIELD_NUM_LETTER_SYNC,
84 	XML_TOK_TEXTFIELD_DISPLAY_FORMULA,
85 	XML_TOK_TEXTFIELD_NUMBERING_LEVEL,
86 	XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR,
87 	XML_TOK_TEXTFIELD_DISPLAY,
88 	XML_TOK_TEXTFIELD_OUTLINE_LEVEL,
89 
90 	XML_TOK_TEXTFIELD_VALUE_TYPE,
91 	XML_TOK_TEXTFIELD_VALUE,
92 	XML_TOK_TEXTFIELD_STRING_VALUE,
93 	XML_TOK_TEXTFIELD_DATE_VALUE,
94 	XML_TOK_TEXTFIELD_TIME_VALUE,
95 	XML_TOK_TEXTFIELD_BOOL_VALUE,
96 	XML_TOK_TEXTFIELD_CURRENCY,
97 	XML_TOK_TEXTFIELD_DATA_STYLE_NAME,
98 
99 	XML_TOK_TEXTFIELD_DATABASE_NAME,
100 	XML_TOK_TEXTFIELD_TABLE_NAME,
101 	XML_TOK_TEXTFIELD_COLUMN_NAME,
102 	XML_TOK_TEXTFIELD_ROW_NUMBER,
103 	XML_TOK_TEXTFIELD_CONDITION,
104 	XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE,
105 	XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE,
106 	XML_TOK_TEXTFIELD_REVISION,
107 	XML_TOK_TEXTFIELD_IS_HIDDEN,
108 	XML_TOK_TEXTFIELD_CURRENT_VALUE,
109 
110 	XML_TOK_TEXTFIELD_REFERENCE_FORMAT,
111 	XML_TOK_TEXTFIELD_REF_NAME,
112 	XML_TOK_TEXTFIELD_CONNECTION_NAME,
113 
114 	XML_TOK_TEXTFIELD_HREF,
115 	XML_TOK_TEXTFIELD_TARGET_FRAME,
116 
117 	XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE,
118 	XML_TOK_TEXTFIELD_OFFICE_AUTHOR,
119 	XML_TOK_TEXTFIELD_ANNOTATION,
120 	XML_TOK_TEXTFIELD_LANGUAGE,
121 
122 	XML_TOK_TEXTFIELD_MEASURE_KIND,
123     XML_TOK_TEXTFIELD_TABLE_TYPE,
124 
125     XML_TOK_TEXTFIELD_NOTE_CLASS,
126 
127 	XML_TOK_TEXTFIELD_UNKNOWN
128 };
129 
130 
131 
132 
133 
134 /// abstract class for text field import
135 class XMLTextFieldImportContext : public SvXMLImportContext
136 {
137 	const ::rtl::OUString sIsFixed;
138 
139 	// data members
140 	::rtl::OUStringBuffer sContentBuffer;	/// collect character data
141 	::rtl::OUString sContent;				/// character data after collection
142 	::rtl::OUString sServiceName;			/// service name for text field
143 	XMLTextImportHelper& rTextImportHelper;	/// the import helper
144 
145 protected:
146 	::rtl::OUString sServicePrefix;
147 
148 	// data members for use in subclasses
149 	sal_Bool bValid;						/// ist dieses Feld g�ltig?
150 
151 public:
152 
153 	TYPEINFO();
154 
155 	XMLTextFieldImportContext(
156 		SvXMLImport& rImport,					/// XML Import
157 		XMLTextImportHelper& rHlp,				/// Text import helper
158 		const sal_Char* pService,				/// name of SO API service
159 		sal_uInt16 nPrfx,						/// namespace prefix
160 		const ::rtl::OUString& rLocalName);		/// element name w/o prefix
161 
162 	virtual ~XMLTextFieldImportContext();
163 
164 	/// process character data: will be collected in member sContentBuffer
165 	virtual void Characters( const ::rtl::OUString& sContent );
166 
167 	/// parses attributes and calls ProcessAttribute
168 	virtual void StartElement(
169 		const ::com::sun::star::uno::Reference<
170 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
171 
172 	/// create XTextField and insert into document; calls PrepareTextField
173 	virtual void EndElement();
174 
175 	/// create the appropriate field context from
176 	/// (for use in paragraph import)
177 	static XMLTextFieldImportContext* CreateTextFieldImportContext(
178 		SvXMLImport& rImport,
179 		XMLTextImportHelper& rHlp,
180 		sal_uInt16 nPrefix,
181 		const ::rtl::OUString& rName,
182 		sal_uInt16 nToken);
183 
184 
185 protected:
186 
187 	/// get helper
188 	inline XMLTextImportHelper& GetImportHelper() { return rTextImportHelper; }
189 
190 	inline ::rtl::OUString GetServiceName() { return sServiceName; }
191 	inline void SetServiceName(::rtl::OUString sStr) { sServiceName = sStr; }
192 
193 	::rtl::OUString GetContent();
194 
195 	/// process attribute values
196 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
197 								   const ::rtl::OUString& sAttrValue ) = 0;
198 
199 	/// prepare XTextField for insertion into document
200 	virtual void PrepareField(
201 		const ::com::sun::star::uno::Reference<
202 		::com::sun::star::beans::XPropertySet> & xPropertySet) = 0;
203 
204 	/// create field from ServiceName
205 	sal_Bool CreateField(::com::sun::star::uno::Reference<
206 						 ::com::sun::star::beans::XPropertySet> & xField,
207 						 const ::rtl::OUString& sServiceName);
208 
209 	/// force an update of the field's value
210 	/// call update on optional XUptadeable interface; (disable Fixed property)
211 	void ForceUpdate(
212 		const ::com::sun::star::uno::Reference<
213 			::com::sun::star::beans::XPropertySet> & rPropertySet);
214 };
215 
216 
217 
218 class XMLSenderFieldImportContext : public XMLTextFieldImportContext
219 {
220 
221 	sal_Int16 nSubType;			/// API subtype for ExtUser field
222 
223 	const ::rtl::OUString sEmpty;		/// empty string
224 	const ::rtl::OUString sPropertyFixed;
225 	const ::rtl::OUString sPropertyFieldSubType;
226 	const ::rtl::OUString sPropertyContent;
227 
228 protected:
229 
230 	// variables for access in subclass
231 	sal_Bool bFixed;
232 	sal_uInt16 nElementToken;	/// token for this elment field
233 
234 public:
235 
236 	TYPEINFO();
237 
238 	XMLSenderFieldImportContext(
239 		SvXMLImport& rImport,					/// XML Import
240 		XMLTextImportHelper& rHlp,				/// Text import helper
241 		sal_uInt16 nPrfx,						/// namespace prefix
242 		const ::rtl::OUString& sLocalName,		/// element name w/o prefix
243 		sal_uInt16 nToken);						/// element token
244 
245 protected:
246 
247 	/// start element
248 	virtual void StartElement(
249 		const ::com::sun::star::uno::Reference<
250 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
251 
252 	/// process attribute values
253 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
254 								   const ::rtl::OUString& sAttrValue );
255 
256 	/// prepare XTextField for insertion into document
257 	virtual void PrepareField(
258 		const ::com::sun::star::uno::Reference<
259 		::com::sun::star::beans::XPropertySet> & xPropertySet);
260 };
261 
262 
263 /** inherit sender field because of fixed attribute in ProcessAttributes */
264 class XMLAuthorFieldImportContext : public XMLSenderFieldImportContext
265 {
266 
267 	sal_Bool bAuthorFullName;
268 	const ::rtl::OUString sServiceAuthor;
269 	const ::rtl::OUString sPropertyAuthorFullName;
270 	const ::rtl::OUString sPropertyFixed;
271 	const ::rtl::OUString sPropertyContent;
272 
273 public:
274 
275 	TYPEINFO();
276 
277 	XMLAuthorFieldImportContext(
278 		SvXMLImport& rImport,					/// XML Import
279 		XMLTextImportHelper& rHlp,				/// Text import helper
280 		sal_uInt16 nPrfx,						/// namespace prefix
281 		const ::rtl::OUString& sLocalName,		/// element name w/o prefix
282 		sal_uInt16 nToken);						/// element token
283 
284 protected:
285 
286 	/// start element
287 	virtual void StartElement(
288 		const ::com::sun::star::uno::Reference<
289 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
290 
291 	/// prepare XTextField for insertion into document
292 	virtual void PrepareField(
293 		const ::com::sun::star::uno::Reference<
294 		::com::sun::star::beans::XPropertySet> & xPropertySet);
295 };
296 
297 
298 
299 class XMLPlaceholderFieldImportContext : public XMLTextFieldImportContext
300 {
301 
302 	const ::rtl::OUString sEmpty;		/// empty string
303 	const ::rtl::OUString sServiceJumpEdit;
304 	const ::rtl::OUString sPropertyPlaceholderType;
305 	const ::rtl::OUString sPropertyPlaceholder;
306 	const ::rtl::OUString sPropertyHint;
307 
308 	::rtl::OUString sDescription;
309 
310 	sal_Int16 nPlaceholderType;
311 
312 public:
313 
314 	TYPEINFO();
315 
316 	XMLPlaceholderFieldImportContext(
317 		SvXMLImport& rImport,					/// XML Import
318 		XMLTextImportHelper& rHlp,				/// Text import helper
319 		sal_uInt16 nPrfx,						/// namespace prefix
320 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
321 
322 protected:
323 
324 	/// process attribute values
325 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
326 								   const ::rtl::OUString& sAttrValue );
327 
328 	/// prepare XTextField for insertion into document
329 	virtual void PrepareField(
330 		const ::com::sun::star::uno::Reference<
331 		::com::sun::star::beans::XPropertySet> & xPropertySet);
332 };
333 
334 class XMLTimeFieldImportContext : public XMLTextFieldImportContext
335 {
336 
337 protected:
338 	const ::rtl::OUString sPropertyNumberFormat;
339 	const ::rtl::OUString sPropertyFixed;
340 	const ::rtl::OUString sPropertyDateTimeValue;
341 	const ::rtl::OUString sPropertyDateTime;
342 	const ::rtl::OUString sPropertyAdjust;
343 	const ::rtl::OUString sPropertyIsDate;
344     const ::rtl::OUString sPropertyIsFixedLanguage;
345 
346 	double fTimeValue;
347 	::com::sun::star::util::DateTime aDateTimeValue;
348 	sal_Int32 nAdjust;
349 	sal_Int32 nFormatKey;
350 	sal_Bool bTimeOK;
351 	sal_Bool bFormatOK;
352 	sal_Bool bFixed;
353 	sal_Bool bIsDate;			// is this a date?
354 								// (for XMLDateFieldImportContext, really)
355     sal_Bool bIsDefaultLanguage;
356 
357 public:
358 
359 	TYPEINFO();
360 
361 	XMLTimeFieldImportContext(
362 		SvXMLImport& rImport,					/// XML Import
363 		XMLTextImportHelper& rHlp,				/// Text import helper
364 		sal_uInt16 nPrfx,						/// namespace prefix
365 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
366 
367 	/// process attribute values
368 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
369 								   const ::rtl::OUString& sAttrValue );
370 
371 	/// prepare XTextField for insertion into document
372 	virtual void PrepareField(
373 		const ::com::sun::star::uno::Reference<
374 		::com::sun::star::beans::XPropertySet> & xPropertySet);
375 };
376 
377 
378 /** import date fields (<text:date>);
379 	inherit from TimeField to reuse implementation */
380 class XMLDateFieldImportContext : public XMLTimeFieldImportContext
381 {
382 
383 public:
384 
385 	TYPEINFO();
386 
387 	XMLDateFieldImportContext(
388 		SvXMLImport& rImport,					/// XML Import
389 		XMLTextImportHelper& rHlp,				/// Text import helper
390 		sal_uInt16 nPrfx,						/// namespace prefix
391 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
392 
393 	/// process attribute values
394 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
395 								   const ::rtl::OUString& sAttrValue );
396 };
397 
398 
399 /** import page continuation fields (<text:page-continuation-string>) */
400 class XMLPageContinuationImportContext : public XMLTextFieldImportContext
401 {
402 	const ::rtl::OUString sPropertySubType;
403 	const ::rtl::OUString sPropertyUserText;
404 	const ::rtl::OUString sPropertyNumberingType;
405 
406 	::rtl::OUString sString;			/// continuation string
407 	com::sun::star::text::PageNumberType eSelectPage;	/// previous, current
408 														/// or next page
409 	sal_Bool sStringOK;					/// continuation string encountered?
410 
411 public:
412 
413 	TYPEINFO();
414 
415 	XMLPageContinuationImportContext(
416 		SvXMLImport& rImport,					/// XML Import
417 		XMLTextImportHelper& rHlp,				/// Text import helper
418 		sal_uInt16 nPrfx,						/// namespace prefix
419 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
420 
421 
422 	/// process attribute values
423 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
424 								   const ::rtl::OUString& sAttrValue );
425 
426 	/// prepare XTextField for insertion into document
427 	virtual void PrepareField(
428 		const ::com::sun::star::uno::Reference<
429 		::com::sun::star::beans::XPropertySet> & xPropertySet);
430 };
431 
432 
433 /** import page number fields (<text:page-number>) */
434 class XMLPageNumberImportContext : public XMLTextFieldImportContext
435 {
436 	const ::rtl::OUString sPropertySubType;
437 	const ::rtl::OUString sPropertyNumberingType;
438 	const ::rtl::OUString sPropertyOffset;
439 
440 	::rtl::OUString sNumberFormat;
441 	::rtl::OUString sNumberSync;
442 	sal_Int16 nPageAdjust;
443 	com::sun::star::text::PageNumberType eSelectPage;	/// previous, current
444 														/// or next page
445 	sal_Bool sNumberFormatOK;
446 
447 public:
448 
449 	TYPEINFO();
450 
451 	XMLPageNumberImportContext(
452 		SvXMLImport& rImport,					/// XML Import
453 		XMLTextImportHelper& rHlp,				/// Text import helper
454 		sal_uInt16 nPrfx,						/// namespace prefix
455 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
456 
457 
458 	/// process attribute values
459 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
460 								   const ::rtl::OUString& sAttrValue );
461 
462 	/// prepare XTextField for insertion into document
463 	virtual void PrepareField(
464 		const ::com::sun::star::uno::Reference<
465 		::com::sun::star::beans::XPropertySet> & xPropertySet);
466 };
467 
468 
469 /** superclass for database fields: handle database and table names */
470 class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext
471 {
472 	const ::rtl::OUString sPropertyDataBaseName;
473 	const ::rtl::OUString sPropertyDataBaseURL;
474 	const ::rtl::OUString sPropertyTableName;
475     const ::rtl::OUString sPropertyDataCommandType;
476     const ::rtl::OUString sPropertyIsVisible;
477 
478 	::rtl::OUString sDatabaseName;
479 	::rtl::OUString sDatabaseURL;
480 	::rtl::OUString sTableName;
481 
482     sal_Int32 nCommandType;
483     sal_Bool bCommandTypeOK;
484 
485     sal_Bool bDisplay;
486     bool bDisplayOK;
487     bool bUseDisplay;
488 
489 protected:
490 	sal_Bool bDatabaseOK;
491 	sal_Bool bDatabaseNameOK;
492 	sal_Bool bDatabaseURLOK;
493 	sal_Bool bTableOK;
494 
495 	/// protected constructor: only for subclasses
496 	XMLDatabaseFieldImportContext(SvXMLImport& rImport,
497 								  XMLTextImportHelper& rHlp,
498 								  const sal_Char* pServiceName,
499 								  sal_uInt16 nPrfx,
500 								  const ::rtl::OUString& sLocalName,
501                                   bool bUseDisplay );
502 
503 public:
504 
505 TYPEINFO();
506 
507 	/// process attribute values
508 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
509 								   const ::rtl::OUString& sAttrValue );
510 
511 	/// prepare XTextField for insertion into document
512 	virtual void PrepareField(
513 		const ::com::sun::star::uno::Reference<
514 		::com::sun::star::beans::XPropertySet> & xPropertySet);
515 
516     /// handle database-location children
517     virtual SvXMLImportContext *CreateChildContext(
518 		sal_uInt16 nPrefix,
519 		const ::rtl::OUString& rLocalName,
520 		const ::com::sun::star::uno::Reference<
521 		::com::sun::star::xml::sax::XAttributeList> & xAttrList );
522 };
523 
524 /** import database name fields (<text:database-name>) */
525 class XMLDatabaseNameImportContext : public XMLDatabaseFieldImportContext
526 {
527 public:
528 
529 	TYPEINFO();
530 
531 	XMLDatabaseNameImportContext(SvXMLImport& rImport,
532 								 XMLTextImportHelper& rHlp,
533 								 sal_uInt16 nPrfx,
534 								 const ::rtl::OUString& sLocalName);
535 
536 	/// process attribute values
537 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
538 								   const ::rtl::OUString& sAttrValue );
539 };
540 
541 
542 /** import database next fields (<text:database-next>) */
543 class XMLDatabaseNextImportContext : public XMLDatabaseFieldImportContext
544 {
545 	const ::rtl::OUString sPropertyCondition;
546 	const ::rtl::OUString sTrue;
547 	::rtl::OUString sCondition;
548 	sal_Bool bConditionOK;
549 
550 protected:
551 
552 	// for use in child classes
553 	XMLDatabaseNextImportContext(SvXMLImport& rImport,
554 								 XMLTextImportHelper& rHlp,
555 								 const sal_Char* pServiceName,
556 								 sal_uInt16 nPrfx,
557 								 const ::rtl::OUString& sLocalName);
558 
559 public:
560 
561 	TYPEINFO();
562 
563 	XMLDatabaseNextImportContext(SvXMLImport& rImport,
564 								 XMLTextImportHelper& rHlp,
565 								 sal_uInt16 nPrfx,
566 								 const ::rtl::OUString& sLocalName);
567 
568 	/// process attribute values
569 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
570 								   const ::rtl::OUString& sAttrValue );
571 
572 	/// prepare XTextField for insertion into document
573 	virtual void PrepareField(
574 		const ::com::sun::star::uno::Reference<
575 		::com::sun::star::beans::XPropertySet> & xPropertySet);
576 };
577 
578 
579 
580 /** import database select fields (<text:database-select>) */
581 class XMLDatabaseSelectImportContext : public XMLDatabaseNextImportContext
582 {
583 	const ::rtl::OUString sPropertySetNumber;
584 	sal_Int32 nNumber;
585 	sal_Bool bNumberOK;
586 
587 public:
588 
589 	TYPEINFO();
590 
591 	XMLDatabaseSelectImportContext(SvXMLImport& rImport,
592 								   XMLTextImportHelper& rHlp,
593 								   sal_uInt16 nPrfx,
594 								   const ::rtl::OUString& sLocalName);
595 
596 	/// process attribute values
597 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
598 								   const ::rtl::OUString& sAttrValue );
599 
600 	/// prepare XTextField for insertion into document
601 	virtual void PrepareField(
602 		const ::com::sun::star::uno::Reference<
603 		::com::sun::star::beans::XPropertySet> & xPropertySet);
604 };
605 
606 
607 /** import database display number fields (<text:database-row-number>) */
608 class XMLDatabaseNumberImportContext : public XMLDatabaseFieldImportContext
609 {
610 	const ::rtl::OUString sPropertyNumberingType;
611 	const ::rtl::OUString sPropertySetNumber;
612 	::rtl::OUString sNumberFormat;
613 	::rtl::OUString sNumberSync;
614 	sal_Int32 nValue;
615 	sal_Bool bValueOK;
616 
617 public:
618 
619 	TYPEINFO();
620 
621 	XMLDatabaseNumberImportContext(SvXMLImport& rImport,
622 								   XMLTextImportHelper& rHlp,
623 								   sal_uInt16 nPrfx,
624 								   const ::rtl::OUString& sLocalName);
625 
626 	/// process attribute values
627 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
628 								   const ::rtl::OUString& sAttrValue );
629 
630 	/// prepare XTextField for insertion into document
631 	virtual void PrepareField(
632 		const ::com::sun::star::uno::Reference<
633 		::com::sun::star::beans::XPropertySet> & xPropertySet);
634 };
635 
636 
637 /** import docinfo fields with only fixed atribute */
638 class XMLSimpleDocInfoImportContext : public XMLTextFieldImportContext
639 {
640 	const ::rtl::OUString sPropertyFixed;
641 	const ::rtl::OUString sPropertyContent;
642 	const ::rtl::OUString sPropertyAuthor;
643 	const ::rtl::OUString sPropertyCurrentPresentation;
644 
645 protected:
646 	sal_Bool bFixed;
647 	sal_Bool bHasAuthor;
648 	sal_Bool bHasContent;
649 
650 public:
651 
652 	TYPEINFO();
653 
654 	XMLSimpleDocInfoImportContext(SvXMLImport& rImport,
655 								  XMLTextImportHelper& rHlp,
656 								  sal_uInt16 nPrfx,
657 								  const ::rtl::OUString& sLocalName,
658 								  sal_uInt16 nToken,
659 								  sal_Bool bContent,
660 								  sal_Bool bAuthor);
661 
662 protected:
663 
664 	/// process attribute values
665 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
666 								   const ::rtl::OUString& sAttrValue );
667 
668 	/// prepare XTextField for insertion into document
669 	virtual void PrepareField(
670 		const ::com::sun::star::uno::Reference<
671 		::com::sun::star::beans::XPropertySet> & xPropertySet);
672 
673 	static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
674 };
675 
676 
677 
678 /** import docinfo fields with date or time attributes and numberformats */
679 class XMLDateTimeDocInfoImportContext : public XMLSimpleDocInfoImportContext
680 {
681 	const ::rtl::OUString sPropertyNumberFormat;
682 	const ::rtl::OUString sPropertyIsDate;
683     const ::rtl::OUString sPropertyIsFixedLanguage;
684 
685 	sal_Int32 nFormat;
686 	sal_Bool bFormatOK;
687 	sal_Bool bIsDate;
688 	sal_Bool bHasDateTime;
689     sal_Bool bIsDefaultLanguage;
690 
691 public:
692 
693 	TYPEINFO();
694 
695 	XMLDateTimeDocInfoImportContext(SvXMLImport& rImport,
696 									XMLTextImportHelper& rHlp,
697 									sal_uInt16 nPrfx,
698 									const ::rtl::OUString& sLocalName,
699 									sal_uInt16 nToken);
700 
701 protected:
702 
703 	/// process attribute values
704 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
705 								   const ::rtl::OUString& sAttrValue );
706 
707 	/// prepare XTextField for insertion into document
708 	virtual void PrepareField(
709 		const ::com::sun::star::uno::Reference<
710 		::com::sun::star::beans::XPropertySet> & xPropertySet);
711 };
712 
713 
714 
715 /** import revision field (<text:editing-cycles>) */
716 class XMLRevisionDocInfoImportContext : public XMLSimpleDocInfoImportContext
717 {
718 	const ::rtl::OUString sPropertyRevision;
719 
720 public:
721 
722 	TYPEINFO();
723 
724 	XMLRevisionDocInfoImportContext(SvXMLImport& rImport,
725 									XMLTextImportHelper& rHlp,
726 									sal_uInt16 nPrfx,
727 									const ::rtl::OUString& sLocalName,
728 									sal_uInt16 nToken);
729 
730 protected:
731 
732 	/// prepare XTextField for insertion into document
733 	virtual void PrepareField(
734 		const ::com::sun::star::uno::Reference<
735 		::com::sun::star::beans::XPropertySet> & xPropertySet);
736 };
737 
738 
739 
740 /** import user docinfo field (<text:user-defined>) */
741 class XMLUserDocInfoImportContext : public XMLSimpleDocInfoImportContext
742 {
743 	rtl::OUString aName;
744 	const ::rtl::OUString sPropertyName;
745 	const ::rtl::OUString sPropertyNumberFormat;
746     const ::rtl::OUString sPropertyIsFixedLanguage;
747 	sal_Int32   nFormat;
748 	sal_Bool    bFormatOK;
749 	sal_Bool    bIsDefaultLanguage;
750 
751 public:
752 
753 	TYPEINFO();
754 
755 	XMLUserDocInfoImportContext(SvXMLImport& rImport,
756 								XMLTextImportHelper& rHlp,
757 								sal_uInt16 nPrfx,
758 								const ::rtl::OUString& sLocalName,
759 								sal_uInt16 nToken);
760 
761 protected:
762 
763 	/// process attribute values
764 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
765 								   const ::rtl::OUString& sAttrValue );
766 	virtual void PrepareField(
767 		const ::com::sun::star::uno::Reference<
768 		::com::sun::star::beans::XPropertySet> & xPropertySet);
769 };
770 
771 
772 
773 /** import hidden paragraph fields (<text:hidden-paragraph>) */
774 class XMLHiddenParagraphImportContext : public XMLTextFieldImportContext
775 {
776 	const ::rtl::OUString sPropertyCondition;
777 	const ::rtl::OUString sPropertyIsHidden;
778 
779 	::rtl::OUString sCondition;
780 	sal_Bool bIsHidden;
781 
782 public:
783 
784 	TYPEINFO();
785 
786 	XMLHiddenParagraphImportContext(SvXMLImport& rImport,
787 									XMLTextImportHelper& rHlp,
788 									sal_uInt16 nPrfx,
789 									const ::rtl::OUString& sLocalName);
790 
791 protected:
792 
793 	/// process attribute values
794 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
795 								   const ::rtl::OUString& sAttrValue );
796 
797 	/// prepare XTextField for insertion into document
798 	virtual void PrepareField(
799 		const ::com::sun::star::uno::Reference<
800 		::com::sun::star::beans::XPropertySet> & xPropertySet);
801 };
802 
803 
804 
805 /** import conditional text fields (<text:conditional-text>) */
806 class XMLConditionalTextImportContext : public XMLTextFieldImportContext
807 {
808 	const ::rtl::OUString sPropertyCondition;
809 	const ::rtl::OUString sPropertyTrueContent;
810 	const ::rtl::OUString sPropertyFalseContent;
811 	const ::rtl::OUString sPropertyIsConditionTrue;
812     const ::rtl::OUString sPropertyCurrentPresentation;
813 
814 	::rtl::OUString sCondition;
815 	::rtl::OUString sTrueContent;
816 	::rtl::OUString sFalseContent;
817 
818 	sal_Bool bConditionOK;
819 	sal_Bool bTrueOK;
820 	sal_Bool bFalseOK;
821 	sal_Bool bCurrentValue;
822 
823 public:
824 
825 	TYPEINFO();
826 
827 	XMLConditionalTextImportContext(SvXMLImport& rImport,
828 									XMLTextImportHelper& rHlp,
829 									sal_uInt16 nPrfx,
830 									const ::rtl::OUString& sLocalName);
831 
832 protected:
833 
834 	/// process attribute values
835 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
836 								   const ::rtl::OUString& sAttrValue );
837 
838 	/// prepare XTextField for insertion into document
839 	virtual void PrepareField(
840 		const ::com::sun::star::uno::Reference<
841 		::com::sun::star::beans::XPropertySet> & xPropertySet);
842 };
843 
844 
845 
846 /** import conditional text fields (<text:hidden-text>) */
847 class XMLHiddenTextImportContext : public XMLTextFieldImportContext
848 {
849 	const ::rtl::OUString sPropertyCondition;
850 	const ::rtl::OUString sPropertyContent;
851 	const ::rtl::OUString sPropertyIsHidden;
852 
853 	::rtl::OUString sCondition;
854 	::rtl::OUString sString;
855 
856 	sal_Bool bConditionOK;
857 	sal_Bool bStringOK;
858 	sal_Bool bIsHidden;
859 
860 public:
861 
862 	TYPEINFO();
863 
864 	XMLHiddenTextImportContext(SvXMLImport& rImport,
865 							   XMLTextImportHelper& rHlp,
866 							   sal_uInt16 nPrfx,
867 							   const ::rtl::OUString& sLocalName);
868 
869 protected:
870 
871 	/// process attribute values
872 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
873 								   const ::rtl::OUString& sAttrValue );
874 
875 	/// prepare XTextField for insertion into document
876 	virtual void PrepareField(
877 		const ::com::sun::star::uno::Reference<
878 		::com::sun::star::beans::XPropertySet> & xPropertySet);
879 };
880 
881 
882 
883 /** import file name fields (<text:file-name>) */
884 class XMLFileNameImportContext : public XMLTextFieldImportContext
885 {
886 	const ::rtl::OUString sPropertyFixed;
887 	const ::rtl::OUString sPropertyFileFormat;
888 	const ::rtl::OUString sPropertyCurrentPresentation;
889 
890 	sal_Int16 nFormat;
891 	sal_Bool bFixed;
892 
893 public:
894 
895 	TYPEINFO();
896 
897 	XMLFileNameImportContext(SvXMLImport& rImport,
898 							 XMLTextImportHelper& rHlp,
899 							 sal_uInt16 nPrfx,
900 							 const ::rtl::OUString& sLocalName);
901 
902 protected:
903 
904 	/// process attribute values
905 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
906 								   const ::rtl::OUString& sAttrValue );
907 
908 	/// prepare XTextField for insertion into document
909 	virtual void PrepareField(
910 		const ::com::sun::star::uno::Reference<
911 		::com::sun::star::beans::XPropertySet> & xPropertySet);
912 };
913 
914 
915 
916 /** import document template name fields (<text:template-name>) */
917 class XMLTemplateNameImportContext : public XMLTextFieldImportContext
918 {
919 	const ::rtl::OUString sPropertyFileFormat;
920 
921 	sal_Int16 nFormat;
922 
923 public:
924 
925 	TYPEINFO();
926 
927 	XMLTemplateNameImportContext(SvXMLImport& rImport,
928 								 XMLTextImportHelper& rHlp,
929 								 sal_uInt16 nPrfx,
930 								 const ::rtl::OUString& sLocalName);
931 
932 protected:
933 
934 	/// process attribute values
935 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
936 								   const ::rtl::OUString& sAttrValue );
937 
938 	/// prepare XTextField for insertion into document
939 	virtual void PrepareField(
940 		const ::com::sun::star::uno::Reference<
941 		::com::sun::star::beans::XPropertySet> & xPropertySet);
942 };
943 
944 
945 /** import chapter fields (<text:chapter>) */
946 class XMLChapterImportContext : public XMLTextFieldImportContext
947 {
948 	const ::rtl::OUString sPropertyChapterFormat;
949 	const ::rtl::OUString sPropertyLevel;
950 
951 	sal_Int16 nFormat;
952 	sal_Int8 nLevel;
953 
954 public:
955 
956 	TYPEINFO();
957 
958 	XMLChapterImportContext(SvXMLImport& rImport,
959 							XMLTextImportHelper& rHlp,
960 							sal_uInt16 nPrfx,
961 							const ::rtl::OUString& sLocalName);
962 
963 protected:
964 
965 	/// process attribute values
966 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
967 								   const ::rtl::OUString& sAttrValue );
968 
969 	/// prepare XTextField for insertion into document
970 	virtual void PrepareField(
971 		const ::com::sun::star::uno::Reference<
972 		::com::sun::star::beans::XPropertySet> & xPropertySet);
973 };
974 
975 
976 
977 /** import count fields (<text:[XXX]-count>) */
978 class XMLCountFieldImportContext : public XMLTextFieldImportContext
979 {
980 	const ::rtl::OUString sPropertyNumberingType;
981 
982 	::rtl::OUString sNumberFormat;
983 	::rtl::OUString sLetterSync;
984 
985 	sal_Bool bNumberFormatOK;
986 
987 public:
988 
989 	TYPEINFO();
990 
991 	XMLCountFieldImportContext(SvXMLImport& rImport,
992 							   XMLTextImportHelper& rHlp,
993 							   sal_uInt16 nPrfx,
994 							   const ::rtl::OUString& sLocalName,
995 							   sal_uInt16 nToken);
996 
997 protected:
998 
999 	/// process attribute values
1000 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1001 								   const ::rtl::OUString& sAttrValue );
1002 
1003 	/// prepare XTextField for insertion into document
1004 	virtual void PrepareField(
1005 		const ::com::sun::star::uno::Reference<
1006 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1007 
1008 	static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
1009 };
1010 
1011 
1012 /** import page variable fields (<text:get-page-variable>) */
1013 class XMLPageVarGetFieldImportContext : public XMLTextFieldImportContext
1014 {
1015 	const ::rtl::OUString sPropertyNumberingType;
1016 
1017 	::rtl::OUString sNumberFormat;
1018 	::rtl::OUString sLetterSync;
1019 
1020 	sal_Bool bNumberFormatOK;
1021 
1022 public:
1023 
1024 	TYPEINFO();
1025 
1026 	XMLPageVarGetFieldImportContext(SvXMLImport& rImport,
1027 									XMLTextImportHelper& rHlp,
1028 									sal_uInt16 nPrfx,
1029 									const ::rtl::OUString& sLocalName);
1030 
1031 protected:
1032 
1033 	/// process attribute values
1034 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1035 								   const ::rtl::OUString& sAttrValue );
1036 
1037 	/// prepare XTextField for insertion into document
1038 	virtual void PrepareField(
1039 		const ::com::sun::star::uno::Reference<
1040 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1041 };
1042 
1043 
1044 /** import page variable fields (<text:get-page-variable>) */
1045 class XMLPageVarSetFieldImportContext : public XMLTextFieldImportContext
1046 {
1047 	const ::rtl::OUString sPropertyOn;
1048 	const ::rtl::OUString sPropertyOffset;
1049 
1050 	sal_Int16 nAdjust;
1051 	sal_Bool bActive;
1052 
1053 public:
1054 
1055 	TYPEINFO();
1056 
1057 	XMLPageVarSetFieldImportContext(SvXMLImport& rImport,
1058 									XMLTextImportHelper& rHlp,
1059 									sal_uInt16 nPrfx,
1060 									const ::rtl::OUString& sLocalName);
1061 
1062 protected:
1063 
1064 	/// process attribute values
1065 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1066 								   const ::rtl::OUString& sAttrValue );
1067 
1068 	/// prepare XTextField for insertion into document
1069 	virtual void PrepareField(
1070 		const ::com::sun::star::uno::Reference<
1071 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1072 };
1073 
1074 
1075 /** import macro fields (<text:execute-macro>) */
1076 class XMLMacroFieldImportContext : public XMLTextFieldImportContext
1077 {
1078 
1079 	const ::rtl::OUString sPropertyHint;
1080 	const ::rtl::OUString sPropertyMacroName;
1081 	const ::rtl::OUString sPropertyScriptURL;
1082     const ::rtl::OUString sPropertyLibraryName;
1083 
1084 	::rtl::OUString sDescription;
1085     SvXMLImportContextRef xEventContext;
1086 
1087 	::rtl::OUString sMacro; // macro for old documents (pre 638i)
1088 
1089 	sal_Bool bMacroOK;
1090 	sal_Bool bDescriptionOK;
1091 
1092 public:
1093 
1094 	TYPEINFO();
1095 
1096 	XMLMacroFieldImportContext(SvXMLImport& rImport,
1097 							   XMLTextImportHelper& rHlp,
1098 							   sal_uInt16 nPrfx,
1099 							   const ::rtl::OUString& sLocalName);
1100 
1101 protected:
1102 
1103 	/// for <office:events> children
1104     virtual SvXMLImportContext *CreateChildContext(
1105 		sal_uInt16 nPrefix,
1106 		const ::rtl::OUString& rLocalName,
1107 		const ::com::sun::star::uno::Reference<
1108 		::com::sun::star::xml::sax::XAttributeList> & xAttrList );
1109 
1110 	/// process attribute values
1111 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1112 								   const ::rtl::OUString& sAttrValue );
1113 
1114 	/// prepare XTextField for insertion into document
1115 	virtual void PrepareField(
1116 		const ::com::sun::star::uno::Reference<
1117 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1118 };
1119 
1120 
1121 
1122 /** import reference fields (<text:reference-get>) */
1123 class XMLReferenceFieldImportContext : public XMLTextFieldImportContext
1124 {
1125 	const ::rtl::OUString sPropertyReferenceFieldPart;
1126 	const ::rtl::OUString sPropertyReferenceFieldSource;
1127 	const ::rtl::OUString sPropertySourceName;
1128 	const ::rtl::OUString sPropertyCurrentPresentation;
1129 
1130 	::rtl::OUString sName;
1131 	sal_uInt16 nElementToken;
1132 	sal_Int16 nSource;
1133 	sal_Int16 nType;
1134 	sal_Int16 nSequenceNumber;
1135 
1136 	sal_Bool bNameOK;
1137 	sal_Bool bTypeOK;
1138 	sal_Bool bSeqNumberOK;
1139 
1140 public:
1141 
1142 	TYPEINFO();
1143 
1144 	XMLReferenceFieldImportContext(SvXMLImport& rImport,
1145 								   XMLTextImportHelper& rHlp,
1146 								   sal_uInt16 nToken,
1147 								   sal_uInt16 nPrfx,
1148 								   const ::rtl::OUString& sLocalName);
1149 
1150 protected:
1151 
1152 	/// start element
1153 	virtual void StartElement(
1154 		const ::com::sun::star::uno::Reference<
1155 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1156 
1157 	/// process attribute values
1158 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1159 								   const ::rtl::OUString& sAttrValue );
1160 
1161 	/// prepare XTextField for insertion into document
1162 	virtual void PrepareField(
1163 		const ::com::sun::star::uno::Reference<
1164 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1165 };
1166 
1167 
1168 
1169 /** import dde field declaration container (<text:dde-connection-decls>) */
1170 class XMLDdeFieldDeclsImportContext : public SvXMLImportContext
1171 {
1172 
1173 	SvXMLTokenMap aTokenMap;
1174 
1175 public:
1176 
1177 	TYPEINFO();
1178 
1179 	XMLDdeFieldDeclsImportContext(SvXMLImport& rImport,
1180 								  sal_uInt16 nPrfx,
1181 								  const ::rtl::OUString& sLocalName);
1182 
1183 	virtual SvXMLImportContext *CreateChildContext(
1184 		sal_uInt16 nPrefix,
1185 		const ::rtl::OUString& rLocalName,
1186 		const ::com::sun::star::uno::Reference<
1187 		::com::sun::star::xml::sax::XAttributeList> & xAttrList );
1188 
1189 
1190 };
1191 
1192 
1193 
1194 /** import dde field declaration (<text:dde-connection-decl>) */
1195 class XMLDdeFieldDeclImportContext : public SvXMLImportContext
1196 {
1197 	const ::rtl::OUString sPropertyIsAutomaticUpdate;
1198 	const ::rtl::OUString sPropertyName;
1199 	const ::rtl::OUString sPropertyDDECommandType;
1200 	const ::rtl::OUString sPropertyDDECommandFile;
1201 	const ::rtl::OUString sPropertyDDECommandElement;
1202 
1203 	const SvXMLTokenMap& rTokenMap;
1204 
1205 public:
1206 
1207 	TYPEINFO();
1208 
1209 	XMLDdeFieldDeclImportContext(SvXMLImport& rImport,
1210 								 sal_uInt16 nPrfx,
1211 								 const ::rtl::OUString& sLocalName,
1212 								 const SvXMLTokenMap& rMap);
1213 
1214 	// create fieldmaster
1215 	virtual void StartElement(
1216 		const ::com::sun::star::uno::Reference<
1217 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1218 };
1219 
1220 
1221 
1222 /** import dde fields (<text:dde-connection>) */
1223 class XMLDdeFieldImportContext : public XMLTextFieldImportContext
1224 {
1225 	::rtl::OUString sName;
1226     ::rtl::OUString sPropertyContent;
1227 public:
1228 
1229 	TYPEINFO();
1230 
1231 	XMLDdeFieldImportContext(SvXMLImport& rImport,
1232 							 XMLTextImportHelper& rHlp,
1233 							 sal_uInt16 nPrfx,
1234 							 const ::rtl::OUString& sLocalName);
1235 
1236 protected:
1237 
1238 	/// process attribute values
1239 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1240 								   const ::rtl::OUString& sAttrValue );
1241 
1242 	/// create textfield, attach master, and insert into document
1243 	virtual void EndElement();
1244 
1245 	/// empty method
1246 	virtual void PrepareField(
1247 		const ::com::sun::star::uno::Reference<
1248 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1249 
1250 };
1251 
1252 
1253 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1254 class XMLSheetNameImportContext : public XMLTextFieldImportContext
1255 {
1256 
1257 public:
1258 
1259 	TYPEINFO();
1260 
1261 	XMLSheetNameImportContext(SvXMLImport& rImport,
1262 							  XMLTextImportHelper& rHlp,
1263 							  sal_uInt16 nPrfx,
1264 							  const ::rtl::OUString& sLocalName);
1265 
1266 protected:
1267 
1268 	/// no attributes -> empty method
1269 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1270 								   const ::rtl::OUString& sAttrValue );
1271 
1272 	/// no atributes -> empty method
1273 	virtual void PrepareField(
1274 		const ::com::sun::star::uno::Reference<
1275 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1276 };
1277 
1278 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1279 class XMLUrlFieldImportContext : public XMLTextFieldImportContext
1280 {
1281 
1282 	const ::rtl::OUString sPropertyURL;
1283 	const ::rtl::OUString sPropertyTargetFrame;
1284 	const ::rtl::OUString sPropertyRepresentation;
1285 
1286 	::rtl::OUString sURL;
1287 	::rtl::OUString sFrame;
1288 	sal_Bool bFrameOK;
1289 
1290 public:
1291 
1292 	TYPEINFO();
1293 
1294 	XMLUrlFieldImportContext(SvXMLImport& rImport,
1295 							 XMLTextImportHelper& rHlp,
1296 							 sal_uInt16 nPrfx,
1297 							 const ::rtl::OUString& sLocalName);
1298 
1299 protected:
1300 
1301 	/// no attributes -> empty method
1302 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1303 								   const ::rtl::OUString& sAttrValue );
1304 
1305 	/// no atributes -> empty method
1306 	virtual void PrepareField(
1307 		const ::com::sun::star::uno::Reference<
1308 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1309 };
1310 
1311 /** import bibliography info fields (<text:bibliography-mark>) */
1312 class XMLBibliographyFieldImportContext : public XMLTextFieldImportContext
1313 {
1314 
1315 	const ::rtl::OUString sPropertyFields;
1316 
1317 	::std::vector< ::com::sun::star::beans::PropertyValue> aValues;
1318 
1319 public:
1320 
1321 	TYPEINFO();
1322 
1323 	XMLBibliographyFieldImportContext(SvXMLImport& rImport,
1324 									  XMLTextImportHelper& rHlp,
1325 									  sal_uInt16 nPrfx,
1326 									  const ::rtl::OUString& sLocalName);
1327 
1328 protected:
1329 
1330 	/// process attributes (fill aValues)
1331 	virtual void StartElement(
1332 		const ::com::sun::star::uno::Reference<
1333 		::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1334 
1335 	/// empty method; all attributes are handled in StartElement
1336 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1337 								   const ::rtl::OUString& sAttrValue );
1338 
1339 	/// convert aValues into sequence and set property
1340 	virtual void PrepareField(
1341 		const ::com::sun::star::uno::Reference<
1342 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1343 
1344 	static const sal_Char* MapBibliographyFieldName(::rtl::OUString sName);
1345 
1346 };
1347 
1348 
1349 /** Import an annotation field (<text:annotation>) */
1350 class XMLAnnotationImportContext : public XMLTextFieldImportContext
1351 {
1352 	const ::rtl::OUString sPropertyAuthor;
1353 	const ::rtl::OUString sPropertyContent;
1354 	const ::rtl::OUString sPropertyDate;
1355 	const ::rtl::OUString sPropertyTextRange;
1356 
1357 	::rtl::OUStringBuffer aAuthorBuffer;
1358 	::rtl::OUStringBuffer aTextBuffer;
1359 	::rtl::OUStringBuffer aDateBuffer;
1360 
1361 	com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxField;
1362 	com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxCursor;
1363 	com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxOldCursor;
1364 
1365 public:
1366 
1367 	TYPEINFO();
1368 
1369 	XMLAnnotationImportContext(SvXMLImport& rImport,
1370 							   XMLTextImportHelper& rHlp,
1371 							   sal_uInt16 nPrfx,
1372 							   const ::rtl::OUString& sLocalName);
1373 
1374 protected:
1375 
1376 	/// process attributes
1377 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1378 								   const ::rtl::OUString& sAttrValue );
1379 
1380 	/// set properties
1381 	virtual void PrepareField(
1382 		const ::com::sun::star::uno::Reference<
1383 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1384 
1385 	virtual SvXMLImportContext *CreateChildContext(
1386 		sal_uInt16 nPrefix,
1387 		const ::rtl::OUString& rLocalName,
1388 		const ::com::sun::star::uno::Reference<
1389 				::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1390 	virtual void EndElement();
1391 };
1392 
1393 
1394 /** Import a script field (<text:script>) */
1395 class XMLScriptImportContext : public XMLTextFieldImportContext
1396 {
1397 	const ::rtl::OUString sPropertyScriptType;
1398 	const ::rtl::OUString sPropertyURLContent;
1399 	const ::rtl::OUString sPropertyContent;
1400 
1401 	::rtl::OUString sContent;
1402 	::rtl::OUString sScriptType;
1403 
1404 	sal_Bool bContentOK;
1405 	sal_Bool bScriptTypeOK;
1406 	sal_Bool bUrlContent;
1407 
1408 public:
1409 
1410 	TYPEINFO();
1411 
1412 	XMLScriptImportContext(SvXMLImport& rImport,
1413 						   XMLTextImportHelper& rHlp,
1414 						   sal_uInt16 nPrfx,
1415 						   const ::rtl::OUString& sLocalName);
1416 
1417 protected:
1418 
1419 	/// process attributes
1420 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1421 								   const ::rtl::OUString& sAttrValue );
1422 
1423 	/// set properties
1424 	virtual void PrepareField(
1425 		const ::com::sun::star::uno::Reference<
1426 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1427 };
1428 
1429 /** import measure fields (<text:measure>) */
1430 class XMLMeasureFieldImportContext : public XMLTextFieldImportContext
1431 {
1432 	sal_Int16 mnKind;
1433 public:
1434 
1435 	TYPEINFO();
1436 
1437 	XMLMeasureFieldImportContext(SvXMLImport& rImport,
1438 									XMLTextImportHelper& rHlp,
1439 									sal_uInt16 nPrfx,
1440 									const ::rtl::OUString& sLocalName);
1441 
1442 protected:
1443 
1444 	/// process attribute values
1445 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1446 								   const ::rtl::OUString& sAttrValue );
1447 
1448 	/// prepare XTextField for insertion into document
1449 	virtual void PrepareField(
1450 		const ::com::sun::star::uno::Reference<
1451 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1452 };
1453 
1454 
1455 /** dropdown field (filter legacy) */
1456 class XMLDropDownFieldImportContext : public XMLTextFieldImportContext
1457 {
1458     std::vector<rtl::OUString> aLabels;
1459     rtl::OUString sName;
1460     rtl::OUString sHelp;
1461     rtl::OUString sHint;
1462     sal_Int32 nSelected;
1463     bool bNameOK;
1464     bool bHelpOK;
1465     bool bHintOK;
1466 
1467     const rtl::OUString sPropertyItems;
1468     const rtl::OUString sPropertySelectedItem;
1469     const rtl::OUString sPropertyName;
1470     const rtl::OUString sPropertyHelp;
1471     const rtl::OUString sPropertyToolTip;
1472 
1473 public:
1474 	TYPEINFO();
1475 
1476 	XMLDropDownFieldImportContext(SvXMLImport& rImport,
1477 									XMLTextImportHelper& rHlp,
1478 									sal_uInt16 nPrfx,
1479 									const ::rtl::OUString& sLocalName);
1480 
1481 	virtual SvXMLImportContext* CreateChildContext(
1482         sal_uInt16 nPrefix,
1483         const ::rtl::OUString& rLocalName,
1484         const ::com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList >& xAttrList );
1485 
1486 protected:
1487 
1488 	/// process attribute values
1489 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1490 								   const ::rtl::OUString& sAttrValue );
1491 
1492 	/// prepare XTextField for insertion into document
1493 	virtual void PrepareField(
1494 		const ::com::sun::star::uno::Reference<
1495 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1496 };
1497 
1498 /** import header fields (<draw:header>) */
1499 class XMLHeaderFieldImportContext : public XMLTextFieldImportContext
1500 {
1501 public:
1502 	TYPEINFO();
1503 
1504 	XMLHeaderFieldImportContext(
1505 		SvXMLImport& rImport,					/// XML Import
1506 		XMLTextImportHelper& rHlp,				/// Text import helper
1507 		sal_uInt16 nPrfx,						/// namespace prefix
1508 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
1509 
1510 	/// process attribute values
1511 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1512 								   const ::rtl::OUString& sAttrValue );
1513 
1514 	/// prepare XTextField for insertion into document
1515 	virtual void PrepareField(
1516 		const ::com::sun::star::uno::Reference<
1517 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1518 };
1519 
1520 /** import footer fields (<draw:footer>) */
1521 class XMLFooterFieldImportContext : public XMLTextFieldImportContext
1522 {
1523 public:
1524 	TYPEINFO();
1525 
1526 	XMLFooterFieldImportContext(
1527 		SvXMLImport& rImport,					/// XML Import
1528 		XMLTextImportHelper& rHlp,				/// Text import helper
1529 		sal_uInt16 nPrfx,						/// namespace prefix
1530 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
1531 
1532 	/// process attribute values
1533 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1534 								   const ::rtl::OUString& sAttrValue );
1535 
1536 	/// prepare XTextField for insertion into document
1537 	virtual void PrepareField(
1538 		const ::com::sun::star::uno::Reference<
1539 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1540 };
1541 
1542 /** import footer fields (<draw:date-and-time>) */
1543 class XMLDateTimeFieldImportContext : public XMLTextFieldImportContext
1544 {
1545 public:
1546 	TYPEINFO();
1547 
1548 	XMLDateTimeFieldImportContext(
1549 		SvXMLImport& rImport,					/// XML Import
1550 		XMLTextImportHelper& rHlp,				/// Text import helper
1551 		sal_uInt16 nPrfx,						/// namespace prefix
1552 		const ::rtl::OUString& sLocalName);		/// element name w/o prefix
1553 
1554 	/// process attribute values
1555 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1556 								   const ::rtl::OUString& sAttrValue );
1557 
1558 	/// prepare XTextField for insertion into document
1559 	virtual void PrepareField(
1560 		const ::com::sun::star::uno::Reference<
1561 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1562 };
1563 
1564 class XMLCustomPropertyFieldImportContext : public XMLTextFieldImportContext
1565 {
1566 	::rtl::OUString sName;
1567 	::com::sun::star::uno::Any aValue;
1568 	const ::rtl::OUString sPropertyName;
1569 	const ::rtl::OUString sPropertyValue;
1570 
1571 public:
1572 
1573 	TYPEINFO();
1574 
1575 	XMLCustomPropertyFieldImportContext (SvXMLImport& rImport,
1576 									XMLTextImportHelper& rHlp,
1577 									sal_uInt16 nPrfx,
1578 									const ::rtl::OUString& sLocalName);
1579 
1580 protected:
1581 
1582 	/// process attribute values
1583 	virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1584 								   const ::rtl::OUString& sAttrValue );
1585 
1586 	/// prepare XTextField for insertion into document
1587 	virtual void PrepareField(
1588 		const ::com::sun::star::uno::Reference<
1589 		::com::sun::star::beans::XPropertySet> & xPropertySet);
1590 };
1591 
1592 
1593 #endif
1594