1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 * import of all text fields
23 * (except variable related + database display field: see txtvfldi.hxx)
26 #ifndef INCLUDED_XMLOFF_INC_TXTFLDI_HXX
27 #define INCLUDED_XMLOFF_INC_TXTFLDI_HXX
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <com/sun/star/text/PageNumberType.hpp>
32 #include <com/sun/star/util/DateTime.hpp>
33 #include <xmloff/xmlictxt.hxx>
34 #include <xmloff/txtimp.hxx>
35 #include <xmloff/xmltkmap.hxx>
36 #include <rtl/ustrbuf.hxx>
39 namespace com
{ namespace sun
{ namespace star
{
40 namespace xml
{ namespace sax
{ class XAttributeList
; } }
41 namespace text
{ class XTextField
; }
42 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
46 class XMLTextImportHelper
;
49 enum XMLTextFieldAttrTokens
51 XML_TOK_TEXTFIELD_FIXED
= 0,
52 XML_TOK_TEXTFIELD_DESCRIPTION
,
53 XML_TOK_TEXTFIELD_HELP
,
54 XML_TOK_TEXTFIELD_HINT
,
55 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE
,
56 XML_TOK_TEXTFIELD_TIME_ADJUST
,
57 XML_TOK_TEXTFIELD_DATE_ADJUST
,
58 XML_TOK_TEXTFIELD_PAGE_ADJUST
,
59 XML_TOK_TEXTFIELD_SELECT_PAGE
,
60 XML_TOK_TEXTFIELD_ACTIVE
,
62 XML_TOK_TEXTFIELD_NAME
,
63 XML_TOK_TEXTFIELD_FORMULA
,
64 XML_TOK_TEXTFIELD_NUM_FORMAT
,
65 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC
,
66 XML_TOK_TEXTFIELD_DISPLAY_FORMULA
,
67 XML_TOK_TEXTFIELD_NUMBERING_LEVEL
,
68 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR
,
69 XML_TOK_TEXTFIELD_DISPLAY
,
70 XML_TOK_TEXTFIELD_OUTLINE_LEVEL
,
72 XML_TOK_TEXTFIELD_VALUE_TYPE
,
73 XML_TOK_TEXTFIELD_VALUE
,
74 XML_TOK_TEXTFIELD_STRING_VALUE
,
75 XML_TOK_TEXTFIELD_DATE_VALUE
,
76 XML_TOK_TEXTFIELD_TIME_VALUE
,
77 XML_TOK_TEXTFIELD_BOOL_VALUE
,
78 XML_TOK_TEXTFIELD_CURRENCY
,
79 XML_TOK_TEXTFIELD_DATA_STYLE_NAME
,
81 XML_TOK_TEXTFIELD_DATABASE_NAME
,
82 XML_TOK_TEXTFIELD_TABLE_NAME
,
83 XML_TOK_TEXTFIELD_COLUMN_NAME
,
84 XML_TOK_TEXTFIELD_ROW_NUMBER
,
85 XML_TOK_TEXTFIELD_CONDITION
,
86 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE
,
87 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE
,
88 XML_TOK_TEXTFIELD_REVISION
,
89 XML_TOK_TEXTFIELD_IS_HIDDEN
,
90 XML_TOK_TEXTFIELD_CURRENT_VALUE
,
92 XML_TOK_TEXTFIELD_REFERENCE_FORMAT
,
93 XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE
,
94 XML_TOK_TEXTFIELD_REF_NAME
,
95 XML_TOK_TEXTFIELD_CONNECTION_NAME
,
97 XML_TOK_TEXTFIELD_HREF
,
98 XML_TOK_TEXTFIELD_TARGET_FRAME
,
100 XML_TOK_TEXTFIELD_ANNOTATION
,
101 XML_TOK_TEXTFIELD_LANGUAGE
,
103 XML_TOK_TEXTFIELD_MEASURE_KIND
,
104 XML_TOK_TEXTFIELD_TABLE_TYPE
,
106 XML_TOK_TEXTFIELD_NOTE_CLASS
,
109 /// abstract class for text field import
110 class XMLTextFieldImportContext
: public SvXMLImportContext
113 OUStringBuffer sContentBuffer
; /// collect character data
114 OUString sContent
; /// character data after collection
115 OUString sServiceName
; /// service name for text field
116 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
119 OUString sServicePrefix
;
121 // data members for use in subclasses
122 bool bValid
; /// whether this field is valid ?
126 XMLTextFieldImportContext(
127 SvXMLImport
& rImport
, /// XML Import
128 XMLTextImportHelper
& rHlp
, /// Text import helper
129 const sal_Char
* pService
, /// name of SO API service
130 sal_uInt16 nPrfx
, /// namespace prefix
131 const OUString
& rLocalName
); /// element name w/o prefix
133 /// process character data: will be collected in member sContentBuffer
134 virtual void Characters( const OUString
& sContent
) override
;
136 /// parses attributes and calls ProcessAttribute
137 virtual void StartElement(
138 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
140 /// create XTextField and insert into document; calls PrepareTextField
141 virtual void EndElement() override
;
143 /// create the appropriate field context from
144 /// (for use in paragraph import)
145 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
146 SvXMLImport
& rImport
,
147 XMLTextImportHelper
& rHlp
,
149 const OUString
& rName
,
154 XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
156 const OUString
& GetServiceName() const { return sServiceName
; }
157 void SetServiceName(const OUString
& sStr
) { sServiceName
= sStr
; }
159 OUString
const & GetContent();
161 /// process attribute values
162 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
163 const OUString
& sAttrValue
) = 0;
165 /// prepare XTextField for insertion into document
166 virtual void PrepareField(
167 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) = 0;
169 /// create field from ServiceName
170 bool CreateField(css::uno::Reference
< css::beans::XPropertySet
> & xField
,
171 const OUString
& sServiceName
);
173 /// force an update of the field's value
174 /// call update on optional XUpdatable interface; (disable Fixed property)
175 static void ForceUpdate(
176 const css::uno::Reference
< css::beans::XPropertySet
> & rPropertySet
);
179 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
182 sal_Int16 nSubType
; /// API subtype for ExtUser field
184 const OUString sPropertyFixed
;
185 const OUString sPropertyContent
;
188 // variables for access in subclass
190 sal_uInt16
const nElementToken
; /// token for this element field
194 XMLSenderFieldImportContext(
195 SvXMLImport
& rImport
, /// XML Import
196 XMLTextImportHelper
& rHlp
, /// Text import helper
197 sal_uInt16 nPrfx
, /// namespace prefix
198 const OUString
& sLocalName
, /// element name w/o prefix
199 sal_uInt16 nToken
); /// element token
203 virtual void StartElement(
204 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
206 /// process attribute values
207 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
208 const OUString
& sAttrValue
) override
;
210 /// prepare XTextField for insertion into document
211 virtual void PrepareField(
212 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
215 /** inherit sender field because of fixed attribute in ProcessAttributes */
216 class XMLAuthorFieldImportContext
: public XMLSenderFieldImportContext
218 bool bAuthorFullName
;
219 const OUString sPropertyFixed
;
220 const OUString sPropertyContent
;
224 XMLAuthorFieldImportContext(
225 SvXMLImport
& rImport
, /// XML Import
226 XMLTextImportHelper
& rHlp
, /// Text import helper
227 sal_uInt16 nPrfx
, /// namespace prefix
228 const OUString
& sLocalName
, /// element name w/o prefix
229 sal_uInt16 nToken
); /// element token
233 virtual void StartElement(
234 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
236 /// process attribute values
237 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
238 const OUString
& sAttrValue
) override
;
240 /// prepare XTextField for insertion into document
241 virtual void PrepareField(
242 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
245 class XMLPlaceholderFieldImportContext
: public XMLTextFieldImportContext
247 const OUString sPropertyHint
;
249 OUString sDescription
;
251 sal_Int16 nPlaceholderType
;
255 XMLPlaceholderFieldImportContext(
256 SvXMLImport
& rImport
, /// XML Import
257 XMLTextImportHelper
& rHlp
, /// Text import helper
258 sal_uInt16 nPrfx
, /// namespace prefix
259 const OUString
& sLocalName
); /// element name w/o prefix
262 /// process attribute values
263 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
264 const OUString
& sAttrValue
) override
;
266 /// prepare XTextField for insertion into document
267 virtual void PrepareField(
268 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
271 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
274 const OUString sPropertyNumberFormat
;
275 const OUString sPropertyFixed
;
276 const OUString sPropertyDateTimeValue
;
277 const OUString sPropertyDateTime
;
278 const OUString sPropertyIsDate
;
279 const OUString sPropertyIsFixedLanguage
;
281 css::util::DateTime aDateTimeValue
;
283 sal_Int32 nFormatKey
;
287 bool bIsDate
; // is this a date?
288 // (for XMLDateFieldImportContext, really)
289 bool bIsDefaultLanguage
;
293 XMLTimeFieldImportContext(
294 SvXMLImport
& rImport
, /// XML Import
295 XMLTextImportHelper
& rHlp
, /// Text import helper
296 sal_uInt16 nPrfx
, /// namespace prefix
297 const OUString
& sLocalName
); /// element name w/o prefix
299 /// process attribute values
300 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
301 const OUString
& sAttrValue
) override
;
303 /// prepare XTextField for insertion into document
304 virtual void PrepareField(
305 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
308 /** import date fields (<text:date>);
309 inherit from TimeField to reuse implementation */
310 class XMLDateFieldImportContext
: public XMLTimeFieldImportContext
314 XMLDateFieldImportContext(
315 SvXMLImport
& rImport
, /// XML Import
316 XMLTextImportHelper
& rHlp
, /// Text import helper
317 sal_uInt16 nPrfx
, /// namespace prefix
318 const OUString
& sLocalName
); /// element name w/o prefix
320 /// process attribute values
321 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
322 const OUString
& sAttrValue
) override
;
325 /** import page continuation fields (<text:page-continuation-string>) */
326 class XMLPageContinuationImportContext
: public XMLTextFieldImportContext
328 const OUString sPropertySubType
;
329 const OUString sPropertyNumberingType
;
331 OUString sString
; /// continuation string
332 css::text::PageNumberType eSelectPage
; /// previous, current
334 bool sStringOK
; /// continuation string encountered?
338 XMLPageContinuationImportContext(
339 SvXMLImport
& rImport
, /// XML Import
340 XMLTextImportHelper
& rHlp
, /// Text import helper
341 sal_uInt16 nPrfx
, /// namespace prefix
342 const OUString
& sLocalName
); /// element name w/o prefix
344 /// process attribute values
345 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
346 const OUString
& sAttrValue
) override
;
348 /// prepare XTextField for insertion into document
349 virtual void PrepareField(
350 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
353 /** import page number fields (<text:page-number>) */
354 class XMLPageNumberImportContext
: public XMLTextFieldImportContext
356 const OUString sPropertySubType
;
357 const OUString sPropertyNumberingType
;
358 const OUString sPropertyOffset
;
360 OUString sNumberFormat
;
361 OUString sNumberSync
;
362 sal_Int16 nPageAdjust
;
363 css::text::PageNumberType eSelectPage
; /// previous, current
365 bool sNumberFormatOK
;
369 XMLPageNumberImportContext(
370 SvXMLImport
& rImport
, /// XML Import
371 XMLTextImportHelper
& rHlp
, /// Text import helper
372 sal_uInt16 nPrfx
, /// namespace prefix
373 const OUString
& sLocalName
); /// element name w/o prefix
376 /// process attribute values
377 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
378 const OUString
& sAttrValue
) override
;
380 /// prepare XTextField for insertion into document
381 virtual void PrepareField(
382 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
385 /** superclass for database fields: handle database and table names */
386 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
388 OUString sDatabaseName
;
389 OUString sDatabaseURL
;
392 sal_Int32 nCommandType
;
397 bool const bUseDisplay
;
401 bool bDatabaseNameOK
;
405 /// protected constructor: only for subclasses
406 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
407 XMLTextImportHelper
& rHlp
,
408 const sal_Char
* pServiceName
,
410 const OUString
& sLocalName
,
415 /// process attribute values
416 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
417 const OUString
& sAttrValue
) override
;
419 /// prepare XTextField for insertion into document
420 virtual void PrepareField(
421 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
423 /// handle database-location children
424 virtual SvXMLImportContextRef
CreateChildContext(
426 const OUString
& rLocalName
,
427 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
430 /** import database name fields (<text:database-name>) */
431 class XMLDatabaseNameImportContext
: public XMLDatabaseFieldImportContext
435 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
436 XMLTextImportHelper
& rHlp
,
438 const OUString
& sLocalName
);
440 /// process attribute values
441 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
442 const OUString
& sAttrValue
) override
;
445 /** import database next fields (<text:database-next>) */
446 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
448 const OUString sPropertyCondition
;
449 const OUString sTrue
;
454 // for use in child classes
455 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
456 XMLTextImportHelper
& rHlp
,
457 const sal_Char
* pServiceName
,
459 const OUString
& sLocalName
);
463 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
464 XMLTextImportHelper
& rHlp
,
466 const OUString
& sLocalName
);
468 /// process attribute values
469 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
470 const OUString
& sAttrValue
) override
;
472 /// prepare XTextField for insertion into document
473 virtual void PrepareField(
474 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
477 /** import database select fields (<text:database-select>) */
478 class XMLDatabaseSelectImportContext
: public XMLDatabaseNextImportContext
480 const OUString sPropertySetNumber
;
486 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
487 XMLTextImportHelper
& rHlp
,
489 const OUString
& sLocalName
);
491 /// process attribute values
492 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
493 const OUString
& sAttrValue
) override
;
495 /// prepare XTextField for insertion into document
496 virtual void PrepareField(
497 const css::uno::Reference
<
498 css::beans::XPropertySet
> & xPropertySet
) override
;
501 /** import database display number fields (<text:database-row-number>) */
502 class XMLDatabaseNumberImportContext
: public XMLDatabaseFieldImportContext
504 const OUString sPropertyNumberingType
;
505 const OUString sPropertySetNumber
;
506 OUString sNumberFormat
;
507 OUString sNumberSync
;
513 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
514 XMLTextImportHelper
& rHlp
,
516 const OUString
& sLocalName
);
518 /// process attribute values
519 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
520 const OUString
& sAttrValue
) override
;
522 /// prepare XTextField for insertion into document
523 virtual void PrepareField(
524 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
527 /** import docinfo fields with only fixed attribute */
528 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
530 const OUString sPropertyFixed
;
531 const OUString sPropertyContent
;
532 const OUString sPropertyAuthor
;
533 const OUString sPropertyCurrentPresentation
;
537 bool const bHasAuthor
;
538 bool const bHasContent
;
542 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
543 XMLTextImportHelper
& rHlp
,
545 const OUString
& sLocalName
,
551 /// process attribute values
552 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
553 const OUString
& sAttrValue
) override
;
555 /// prepare XTextField for insertion into document
556 virtual void PrepareField(
557 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
559 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
562 /** import docinfo fields with date or time attributes and numberformats */
563 class XMLDateTimeDocInfoImportContext
: public XMLSimpleDocInfoImportContext
565 const OUString sPropertyNumberFormat
;
566 const OUString sPropertyIsDate
;
567 const OUString sPropertyIsFixedLanguage
;
573 bool bIsDefaultLanguage
;
577 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
578 XMLTextImportHelper
& rHlp
,
580 const OUString
& sLocalName
,
584 /// process attribute values
585 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
586 const OUString
& sAttrValue
) override
;
588 /// prepare XTextField for insertion into document
589 virtual void PrepareField(
590 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
593 /** import revision field (<text:editing-cycles>) */
594 class XMLRevisionDocInfoImportContext
: public XMLSimpleDocInfoImportContext
598 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
599 XMLTextImportHelper
& rHlp
,
601 const OUString
& sLocalName
,
605 /// prepare XTextField for insertion into document
606 virtual void PrepareField(
607 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
610 /** import user docinfo field (<text:user-defined>) */
611 class XMLUserDocInfoImportContext
: public XMLSimpleDocInfoImportContext
614 const OUString sPropertyName
;
615 const OUString sPropertyNumberFormat
;
616 const OUString sPropertyIsFixedLanguage
;
619 bool bIsDefaultLanguage
;
623 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
624 XMLTextImportHelper
& rHlp
,
626 const OUString
& sLocalName
,
630 /// process attribute values
631 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
632 const OUString
& sAttrValue
) override
;
633 virtual void PrepareField(
634 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
637 /** import hidden paragraph fields (<text:hidden-paragraph>) */
638 class XMLHiddenParagraphImportContext
: public XMLTextFieldImportContext
640 const OUString sPropertyCondition
;
641 const OUString sPropertyIsHidden
;
648 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
649 XMLTextImportHelper
& rHlp
,
651 const OUString
& sLocalName
);
654 /// process attribute values
655 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
656 const OUString
& sAttrValue
) override
;
658 /// prepare XTextField for insertion into document
659 virtual void PrepareField(
660 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
663 /** import conditional text fields (<text:conditional-text>) */
664 class XMLConditionalTextImportContext
: public XMLTextFieldImportContext
666 const OUString sPropertyCondition
;
667 const OUString sPropertyCurrentPresentation
;
670 OUString sTrueContent
;
671 OUString sFalseContent
;
680 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
681 XMLTextImportHelper
& rHlp
,
683 const OUString
& sLocalName
);
686 /// process attribute values
687 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
688 const OUString
& sAttrValue
) override
;
690 /// prepare XTextField for insertion into document
691 virtual void PrepareField(
692 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
695 /** import conditional text fields (<text:hidden-text>) */
696 class XMLHiddenTextImportContext
: public XMLTextFieldImportContext
698 const OUString sPropertyCondition
;
699 const OUString sPropertyContent
;
700 const OUString sPropertyIsHidden
;
711 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
712 XMLTextImportHelper
& rHlp
,
714 const OUString
& sLocalName
);
717 /// process attribute values
718 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
719 const OUString
& sAttrValue
) override
;
721 /// prepare XTextField for insertion into document
722 virtual void PrepareField(
723 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
726 /** import file name fields (<text:file-name>) */
727 class XMLFileNameImportContext
: public XMLTextFieldImportContext
729 const OUString sPropertyFixed
;
730 const OUString sPropertyFileFormat
;
731 const OUString sPropertyCurrentPresentation
;
738 XMLFileNameImportContext(SvXMLImport
& rImport
,
739 XMLTextImportHelper
& rHlp
,
741 const OUString
& sLocalName
);
744 /// process attribute values
745 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
746 const OUString
& sAttrValue
) override
;
748 /// prepare XTextField for insertion into document
749 virtual void PrepareField(
750 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
753 /** import document template name fields (<text:template-name>) */
754 class XMLTemplateNameImportContext
: public XMLTextFieldImportContext
756 const OUString sPropertyFileFormat
;
762 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
763 XMLTextImportHelper
& rHlp
,
765 const OUString
& sLocalName
);
768 /// process attribute values
769 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
770 const OUString
& sAttrValue
) override
;
772 /// prepare XTextField for insertion into document
773 virtual void PrepareField(
774 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
777 /** import chapter fields (<text:chapter>) */
778 class XMLChapterImportContext
: public XMLTextFieldImportContext
785 XMLChapterImportContext(SvXMLImport
& rImport
,
786 XMLTextImportHelper
& rHlp
,
788 const OUString
& sLocalName
);
791 /// process attribute values
792 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
793 const OUString
& sAttrValue
) override
;
795 /// prepare XTextField for insertion into document
796 virtual void PrepareField(
797 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
800 /** import count fields (<text:[XXX]-count>) */
801 class XMLCountFieldImportContext
: public XMLTextFieldImportContext
803 const OUString sPropertyNumberingType
;
805 OUString sNumberFormat
;
806 OUString sLetterSync
;
808 bool bNumberFormatOK
;
812 XMLCountFieldImportContext(SvXMLImport
& rImport
,
813 XMLTextImportHelper
& rHlp
,
815 const OUString
& sLocalName
,
819 /// process attribute values
820 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
821 const OUString
& sAttrValue
) override
;
823 /// prepare XTextField for insertion into document
824 virtual void PrepareField(
825 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
827 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
830 /** import page variable fields (<text:get-page-variable>) */
831 class XMLPageVarGetFieldImportContext
: public XMLTextFieldImportContext
833 OUString sNumberFormat
;
834 OUString sLetterSync
;
836 bool bNumberFormatOK
;
840 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
841 XMLTextImportHelper
& rHlp
,
843 const OUString
& sLocalName
);
846 /// process attribute values
847 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
848 const OUString
& sAttrValue
) override
;
850 /// prepare XTextField for insertion into document
851 virtual void PrepareField(
852 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
855 /** import page variable fields (<text:get-page-variable>) */
856 class XMLPageVarSetFieldImportContext
: public XMLTextFieldImportContext
863 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
864 XMLTextImportHelper
& rHlp
,
866 const OUString
& sLocalName
);
869 /// process attribute values
870 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
871 const OUString
& sAttrValue
) override
;
873 /// prepare XTextField for insertion into document
874 virtual void PrepareField(
875 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
878 /** import macro fields (<text:execute-macro>) */
879 class XMLMacroFieldImportContext
: public XMLTextFieldImportContext
881 OUString sDescription
;
882 SvXMLImportContextRef xEventContext
;
884 OUString sMacro
; // macro for old documents (pre 638i)
890 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
891 XMLTextImportHelper
& rHlp
,
893 const OUString
& sLocalName
);
896 /// for <office:events> children
897 virtual SvXMLImportContextRef
CreateChildContext(
899 const OUString
& rLocalName
,
900 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
902 /// process attribute values
903 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
904 const OUString
& sAttrValue
) override
;
906 /// prepare XTextField for insertion into document
907 virtual void PrepareField(
908 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
911 /** import reference fields (<text:reference-get>) */
912 class XMLReferenceFieldImportContext
: public XMLTextFieldImportContext
916 sal_uInt16
const nElementToken
;
925 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
926 XMLTextImportHelper
& rHlp
,
929 const OUString
& sLocalName
);
933 virtual void StartElement(
934 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
936 /// process attribute values
937 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
938 const OUString
& sAttrValue
) override
;
940 /// prepare XTextField for insertion into document
941 virtual void PrepareField(
942 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
945 /** import dde field declaration container (<text:dde-connection-decls>) */
946 class XMLDdeFieldDeclsImportContext
: public SvXMLImportContext
950 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
952 const OUString
& sLocalName
);
954 virtual SvXMLImportContextRef
CreateChildContext(
956 const OUString
& rLocalName
,
957 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
960 /** import dde field declaration (<text:dde-connection-decl>) */
961 class XMLDdeFieldDeclImportContext
: public SvXMLImportContext
963 const SvXMLTokenMap
& rTokenMap
;
967 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
969 const OUString
& sLocalName
,
970 const SvXMLTokenMap
& rMap
);
972 // create fieldmaster
973 virtual void StartElement(
974 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
977 /** import dde fields (<text:dde-connection>) */
978 class XMLDdeFieldImportContext
: public XMLTextFieldImportContext
981 OUString
const sPropertyContent
;
985 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
986 XMLTextImportHelper
& rHlp
,
988 const OUString
& sLocalName
);
991 /// process attribute values
992 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
993 const OUString
& sAttrValue
) override
;
995 /// create textfield, attach master, and insert into document
996 virtual void EndElement() override
;
999 virtual void PrepareField(
1000 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1003 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1004 class XMLSheetNameImportContext
: public XMLTextFieldImportContext
1009 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1010 XMLTextImportHelper
& rHlp
,
1012 const OUString
& sLocalName
);
1015 /// no attributes -> empty method
1016 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1017 const OUString
& sAttrValue
) override
;
1019 /// no attributes -> empty method
1020 virtual void PrepareField(
1021 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1024 /** import page|slide name fields (<text:page-name>) */
1025 class XMLPageNameFieldImportContext
: public XMLTextFieldImportContext
1029 XMLPageNameFieldImportContext(
1030 SvXMLImport
& rImport
, /// XML Import
1031 XMLTextImportHelper
& rHlp
, /// Text import helper
1032 sal_uInt16 nPrfx
, /// namespace prefix
1033 const OUString
& sLocalName
); /// element name w/o prefix
1035 /// process attribute values
1036 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1037 const OUString
& sAttrValue
) override
;
1039 /// prepare XTextField for insertion into document
1040 virtual void PrepareField(
1041 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1044 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1045 class XMLUrlFieldImportContext
: public XMLTextFieldImportContext
1053 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1054 XMLTextImportHelper
& rHlp
,
1056 const OUString
& sLocalName
);
1059 /// no attributes -> empty method
1060 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1061 const OUString
& sAttrValue
) override
;
1063 /// no attributes -> empty method
1064 virtual void PrepareField(
1065 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1068 /** import bibliography info fields (<text:bibliography-mark>) */
1069 class XMLBibliographyFieldImportContext
: public XMLTextFieldImportContext
1071 ::std::vector
< css::beans::PropertyValue
> aValues
;
1075 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1076 XMLTextImportHelper
& rHlp
,
1078 const OUString
& sLocalName
);
1081 /// process attributes (fill aValues)
1082 virtual void StartElement(
1083 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
1085 /// empty method; all attributes are handled in StartElement
1086 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1087 const OUString
& sAttrValue
) override
;
1089 /// convert aValues into sequence and set property
1090 virtual void PrepareField(
1091 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1093 static const sal_Char
* MapBibliographyFieldName(const OUString
& sName
);
1096 /** Import an annotation field (<text:annotation>) */
1097 class XMLAnnotationImportContext
: public XMLTextFieldImportContext
1099 OUStringBuffer aAuthorBuffer
;
1100 OUStringBuffer aInitialsBuffer
;
1102 OUStringBuffer aTextBuffer
;
1103 OUStringBuffer aDateBuffer
;
1106 css::uno::Reference
< css::beans::XPropertySet
> mxField
;
1107 css::uno::Reference
< css::text::XTextCursor
> mxCursor
;
1108 css::uno::Reference
< css::text::XTextCursor
> mxOldCursor
;
1110 sal_uInt16
const m_nToken
;
1114 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1115 XMLTextImportHelper
& rHlp
,
1118 const OUString
& sLocalName
);
1121 /// process attributes
1122 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1123 const OUString
& sAttrValue
) override
;
1126 virtual void PrepareField(
1127 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
1129 virtual SvXMLImportContextRef
CreateChildContext(
1131 const OUString
& rLocalName
,
1132 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
1133 virtual void EndElement() override
;
1136 /** Import a script field (<text:script>) */
1137 class XMLScriptImportContext
: public XMLTextFieldImportContext
1140 OUString sScriptType
;
1146 XMLScriptImportContext(SvXMLImport
& rImport
,
1147 XMLTextImportHelper
& rHlp
,
1149 const OUString
& sLocalName
);
1152 /// process attributes
1153 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1154 const OUString
& sAttrValue
) override
;
1157 virtual void PrepareField(
1158 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1161 /** import measure fields (<text:measure>) */
1162 class XMLMeasureFieldImportContext
: public XMLTextFieldImportContext
1168 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1169 XMLTextImportHelper
& rHlp
,
1171 const OUString
& sLocalName
);
1174 /// process attribute values
1175 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1176 const OUString
& sAttrValue
) override
;
1178 /// prepare XTextField for insertion into document
1179 virtual void PrepareField(
1180 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1183 /** dropdown field (filter legacy) */
1184 class XMLDropDownFieldImportContext
: public XMLTextFieldImportContext
1186 std::vector
<OUString
> aLabels
;
1190 sal_Int32 nSelected
;
1197 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1198 XMLTextImportHelper
& rHlp
,
1200 const OUString
& sLocalName
);
1202 virtual SvXMLImportContextRef
CreateChildContext(
1204 const OUString
& rLocalName
,
1205 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
1208 /// process attribute values
1209 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1210 const OUString
& sAttrValue
) override
;
1212 /// prepare XTextField for insertion into document
1213 virtual void PrepareField(
1214 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1217 /** import header fields (<draw:header>) */
1218 class XMLHeaderFieldImportContext
: public XMLTextFieldImportContext
1222 XMLHeaderFieldImportContext(
1223 SvXMLImport
& rImport
, /// XML Import
1224 XMLTextImportHelper
& rHlp
, /// Text import helper
1225 sal_uInt16 nPrfx
, /// namespace prefix
1226 const OUString
& sLocalName
); /// element name w/o prefix
1228 /// process attribute values
1229 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1230 const OUString
& sAttrValue
) override
;
1232 /// prepare XTextField for insertion into document
1233 virtual void PrepareField(
1234 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1237 /** import footer fields (<draw:footer>) */
1238 class XMLFooterFieldImportContext
: public XMLTextFieldImportContext
1242 XMLFooterFieldImportContext(
1243 SvXMLImport
& rImport
, /// XML Import
1244 XMLTextImportHelper
& rHlp
, /// Text import helper
1245 sal_uInt16 nPrfx
, /// namespace prefix
1246 const OUString
& sLocalName
); /// element name w/o prefix
1248 /// process attribute values
1249 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1250 const OUString
& sAttrValue
) override
;
1252 /// prepare XTextField for insertion into document
1253 virtual void PrepareField(
1254 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1257 /** import footer fields (<draw:date-and-time>) */
1258 class XMLDateTimeFieldImportContext
: public XMLTextFieldImportContext
1262 XMLDateTimeFieldImportContext(
1263 SvXMLImport
& rImport
, /// XML Import
1264 XMLTextImportHelper
& rHlp
, /// Text import helper
1265 sal_uInt16 nPrfx
, /// namespace prefix
1266 const OUString
& sLocalName
); /// element name w/o prefix
1268 /// process attribute values
1269 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1270 const OUString
& sAttrValue
) override
;
1272 /// prepare XTextField for insertion into document
1273 virtual void PrepareField(
1274 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1279 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */