1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtfldi.hxx,v $
10 * $Revision: 1.38.66.2 $
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 ************************************************************************/
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 #include <com/sun/star/uno/Reference.h>
41 #include <com/sun/star/text/PageNumberType.hpp>
42 #include <com/sun/star/util/DateTime.hpp>
43 #include <com/sun/star/util/Date.hpp>
44 #include <xmloff/xmlictxt.hxx>
45 #include <xmloff/txtimp.hxx>
46 #include <rtl/ustrbuf.hxx>
47 #include <tools/debug.hxx>
51 namespace com
{ namespace sun
{ namespace star
{
52 namespace xml
{ namespace sax
{ class XAttributeList
; } }
53 namespace text
{ class XTextField
; }
54 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
64 class XMLTextImportHelper
;
70 enum XMLTextFieldAttrTokens
72 XML_TOK_TEXTFIELD_FIXED
= 0,
73 XML_TOK_TEXTFIELD_DESCRIPTION
,
74 XML_TOK_TEXTFIELD_HELP
,
75 XML_TOK_TEXTFIELD_HINT
,
76 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE
,
77 XML_TOK_TEXTFIELD_TIME_ADJUST
,
78 XML_TOK_TEXTFIELD_DATE_ADJUST
,
79 XML_TOK_TEXTFIELD_PAGE_ADJUST
,
80 XML_TOK_TEXTFIELD_SELECT_PAGE
,
81 XML_TOK_TEXTFIELD_ACTIVE
,
83 XML_TOK_TEXTFIELD_NAME
,
84 XML_TOK_TEXTFIELD_FORMULA
,
85 XML_TOK_TEXTFIELD_NUM_FORMAT
,
86 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC
,
87 XML_TOK_TEXTFIELD_DISPLAY_FORMULA
,
88 XML_TOK_TEXTFIELD_NUMBERING_LEVEL
,
89 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR
,
90 XML_TOK_TEXTFIELD_DISPLAY
,
91 XML_TOK_TEXTFIELD_OUTLINE_LEVEL
,
93 XML_TOK_TEXTFIELD_VALUE_TYPE
,
94 XML_TOK_TEXTFIELD_VALUE
,
95 XML_TOK_TEXTFIELD_STRING_VALUE
,
96 XML_TOK_TEXTFIELD_DATE_VALUE
,
97 XML_TOK_TEXTFIELD_TIME_VALUE
,
98 XML_TOK_TEXTFIELD_BOOL_VALUE
,
99 XML_TOK_TEXTFIELD_CURRENCY
,
100 XML_TOK_TEXTFIELD_DATA_STYLE_NAME
,
102 XML_TOK_TEXTFIELD_DATABASE_NAME
,
103 XML_TOK_TEXTFIELD_TABLE_NAME
,
104 XML_TOK_TEXTFIELD_COLUMN_NAME
,
105 XML_TOK_TEXTFIELD_ROW_NUMBER
,
106 XML_TOK_TEXTFIELD_CONDITION
,
107 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE
,
108 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE
,
109 XML_TOK_TEXTFIELD_REVISION
,
110 XML_TOK_TEXTFIELD_IS_HIDDEN
,
111 XML_TOK_TEXTFIELD_CURRENT_VALUE
,
113 XML_TOK_TEXTFIELD_REFERENCE_FORMAT
,
114 XML_TOK_TEXTFIELD_REF_NAME
,
115 XML_TOK_TEXTFIELD_CONNECTION_NAME
,
117 XML_TOK_TEXTFIELD_HREF
,
118 XML_TOK_TEXTFIELD_TARGET_FRAME
,
120 XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE
,
121 XML_TOK_TEXTFIELD_OFFICE_AUTHOR
,
122 XML_TOK_TEXTFIELD_ANNOTATION
,
123 XML_TOK_TEXTFIELD_LANGUAGE
,
125 XML_TOK_TEXTFIELD_MEASURE_KIND
,
126 XML_TOK_TEXTFIELD_TABLE_TYPE
,
128 XML_TOK_TEXTFIELD_NOTE_CLASS
,
130 XML_TOK_TEXTFIELD_UNKNOWN
137 /// abstract class for text field import
138 class XMLTextFieldImportContext
: public SvXMLImportContext
140 const ::rtl::OUString sIsFixed
;
143 ::rtl::OUStringBuffer sContentBuffer
; /// collect character data
144 ::rtl::OUString sContent
; /// character data after collection
145 ::rtl::OUString sServiceName
; /// service name for text field
146 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
149 ::rtl::OUString sServicePrefix
;
151 // data members for use in subclasses
152 sal_Bool bValid
; /// ist dieses Feld gültig?
158 XMLTextFieldImportContext(
159 SvXMLImport
& rImport
, /// XML Import
160 XMLTextImportHelper
& rHlp
, /// Text import helper
161 const sal_Char
* pService
, /// name of SO API service
162 sal_uInt16 nPrfx
, /// namespace prefix
163 const ::rtl::OUString
& rLocalName
); /// element name w/o prefix
165 virtual ~XMLTextFieldImportContext();
167 /// process character data: will be collected in member sContentBuffer
168 virtual void Characters( const ::rtl::OUString
& sContent
);
170 /// parses attributes and calls ProcessAttribute
171 virtual void StartElement(
172 const ::com::sun::star::uno::Reference
<
173 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
175 /// create XTextField and insert into document; calls PrepareTextField
176 virtual void EndElement();
178 /// create the appropriate field context from
179 /// (for use in paragraph import)
180 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
181 SvXMLImport
& rImport
,
182 XMLTextImportHelper
& rHlp
,
184 const ::rtl::OUString
& rName
,
191 inline XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
193 inline ::rtl::OUString
GetServiceName() { return sServiceName
; }
194 inline void SetServiceName(::rtl::OUString sStr
) { sServiceName
= sStr
; }
196 ::rtl::OUString
GetContent();
198 /// process attribute values
199 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
200 const ::rtl::OUString
& sAttrValue
) = 0;
202 /// prepare XTextField for insertion into document
203 virtual void PrepareField(
204 const ::com::sun::star::uno::Reference
<
205 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) = 0;
207 /// create field from ServiceName
208 sal_Bool
CreateField(::com::sun::star::uno::Reference
<
209 ::com::sun::star::beans::XPropertySet
> & xField
,
210 const ::rtl::OUString
& sServiceName
);
212 /// force an update of the field's value
213 /// call update on optional XUptadeable interface; (disable Fixed property)
215 const ::com::sun::star::uno::Reference
<
216 ::com::sun::star::beans::XPropertySet
> & rPropertySet
);
221 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
224 sal_Int16 nSubType
; /// API subtype for ExtUser field
226 const ::rtl::OUString sEmpty
; /// empty string
227 const ::rtl::OUString sPropertyFixed
;
228 const ::rtl::OUString sPropertyFieldSubType
;
229 const ::rtl::OUString sPropertyContent
;
233 // variables for access in subclass
235 sal_uInt16 nElementToken
; /// token for this elment field
241 XMLSenderFieldImportContext(
242 SvXMLImport
& rImport
, /// XML Import
243 XMLTextImportHelper
& rHlp
, /// Text import helper
244 sal_uInt16 nPrfx
, /// namespace prefix
245 const ::rtl::OUString
& sLocalName
, /// element name w/o prefix
246 sal_uInt16 nToken
); /// element token
251 virtual void StartElement(
252 const ::com::sun::star::uno::Reference
<
253 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
255 /// process attribute values
256 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
257 const ::rtl::OUString
& sAttrValue
);
259 /// prepare XTextField for insertion into document
260 virtual void PrepareField(
261 const ::com::sun::star::uno::Reference
<
262 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
266 /** inherit sender field because of fixed attribute in ProcessAttributes */
267 class XMLAuthorFieldImportContext
: public XMLSenderFieldImportContext
270 sal_Bool bAuthorFullName
;
271 const ::rtl::OUString sServiceAuthor
;
272 const ::rtl::OUString sPropertyAuthorFullName
;
273 const ::rtl::OUString sPropertyFixed
;
274 const ::rtl::OUString sPropertyContent
;
280 XMLAuthorFieldImportContext(
281 SvXMLImport
& rImport
, /// XML Import
282 XMLTextImportHelper
& rHlp
, /// Text import helper
283 sal_uInt16 nPrfx
, /// namespace prefix
284 const ::rtl::OUString
& sLocalName
, /// element name w/o prefix
285 sal_uInt16 nToken
); /// element token
290 virtual void StartElement(
291 const ::com::sun::star::uno::Reference
<
292 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
294 /// prepare XTextField for insertion into document
295 virtual void PrepareField(
296 const ::com::sun::star::uno::Reference
<
297 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
302 class XMLPlaceholderFieldImportContext
: public XMLTextFieldImportContext
305 const ::rtl::OUString sEmpty
; /// empty string
306 const ::rtl::OUString sServiceJumpEdit
;
307 const ::rtl::OUString sPropertyPlaceholderType
;
308 const ::rtl::OUString sPropertyPlaceholder
;
309 const ::rtl::OUString sPropertyHint
;
311 ::rtl::OUString sDescription
;
313 sal_Int16 nPlaceholderType
;
319 XMLPlaceholderFieldImportContext(
320 SvXMLImport
& rImport
, /// XML Import
321 XMLTextImportHelper
& rHlp
, /// Text import helper
322 sal_uInt16 nPrfx
, /// namespace prefix
323 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
327 /// process attribute values
328 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
329 const ::rtl::OUString
& sAttrValue
);
331 /// prepare XTextField for insertion into document
332 virtual void PrepareField(
333 const ::com::sun::star::uno::Reference
<
334 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
337 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
341 const ::rtl::OUString sPropertyNumberFormat
;
342 const ::rtl::OUString sPropertyFixed
;
343 const ::rtl::OUString sPropertyDateTimeValue
;
344 const ::rtl::OUString sPropertyDateTime
;
345 const ::rtl::OUString sPropertyAdjust
;
346 const ::rtl::OUString sPropertyIsDate
;
347 const ::rtl::OUString sPropertyIsFixedLanguage
;
350 ::com::sun::star::util::DateTime aDateTimeValue
;
352 sal_Int32 nFormatKey
;
356 sal_Bool bIsDate
; // is this a date?
357 // (for XMLDateFieldImportContext, really)
358 sal_Bool bIsDefaultLanguage
;
364 XMLTimeFieldImportContext(
365 SvXMLImport
& rImport
, /// XML Import
366 XMLTextImportHelper
& rHlp
, /// Text import helper
367 sal_uInt16 nPrfx
, /// namespace prefix
368 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
370 /// process attribute values
371 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
372 const ::rtl::OUString
& sAttrValue
);
374 /// prepare XTextField for insertion into document
375 virtual void PrepareField(
376 const ::com::sun::star::uno::Reference
<
377 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
381 /** import date fields (<text:date>);
382 inherit from TimeField to reuse implementation */
383 class XMLDateFieldImportContext
: public XMLTimeFieldImportContext
390 XMLDateFieldImportContext(
391 SvXMLImport
& rImport
, /// XML Import
392 XMLTextImportHelper
& rHlp
, /// Text import helper
393 sal_uInt16 nPrfx
, /// namespace prefix
394 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
396 /// process attribute values
397 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
398 const ::rtl::OUString
& sAttrValue
);
402 /** import page continuation fields (<text:page-continuation-string>) */
403 class XMLPageContinuationImportContext
: public XMLTextFieldImportContext
405 const ::rtl::OUString sPropertySubType
;
406 const ::rtl::OUString sPropertyUserText
;
407 const ::rtl::OUString sPropertyNumberingType
;
409 ::rtl::OUString sString
; /// continuation string
410 com::sun::star::text::PageNumberType eSelectPage
; /// previous, current
412 sal_Bool sStringOK
; /// continuation string encountered?
418 XMLPageContinuationImportContext(
419 SvXMLImport
& rImport
, /// XML Import
420 XMLTextImportHelper
& rHlp
, /// Text import helper
421 sal_uInt16 nPrfx
, /// namespace prefix
422 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
425 /// process attribute values
426 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
427 const ::rtl::OUString
& sAttrValue
);
429 /// prepare XTextField for insertion into document
430 virtual void PrepareField(
431 const ::com::sun::star::uno::Reference
<
432 ::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
448 sal_Bool sNumberFormatOK
;
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
461 /// process attribute values
462 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
463 const ::rtl::OUString
& sAttrValue
);
465 /// prepare XTextField for insertion into document
466 virtual void PrepareField(
467 const ::com::sun::star::uno::Reference
<
468 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
472 /** superclass for database fields: handle database and table names */
473 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
475 const ::rtl::OUString sPropertyDataBaseName
;
476 const ::rtl::OUString sPropertyDataBaseURL
;
477 const ::rtl::OUString sPropertyTableName
;
478 const ::rtl::OUString sPropertyDataCommandType
;
479 const ::rtl::OUString sPropertyIsVisible
;
481 ::rtl::OUString sDatabaseName
;
482 ::rtl::OUString sDatabaseURL
;
483 ::rtl::OUString sTableName
;
485 sal_Int32 nCommandType
;
486 sal_Bool bCommandTypeOK
;
493 sal_Bool bDatabaseOK
;
494 sal_Bool bDatabaseNameOK
;
495 sal_Bool bDatabaseURLOK
;
498 /// protected constructor: only for subclasses
499 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
500 XMLTextImportHelper
& rHlp
,
501 const sal_Char
* pServiceName
,
503 const ::rtl::OUString
& sLocalName
,
510 /// process attribute values
511 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
512 const ::rtl::OUString
& sAttrValue
);
514 /// prepare XTextField for insertion into document
515 virtual void PrepareField(
516 const ::com::sun::star::uno::Reference
<
517 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
519 /// handle database-location children
520 virtual SvXMLImportContext
*CreateChildContext(
522 const ::rtl::OUString
& rLocalName
,
523 const ::com::sun::star::uno::Reference
<
524 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
527 /** import database name fields (<text:database-name>) */
528 class XMLDatabaseNameImportContext
: public XMLDatabaseFieldImportContext
534 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
535 XMLTextImportHelper
& rHlp
,
537 const ::rtl::OUString
& sLocalName
);
539 /// process attribute values
540 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
541 const ::rtl::OUString
& sAttrValue
);
545 /** import database next fields (<text:database-next>) */
546 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
548 const ::rtl::OUString sPropertyCondition
;
549 const ::rtl::OUString sTrue
;
550 ::rtl::OUString sCondition
;
551 sal_Bool bConditionOK
;
555 // for use in child classes
556 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
557 XMLTextImportHelper
& rHlp
,
558 const sal_Char
* pServiceName
,
560 const ::rtl::OUString
& sLocalName
);
566 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
567 XMLTextImportHelper
& rHlp
,
569 const ::rtl::OUString
& sLocalName
);
571 /// process attribute values
572 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
573 const ::rtl::OUString
& sAttrValue
);
575 /// prepare XTextField for insertion into document
576 virtual void PrepareField(
577 const ::com::sun::star::uno::Reference
<
578 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
583 /** import database select fields (<text:database-select>) */
584 class XMLDatabaseSelectImportContext
: public XMLDatabaseNextImportContext
586 const ::rtl::OUString sPropertySetNumber
;
594 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
595 XMLTextImportHelper
& rHlp
,
597 const ::rtl::OUString
& sLocalName
);
599 /// process attribute values
600 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
601 const ::rtl::OUString
& sAttrValue
);
603 /// prepare XTextField for insertion into document
604 virtual void PrepareField(
605 const ::com::sun::star::uno::Reference
<
606 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
610 /** import database display number fields (<text:database-row-number>) */
611 class XMLDatabaseNumberImportContext
: public XMLDatabaseFieldImportContext
613 const ::rtl::OUString sPropertyNumberingType
;
614 const ::rtl::OUString sPropertySetNumber
;
615 ::rtl::OUString sNumberFormat
;
616 ::rtl::OUString sNumberSync
;
624 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
625 XMLTextImportHelper
& rHlp
,
627 const ::rtl::OUString
& sLocalName
);
629 /// process attribute values
630 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
631 const ::rtl::OUString
& sAttrValue
);
633 /// prepare XTextField for insertion into document
634 virtual void PrepareField(
635 const ::com::sun::star::uno::Reference
<
636 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
640 /** import docinfo fields with only fixed atribute */
641 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
643 const ::rtl::OUString sPropertyFixed
;
644 const ::rtl::OUString sPropertyContent
;
645 const ::rtl::OUString sPropertyAuthor
;
646 const ::rtl::OUString sPropertyCurrentPresentation
;
651 sal_Bool bHasContent
;
657 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
658 XMLTextImportHelper
& rHlp
,
660 const ::rtl::OUString
& sLocalName
,
667 /// process attribute values
668 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
669 const ::rtl::OUString
& sAttrValue
);
671 /// prepare XTextField for insertion into document
672 virtual void PrepareField(
673 const ::com::sun::star::uno::Reference
<
674 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
676 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
681 /** import docinfo fields with date or time attributes and numberformats */
682 class XMLDateTimeDocInfoImportContext
: public XMLSimpleDocInfoImportContext
684 const ::rtl::OUString sPropertyNumberFormat
;
685 const ::rtl::OUString sPropertyIsDate
;
686 const ::rtl::OUString sPropertyIsFixedLanguage
;
691 sal_Bool bHasDateTime
;
692 sal_Bool bIsDefaultLanguage
;
698 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
699 XMLTextImportHelper
& rHlp
,
701 const ::rtl::OUString
& sLocalName
,
706 /// process attribute values
707 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
708 const ::rtl::OUString
& sAttrValue
);
710 /// prepare XTextField for insertion into document
711 virtual void PrepareField(
712 const ::com::sun::star::uno::Reference
<
713 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
718 /** import revision field (<text:editing-cycles>) */
719 class XMLRevisionDocInfoImportContext
: public XMLSimpleDocInfoImportContext
721 const ::rtl::OUString sPropertyRevision
;
727 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
728 XMLTextImportHelper
& rHlp
,
730 const ::rtl::OUString
& sLocalName
,
735 /// prepare XTextField for insertion into document
736 virtual void PrepareField(
737 const ::com::sun::star::uno::Reference
<
738 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
743 /** import user docinfo field (<text:user-defined>) */
744 class XMLUserDocInfoImportContext
: public XMLSimpleDocInfoImportContext
747 const ::rtl::OUString sPropertyName
;
753 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
754 XMLTextImportHelper
& rHlp
,
756 const ::rtl::OUString
& sLocalName
,
761 /// process attribute values
762 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
763 const ::rtl::OUString
& sAttrValue
);
764 virtual void PrepareField(
765 const ::com::sun::star::uno::Reference
<
766 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
771 /** import hidden paragraph fields (<text:hidden-paragraph>) */
772 class XMLHiddenParagraphImportContext
: public XMLTextFieldImportContext
774 const ::rtl::OUString sPropertyCondition
;
775 const ::rtl::OUString sPropertyIsHidden
;
777 ::rtl::OUString sCondition
;
784 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
785 XMLTextImportHelper
& rHlp
,
787 const ::rtl::OUString
& sLocalName
);
791 /// process attribute values
792 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
793 const ::rtl::OUString
& sAttrValue
);
795 /// prepare XTextField for insertion into document
796 virtual void PrepareField(
797 const ::com::sun::star::uno::Reference
<
798 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
803 /** import conditional text fields (<text:conditional-text>) */
804 class XMLConditionalTextImportContext
: public XMLTextFieldImportContext
806 const ::rtl::OUString sPropertyCondition
;
807 const ::rtl::OUString sPropertyTrueContent
;
808 const ::rtl::OUString sPropertyFalseContent
;
809 const ::rtl::OUString sPropertyIsConditionTrue
;
810 const ::rtl::OUString sPropertyCurrentPresentation
;
812 ::rtl::OUString sCondition
;
813 ::rtl::OUString sTrueContent
;
814 ::rtl::OUString sFalseContent
;
816 sal_Bool bConditionOK
;
819 sal_Bool bCurrentValue
;
825 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
826 XMLTextImportHelper
& rHlp
,
828 const ::rtl::OUString
& sLocalName
);
832 /// process attribute values
833 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
834 const ::rtl::OUString
& sAttrValue
);
836 /// prepare XTextField for insertion into document
837 virtual void PrepareField(
838 const ::com::sun::star::uno::Reference
<
839 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
844 /** import conditional text fields (<text:hidden-text>) */
845 class XMLHiddenTextImportContext
: public XMLTextFieldImportContext
847 const ::rtl::OUString sPropertyCondition
;
848 const ::rtl::OUString sPropertyContent
;
849 const ::rtl::OUString sPropertyIsHidden
;
851 ::rtl::OUString sCondition
;
852 ::rtl::OUString sString
;
854 sal_Bool bConditionOK
;
862 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
863 XMLTextImportHelper
& rHlp
,
865 const ::rtl::OUString
& sLocalName
);
869 /// process attribute values
870 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
871 const ::rtl::OUString
& sAttrValue
);
873 /// prepare XTextField for insertion into document
874 virtual void PrepareField(
875 const ::com::sun::star::uno::Reference
<
876 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
881 /** import file name fields (<text:file-name>) */
882 class XMLFileNameImportContext
: public XMLTextFieldImportContext
884 const ::rtl::OUString sPropertyFixed
;
885 const ::rtl::OUString sPropertyFileFormat
;
886 const ::rtl::OUString sPropertyCurrentPresentation
;
895 XMLFileNameImportContext(SvXMLImport
& rImport
,
896 XMLTextImportHelper
& rHlp
,
898 const ::rtl::OUString
& sLocalName
);
902 /// process attribute values
903 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
904 const ::rtl::OUString
& sAttrValue
);
906 /// prepare XTextField for insertion into document
907 virtual void PrepareField(
908 const ::com::sun::star::uno::Reference
<
909 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
914 /** import document template name fields (<text:template-name>) */
915 class XMLTemplateNameImportContext
: public XMLTextFieldImportContext
917 const ::rtl::OUString sPropertyFileFormat
;
925 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
926 XMLTextImportHelper
& rHlp
,
928 const ::rtl::OUString
& sLocalName
);
932 /// process attribute values
933 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
934 const ::rtl::OUString
& sAttrValue
);
936 /// prepare XTextField for insertion into document
937 virtual void PrepareField(
938 const ::com::sun::star::uno::Reference
<
939 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
943 /** import chapter fields (<text:chapter>) */
944 class XMLChapterImportContext
: public XMLTextFieldImportContext
946 const ::rtl::OUString sPropertyChapterFormat
;
947 const ::rtl::OUString sPropertyLevel
;
956 XMLChapterImportContext(SvXMLImport
& rImport
,
957 XMLTextImportHelper
& rHlp
,
959 const ::rtl::OUString
& sLocalName
);
963 /// process attribute values
964 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
965 const ::rtl::OUString
& sAttrValue
);
967 /// prepare XTextField for insertion into document
968 virtual void PrepareField(
969 const ::com::sun::star::uno::Reference
<
970 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
975 /** import count fields (<text:[XXX]-count>) */
976 class XMLCountFieldImportContext
: public XMLTextFieldImportContext
978 const ::rtl::OUString sPropertyNumberingType
;
980 ::rtl::OUString sNumberFormat
;
981 ::rtl::OUString sLetterSync
;
983 sal_Bool bNumberFormatOK
;
989 XMLCountFieldImportContext(SvXMLImport
& rImport
,
990 XMLTextImportHelper
& rHlp
,
992 const ::rtl::OUString
& sLocalName
,
997 /// process attribute values
998 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
999 const ::rtl::OUString
& sAttrValue
);
1001 /// prepare XTextField for insertion into document
1002 virtual void PrepareField(
1003 const ::com::sun::star::uno::Reference
<
1004 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1006 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
1010 /** import page variable fields (<text:get-page-variable>) */
1011 class XMLPageVarGetFieldImportContext
: public XMLTextFieldImportContext
1013 const ::rtl::OUString sPropertyNumberingType
;
1015 ::rtl::OUString sNumberFormat
;
1016 ::rtl::OUString sLetterSync
;
1018 sal_Bool bNumberFormatOK
;
1024 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
1025 XMLTextImportHelper
& rHlp
,
1027 const ::rtl::OUString
& sLocalName
);
1031 /// process attribute values
1032 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1033 const ::rtl::OUString
& sAttrValue
);
1035 /// prepare XTextField for insertion into document
1036 virtual void PrepareField(
1037 const ::com::sun::star::uno::Reference
<
1038 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1042 /** import page variable fields (<text:get-page-variable>) */
1043 class XMLPageVarSetFieldImportContext
: public XMLTextFieldImportContext
1045 const ::rtl::OUString sPropertyOn
;
1046 const ::rtl::OUString sPropertyOffset
;
1055 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
1056 XMLTextImportHelper
& rHlp
,
1058 const ::rtl::OUString
& sLocalName
);
1062 /// process attribute values
1063 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1064 const ::rtl::OUString
& sAttrValue
);
1066 /// prepare XTextField for insertion into document
1067 virtual void PrepareField(
1068 const ::com::sun::star::uno::Reference
<
1069 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1073 /** import macro fields (<text:execute-macro>) */
1074 class XMLMacroFieldImportContext
: public XMLTextFieldImportContext
1077 const ::rtl::OUString sPropertyHint
;
1078 const ::rtl::OUString sPropertyMacroName
;
1079 const ::rtl::OUString sPropertyScriptURL
;
1080 const ::rtl::OUString sPropertyLibraryName
;
1082 ::rtl::OUString sDescription
;
1083 SvXMLImportContextRef xEventContext
;
1085 ::rtl::OUString sMacro
; // macro for old documents (pre 638i)
1088 sal_Bool bDescriptionOK
;
1094 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
1095 XMLTextImportHelper
& rHlp
,
1097 const ::rtl::OUString
& sLocalName
);
1101 /// for <office:events> children
1102 virtual SvXMLImportContext
*CreateChildContext(
1104 const ::rtl::OUString
& rLocalName
,
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
);
1120 /** import reference fields (<text:reference-get>) */
1121 class XMLReferenceFieldImportContext
: public XMLTextFieldImportContext
1123 const ::rtl::OUString sPropertyReferenceFieldPart
;
1124 const ::rtl::OUString sPropertyReferenceFieldSource
;
1125 const ::rtl::OUString sPropertySourceName
;
1126 const ::rtl::OUString sPropertyCurrentPresentation
;
1128 ::rtl::OUString sName
;
1129 sal_uInt16 nElementToken
;
1132 sal_Int16 nSequenceNumber
;
1136 sal_Bool bSeqNumberOK
;
1142 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
1143 XMLTextImportHelper
& rHlp
,
1146 const ::rtl::OUString
& sLocalName
);
1151 virtual void StartElement(
1152 const ::com::sun::star::uno::Reference
<
1153 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1155 /// process attribute values
1156 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1157 const ::rtl::OUString
& sAttrValue
);
1159 /// prepare XTextField for insertion into document
1160 virtual void PrepareField(
1161 const ::com::sun::star::uno::Reference
<
1162 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1167 /** import dde field declaration container (<text:dde-connection-decls>) */
1168 class XMLDdeFieldDeclsImportContext
: public SvXMLImportContext
1171 SvXMLTokenMap aTokenMap
;
1177 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
1179 const ::rtl::OUString
& sLocalName
);
1181 virtual SvXMLImportContext
*CreateChildContext(
1183 const ::rtl::OUString
& rLocalName
,
1184 const ::com::sun::star::uno::Reference
<
1185 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1192 /** import dde field declaration (<text:dde-connection-decl>) */
1193 class XMLDdeFieldDeclImportContext
: public SvXMLImportContext
1195 const ::rtl::OUString sPropertyIsAutomaticUpdate
;
1196 const ::rtl::OUString sPropertyName
;
1197 const ::rtl::OUString sPropertyDDECommandType
;
1198 const ::rtl::OUString sPropertyDDECommandFile
;
1199 const ::rtl::OUString sPropertyDDECommandElement
;
1201 const SvXMLTokenMap
& rTokenMap
;
1207 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
1209 const ::rtl::OUString
& sLocalName
,
1210 const SvXMLTokenMap
& rMap
);
1212 // create fieldmaster
1213 virtual void StartElement(
1214 const ::com::sun::star::uno::Reference
<
1215 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1220 /** import dde fields (<text:dde-connection>) */
1221 class XMLDdeFieldImportContext
: public XMLTextFieldImportContext
1223 ::rtl::OUString sName
;
1224 ::rtl::OUString sPropertyContent
;
1229 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
1230 XMLTextImportHelper
& rHlp
,
1232 const ::rtl::OUString
& sLocalName
);
1236 /// process attribute values
1237 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1238 const ::rtl::OUString
& sAttrValue
);
1240 /// create textfield, attach master, and insert into document
1241 virtual void EndElement();
1244 virtual void PrepareField(
1245 const ::com::sun::star::uno::Reference
<
1246 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1251 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1252 class XMLSheetNameImportContext
: public XMLTextFieldImportContext
1259 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1260 XMLTextImportHelper
& rHlp
,
1262 const ::rtl::OUString
& sLocalName
);
1266 /// no attributes -> empty method
1267 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1268 const ::rtl::OUString
& sAttrValue
);
1270 /// no atributes -> empty method
1271 virtual void PrepareField(
1272 const ::com::sun::star::uno::Reference
<
1273 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1276 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1277 class XMLUrlFieldImportContext
: public XMLTextFieldImportContext
1280 const ::rtl::OUString sPropertyURL
;
1281 const ::rtl::OUString sPropertyTargetFrame
;
1282 const ::rtl::OUString sPropertyRepresentation
;
1284 ::rtl::OUString sURL
;
1285 ::rtl::OUString sFrame
;
1292 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1293 XMLTextImportHelper
& rHlp
,
1295 const ::rtl::OUString
& sLocalName
);
1299 /// no attributes -> empty method
1300 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1301 const ::rtl::OUString
& sAttrValue
);
1303 /// no atributes -> empty method
1304 virtual void PrepareField(
1305 const ::com::sun::star::uno::Reference
<
1306 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1309 /** import bibliography info fields (<text:bibliography-mark>) */
1310 class XMLBibliographyFieldImportContext
: public XMLTextFieldImportContext
1313 const ::rtl::OUString sPropertyFields
;
1315 ::std::vector
< ::com::sun::star::beans::PropertyValue
> aValues
;
1321 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1322 XMLTextImportHelper
& rHlp
,
1324 const ::rtl::OUString
& sLocalName
);
1328 /// process attributes (fill aValues)
1329 virtual void StartElement(
1330 const ::com::sun::star::uno::Reference
<
1331 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1333 /// empty method; all attributes are handled in StartElement
1334 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1335 const ::rtl::OUString
& sAttrValue
);
1337 /// convert aValues into sequence and set property
1338 virtual void PrepareField(
1339 const ::com::sun::star::uno::Reference
<
1340 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1342 static const sal_Char
* MapBibliographyFieldName(::rtl::OUString sName
);
1347 /** Import an annotation field (<text:annotation>) */
1348 class XMLAnnotationImportContext
: public XMLTextFieldImportContext
1350 const ::rtl::OUString sPropertyAuthor
;
1351 const ::rtl::OUString sPropertyContent
;
1352 const ::rtl::OUString sPropertyDate
;
1353 const ::rtl::OUString sPropertyTextRange
;
1355 ::rtl::OUStringBuffer aAuthorBuffer
;
1356 ::rtl::OUStringBuffer aTextBuffer
;
1357 ::rtl::OUStringBuffer aDateBuffer
;
1359 com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySet
> mxField
;
1360 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxCursor
;
1361 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxOldCursor
;
1367 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1368 XMLTextImportHelper
& rHlp
,
1370 const ::rtl::OUString
& sLocalName
);
1374 /// process attributes
1375 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1376 const ::rtl::OUString
& sAttrValue
);
1379 virtual void PrepareField(
1380 const ::com::sun::star::uno::Reference
<
1381 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1383 virtual SvXMLImportContext
*CreateChildContext(
1385 const ::rtl::OUString
& rLocalName
,
1386 const ::com::sun::star::uno::Reference
<
1387 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
1388 virtual void EndElement();
1392 /** Import a script field (<text:script>) */
1393 class XMLScriptImportContext
: public XMLTextFieldImportContext
1395 const ::rtl::OUString sPropertyScriptType
;
1396 const ::rtl::OUString sPropertyURLContent
;
1397 const ::rtl::OUString sPropertyContent
;
1399 ::rtl::OUString sContent
;
1400 ::rtl::OUString sScriptType
;
1402 sal_Bool bContentOK
;
1403 sal_Bool bScriptTypeOK
;
1404 sal_Bool bUrlContent
;
1410 XMLScriptImportContext(SvXMLImport
& rImport
,
1411 XMLTextImportHelper
& rHlp
,
1413 const ::rtl::OUString
& sLocalName
);
1417 /// process attributes
1418 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1419 const ::rtl::OUString
& sAttrValue
);
1422 virtual void PrepareField(
1423 const ::com::sun::star::uno::Reference
<
1424 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1427 /** import measure fields (<text:measure>) */
1428 class XMLMeasureFieldImportContext
: public XMLTextFieldImportContext
1435 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1436 XMLTextImportHelper
& rHlp
,
1438 const ::rtl::OUString
& sLocalName
);
1442 /// process attribute values
1443 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1444 const ::rtl::OUString
& sAttrValue
);
1446 /// prepare XTextField for insertion into document
1447 virtual void PrepareField(
1448 const ::com::sun::star::uno::Reference
<
1449 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1453 /** dropdown field (filter legacy) */
1454 class XMLDropDownFieldImportContext
: public XMLTextFieldImportContext
1456 std::vector
<rtl::OUString
> aLabels
;
1457 rtl::OUString sName
;
1458 rtl::OUString sHelp
;
1459 rtl::OUString sHint
;
1460 sal_Int32 nSelected
;
1465 const rtl::OUString sPropertyItems
;
1466 const rtl::OUString sPropertySelectedItem
;
1467 const rtl::OUString sPropertyName
;
1468 const rtl::OUString sPropertyHelp
;
1469 const rtl::OUString sPropertyToolTip
;
1474 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1475 XMLTextImportHelper
& rHlp
,
1477 const ::rtl::OUString
& sLocalName
);
1479 virtual SvXMLImportContext
* CreateChildContext(
1481 const ::rtl::OUString
& rLocalName
,
1482 const ::com::sun::star::uno::Reference
<com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
1486 /// process attribute values
1487 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1488 const ::rtl::OUString
& sAttrValue
);
1490 /// prepare XTextField for insertion into document
1491 virtual void PrepareField(
1492 const ::com::sun::star::uno::Reference
<
1493 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1496 /** import header fields (<draw:header>) */
1497 class XMLHeaderFieldImportContext
: public XMLTextFieldImportContext
1502 XMLHeaderFieldImportContext(
1503 SvXMLImport
& rImport
, /// XML Import
1504 XMLTextImportHelper
& rHlp
, /// Text import helper
1505 sal_uInt16 nPrfx
, /// namespace prefix
1506 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
1508 /// process attribute values
1509 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1510 const ::rtl::OUString
& sAttrValue
);
1512 /// prepare XTextField for insertion into document
1513 virtual void PrepareField(
1514 const ::com::sun::star::uno::Reference
<
1515 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1518 /** import footer fields (<draw:footer>) */
1519 class XMLFooterFieldImportContext
: public XMLTextFieldImportContext
1524 XMLFooterFieldImportContext(
1525 SvXMLImport
& rImport
, /// XML Import
1526 XMLTextImportHelper
& rHlp
, /// Text import helper
1527 sal_uInt16 nPrfx
, /// namespace prefix
1528 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
1530 /// process attribute values
1531 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1532 const ::rtl::OUString
& sAttrValue
);
1534 /// prepare XTextField for insertion into document
1535 virtual void PrepareField(
1536 const ::com::sun::star::uno::Reference
<
1537 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1540 /** import footer fields (<draw:date-and-time>) */
1541 class XMLDateTimeFieldImportContext
: public XMLTextFieldImportContext
1546 XMLDateTimeFieldImportContext(
1547 SvXMLImport
& rImport
, /// XML Import
1548 XMLTextImportHelper
& rHlp
, /// Text import helper
1549 sal_uInt16 nPrfx
, /// namespace prefix
1550 const ::rtl::OUString
& sLocalName
); /// element name w/o prefix
1552 /// process attribute values
1553 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1554 const ::rtl::OUString
& sAttrValue
);
1556 /// prepare XTextField for insertion into document
1557 virtual void PrepareField(
1558 const ::com::sun::star::uno::Reference
<
1559 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1562 class XMLCustomPropertyFieldImportContext
: public XMLTextFieldImportContext
1564 ::rtl::OUString sName
;
1565 ::com::sun::star::uno::Any aValue
;
1566 const ::rtl::OUString sPropertyName
;
1567 const ::rtl::OUString sPropertyValue
;
1573 XMLCustomPropertyFieldImportContext (SvXMLImport
& rImport
,
1574 XMLTextImportHelper
& rHlp
,
1576 const ::rtl::OUString
& sLocalName
);
1580 /// process attribute values
1581 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1582 const ::rtl::OUString
& sAttrValue
);
1584 /// prepare XTextField for insertion into document
1585 virtual void PrepareField(
1586 const ::com::sun::star::uno::Reference
<
1587 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);