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/text/PageNumberType.hpp>
31 #include <com/sun/star/util/DateTime.hpp>
32 #include <com/sun/star/util/Date.hpp>
33 #include <xmloff/xmlictxt.hxx>
34 #include <xmloff/txtimp.hxx>
35 #include <rtl/ustrbuf.hxx>
38 namespace com
{ namespace sun
{ namespace star
{
39 namespace xml
{ namespace sax
{ class XAttributeList
; } }
40 namespace text
{ class XTextField
; }
41 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
45 class XMLTextImportHelper
;
48 enum XMLTextFieldAttrTokens
50 XML_TOK_TEXTFIELD_FIXED
= 0,
51 XML_TOK_TEXTFIELD_DESCRIPTION
,
52 XML_TOK_TEXTFIELD_HELP
,
53 XML_TOK_TEXTFIELD_HINT
,
54 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE
,
55 XML_TOK_TEXTFIELD_TIME_ADJUST
,
56 XML_TOK_TEXTFIELD_DATE_ADJUST
,
57 XML_TOK_TEXTFIELD_PAGE_ADJUST
,
58 XML_TOK_TEXTFIELD_SELECT_PAGE
,
59 XML_TOK_TEXTFIELD_ACTIVE
,
61 XML_TOK_TEXTFIELD_NAME
,
62 XML_TOK_TEXTFIELD_FORMULA
,
63 XML_TOK_TEXTFIELD_NUM_FORMAT
,
64 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC
,
65 XML_TOK_TEXTFIELD_DISPLAY_FORMULA
,
66 XML_TOK_TEXTFIELD_NUMBERING_LEVEL
,
67 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR
,
68 XML_TOK_TEXTFIELD_DISPLAY
,
69 XML_TOK_TEXTFIELD_OUTLINE_LEVEL
,
71 XML_TOK_TEXTFIELD_VALUE_TYPE
,
72 XML_TOK_TEXTFIELD_VALUE
,
73 XML_TOK_TEXTFIELD_STRING_VALUE
,
74 XML_TOK_TEXTFIELD_DATE_VALUE
,
75 XML_TOK_TEXTFIELD_TIME_VALUE
,
76 XML_TOK_TEXTFIELD_BOOL_VALUE
,
77 XML_TOK_TEXTFIELD_CURRENCY
,
78 XML_TOK_TEXTFIELD_DATA_STYLE_NAME
,
80 XML_TOK_TEXTFIELD_DATABASE_NAME
,
81 XML_TOK_TEXTFIELD_TABLE_NAME
,
82 XML_TOK_TEXTFIELD_COLUMN_NAME
,
83 XML_TOK_TEXTFIELD_ROW_NUMBER
,
84 XML_TOK_TEXTFIELD_CONDITION
,
85 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE
,
86 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE
,
87 XML_TOK_TEXTFIELD_REVISION
,
88 XML_TOK_TEXTFIELD_IS_HIDDEN
,
89 XML_TOK_TEXTFIELD_CURRENT_VALUE
,
91 XML_TOK_TEXTFIELD_REFERENCE_FORMAT
,
92 XML_TOK_TEXTFIELD_REF_NAME
,
93 XML_TOK_TEXTFIELD_CONNECTION_NAME
,
95 XML_TOK_TEXTFIELD_HREF
,
96 XML_TOK_TEXTFIELD_TARGET_FRAME
,
98 XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE
,
99 XML_TOK_TEXTFIELD_OFFICE_AUTHOR
,
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
,
108 XML_TOK_TEXTFIELD_UNKNOWN
111 /// abstract class for text field import
112 class XMLTextFieldImportContext
: public SvXMLImportContext
115 OUStringBuffer sContentBuffer
; /// collect character data
116 OUString sContent
; /// character data after collection
117 OUString sServiceName
; /// service name for text field
118 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
121 OUString sServicePrefix
;
123 // data members for use in subclasses
124 bool bValid
; /// whether this field is valid ?
128 XMLTextFieldImportContext(
129 SvXMLImport
& rImport
, /// XML Import
130 XMLTextImportHelper
& rHlp
, /// Text import helper
131 const sal_Char
* pService
, /// name of SO API service
132 sal_uInt16 nPrfx
, /// namespace prefix
133 const OUString
& rLocalName
); /// element name w/o prefix
135 virtual ~XMLTextFieldImportContext() override
;
137 /// process character data: will be collected in member sContentBuffer
138 virtual void Characters( const OUString
& sContent
) override
;
140 /// parses attributes and calls ProcessAttribute
141 virtual void StartElement(
142 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
144 /// create XTextField and insert into document; calls PrepareTextField
145 virtual void EndElement() override
;
147 /// create the appropriate field context from
148 /// (for use in paragraph import)
149 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
150 SvXMLImport
& rImport
,
151 XMLTextImportHelper
& rHlp
,
153 const OUString
& rName
,
158 inline XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
160 const OUString
& GetServiceName() { return sServiceName
; }
161 inline void SetServiceName(const OUString
& sStr
) { sServiceName
= sStr
; }
163 OUString
const & GetContent();
165 /// process attribute values
166 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
167 const OUString
& sAttrValue
) = 0;
169 /// prepare XTextField for insertion into document
170 virtual void PrepareField(
171 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) = 0;
173 /// create field from ServiceName
174 bool CreateField(css::uno::Reference
< css::beans::XPropertySet
> & xField
,
175 const OUString
& sServiceName
);
177 /// force an update of the field's value
178 /// call update on optional XUptadeable interface; (disable Fixed property)
179 static void ForceUpdate(
180 const css::uno::Reference
< css::beans::XPropertySet
> & rPropertySet
);
183 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
186 sal_Int16 nSubType
; /// API subtype for ExtUser field
188 const OUString sPropertyFixed
;
189 const OUString sPropertyFieldSubType
;
190 const OUString sPropertyContent
;
193 // variables for access in subclass
195 sal_uInt16 nElementToken
; /// token for this element field
199 XMLSenderFieldImportContext(
200 SvXMLImport
& rImport
, /// XML Import
201 XMLTextImportHelper
& rHlp
, /// Text import helper
202 sal_uInt16 nPrfx
, /// namespace prefix
203 const OUString
& sLocalName
, /// element name w/o prefix
204 sal_uInt16 nToken
); /// element token
208 virtual void StartElement(
209 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
211 /// process attribute values
212 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
213 const OUString
& sAttrValue
) override
;
215 /// prepare XTextField for insertion into document
216 virtual void PrepareField(
217 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
220 /** inherit sender field because of fixed attribute in ProcessAttributes */
221 class XMLAuthorFieldImportContext
: public XMLSenderFieldImportContext
223 bool bAuthorFullName
;
224 const OUString sServiceAuthor
;
225 const OUString sPropertyAuthorFullName
;
226 const OUString sPropertyFixed
;
227 const OUString sPropertyContent
;
231 XMLAuthorFieldImportContext(
232 SvXMLImport
& rImport
, /// XML Import
233 XMLTextImportHelper
& rHlp
, /// Text import helper
234 sal_uInt16 nPrfx
, /// namespace prefix
235 const OUString
& sLocalName
, /// element name w/o prefix
236 sal_uInt16 nToken
); /// element token
240 virtual void StartElement(
241 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
243 /// prepare XTextField for insertion into document
244 virtual void PrepareField(
245 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
248 class XMLPlaceholderFieldImportContext
: public XMLTextFieldImportContext
250 const OUString sPropertyPlaceholderType
;
251 const OUString sPropertyPlaceholder
;
252 const OUString sPropertyHint
;
254 OUString sDescription
;
256 sal_Int16 nPlaceholderType
;
260 XMLPlaceholderFieldImportContext(
261 SvXMLImport
& rImport
, /// XML Import
262 XMLTextImportHelper
& rHlp
, /// Text import helper
263 sal_uInt16 nPrfx
, /// namespace prefix
264 const OUString
& sLocalName
); /// element name w/o prefix
267 /// process attribute values
268 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
269 const OUString
& sAttrValue
) override
;
271 /// prepare XTextField for insertion into document
272 virtual void PrepareField(
273 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
276 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
279 const OUString sPropertyNumberFormat
;
280 const OUString sPropertyFixed
;
281 const OUString sPropertyDateTimeValue
;
282 const OUString sPropertyDateTime
;
283 const OUString sPropertyAdjust
;
284 const OUString sPropertyIsDate
;
285 const OUString sPropertyIsFixedLanguage
;
287 css::util::DateTime aDateTimeValue
;
289 sal_Int32 nFormatKey
;
293 bool bIsDate
; // is this a date?
294 // (for XMLDateFieldImportContext, really)
295 bool bIsDefaultLanguage
;
299 XMLTimeFieldImportContext(
300 SvXMLImport
& rImport
, /// XML Import
301 XMLTextImportHelper
& rHlp
, /// Text import helper
302 sal_uInt16 nPrfx
, /// namespace prefix
303 const OUString
& sLocalName
); /// element name w/o prefix
305 /// process attribute values
306 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
307 const OUString
& sAttrValue
) override
;
309 /// prepare XTextField for insertion into document
310 virtual void PrepareField(
311 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
314 /** import date fields (<text:date>);
315 inherit from TimeField to reuse implementation */
316 class XMLDateFieldImportContext
: public XMLTimeFieldImportContext
320 XMLDateFieldImportContext(
321 SvXMLImport
& rImport
, /// XML Import
322 XMLTextImportHelper
& rHlp
, /// Text import helper
323 sal_uInt16 nPrfx
, /// namespace prefix
324 const OUString
& sLocalName
); /// element name w/o prefix
326 /// process attribute values
327 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
328 const OUString
& sAttrValue
) override
;
331 /** import page continuation fields (<text:page-continuation-string>) */
332 class XMLPageContinuationImportContext
: public XMLTextFieldImportContext
334 const OUString sPropertySubType
;
335 const OUString sPropertyUserText
;
336 const OUString sPropertyNumberingType
;
338 OUString sString
; /// continuation string
339 css::text::PageNumberType eSelectPage
; /// previous, current
341 bool sStringOK
; /// continuation string encountered?
345 XMLPageContinuationImportContext(
346 SvXMLImport
& rImport
, /// XML Import
347 XMLTextImportHelper
& rHlp
, /// Text import helper
348 sal_uInt16 nPrfx
, /// namespace prefix
349 const OUString
& sLocalName
); /// element name w/o prefix
351 /// process attribute values
352 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
353 const OUString
& sAttrValue
) override
;
355 /// prepare XTextField for insertion into document
356 virtual void PrepareField(
357 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
360 /** import page number fields (<text:page-number>) */
361 class XMLPageNumberImportContext
: public XMLTextFieldImportContext
363 const OUString sPropertySubType
;
364 const OUString sPropertyNumberingType
;
365 const OUString sPropertyOffset
;
367 OUString sNumberFormat
;
368 OUString sNumberSync
;
369 sal_Int16 nPageAdjust
;
370 css::text::PageNumberType eSelectPage
; /// previous, current
372 bool sNumberFormatOK
;
376 XMLPageNumberImportContext(
377 SvXMLImport
& rImport
, /// XML Import
378 XMLTextImportHelper
& rHlp
, /// Text import helper
379 sal_uInt16 nPrfx
, /// namespace prefix
380 const OUString
& sLocalName
); /// element name w/o prefix
383 /// process attribute values
384 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
385 const OUString
& sAttrValue
) override
;
387 /// prepare XTextField for insertion into document
388 virtual void PrepareField(
389 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
392 /** superclass for database fields: handle database and table names */
393 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
395 const OUString sPropertyDataBaseName
;
396 const OUString sPropertyDataBaseURL
;
397 const OUString sPropertyTableName
;
398 const OUString sPropertyDataCommandType
;
399 const OUString sPropertyIsVisible
;
401 OUString sDatabaseName
;
402 OUString sDatabaseURL
;
405 sal_Int32 nCommandType
;
414 bool bDatabaseNameOK
;
418 /// protected constructor: only for subclasses
419 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
420 XMLTextImportHelper
& rHlp
,
421 const sal_Char
* pServiceName
,
423 const OUString
& sLocalName
,
428 /// process attribute values
429 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
430 const OUString
& sAttrValue
) override
;
432 /// prepare XTextField for insertion into document
433 virtual void PrepareField(
434 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
436 /// handle database-location children
437 virtual SvXMLImportContext
*CreateChildContext(
439 const OUString
& rLocalName
,
440 const css::uno::Reference
< css::xml::sax::XAttributeList
> & xAttrList
) override
;
443 /** import database name fields (<text:database-name>) */
444 class XMLDatabaseNameImportContext
: public XMLDatabaseFieldImportContext
448 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
449 XMLTextImportHelper
& rHlp
,
451 const OUString
& sLocalName
);
453 /// process attribute values
454 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
455 const OUString
& sAttrValue
) override
;
458 /** import database next fields (<text:database-next>) */
459 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
461 const OUString sPropertyCondition
;
462 const OUString sTrue
;
467 // for use in child classes
468 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
469 XMLTextImportHelper
& rHlp
,
470 const sal_Char
* pServiceName
,
472 const OUString
& sLocalName
);
476 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
477 XMLTextImportHelper
& rHlp
,
479 const OUString
& sLocalName
);
481 /// process attribute values
482 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
483 const OUString
& sAttrValue
) override
;
485 /// prepare XTextField for insertion into document
486 virtual void PrepareField(
487 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
490 /** import database select fields (<text:database-select>) */
491 class XMLDatabaseSelectImportContext
: public XMLDatabaseNextImportContext
493 const OUString sPropertySetNumber
;
499 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
500 XMLTextImportHelper
& rHlp
,
502 const OUString
& sLocalName
);
504 /// process attribute values
505 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
506 const OUString
& sAttrValue
) override
;
508 /// prepare XTextField for insertion into document
509 virtual void PrepareField(
510 const css::uno::Reference
<
511 css::beans::XPropertySet
> & xPropertySet
) override
;
514 /** import database display number fields (<text:database-row-number>) */
515 class XMLDatabaseNumberImportContext
: public XMLDatabaseFieldImportContext
517 const OUString sPropertyNumberingType
;
518 const OUString sPropertySetNumber
;
519 OUString sNumberFormat
;
520 OUString sNumberSync
;
526 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
527 XMLTextImportHelper
& rHlp
,
529 const OUString
& sLocalName
);
531 /// process attribute values
532 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
533 const OUString
& sAttrValue
) override
;
535 /// prepare XTextField for insertion into document
536 virtual void PrepareField(
537 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
540 /** import docinfo fields with only fixed attribute */
541 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
543 const OUString sPropertyFixed
;
544 const OUString sPropertyContent
;
545 const OUString sPropertyAuthor
;
546 const OUString sPropertyCurrentPresentation
;
555 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
556 XMLTextImportHelper
& rHlp
,
558 const OUString
& sLocalName
,
564 /// process attribute values
565 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
566 const OUString
& sAttrValue
) override
;
568 /// prepare XTextField for insertion into document
569 virtual void PrepareField(
570 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
572 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
575 /** import docinfo fields with date or time attributes and numberformats */
576 class XMLDateTimeDocInfoImportContext
: public XMLSimpleDocInfoImportContext
578 const OUString sPropertyNumberFormat
;
579 const OUString sPropertyIsDate
;
580 const OUString sPropertyIsFixedLanguage
;
586 bool bIsDefaultLanguage
;
590 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
591 XMLTextImportHelper
& rHlp
,
593 const OUString
& sLocalName
,
597 /// process attribute values
598 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
599 const OUString
& sAttrValue
) override
;
601 /// prepare XTextField for insertion into document
602 virtual void PrepareField(
603 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
606 /** import revision field (<text:editing-cycles>) */
607 class XMLRevisionDocInfoImportContext
: public XMLSimpleDocInfoImportContext
609 const OUString sPropertyRevision
;
613 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
614 XMLTextImportHelper
& rHlp
,
616 const OUString
& sLocalName
,
620 /// prepare XTextField for insertion into document
621 virtual void PrepareField(
622 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
625 /** import user docinfo field (<text:user-defined>) */
626 class XMLUserDocInfoImportContext
: public XMLSimpleDocInfoImportContext
629 const OUString sPropertyName
;
630 const OUString sPropertyNumberFormat
;
631 const OUString sPropertyIsFixedLanguage
;
634 bool bIsDefaultLanguage
;
638 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
639 XMLTextImportHelper
& rHlp
,
641 const OUString
& sLocalName
,
645 /// process attribute values
646 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
647 const OUString
& sAttrValue
) override
;
648 virtual void PrepareField(
649 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
652 /** import hidden paragraph fields (<text:hidden-paragraph>) */
653 class XMLHiddenParagraphImportContext
: public XMLTextFieldImportContext
655 const OUString sPropertyCondition
;
656 const OUString sPropertyIsHidden
;
663 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
664 XMLTextImportHelper
& rHlp
,
666 const OUString
& sLocalName
);
669 /// process attribute values
670 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
671 const OUString
& sAttrValue
) override
;
673 /// prepare XTextField for insertion into document
674 virtual void PrepareField(
675 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
678 /** import conditional text fields (<text:conditional-text>) */
679 class XMLConditionalTextImportContext
: public XMLTextFieldImportContext
681 const OUString sPropertyCondition
;
682 const OUString sPropertyTrueContent
;
683 const OUString sPropertyFalseContent
;
684 const OUString sPropertyIsConditionTrue
;
685 const OUString sPropertyCurrentPresentation
;
688 OUString sTrueContent
;
689 OUString sFalseContent
;
698 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
699 XMLTextImportHelper
& rHlp
,
701 const OUString
& sLocalName
);
704 /// process attribute values
705 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
706 const OUString
& sAttrValue
) override
;
708 /// prepare XTextField for insertion into document
709 virtual void PrepareField(
710 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
713 /** import conditional text fields (<text:hidden-text>) */
714 class XMLHiddenTextImportContext
: public XMLTextFieldImportContext
716 const OUString sPropertyCondition
;
717 const OUString sPropertyContent
;
718 const OUString sPropertyIsHidden
;
729 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
730 XMLTextImportHelper
& rHlp
,
732 const OUString
& sLocalName
);
735 /// process attribute values
736 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
737 const OUString
& sAttrValue
) override
;
739 /// prepare XTextField for insertion into document
740 virtual void PrepareField(
741 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
744 /** import file name fields (<text:file-name>) */
745 class XMLFileNameImportContext
: public XMLTextFieldImportContext
747 const OUString sPropertyFixed
;
748 const OUString sPropertyFileFormat
;
749 const OUString sPropertyCurrentPresentation
;
756 XMLFileNameImportContext(SvXMLImport
& rImport
,
757 XMLTextImportHelper
& rHlp
,
759 const OUString
& sLocalName
);
762 /// process attribute values
763 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
764 const OUString
& sAttrValue
) override
;
766 /// prepare XTextField for insertion into document
767 virtual void PrepareField(
768 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
771 /** import document template name fields (<text:template-name>) */
772 class XMLTemplateNameImportContext
: public XMLTextFieldImportContext
774 const OUString sPropertyFileFormat
;
780 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
781 XMLTextImportHelper
& rHlp
,
783 const OUString
& sLocalName
);
786 /// process attribute values
787 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
788 const OUString
& sAttrValue
) override
;
790 /// prepare XTextField for insertion into document
791 virtual void PrepareField(
792 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
795 /** import chapter fields (<text:chapter>) */
796 class XMLChapterImportContext
: public XMLTextFieldImportContext
798 const OUString sPropertyChapterFormat
;
799 const OUString sPropertyLevel
;
806 XMLChapterImportContext(SvXMLImport
& rImport
,
807 XMLTextImportHelper
& rHlp
,
809 const OUString
& sLocalName
);
812 /// process attribute values
813 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
814 const OUString
& sAttrValue
) override
;
816 /// prepare XTextField for insertion into document
817 virtual void PrepareField(
818 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
821 /** import count fields (<text:[XXX]-count>) */
822 class XMLCountFieldImportContext
: public XMLTextFieldImportContext
824 const OUString sPropertyNumberingType
;
826 OUString sNumberFormat
;
827 OUString sLetterSync
;
829 bool bNumberFormatOK
;
833 XMLCountFieldImportContext(SvXMLImport
& rImport
,
834 XMLTextImportHelper
& rHlp
,
836 const OUString
& sLocalName
,
840 /// process attribute values
841 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
842 const OUString
& sAttrValue
) override
;
844 /// prepare XTextField for insertion into document
845 virtual void PrepareField(
846 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
848 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
851 /** import page variable fields (<text:get-page-variable>) */
852 class XMLPageVarGetFieldImportContext
: public XMLTextFieldImportContext
854 const OUString sPropertyNumberingType
;
856 OUString sNumberFormat
;
857 OUString sLetterSync
;
859 bool bNumberFormatOK
;
863 XMLPageVarGetFieldImportContext(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 page variable fields (<text:get-page-variable>) */
879 class XMLPageVarSetFieldImportContext
: public XMLTextFieldImportContext
881 const OUString sPropertyOn
;
882 const OUString sPropertyOffset
;
889 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
890 XMLTextImportHelper
& rHlp
,
892 const OUString
& sLocalName
);
895 /// process attribute values
896 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
897 const OUString
& sAttrValue
) override
;
899 /// prepare XTextField for insertion into document
900 virtual void PrepareField(
901 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
904 /** import macro fields (<text:execute-macro>) */
905 class XMLMacroFieldImportContext
: public XMLTextFieldImportContext
907 const OUString sPropertyHint
;
908 const OUString sPropertyMacroName
;
909 const OUString sPropertyScriptURL
;
911 OUString sDescription
;
912 SvXMLImportContextRef xEventContext
;
914 OUString sMacro
; // macro for old documents (pre 638i)
920 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
921 XMLTextImportHelper
& rHlp
,
923 const OUString
& sLocalName
);
926 /// for <office:events> children
927 virtual SvXMLImportContext
*CreateChildContext(
929 const OUString
& rLocalName
,
930 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
932 /// process attribute values
933 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
934 const OUString
& sAttrValue
) override
;
936 /// prepare XTextField for insertion into document
937 virtual void PrepareField(
938 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
941 /** import reference fields (<text:reference-get>) */
942 class XMLReferenceFieldImportContext
: public XMLTextFieldImportContext
944 const OUString sPropertyReferenceFieldPart
;
945 const OUString sPropertyReferenceFieldSource
;
946 const OUString sPropertySourceName
;
947 const OUString sPropertyCurrentPresentation
;
950 sal_uInt16 nElementToken
;
959 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
960 XMLTextImportHelper
& rHlp
,
963 const OUString
& sLocalName
);
967 virtual void StartElement(
968 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
970 /// process attribute values
971 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
972 const OUString
& sAttrValue
) override
;
974 /// prepare XTextField for insertion into document
975 virtual void PrepareField(
976 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
979 /** import dde field declaration container (<text:dde-connection-decls>) */
980 class XMLDdeFieldDeclsImportContext
: public SvXMLImportContext
982 SvXMLTokenMap aTokenMap
;
986 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
988 const OUString
& sLocalName
);
990 virtual SvXMLImportContext
*CreateChildContext(
992 const OUString
& rLocalName
,
993 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
996 /** import dde field declaration (<text:dde-connection-decl>) */
997 class XMLDdeFieldDeclImportContext
: public SvXMLImportContext
999 const OUString sPropertyIsAutomaticUpdate
;
1000 const OUString sPropertyName
;
1001 const OUString sPropertyDDECommandType
;
1002 const OUString sPropertyDDECommandFile
;
1003 const OUString sPropertyDDECommandElement
;
1005 const SvXMLTokenMap
& rTokenMap
;
1009 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
1011 const OUString
& sLocalName
,
1012 const SvXMLTokenMap
& rMap
);
1014 // create fieldmaster
1015 virtual void StartElement(
1016 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
1019 /** import dde fields (<text:dde-connection>) */
1020 class XMLDdeFieldImportContext
: public XMLTextFieldImportContext
1023 OUString sPropertyContent
;
1027 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
1028 XMLTextImportHelper
& rHlp
,
1030 const OUString
& sLocalName
);
1033 /// process attribute values
1034 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1035 const OUString
& sAttrValue
) override
;
1037 /// create textfield, attach master, and insert into document
1038 virtual void EndElement() override
;
1041 virtual void PrepareField(
1042 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1045 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1046 class XMLSheetNameImportContext
: public XMLTextFieldImportContext
1051 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1052 XMLTextImportHelper
& rHlp
,
1054 const OUString
& sLocalName
);
1057 /// no attributes -> empty method
1058 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1059 const OUString
& sAttrValue
) override
;
1061 /// no attributes -> empty method
1062 virtual void PrepareField(
1063 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1066 /** import page|slide name fields (<text:page-name>) */
1067 class XMLPageNameFieldImportContext
: public XMLTextFieldImportContext
1071 XMLPageNameFieldImportContext(
1072 SvXMLImport
& rImport
, /// XML Import
1073 XMLTextImportHelper
& rHlp
, /// Text import helper
1074 sal_uInt16 nPrfx
, /// namespace prefix
1075 const OUString
& sLocalName
); /// element name w/o prefix
1077 /// process attribute values
1078 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1079 const OUString
& sAttrValue
) override
;
1081 /// prepare XTextField for insertion into document
1082 virtual void PrepareField(
1083 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1086 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1087 class XMLUrlFieldImportContext
: public XMLTextFieldImportContext
1089 const OUString sPropertyURL
;
1090 const OUString sPropertyTargetFrame
;
1091 const OUString sPropertyRepresentation
;
1099 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1100 XMLTextImportHelper
& rHlp
,
1102 const OUString
& sLocalName
);
1105 /// no attributes -> empty method
1106 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1107 const OUString
& sAttrValue
) override
;
1109 /// no attributes -> empty method
1110 virtual void PrepareField(
1111 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1114 /** import bibliography info fields (<text:bibliography-mark>) */
1115 class XMLBibliographyFieldImportContext
: public XMLTextFieldImportContext
1117 const OUString sPropertyFields
;
1119 ::std::vector
< css::beans::PropertyValue
> aValues
;
1123 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1124 XMLTextImportHelper
& rHlp
,
1126 const OUString
& sLocalName
);
1129 /// process attributes (fill aValues)
1130 virtual void StartElement(
1131 const css::uno::Reference
<css::xml::sax::XAttributeList
> & xAttrList
) override
;
1133 /// empty method; all attributes are handled in StartElement
1134 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1135 const OUString
& sAttrValue
) override
;
1137 /// convert aValues into sequence and set property
1138 virtual void PrepareField(
1139 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1141 static const sal_Char
* MapBibliographyFieldName(const OUString
& sName
);
1144 /** Import an annotation field (<text:annotation>) */
1145 class XMLAnnotationImportContext
: public XMLTextFieldImportContext
1147 const OUString sPropertyAuthor
;
1148 const OUString sPropertyInitials
;
1149 const OUString sPropertyContent
;
1150 const OUString sPropertyDate
;
1151 const OUString sPropertyTextRange
;
1152 const OUString sPropertyName
;
1154 OUStringBuffer aAuthorBuffer
;
1155 OUStringBuffer aInitialsBuffer
;
1157 OUStringBuffer aTextBuffer
;
1158 OUStringBuffer aDateBuffer
;
1160 css::uno::Reference
< css::beans::XPropertySet
> mxField
;
1161 css::uno::Reference
< css::text::XTextCursor
> mxCursor
;
1162 css::uno::Reference
< css::text::XTextCursor
> mxOldCursor
;
1164 sal_uInt16 m_nToken
;
1168 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1169 XMLTextImportHelper
& rHlp
,
1172 const OUString
& sLocalName
);
1175 /// process attributes
1176 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1177 const OUString
& sAttrValue
) override
;
1180 virtual void PrepareField(
1181 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
1183 virtual SvXMLImportContext
*CreateChildContext(
1185 const OUString
& rLocalName
,
1186 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
1187 virtual void EndElement() override
;
1190 /** Import a script field (<text:script>) */
1191 class XMLScriptImportContext
: public XMLTextFieldImportContext
1193 const OUString sPropertyScriptType
;
1194 const OUString sPropertyURLContent
;
1195 const OUString sPropertyContent
;
1198 OUString sScriptType
;
1205 XMLScriptImportContext(SvXMLImport
& rImport
,
1206 XMLTextImportHelper
& rHlp
,
1208 const OUString
& sLocalName
);
1211 /// process attributes
1212 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1213 const OUString
& sAttrValue
) override
;
1216 virtual void PrepareField(
1217 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1220 /** import measure fields (<text:measure>) */
1221 class XMLMeasureFieldImportContext
: public XMLTextFieldImportContext
1227 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1228 XMLTextImportHelper
& rHlp
,
1230 const OUString
& sLocalName
);
1233 /// process attribute values
1234 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1235 const OUString
& sAttrValue
) override
;
1237 /// prepare XTextField for insertion into document
1238 virtual void PrepareField(
1239 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1242 /** dropdown field (filter legacy) */
1243 class XMLDropDownFieldImportContext
: public XMLTextFieldImportContext
1245 std::vector
<OUString
> aLabels
;
1249 sal_Int32 nSelected
;
1254 const OUString sPropertyItems
;
1255 const OUString sPropertySelectedItem
;
1256 const OUString sPropertyName
;
1257 const OUString sPropertyHelp
;
1258 const OUString sPropertyToolTip
;
1262 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1263 XMLTextImportHelper
& rHlp
,
1265 const OUString
& sLocalName
);
1267 virtual SvXMLImportContext
* CreateChildContext(
1269 const OUString
& rLocalName
,
1270 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
1273 /// process attribute values
1274 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1275 const OUString
& sAttrValue
) override
;
1277 /// prepare XTextField for insertion into document
1278 virtual void PrepareField(
1279 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1282 /** import header fields (<draw:header>) */
1283 class XMLHeaderFieldImportContext
: public XMLTextFieldImportContext
1287 XMLHeaderFieldImportContext(
1288 SvXMLImport
& rImport
, /// XML Import
1289 XMLTextImportHelper
& rHlp
, /// Text import helper
1290 sal_uInt16 nPrfx
, /// namespace prefix
1291 const OUString
& sLocalName
); /// element name w/o prefix
1293 /// process attribute values
1294 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1295 const OUString
& sAttrValue
) override
;
1297 /// prepare XTextField for insertion into document
1298 virtual void PrepareField(
1299 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1302 /** import footer fields (<draw:footer>) */
1303 class XMLFooterFieldImportContext
: public XMLTextFieldImportContext
1307 XMLFooterFieldImportContext(
1308 SvXMLImport
& rImport
, /// XML Import
1309 XMLTextImportHelper
& rHlp
, /// Text import helper
1310 sal_uInt16 nPrfx
, /// namespace prefix
1311 const OUString
& sLocalName
); /// element name w/o prefix
1313 /// process attribute values
1314 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1315 const OUString
& sAttrValue
) override
;
1317 /// prepare XTextField for insertion into document
1318 virtual void PrepareField(
1319 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1322 /** import footer fields (<draw:date-and-time>) */
1323 class XMLDateTimeFieldImportContext
: public XMLTextFieldImportContext
1327 XMLDateTimeFieldImportContext(
1328 SvXMLImport
& rImport
, /// XML Import
1329 XMLTextImportHelper
& rHlp
, /// Text import helper
1330 sal_uInt16 nPrfx
, /// namespace prefix
1331 const OUString
& sLocalName
); /// element name w/o prefix
1333 /// process attribute values
1334 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1335 const OUString
& sAttrValue
) override
;
1337 /// prepare XTextField for insertion into document
1338 virtual void PrepareField(
1339 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1344 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */