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