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 $
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 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
41 #include <com/sun/star/uno/Reference.h>
44 #ifndef _COM_SUN_STAR_TEXT_PAGENUMBERTYPE_HPP_
45 #include <com/sun/star/text/PageNumberType.hpp>
48 #ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
49 #include <com/sun/star/util/DateTime.hpp>
52 #ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
53 #include <com/sun/star/util/Date.hpp>
56 #ifndef _XMLOFF_XMLICTXT_HXX
57 #include <bf_xmloff/xmlictxt.hxx>
60 #ifndef _XMLOFF_TEXTIMP_HXX_
61 #include <bf_xmloff/txtimp.hxx>
64 #ifndef _RTL_USTRBUF_HXX_
65 #include <rtl/ustrbuf.hxx>
68 #ifndef _TOOLS_DEBUG_HXX
69 #include <tools/debug.hxx>
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
; }
85 class XMLTextImportHelper
;
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
;
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
161 // data members for use in subclasses
162 sal_Bool bValid
; /// ist dieses Feld gültig?
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
,
194 const ::rtl::OUString
& rName
,
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)
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
;
240 // variables for access in subclass
242 sal_uInt16 nElementToken
; /// token for this elment field
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
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
;
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
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
;
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
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
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
;
354 ::com::sun::star::util::DateTime aDateTimeValue
;
356 sal_Int32 nFormatKey
;
360 sal_Bool bIsDate
; // is this a date?
361 // (for XMLDateFieldImportContext, really)
362 sal_Bool bIsDefaultLanguage
;
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
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
414 sal_Bool sStringOK
; /// continuation string encountered?
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
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
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
;
489 sal_Bool bDatabaseOK
;
492 /// protected constructor: only for subclasses
493 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
494 XMLTextImportHelper
& rHlp
,
495 const sal_Char
* pServiceName
,
497 const ::rtl::OUString
& sLocalName
,
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
521 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
522 XMLTextImportHelper
& rHlp
,
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
;
541 // for use in child classes
542 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
543 XMLTextImportHelper
& rHlp
,
544 const sal_Char
* pServiceName
,
546 const ::rtl::OUString
& sLocalName
);
552 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
553 XMLTextImportHelper
& rHlp
,
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
;
578 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
579 XMLTextImportHelper
& rHlp
,
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
;
607 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
608 XMLTextImportHelper
& rHlp
,
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;
633 sal_Bool bHasContent
;
639 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
640 XMLTextImportHelper
& rHlp
,
642 const ::rtl::OUString
& sLocalName
,
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
;
671 sal_Bool bHasDateTime
;
672 sal_Bool bIsDefaultLanguage
;
678 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
679 XMLTextImportHelper
& rHlp
,
681 const ::rtl::OUString
& sLocalName
,
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
;
701 sal_Bool bRevisionOK
;
707 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
708 XMLTextImportHelper
& rHlp
,
710 const ::rtl::OUString
& sLocalName
,
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
728 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
729 XMLTextImportHelper
& rHlp
,
731 const ::rtl::OUString
& sLocalName
,
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
;
754 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
755 XMLTextImportHelper
& rHlp
,
757 const ::rtl::OUString
& sLocalName
);
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
;
787 sal_Bool bCurrentValue
;
793 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
794 XMLTextImportHelper
& rHlp
,
796 const ::rtl::OUString
& sLocalName
);
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
;
828 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
829 XMLTextImportHelper
& rHlp
,
831 const ::rtl::OUString
& sLocalName
);
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;
859 XMLFileNameImportContext(SvXMLImport
& rImport
,
860 XMLTextImportHelper
& rHlp
,
862 const ::rtl::OUString
& sLocalName
);
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
;
887 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
888 XMLTextImportHelper
& rHlp
,
890 const ::rtl::OUString
& sLocalName
);
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
;
917 XMLChapterImportContext(SvXMLImport
& rImport
,
918 XMLTextImportHelper
& rHlp
,
920 const ::rtl::OUString
& sLocalName
);
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
;
948 XMLCountFieldImportContext(SvXMLImport
& rImport
,
949 XMLTextImportHelper
& rHlp
,
951 const ::rtl::OUString
& sLocalName
,
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
;
982 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
983 XMLTextImportHelper
& rHlp
,
985 const ::rtl::OUString
& sLocalName
);
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
;
1012 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
1013 XMLTextImportHelper
& rHlp
,
1015 const ::rtl::OUString
& sLocalName
);
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)
1043 sal_Bool bDescriptionOK
;
1049 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
1050 XMLTextImportHelper
& rHlp
,
1052 const ::rtl::OUString
& sLocalName
);
1056 /// for <office:events> children
1057 virtual SvXMLImportContext
*CreateChildContext(
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
;
1085 sal_Int16 nSequenceNumber
;
1089 sal_Bool bSeqNumberOK
;
1095 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
1096 XMLTextImportHelper
& rHlp
,
1099 const ::rtl::OUString
& sLocalName
);
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
;
1128 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
1130 const ::rtl::OUString
& sLocalName
);
1132 virtual SvXMLImportContext
*CreateChildContext(
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
;
1155 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
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
;
1175 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
1176 XMLTextImportHelper
& rHlp
,
1178 const ::rtl::OUString
& sLocalName
);
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();
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
1204 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1205 XMLTextImportHelper
& rHlp
,
1207 const ::rtl::OUString
& sLocalName
);
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
;
1237 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1238 XMLTextImportHelper
& rHlp
,
1240 const ::rtl::OUString
& sLocalName
);
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
;
1266 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1267 XMLTextImportHelper
& rHlp
,
1269 const ::rtl::OUString
& sLocalName
);
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
;
1308 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1309 XMLTextImportHelper
& rHlp
,
1311 const ::rtl::OUString
& sLocalName
);
1315 /// process attributes
1316 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1317 const ::rtl::OUString
& sAttrValue
);
1320 virtual void PrepareField(
1321 const ::com::sun::star::uno::Reference
<
1322 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1324 virtual SvXMLImportContext
*CreateChildContext(
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
;
1349 XMLScriptImportContext(SvXMLImport
& rImport
,
1350 XMLTextImportHelper
& rHlp
,
1352 const ::rtl::OUString
& sLocalName
);
1356 /// process attributes
1357 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1358 const ::rtl::OUString
& sAttrValue
);
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
1374 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1375 XMLTextImportHelper
& rHlp
,
1377 const ::rtl::OUString
& sLocalName
);
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
;
1399 const ::rtl::OUString sPropertyItems
;
1400 const ::rtl::OUString sPropertySelectedItem
;
1401 const ::rtl::OUString sPropertyName
;
1406 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1407 XMLTextImportHelper
& rHlp
,
1409 const ::rtl::OUString
& sLocalName
);
1411 virtual SvXMLImportContext
* CreateChildContext(
1413 const ::rtl::OUString
& rLocalName
,
1414 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
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