merge the formfield patch from ooo-build
[ooovba.git] / binfilter / inc / bf_xmloff / txtfldi.hxx
blob227a6187d6e6273f5627955e1d554f9c9bb7ce77
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtfldi.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /** @#file
33 * import of all text fields
34 * (except variable related + database display field: see txtvfldi.hxx)
37 #ifndef _XMLOFF_TXTFLDI_HXX
38 #define _XMLOFF_TXTFLDI_HXX
40 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
41 #include <com/sun/star/uno/Reference.h>
42 #endif
44 #ifndef _COM_SUN_STAR_TEXT_PAGENUMBERTYPE_HPP_
45 #include <com/sun/star/text/PageNumberType.hpp>
46 #endif
48 #ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
49 #include <com/sun/star/util/DateTime.hpp>
50 #endif
52 #ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
53 #include <com/sun/star/util/Date.hpp>
54 #endif
56 #ifndef _XMLOFF_XMLICTXT_HXX
57 #include <bf_xmloff/xmlictxt.hxx>
58 #endif
60 #ifndef _XMLOFF_TEXTIMP_HXX_
61 #include <bf_xmloff/txtimp.hxx>
62 #endif
64 #ifndef _RTL_USTRBUF_HXX_
65 #include <rtl/ustrbuf.hxx>
66 #endif
68 #ifndef _TOOLS_DEBUG_HXX
69 #include <tools/debug.hxx>
70 #endif
72 namespace com { namespace sun { namespace star {
73 namespace xml { namespace sax { class XAttributeList; } }
74 namespace text { class XTextField; }
75 namespace beans { class XPropertySet; struct PropertyValue; }
76 } } }
78 namespace rtl
80 class OUString;
82 namespace binfilter {
84 class SvXMLImport;
85 class XMLTextImportHelper;
86 class SvXMLTokenMap;
88 enum XMLTextFieldAttrTokens
90 XML_TOK_TEXTFIELD_FIXED = 0,
91 XML_TOK_TEXTFIELD_DESCRIPTION,
92 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE,
93 XML_TOK_TEXTFIELD_TIME_ADJUST,
94 XML_TOK_TEXTFIELD_DATE_ADJUST,
95 XML_TOK_TEXTFIELD_PAGE_ADJUST,
96 XML_TOK_TEXTFIELD_SELECT_PAGE,
97 XML_TOK_TEXTFIELD_ACTIVE,
99 XML_TOK_TEXTFIELD_NAME,
100 XML_TOK_TEXTFIELD_FORMULA,
101 XML_TOK_TEXTFIELD_NUM_FORMAT,
102 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC,
103 XML_TOK_TEXTFIELD_DISPLAY_FORMULA,
104 XML_TOK_TEXTFIELD_NUMBERING_LEVEL,
105 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR,
106 XML_TOK_TEXTFIELD_DISPLAY,
107 XML_TOK_TEXTFIELD_OUTLINE_LEVEL,
109 XML_TOK_TEXTFIELD_VALUE_TYPE,
110 XML_TOK_TEXTFIELD_VALUE,
111 XML_TOK_TEXTFIELD_STRING_VALUE,
112 XML_TOK_TEXTFIELD_DATE_VALUE,
113 XML_TOK_TEXTFIELD_TIME_VALUE,
114 XML_TOK_TEXTFIELD_BOOL_VALUE,
115 XML_TOK_TEXTFIELD_CURRENCY,
116 XML_TOK_TEXTFIELD_DATA_STYLE_NAME,
118 XML_TOK_TEXTFIELD_DATABASE_NAME,
119 XML_TOK_TEXTFIELD_TABLE_NAME,
120 XML_TOK_TEXTFIELD_COLUMN_NAME,
121 XML_TOK_TEXTFIELD_ROW_NUMBER,
122 XML_TOK_TEXTFIELD_CONDITION,
123 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE,
124 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE,
125 XML_TOK_TEXTFIELD_REVISION,
126 XML_TOK_TEXTFIELD_IS_HIDDEN,
127 XML_TOK_TEXTFIELD_CURRENT_VALUE,
129 XML_TOK_TEXTFIELD_REFERENCE_FORMAT,
130 XML_TOK_TEXTFIELD_REF_NAME,
131 XML_TOK_TEXTFIELD_CONNECTION_NAME,
133 XML_TOK_TEXTFIELD_HREF,
134 XML_TOK_TEXTFIELD_TARGET_FRAME,
136 XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE,
137 XML_TOK_TEXTFIELD_OFFICE_AUTHOR,
138 XML_TOK_TEXTFIELD_ANNOTATION,
139 XML_TOK_TEXTFIELD_LANGUAGE,
141 XML_TOK_TEXTFIELD_MEASURE_KIND,
142 XML_TOK_TEXTFIELD_TABLE_TYPE,
144 XML_TOK_TEXTFIELD_UNKNOWN
147 /// abstract class for text field import
148 class XMLTextFieldImportContext : public SvXMLImportContext
150 const ::rtl::OUString sServicePrefix;
151 const ::rtl::OUString sIsFixed;
153 // data members
154 ::rtl::OUStringBuffer sContentBuffer; /// collect character data
155 ::rtl::OUString sContent; /// character data after collection
156 ::rtl::OUString sServiceName; /// service name for text field
157 XMLTextImportHelper& rTextImportHelper; /// the import helper
159 protected:
161 // data members for use in subclasses
162 sal_Bool bValid; /// ist dieses Feld gültig?
164 public:
166 TYPEINFO();
168 XMLTextFieldImportContext(
169 SvXMLImport& rImport, /// XML Import
170 XMLTextImportHelper& rHlp, /// Text import helper
171 const sal_Char* pService, /// name of SO API service
172 sal_uInt16 nPrfx, /// namespace prefix
173 const ::rtl::OUString& rLocalName); /// element name w/o prefix
175 virtual ~XMLTextFieldImportContext();
177 /// process character data: will be collected in member sContentBuffer
178 virtual void Characters( const ::rtl::OUString& sContent );
180 /// parses attributes and calls ProcessAttribute
181 virtual void StartElement(
182 const ::com::sun::star::uno::Reference<
183 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
185 /// create XTextField and insert into document; calls PrepareTextField
186 virtual void EndElement();
188 /// create the appropriate field context from
189 /// (for use in paragraph import)
190 static XMLTextFieldImportContext* CreateTextFieldImportContext(
191 SvXMLImport& rImport,
192 XMLTextImportHelper& rHlp,
193 sal_uInt16 nPrefix,
194 const ::rtl::OUString& rName,
195 sal_uInt16 nToken);
197 protected:
199 /// get helper
200 inline XMLTextImportHelper& GetImportHelper() { return rTextImportHelper; }
202 inline ::rtl::OUString GetServiceName() { return sServiceName; }
203 inline void SetServiceName(::rtl::OUString sStr) { sServiceName = sStr; }
205 ::rtl::OUString GetContent();
207 /// process attribute values
208 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
209 const ::rtl::OUString& sAttrValue ) = 0;
211 /// prepare XTextField for insertion into document
212 virtual void PrepareField(
213 const ::com::sun::star::uno::Reference<
214 ::com::sun::star::beans::XPropertySet> & xPropertySet) = 0;
216 /// create field from ServiceName
217 sal_Bool CreateField(::com::sun::star::uno::Reference<
218 ::com::sun::star::beans::XPropertySet> & xField,
219 const ::rtl::OUString& sServiceName);
221 /// force an update of the field's value
222 /// call update on optional XUptadeable interface; (disable Fixed property)
223 void ForceUpdate(
224 const ::com::sun::star::uno::Reference<
225 ::com::sun::star::beans::XPropertySet> & rPropertySet);
228 class XMLSenderFieldImportContext : public XMLTextFieldImportContext
231 sal_Int16 nSubType; /// API subtype for ExtUser field
233 const ::rtl::OUString sEmpty; /// empty string
234 const ::rtl::OUString sPropertyFixed;
235 const ::rtl::OUString sPropertyFieldSubType;
236 const ::rtl::OUString sPropertyContent;
238 protected:
240 // variables for access in subclass
241 sal_Bool bFixed;
242 sal_uInt16 nElementToken; /// token for this elment field
244 public:
246 TYPEINFO();
248 XMLSenderFieldImportContext(
249 SvXMLImport& rImport, /// XML Import
250 XMLTextImportHelper& rHlp, /// Text import helper
251 sal_uInt16 nPrfx, /// namespace prefix
252 const ::rtl::OUString& sLocalName, /// element name w/o prefix
253 sal_uInt16 nToken); /// element token
255 protected:
257 /// start element
258 virtual void StartElement(
259 const ::com::sun::star::uno::Reference<
260 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
262 /// process attribute values
263 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
264 const ::rtl::OUString& sAttrValue );
266 /// prepare XTextField for insertion into document
267 virtual void PrepareField(
268 const ::com::sun::star::uno::Reference<
269 ::com::sun::star::beans::XPropertySet> & xPropertySet);
272 /** inherit sender field because of fixed attribute in ProcessAttributes */
273 class XMLAuthorFieldImportContext : public XMLSenderFieldImportContext
276 sal_Bool bAuthorFullName;
277 const ::rtl::OUString sServiceAuthor;
278 const ::rtl::OUString sPropertyAuthorFullName;
279 const ::rtl::OUString sPropertyFixed;
280 const ::rtl::OUString sPropertyContent;
282 public:
284 TYPEINFO();
286 XMLAuthorFieldImportContext(
287 SvXMLImport& rImport, /// XML Import
288 XMLTextImportHelper& rHlp, /// Text import helper
289 sal_uInt16 nPrfx, /// namespace prefix
290 const ::rtl::OUString& sLocalName, /// element name w/o prefix
291 sal_uInt16 nToken); /// element token
293 protected:
295 /// start element
296 virtual void StartElement(
297 const ::com::sun::star::uno::Reference<
298 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
300 /// prepare XTextField for insertion into document
301 virtual void PrepareField(
302 const ::com::sun::star::uno::Reference<
303 ::com::sun::star::beans::XPropertySet> & xPropertySet);
306 class XMLPlaceholderFieldImportContext : public XMLTextFieldImportContext
309 const ::rtl::OUString sEmpty; /// empty string
310 const ::rtl::OUString sServiceJumpEdit;
311 const ::rtl::OUString sPropertyPlaceholderType;
312 const ::rtl::OUString sPropertyPlaceholder;
313 const ::rtl::OUString sPropertyHint;
315 ::rtl::OUString sDescription;
317 sal_Int16 nPlaceholderType;
319 public:
321 TYPEINFO();
323 XMLPlaceholderFieldImportContext(
324 SvXMLImport& rImport, /// XML Import
325 XMLTextImportHelper& rHlp, /// Text import helper
326 sal_uInt16 nPrfx, /// namespace prefix
327 const ::rtl::OUString& sLocalName); /// element name w/o prefix
329 protected:
331 /// process attribute values
332 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
333 const ::rtl::OUString& sAttrValue );
335 /// prepare XTextField for insertion into document
336 virtual void PrepareField(
337 const ::com::sun::star::uno::Reference<
338 ::com::sun::star::beans::XPropertySet> & xPropertySet);
341 class XMLTimeFieldImportContext : public XMLTextFieldImportContext
344 protected:
345 const ::rtl::OUString sPropertyNumberFormat;
346 const ::rtl::OUString sPropertyFixed;
347 const ::rtl::OUString sPropertyDateTimeValue;
348 const ::rtl::OUString sPropertyDateTime;
349 const ::rtl::OUString sPropertyAdjust;
350 const ::rtl::OUString sPropertyIsDate;
351 const ::rtl::OUString sPropertyIsFixedLanguage;
353 double fTimeValue;
354 ::com::sun::star::util::DateTime aDateTimeValue;
355 sal_Int32 nAdjust;
356 sal_Int32 nFormatKey;
357 sal_Bool bTimeOK;
358 sal_Bool bFormatOK;
359 sal_Bool bFixed;
360 sal_Bool bIsDate; // is this a date?
361 // (for XMLDateFieldImportContext, really)
362 sal_Bool bIsDefaultLanguage;
364 public:
366 TYPEINFO();
368 XMLTimeFieldImportContext(
369 SvXMLImport& rImport, /// XML Import
370 XMLTextImportHelper& rHlp, /// Text import helper
371 sal_uInt16 nPrfx, /// namespace prefix
372 const ::rtl::OUString& sLocalName); /// element name w/o prefix
374 /// process attribute values
375 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
376 const ::rtl::OUString& sAttrValue );
378 /// prepare XTextField for insertion into document
379 virtual void PrepareField(
380 const ::com::sun::star::uno::Reference<
381 ::com::sun::star::beans::XPropertySet> & xPropertySet);
384 /** import date fields (<text:date>);
385 inherit from TimeField to reuse implementation */
386 class XMLDateFieldImportContext : public XMLTimeFieldImportContext
389 public:
391 TYPEINFO();
393 XMLDateFieldImportContext(
394 SvXMLImport& rImport, /// XML Import
395 XMLTextImportHelper& rHlp, /// Text import helper
396 sal_uInt16 nPrfx, /// namespace prefix
397 const ::rtl::OUString& sLocalName); /// element name w/o prefix
399 /// process attribute values
400 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
401 const ::rtl::OUString& sAttrValue );
404 /** import page continuation fields (<text:page-continuation-string>) */
405 class XMLPageContinuationImportContext : public XMLTextFieldImportContext
407 const ::rtl::OUString sPropertySubType;
408 const ::rtl::OUString sPropertyUserText;
409 const ::rtl::OUString sPropertyNumberingType;
411 ::rtl::OUString sString; /// continuation string
412 ::com::sun::star::text::PageNumberType eSelectPage; /// previous, current
413 /// or next page
414 sal_Bool sStringOK; /// continuation string encountered?
416 public:
418 TYPEINFO();
420 XMLPageContinuationImportContext(
421 SvXMLImport& rImport, /// XML Import
422 XMLTextImportHelper& rHlp, /// Text import helper
423 sal_uInt16 nPrfx, /// namespace prefix
424 const ::rtl::OUString& sLocalName); /// element name w/o prefix
426 /// process attribute values
427 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
428 const ::rtl::OUString& sAttrValue );
430 /// prepare XTextField for insertion into document
431 virtual void PrepareField(
432 const ::com::sun::star::uno::Reference<
433 ::com::sun::star::beans::XPropertySet> & xPropertySet);
436 /** import page number fields (<text:page-number>) */
437 class XMLPageNumberImportContext : public XMLTextFieldImportContext
439 const ::rtl::OUString sPropertySubType;
440 const ::rtl::OUString sPropertyNumberingType;
441 const ::rtl::OUString sPropertyOffset;
443 ::rtl::OUString sNumberFormat;
444 ::rtl::OUString sNumberSync;
445 sal_Int16 nPageAdjust;
446 ::com::sun::star::text::PageNumberType eSelectPage; /// previous, current
447 /// or next page
448 sal_Bool sNumberFormatOK;
450 public:
452 TYPEINFO();
454 XMLPageNumberImportContext(
455 SvXMLImport& rImport, /// XML Import
456 XMLTextImportHelper& rHlp, /// Text import helper
457 sal_uInt16 nPrfx, /// namespace prefix
458 const ::rtl::OUString& sLocalName); /// element name w/o prefix
460 /// process attribute values
461 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
462 const ::rtl::OUString& sAttrValue );
464 /// prepare XTextField for insertion into document
465 virtual void PrepareField(
466 const ::com::sun::star::uno::Reference<
467 ::com::sun::star::beans::XPropertySet> & xPropertySet);
470 /** superclass for database fields: handle database and table names */
471 class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext
473 const ::rtl::OUString sPropertyDatabaseName;
474 const ::rtl::OUString sPropertyTableName;
475 const ::rtl::OUString sPropertyDataCommandType;
476 const ::rtl::OUString sPropertyIsVisible;
478 ::rtl::OUString sDatabaseName;
479 ::rtl::OUString sTableName;
481 sal_Int32 nCommandType;
482 sal_Bool bCommandTypeOK;
484 sal_Bool bDisplay;
485 bool bDisplayOK;
486 bool bUseDisplay;
488 protected:
489 sal_Bool bDatabaseOK;
490 sal_Bool bTableOK;
492 /// protected constructor: only for subclasses
493 XMLDatabaseFieldImportContext(SvXMLImport& rImport,
494 XMLTextImportHelper& rHlp,
495 const sal_Char* pServiceName,
496 sal_uInt16 nPrfx,
497 const ::rtl::OUString& sLocalName,
498 bool bUseDisplay );
500 public:
502 TYPEINFO();
504 /// process attribute values
505 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
506 const ::rtl::OUString& sAttrValue );
508 /// prepare XTextField for insertion into document
509 virtual void PrepareField(
510 const ::com::sun::star::uno::Reference<
511 ::com::sun::star::beans::XPropertySet> & xPropertySet);
514 /** import database name fields (<text:database-name>) */
515 class XMLDatabaseNameImportContext : public XMLDatabaseFieldImportContext
517 public:
519 TYPEINFO();
521 XMLDatabaseNameImportContext(SvXMLImport& rImport,
522 XMLTextImportHelper& rHlp,
523 sal_uInt16 nPrfx,
524 const ::rtl::OUString& sLocalName);
526 /// process attribute values
527 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
528 const ::rtl::OUString& sAttrValue );
531 /** import database next fields (<text:database-next>) */
532 class XMLDatabaseNextImportContext : public XMLDatabaseFieldImportContext
534 const ::rtl::OUString sPropertyCondition;
535 const ::rtl::OUString sTrue;
536 ::rtl::OUString sCondition;
537 sal_Bool bConditionOK;
539 protected:
541 // for use in child classes
542 XMLDatabaseNextImportContext(SvXMLImport& rImport,
543 XMLTextImportHelper& rHlp,
544 const sal_Char* pServiceName,
545 sal_uInt16 nPrfx,
546 const ::rtl::OUString& sLocalName);
548 public:
550 TYPEINFO();
552 XMLDatabaseNextImportContext(SvXMLImport& rImport,
553 XMLTextImportHelper& rHlp,
554 sal_uInt16 nPrfx,
555 const ::rtl::OUString& sLocalName);
557 /// process attribute values
558 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
559 const ::rtl::OUString& sAttrValue );
561 /// prepare XTextField for insertion into document
562 virtual void PrepareField(
563 const ::com::sun::star::uno::Reference<
564 ::com::sun::star::beans::XPropertySet> & xPropertySet);
567 /** import database select fields (<text:database-select>) */
568 class XMLDatabaseSelectImportContext : public XMLDatabaseNextImportContext
570 const ::rtl::OUString sPropertySetNumber;
571 sal_Int32 nNumber;
572 sal_Bool bNumberOK;
574 public:
576 TYPEINFO();
578 XMLDatabaseSelectImportContext(SvXMLImport& rImport,
579 XMLTextImportHelper& rHlp,
580 sal_uInt16 nPrfx,
581 const ::rtl::OUString& sLocalName);
583 /// process attribute values
584 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
585 const ::rtl::OUString& sAttrValue );
587 /// prepare XTextField for insertion into document
588 virtual void PrepareField(
589 const ::com::sun::star::uno::Reference<
590 ::com::sun::star::beans::XPropertySet> & xPropertySet);
593 /** import database display number fields (<text:database-row-number>) */
594 class XMLDatabaseNumberImportContext : public XMLDatabaseFieldImportContext
596 const ::rtl::OUString sPropertyNumberingType;
597 const ::rtl::OUString sPropertySetNumber;
598 ::rtl::OUString sNumberFormat;
599 ::rtl::OUString sNumberSync;
600 sal_Int32 nValue;
601 sal_Bool bValueOK;
603 public:
605 TYPEINFO();
607 XMLDatabaseNumberImportContext(SvXMLImport& rImport,
608 XMLTextImportHelper& rHlp,
609 sal_uInt16 nPrfx,
610 const ::rtl::OUString& sLocalName);
612 /// process attribute values
613 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
614 const ::rtl::OUString& sAttrValue );
616 /// prepare XTextField for insertion into document
617 virtual void PrepareField(
618 const ::com::sun::star::uno::Reference<
619 ::com::sun::star::beans::XPropertySet> & xPropertySet);
622 /** import docinfo fields with only fixed atribute */
623 class XMLSimpleDocInfoImportContext : public XMLTextFieldImportContext
625 const ::rtl::OUString sPropertyFixed;
626 const ::rtl::OUString sPropertyContent;
627 const ::rtl::OUString sPropertyAuthor;
628 //STRIP013 const ::rtl::OUString sPropertyCurrentPresentation;
630 protected:
631 sal_Bool bFixed;
632 sal_Bool bHasAuthor;
633 sal_Bool bHasContent;
635 public:
637 TYPEINFO();
639 XMLSimpleDocInfoImportContext(SvXMLImport& rImport,
640 XMLTextImportHelper& rHlp,
641 sal_uInt16 nPrfx,
642 const ::rtl::OUString& sLocalName,
643 sal_uInt16 nToken,
644 sal_Bool bContent,
645 sal_Bool bAuthor);
647 protected:
649 /// process attribute values
650 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
651 const ::rtl::OUString& sAttrValue );
653 /// prepare XTextField for insertion into document
654 virtual void PrepareField(
655 const ::com::sun::star::uno::Reference<
656 ::com::sun::star::beans::XPropertySet> & xPropertySet);
658 static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
661 /** import docinfo fields with date or time attributes and numberformats */
662 class XMLDateTimeDocInfoImportContext : public XMLSimpleDocInfoImportContext
664 const ::rtl::OUString sPropertyNumberFormat;
665 const ::rtl::OUString sPropertyIsDate;
666 const ::rtl::OUString sPropertyIsFixedLanguage;
668 sal_Int32 nFormat;
669 sal_Bool bFormatOK;
670 sal_Bool bIsDate;
671 sal_Bool bHasDateTime;
672 sal_Bool bIsDefaultLanguage;
674 public:
676 TYPEINFO();
678 XMLDateTimeDocInfoImportContext(SvXMLImport& rImport,
679 XMLTextImportHelper& rHlp,
680 sal_uInt16 nPrfx,
681 const ::rtl::OUString& sLocalName,
682 sal_uInt16 nToken);
684 protected:
686 /// process attribute values
687 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
688 const ::rtl::OUString& sAttrValue );
690 /// prepare XTextField for insertion into document
691 virtual void PrepareField(
692 const ::com::sun::star::uno::Reference<
693 ::com::sun::star::beans::XPropertySet> & xPropertySet);
696 /** import revision field (<text:editing-cycles>) */
697 class XMLRevisionDocInfoImportContext : public XMLSimpleDocInfoImportContext
699 const ::rtl::OUString sPropertyRevision;
700 sal_Int16 nRevision;
701 sal_Bool bRevisionOK;
703 public:
705 TYPEINFO();
707 XMLRevisionDocInfoImportContext(SvXMLImport& rImport,
708 XMLTextImportHelper& rHlp,
709 sal_uInt16 nPrfx,
710 const ::rtl::OUString& sLocalName,
711 sal_uInt16 nToken);
713 protected:
715 /// prepare XTextField for insertion into document
716 virtual void PrepareField(
717 const ::com::sun::star::uno::Reference<
718 ::com::sun::star::beans::XPropertySet> & xPropertySet);
721 /** import user docinfo field (<text:user-defined>) */
722 class XMLUserDocInfoImportContext : public XMLSimpleDocInfoImportContext
724 public:
726 TYPEINFO();
728 XMLUserDocInfoImportContext(SvXMLImport& rImport,
729 XMLTextImportHelper& rHlp,
730 sal_uInt16 nPrfx,
731 const ::rtl::OUString& sLocalName,
732 sal_uInt16 nToken);
734 protected:
736 /// process attribute values
737 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
738 const ::rtl::OUString& sAttrValue );
741 /** import hidden paragraph fields (<text:hidden-paragraph>) */
742 class XMLHiddenParagraphImportContext : public XMLTextFieldImportContext
744 const ::rtl::OUString sPropertyCondition;
745 const ::rtl::OUString sPropertyIsHidden;
747 ::rtl::OUString sCondition;
748 sal_Bool bIsHidden;
750 public:
752 TYPEINFO();
754 XMLHiddenParagraphImportContext(SvXMLImport& rImport,
755 XMLTextImportHelper& rHlp,
756 sal_uInt16 nPrfx,
757 const ::rtl::OUString& sLocalName);
759 protected:
761 /// process attribute values
762 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
763 const ::rtl::OUString& sAttrValue );
765 /// prepare XTextField for insertion into document
766 virtual void PrepareField(
767 const ::com::sun::star::uno::Reference<
768 ::com::sun::star::beans::XPropertySet> & xPropertySet);
771 /** import conditional text fields (<text:conditional-text>) */
772 class XMLConditionalTextImportContext : public XMLTextFieldImportContext
774 const ::rtl::OUString sPropertyCondition;
775 const ::rtl::OUString sPropertyTrueContent;
776 const ::rtl::OUString sPropertyFalseContent;
777 const ::rtl::OUString sPropertyIsConditionTrue;
778 //STRIP013 const ::rtl::OUString sPropertyCurrentPresentation;
780 ::rtl::OUString sCondition;
781 ::rtl::OUString sTrueContent;
782 ::rtl::OUString sFalseContent;
784 sal_Bool bConditionOK;
785 sal_Bool bTrueOK;
786 sal_Bool bFalseOK;
787 sal_Bool bCurrentValue;
789 public:
791 TYPEINFO();
793 XMLConditionalTextImportContext(SvXMLImport& rImport,
794 XMLTextImportHelper& rHlp,
795 sal_uInt16 nPrfx,
796 const ::rtl::OUString& sLocalName);
798 protected:
800 /// process attribute values
801 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
802 const ::rtl::OUString& sAttrValue );
804 /// prepare XTextField for insertion into document
805 virtual void PrepareField(
806 const ::com::sun::star::uno::Reference<
807 ::com::sun::star::beans::XPropertySet> & xPropertySet);
810 /** import conditional text fields (<text:hidden-text>) */
811 class XMLHiddenTextImportContext : public XMLTextFieldImportContext
813 const ::rtl::OUString sPropertyCondition;
814 const ::rtl::OUString sPropertyContent;
815 const ::rtl::OUString sPropertyIsHidden;
817 ::rtl::OUString sCondition;
818 ::rtl::OUString sString;
820 sal_Bool bConditionOK;
821 sal_Bool bStringOK;
822 sal_Bool bIsHidden;
824 public:
826 TYPEINFO();
828 XMLHiddenTextImportContext(SvXMLImport& rImport,
829 XMLTextImportHelper& rHlp,
830 sal_uInt16 nPrfx,
831 const ::rtl::OUString& sLocalName);
833 protected:
835 /// process attribute values
836 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
837 const ::rtl::OUString& sAttrValue );
839 /// prepare XTextField for insertion into document
840 virtual void PrepareField(
841 const ::com::sun::star::uno::Reference<
842 ::com::sun::star::beans::XPropertySet> & xPropertySet);
845 /** import file name fields (<text:file-name>) */
846 class XMLFileNameImportContext : public XMLTextFieldImportContext
848 const ::rtl::OUString sPropertyFixed;
849 const ::rtl::OUString sPropertyFileFormat;
850 //STRIP013 const ::rtl::OUString sPropertyCurrentPresentation;
852 sal_Int16 nFormat;
853 sal_Bool bFixed;
855 public:
857 TYPEINFO();
859 XMLFileNameImportContext(SvXMLImport& rImport,
860 XMLTextImportHelper& rHlp,
861 sal_uInt16 nPrfx,
862 const ::rtl::OUString& sLocalName);
864 protected:
866 /// process attribute values
867 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
868 const ::rtl::OUString& sAttrValue );
870 /// prepare XTextField for insertion into document
871 virtual void PrepareField(
872 const ::com::sun::star::uno::Reference<
873 ::com::sun::star::beans::XPropertySet> & xPropertySet);
876 /** import document template name fields (<text:template-name>) */
877 class XMLTemplateNameImportContext : public XMLTextFieldImportContext
879 const ::rtl::OUString sPropertyFileFormat;
881 sal_Int16 nFormat;
883 public:
885 TYPEINFO();
887 XMLTemplateNameImportContext(SvXMLImport& rImport,
888 XMLTextImportHelper& rHlp,
889 sal_uInt16 nPrfx,
890 const ::rtl::OUString& sLocalName);
892 protected:
894 /// process attribute values
895 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
896 const ::rtl::OUString& sAttrValue );
898 /// prepare XTextField for insertion into document
899 virtual void PrepareField(
900 const ::com::sun::star::uno::Reference<
901 ::com::sun::star::beans::XPropertySet> & xPropertySet);
904 /** import chapter fields (<text:chapter>) */
905 class XMLChapterImportContext : public XMLTextFieldImportContext
907 const ::rtl::OUString sPropertyChapterFormat;
908 const ::rtl::OUString sPropertyLevel;
910 sal_Int16 nFormat;
911 sal_Int8 nLevel;
913 public:
915 TYPEINFO();
917 XMLChapterImportContext(SvXMLImport& rImport,
918 XMLTextImportHelper& rHlp,
919 sal_uInt16 nPrfx,
920 const ::rtl::OUString& sLocalName);
922 protected:
924 /// process attribute values
925 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
926 const ::rtl::OUString& sAttrValue );
928 /// prepare XTextField for insertion into document
929 virtual void PrepareField(
930 const ::com::sun::star::uno::Reference<
931 ::com::sun::star::beans::XPropertySet> & xPropertySet);
934 /** import count fields (<text:[XXX]-count>) */
935 class XMLCountFieldImportContext : public XMLTextFieldImportContext
937 const ::rtl::OUString sPropertyNumberingType;
939 ::rtl::OUString sNumberFormat;
940 ::rtl::OUString sLetterSync;
942 sal_Bool bNumberFormatOK;
944 public:
946 TYPEINFO();
948 XMLCountFieldImportContext(SvXMLImport& rImport,
949 XMLTextImportHelper& rHlp,
950 sal_uInt16 nPrfx,
951 const ::rtl::OUString& sLocalName,
952 sal_uInt16 nToken);
954 protected:
956 /// process attribute values
957 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
958 const ::rtl::OUString& sAttrValue );
960 /// prepare XTextField for insertion into document
961 virtual void PrepareField(
962 const ::com::sun::star::uno::Reference<
963 ::com::sun::star::beans::XPropertySet> & xPropertySet);
965 static const sal_Char* MapTokenToServiceName(sal_uInt16 nToken);
968 /** import page variable fields (<text:get-page-variable>) */
969 class XMLPageVarGetFieldImportContext : public XMLTextFieldImportContext
971 const ::rtl::OUString sPropertyNumberingType;
973 ::rtl::OUString sNumberFormat;
974 ::rtl::OUString sLetterSync;
976 sal_Bool bNumberFormatOK;
978 public:
980 TYPEINFO();
982 XMLPageVarGetFieldImportContext(SvXMLImport& rImport,
983 XMLTextImportHelper& rHlp,
984 sal_uInt16 nPrfx,
985 const ::rtl::OUString& sLocalName);
987 protected:
989 /// process attribute values
990 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
991 const ::rtl::OUString& sAttrValue );
993 /// prepare XTextField for insertion into document
994 virtual void PrepareField(
995 const ::com::sun::star::uno::Reference<
996 ::com::sun::star::beans::XPropertySet> & xPropertySet);
999 /** import page variable fields (<text:get-page-variable>) */
1000 class XMLPageVarSetFieldImportContext : public XMLTextFieldImportContext
1002 const ::rtl::OUString sPropertyOn;
1003 const ::rtl::OUString sPropertyOffset;
1005 sal_Int16 nAdjust;
1006 sal_Bool bActive;
1008 public:
1010 TYPEINFO();
1012 XMLPageVarSetFieldImportContext(SvXMLImport& rImport,
1013 XMLTextImportHelper& rHlp,
1014 sal_uInt16 nPrfx,
1015 const ::rtl::OUString& sLocalName);
1017 protected:
1019 /// process attribute values
1020 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1021 const ::rtl::OUString& sAttrValue );
1023 /// prepare XTextField for insertion into document
1024 virtual void PrepareField(
1025 const ::com::sun::star::uno::Reference<
1026 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1029 /** import macro fields (<text:execute-macro>) */
1030 class XMLMacroFieldImportContext : public XMLTextFieldImportContext
1033 const ::rtl::OUString sPropertyHint;
1034 const ::rtl::OUString sPropertyMacroName;
1035 const ::rtl::OUString sPropertyLibraryName;
1037 ::rtl::OUString sDescription;
1038 SvXMLImportContextRef xEventContext;
1040 ::rtl::OUString sMacro; // macro for old documents (pre 638i)
1042 sal_Bool bMacroOK;
1043 sal_Bool bDescriptionOK;
1045 public:
1047 TYPEINFO();
1049 XMLMacroFieldImportContext(SvXMLImport& rImport,
1050 XMLTextImportHelper& rHlp,
1051 sal_uInt16 nPrfx,
1052 const ::rtl::OUString& sLocalName);
1054 protected:
1056 /// for <office:events> children
1057 virtual SvXMLImportContext *CreateChildContext(
1058 sal_uInt16 nPrefix,
1059 const ::rtl::OUString& rLocalName,
1060 const ::com::sun::star::uno::Reference<
1061 ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
1063 /// process attribute values
1064 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1065 const ::rtl::OUString& sAttrValue );
1067 /// prepare XTextField for insertion into document
1068 virtual void PrepareField(
1069 const ::com::sun::star::uno::Reference<
1070 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1073 /** import reference fields (<text:reference-get>) */
1074 class XMLReferenceFieldImportContext : public XMLTextFieldImportContext
1076 const ::rtl::OUString sPropertyReferenceFieldPart;
1077 const ::rtl::OUString sPropertyReferenceFieldSource;
1078 const ::rtl::OUString sPropertySourceName;
1079 //STRIP013 const ::rtl::OUString sPropertyCurrentPresentation;
1081 ::rtl::OUString sName;
1082 sal_uInt16 nElementToken;
1083 sal_Int16 nSource;
1084 sal_Int16 nType;
1085 sal_Int16 nSequenceNumber;
1087 sal_Bool bNameOK;
1088 sal_Bool bTypeOK;
1089 sal_Bool bSeqNumberOK;
1091 public:
1093 TYPEINFO();
1095 XMLReferenceFieldImportContext(SvXMLImport& rImport,
1096 XMLTextImportHelper& rHlp,
1097 sal_uInt16 nToken,
1098 sal_uInt16 nPrfx,
1099 const ::rtl::OUString& sLocalName);
1101 protected:
1103 /// start element
1104 virtual void StartElement(
1105 const ::com::sun::star::uno::Reference<
1106 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1108 /// process attribute values
1109 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1110 const ::rtl::OUString& sAttrValue );
1112 /// prepare XTextField for insertion into document
1113 virtual void PrepareField(
1114 const ::com::sun::star::uno::Reference<
1115 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1118 /** import dde field declaration container (<text:dde-connection-decls>) */
1119 class XMLDdeFieldDeclsImportContext : public SvXMLImportContext
1122 SvXMLTokenMap aTokenMap;
1124 public:
1126 TYPEINFO();
1128 XMLDdeFieldDeclsImportContext(SvXMLImport& rImport,
1129 sal_uInt16 nPrfx,
1130 const ::rtl::OUString& sLocalName);
1132 virtual SvXMLImportContext *CreateChildContext(
1133 sal_uInt16 nPrefix,
1134 const ::rtl::OUString& rLocalName,
1135 const ::com::sun::star::uno::Reference<
1136 ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
1140 /** import dde field declaration (<text:dde-connection-decl>) */
1141 class XMLDdeFieldDeclImportContext : public SvXMLImportContext
1143 const ::rtl::OUString sPropertyIsAutomaticUpdate;
1144 const ::rtl::OUString sPropertyName;
1145 const ::rtl::OUString sPropertyDDECommandType;
1146 const ::rtl::OUString sPropertyDDECommandFile;
1147 const ::rtl::OUString sPropertyDDECommandElement;
1149 const SvXMLTokenMap& rTokenMap;
1151 public:
1153 TYPEINFO();
1155 XMLDdeFieldDeclImportContext(SvXMLImport& rImport,
1156 sal_uInt16 nPrfx,
1157 const ::rtl::OUString& sLocalName,
1158 const SvXMLTokenMap& rMap);
1160 // create fieldmaster
1161 virtual void StartElement(
1162 const ::com::sun::star::uno::Reference<
1163 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1166 /** import dde fields (<text:dde-connection>) */
1167 class XMLDdeFieldImportContext : public XMLTextFieldImportContext
1169 ::rtl::OUString sName;
1171 public:
1173 TYPEINFO();
1175 XMLDdeFieldImportContext(SvXMLImport& rImport,
1176 XMLTextImportHelper& rHlp,
1177 sal_uInt16 nPrfx,
1178 const ::rtl::OUString& sLocalName);
1180 protected:
1182 /// process attribute values
1183 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1184 const ::rtl::OUString& sAttrValue );
1186 /// create textfield, attach master, and insert into document
1187 virtual void EndElement();
1189 /// empty method
1190 virtual void PrepareField(
1191 const ::com::sun::star::uno::Reference<
1192 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1196 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1197 class XMLSheetNameImportContext : public XMLTextFieldImportContext
1200 public:
1202 TYPEINFO();
1204 XMLSheetNameImportContext(SvXMLImport& rImport,
1205 XMLTextImportHelper& rHlp,
1206 sal_uInt16 nPrfx,
1207 const ::rtl::OUString& sLocalName);
1209 protected:
1211 /// no attributes -> empty method
1212 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1213 const ::rtl::OUString& sAttrValue );
1215 /// no atributes -> empty method
1216 virtual void PrepareField(
1217 const ::com::sun::star::uno::Reference<
1218 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1221 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1222 class XMLUrlFieldImportContext : public XMLTextFieldImportContext
1225 const ::rtl::OUString sPropertyURL;
1226 const ::rtl::OUString sPropertyTargetFrame;
1227 const ::rtl::OUString sPropertyRepresentation;
1229 ::rtl::OUString sURL;
1230 ::rtl::OUString sFrame;
1231 sal_Bool bFrameOK;
1233 public:
1235 TYPEINFO();
1237 XMLUrlFieldImportContext(SvXMLImport& rImport,
1238 XMLTextImportHelper& rHlp,
1239 sal_uInt16 nPrfx,
1240 const ::rtl::OUString& sLocalName);
1242 protected:
1244 /// no attributes -> empty method
1245 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1246 const ::rtl::OUString& sAttrValue );
1248 /// no atributes -> empty method
1249 virtual void PrepareField(
1250 const ::com::sun::star::uno::Reference<
1251 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1254 /** import bibliography info fields (<text:bibliography-mark>) */
1255 class XMLBibliographyFieldImportContext : public XMLTextFieldImportContext
1258 const ::rtl::OUString sPropertyFields;
1260 ::std::vector< ::com::sun::star::beans::PropertyValue> aValues;
1262 public:
1264 TYPEINFO();
1266 XMLBibliographyFieldImportContext(SvXMLImport& rImport,
1267 XMLTextImportHelper& rHlp,
1268 sal_uInt16 nPrfx,
1269 const ::rtl::OUString& sLocalName);
1271 protected:
1273 /// process attributes (fill aValues)
1274 virtual void StartElement(
1275 const ::com::sun::star::uno::Reference<
1276 ::com::sun::star::xml::sax::XAttributeList> & xAttrList);
1278 /// empty method; all attributes are handled in StartElement
1279 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1280 const ::rtl::OUString& sAttrValue );
1282 /// convert aValues into sequence and set property
1283 virtual void PrepareField(
1284 const ::com::sun::star::uno::Reference<
1285 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1287 static const sal_Char* MapBibliographyFieldName(::rtl::OUString sName);
1291 /** Import an annotation field (<text:annotation>) */
1292 class XMLAnnotationImportContext : public XMLTextFieldImportContext
1294 const ::rtl::OUString sPropertyAuthor;
1295 const ::rtl::OUString sPropertyContent;
1296 const ::rtl::OUString sPropertyDate;
1298 ::rtl::OUString sAuthor;
1299 ::rtl::OUStringBuffer aTextBuffer;
1300 ::com::sun::star::util::Date aDate;
1302 sal_Bool bDateOK;
1304 public:
1306 TYPEINFO();
1308 XMLAnnotationImportContext(SvXMLImport& rImport,
1309 XMLTextImportHelper& rHlp,
1310 sal_uInt16 nPrfx,
1311 const ::rtl::OUString& sLocalName);
1313 protected:
1315 /// process attributes
1316 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1317 const ::rtl::OUString& sAttrValue );
1319 /// set properties
1320 virtual void PrepareField(
1321 const ::com::sun::star::uno::Reference<
1322 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1324 virtual SvXMLImportContext *CreateChildContext(
1325 USHORT nPrefix,
1326 const ::rtl::OUString& rLocalName,
1327 const ::com::sun::star::uno::Reference<
1328 ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1331 /** Import a script field (<text:script>) */
1332 class XMLScriptImportContext : public XMLTextFieldImportContext
1334 const ::rtl::OUString sPropertyScriptType;
1335 const ::rtl::OUString sPropertyURLContent;
1336 const ::rtl::OUString sPropertyContent;
1338 ::rtl::OUString sContent;
1339 ::rtl::OUString sScriptType;
1341 sal_Bool bContentOK;
1342 sal_Bool bScriptTypeOK;
1343 sal_Bool bUrlContent;
1345 public:
1347 TYPEINFO();
1349 XMLScriptImportContext(SvXMLImport& rImport,
1350 XMLTextImportHelper& rHlp,
1351 sal_uInt16 nPrfx,
1352 const ::rtl::OUString& sLocalName);
1354 protected:
1356 /// process attributes
1357 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1358 const ::rtl::OUString& sAttrValue );
1360 /// set properties
1361 virtual void PrepareField(
1362 const ::com::sun::star::uno::Reference<
1363 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1366 /** import measure fields (<text:measure>) */
1367 class XMLMeasureFieldImportContext : public XMLTextFieldImportContext
1369 sal_Int16 mnKind;
1370 public:
1372 TYPEINFO();
1374 XMLMeasureFieldImportContext(SvXMLImport& rImport,
1375 XMLTextImportHelper& rHlp,
1376 sal_uInt16 nPrfx,
1377 const ::rtl::OUString& sLocalName);
1379 protected:
1381 /// process attribute values
1382 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1383 const ::rtl::OUString& sAttrValue );
1385 /// prepare XTextField for insertion into document
1386 virtual void PrepareField(
1387 const ::com::sun::star::uno::Reference<
1388 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1391 /** dropdown field (filter legacy) */
1392 class XMLDropDownFieldImportContext : public XMLTextFieldImportContext
1394 ::std::vector<rtl::OUString> aLabels;
1395 ::rtl::OUString sName;
1396 sal_Int32 nSelected;
1397 bool bNameOK;
1399 const ::rtl::OUString sPropertyItems;
1400 const ::rtl::OUString sPropertySelectedItem;
1401 const ::rtl::OUString sPropertyName;
1403 public:
1404 TYPEINFO();
1406 XMLDropDownFieldImportContext(SvXMLImport& rImport,
1407 XMLTextImportHelper& rHlp,
1408 sal_uInt16 nPrfx,
1409 const ::rtl::OUString& sLocalName);
1411 virtual SvXMLImportContext* CreateChildContext(
1412 USHORT nPrefix,
1413 const ::rtl::OUString& rLocalName,
1414 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
1416 protected:
1418 /// process attribute values
1419 virtual void ProcessAttribute( sal_uInt16 nAttrToken,
1420 const ::rtl::OUString& sAttrValue );
1422 /// prepare XTextField for insertion into document
1423 virtual void PrepareField(
1424 const ::com::sun::star::uno::Reference<
1425 ::com::sun::star::beans::XPropertySet> & xPropertySet);
1428 }//end of namespace binfilter
1429 #endif