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>
37 namespace com
{ namespace sun
{ namespace star
{
38 namespace xml
{ namespace sax
{ class XAttributeList
; } }
39 namespace text
{ class XTextField
; }
40 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
44 class XMLTextImportHelper
;
47 enum XMLTextFieldAttrTokens
49 XML_TOK_TEXTFIELD_FIXED
= 0,
50 XML_TOK_TEXTFIELD_DESCRIPTION
,
51 XML_TOK_TEXTFIELD_HELP
,
52 XML_TOK_TEXTFIELD_HINT
,
53 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE
,
54 XML_TOK_TEXTFIELD_TIME_ADJUST
,
55 XML_TOK_TEXTFIELD_DATE_ADJUST
,
56 XML_TOK_TEXTFIELD_PAGE_ADJUST
,
57 XML_TOK_TEXTFIELD_SELECT_PAGE
,
58 XML_TOK_TEXTFIELD_ACTIVE
,
60 XML_TOK_TEXTFIELD_NAME
,
61 XML_TOK_TEXTFIELD_FORMULA
,
62 XML_TOK_TEXTFIELD_NUM_FORMAT
,
63 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC
,
64 XML_TOK_TEXTFIELD_DISPLAY_FORMULA
,
65 XML_TOK_TEXTFIELD_NUMBERING_LEVEL
,
66 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR
,
67 XML_TOK_TEXTFIELD_DISPLAY
,
68 XML_TOK_TEXTFIELD_OUTLINE_LEVEL
,
70 XML_TOK_TEXTFIELD_VALUE_TYPE
,
71 XML_TOK_TEXTFIELD_VALUE
,
72 XML_TOK_TEXTFIELD_STRING_VALUE
,
73 XML_TOK_TEXTFIELD_DATE_VALUE
,
74 XML_TOK_TEXTFIELD_TIME_VALUE
,
75 XML_TOK_TEXTFIELD_BOOL_VALUE
,
76 XML_TOK_TEXTFIELD_CURRENCY
,
77 XML_TOK_TEXTFIELD_DATA_STYLE_NAME
,
79 XML_TOK_TEXTFIELD_DATABASE_NAME
,
80 XML_TOK_TEXTFIELD_TABLE_NAME
,
81 XML_TOK_TEXTFIELD_COLUMN_NAME
,
82 XML_TOK_TEXTFIELD_ROW_NUMBER
,
83 XML_TOK_TEXTFIELD_CONDITION
,
84 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE
,
85 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE
,
86 XML_TOK_TEXTFIELD_REVISION
,
87 XML_TOK_TEXTFIELD_IS_HIDDEN
,
88 XML_TOK_TEXTFIELD_CURRENT_VALUE
,
90 XML_TOK_TEXTFIELD_REFERENCE_FORMAT
,
91 XML_TOK_TEXTFIELD_REF_NAME
,
92 XML_TOK_TEXTFIELD_CONNECTION_NAME
,
94 XML_TOK_TEXTFIELD_HREF
,
95 XML_TOK_TEXTFIELD_TARGET_FRAME
,
97 XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE
,
98 XML_TOK_TEXTFIELD_OFFICE_AUTHOR
,
99 XML_TOK_TEXTFIELD_ANNOTATION
,
100 XML_TOK_TEXTFIELD_LANGUAGE
,
102 XML_TOK_TEXTFIELD_MEASURE_KIND
,
103 XML_TOK_TEXTFIELD_TABLE_TYPE
,
105 XML_TOK_TEXTFIELD_NOTE_CLASS
,
107 XML_TOK_TEXTFIELD_UNKNOWN
110 /// abstract class for text field import
111 class XMLTextFieldImportContext
: public SvXMLImportContext
114 OUStringBuffer sContentBuffer
; /// collect character data
115 OUString sContent
; /// character data after collection
116 OUString sServiceName
; /// service name for text field
117 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
120 OUString sServicePrefix
;
122 // data members for use in subclasses
123 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();
137 /// process character data: will be collected in member sContentBuffer
138 virtual void Characters( const OUString
& sContent
) SAL_OVERRIDE
;
140 /// parses attributes and calls ProcessAttribute
141 virtual void StartElement(
142 const ::com::sun::star::uno::Reference
<
143 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
145 /// create XTextField and insert into document; calls PrepareTextField
146 virtual void EndElement() SAL_OVERRIDE
;
148 /// create the appropriate field context from
149 /// (for use in paragraph import)
150 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
151 SvXMLImport
& rImport
,
152 XMLTextImportHelper
& rHlp
,
154 const OUString
& rName
,
159 inline XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
161 inline OUString
GetServiceName() { return sServiceName
; }
162 inline void SetServiceName(const OUString
& sStr
) { sServiceName
= sStr
; }
164 OUString
GetContent();
166 /// process attribute values
167 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
168 const OUString
& sAttrValue
) = 0;
170 /// prepare XTextField for insertion into document
171 virtual void PrepareField(
172 const ::com::sun::star::uno::Reference
<
173 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) = 0;
175 /// create field from ServiceName
176 bool CreateField(::com::sun::star::uno::Reference
<
177 ::com::sun::star::beans::XPropertySet
> & xField
,
178 const OUString
& sServiceName
);
180 /// force an update of the field's value
181 /// call update on optional XUptadeable interface; (disable Fixed property)
182 static void ForceUpdate(
183 const ::com::sun::star::uno::Reference
<
184 ::com::sun::star::beans::XPropertySet
> & rPropertySet
);
187 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
190 sal_Int16 nSubType
; /// API subtype for ExtUser field
192 const OUString sPropertyFixed
;
193 const OUString sPropertyFieldSubType
;
194 const OUString sPropertyContent
;
197 // variables for access in subclass
199 sal_uInt16 nElementToken
; /// token for this elment field
204 XMLSenderFieldImportContext(
205 SvXMLImport
& rImport
, /// XML Import
206 XMLTextImportHelper
& rHlp
, /// Text import helper
207 sal_uInt16 nPrfx
, /// namespace prefix
208 const OUString
& sLocalName
, /// element name w/o prefix
209 sal_uInt16 nToken
); /// element token
213 virtual void StartElement(
214 const ::com::sun::star::uno::Reference
<
215 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
217 /// process attribute values
218 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
219 const OUString
& sAttrValue
) SAL_OVERRIDE
;
221 /// prepare XTextField for insertion into document
222 virtual void PrepareField(
223 const ::com::sun::star::uno::Reference
<
224 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
227 /** inherit sender field because of fixed attribute in ProcessAttributes */
228 class XMLAuthorFieldImportContext
: public XMLSenderFieldImportContext
230 bool bAuthorFullName
;
231 const OUString sServiceAuthor
;
232 const OUString sPropertyAuthorFullName
;
233 const OUString sPropertyFixed
;
234 const OUString sPropertyContent
;
239 XMLAuthorFieldImportContext(
240 SvXMLImport
& rImport
, /// XML Import
241 XMLTextImportHelper
& rHlp
, /// Text import helper
242 sal_uInt16 nPrfx
, /// namespace prefix
243 const OUString
& sLocalName
, /// element name w/o prefix
244 sal_uInt16 nToken
); /// element token
248 virtual void StartElement(
249 const ::com::sun::star::uno::Reference
<
250 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
252 /// prepare XTextField for insertion into document
253 virtual void PrepareField(
254 const ::com::sun::star::uno::Reference
<
255 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
258 class XMLPlaceholderFieldImportContext
: public XMLTextFieldImportContext
260 const OUString sPropertyPlaceholderType
;
261 const OUString sPropertyPlaceholder
;
262 const OUString sPropertyHint
;
264 OUString sDescription
;
266 sal_Int16 nPlaceholderType
;
271 XMLPlaceholderFieldImportContext(
272 SvXMLImport
& rImport
, /// XML Import
273 XMLTextImportHelper
& rHlp
, /// Text import helper
274 sal_uInt16 nPrfx
, /// namespace prefix
275 const OUString
& sLocalName
); /// element name w/o prefix
278 /// process attribute values
279 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
280 const OUString
& sAttrValue
) SAL_OVERRIDE
;
282 /// prepare XTextField for insertion into document
283 virtual void PrepareField(
284 const ::com::sun::star::uno::Reference
<
285 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
288 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
291 const OUString sPropertyNumberFormat
;
292 const OUString sPropertyFixed
;
293 const OUString sPropertyDateTimeValue
;
294 const OUString sPropertyDateTime
;
295 const OUString sPropertyAdjust
;
296 const OUString sPropertyIsDate
;
297 const OUString sPropertyIsFixedLanguage
;
299 ::com::sun::star::util::DateTime aDateTimeValue
;
301 sal_Int32 nFormatKey
;
305 bool bIsDate
; // is this a date?
306 // (for XMLDateFieldImportContext, really)
307 bool bIsDefaultLanguage
;
312 XMLTimeFieldImportContext(
313 SvXMLImport
& rImport
, /// XML Import
314 XMLTextImportHelper
& rHlp
, /// Text import helper
315 sal_uInt16 nPrfx
, /// namespace prefix
316 const OUString
& sLocalName
); /// element name w/o prefix
318 /// process attribute values
319 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
320 const OUString
& sAttrValue
) SAL_OVERRIDE
;
322 /// prepare XTextField for insertion into document
323 virtual void PrepareField(
324 const ::com::sun::star::uno::Reference
<
325 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
328 /** import date fields (<text:date>);
329 inherit from TimeField to reuse implementation */
330 class XMLDateFieldImportContext
: public XMLTimeFieldImportContext
335 XMLDateFieldImportContext(
336 SvXMLImport
& rImport
, /// XML Import
337 XMLTextImportHelper
& rHlp
, /// Text import helper
338 sal_uInt16 nPrfx
, /// namespace prefix
339 const OUString
& sLocalName
); /// element name w/o prefix
341 /// process attribute values
342 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
343 const OUString
& sAttrValue
) SAL_OVERRIDE
;
346 /** import page continuation fields (<text:page-continuation-string>) */
347 class XMLPageContinuationImportContext
: public XMLTextFieldImportContext
349 const OUString sPropertySubType
;
350 const OUString sPropertyUserText
;
351 const OUString sPropertyNumberingType
;
353 OUString sString
; /// continuation string
354 com::sun::star::text::PageNumberType eSelectPage
; /// previous, current
356 bool sStringOK
; /// continuation string encountered?
361 XMLPageContinuationImportContext(
362 SvXMLImport
& rImport
, /// XML Import
363 XMLTextImportHelper
& rHlp
, /// Text import helper
364 sal_uInt16 nPrfx
, /// namespace prefix
365 const OUString
& sLocalName
); /// element name w/o prefix
367 /// process attribute values
368 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
369 const OUString
& sAttrValue
) SAL_OVERRIDE
;
371 /// prepare XTextField for insertion into document
372 virtual void PrepareField(
373 const ::com::sun::star::uno::Reference
<
374 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
377 /** import page number fields (<text:page-number>) */
378 class XMLPageNumberImportContext
: public XMLTextFieldImportContext
380 const OUString sPropertySubType
;
381 const OUString sPropertyNumberingType
;
382 const OUString sPropertyOffset
;
384 OUString sNumberFormat
;
385 OUString sNumberSync
;
386 sal_Int16 nPageAdjust
;
387 com::sun::star::text::PageNumberType eSelectPage
; /// previous, current
389 bool sNumberFormatOK
;
394 XMLPageNumberImportContext(
395 SvXMLImport
& rImport
, /// XML Import
396 XMLTextImportHelper
& rHlp
, /// Text import helper
397 sal_uInt16 nPrfx
, /// namespace prefix
398 const OUString
& sLocalName
); /// element name w/o prefix
401 /// process attribute values
402 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
403 const OUString
& sAttrValue
) SAL_OVERRIDE
;
405 /// prepare XTextField for insertion into document
406 virtual void PrepareField(
407 const ::com::sun::star::uno::Reference
<
408 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
411 /** superclass for database fields: handle database and table names */
412 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
414 const OUString sPropertyDataBaseName
;
415 const OUString sPropertyDataBaseURL
;
416 const OUString sPropertyTableName
;
417 const OUString sPropertyDataCommandType
;
418 const OUString sPropertyIsVisible
;
420 OUString sDatabaseName
;
421 OUString sDatabaseURL
;
424 sal_Int32 nCommandType
;
433 bool bDatabaseNameOK
;
437 /// protected constructor: only for subclasses
438 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
439 XMLTextImportHelper
& rHlp
,
440 const sal_Char
* pServiceName
,
442 const OUString
& sLocalName
,
448 /// process attribute values
449 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
450 const OUString
& sAttrValue
) SAL_OVERRIDE
;
452 /// prepare XTextField for insertion into document
453 virtual void PrepareField(
454 const ::com::sun::star::uno::Reference
<
455 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
457 /// handle database-location children
458 virtual SvXMLImportContext
*CreateChildContext(
460 const OUString
& rLocalName
,
461 const ::com::sun::star::uno::Reference
<
462 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
465 /** import database name fields (<text:database-name>) */
466 class XMLDatabaseNameImportContext
: public XMLDatabaseFieldImportContext
471 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
472 XMLTextImportHelper
& rHlp
,
474 const OUString
& sLocalName
);
476 /// process attribute values
477 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
478 const OUString
& sAttrValue
) SAL_OVERRIDE
;
481 /** import database next fields (<text:database-next>) */
482 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
484 const OUString sPropertyCondition
;
485 const OUString sTrue
;
490 // for use in child classes
491 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
492 XMLTextImportHelper
& rHlp
,
493 const sal_Char
* pServiceName
,
495 const OUString
& sLocalName
);
500 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
501 XMLTextImportHelper
& rHlp
,
503 const OUString
& sLocalName
);
505 /// process attribute values
506 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
507 const OUString
& sAttrValue
) SAL_OVERRIDE
;
509 /// prepare XTextField for insertion into document
510 virtual void PrepareField(
511 const ::com::sun::star::uno::Reference
<
512 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
515 /** import database select fields (<text:database-select>) */
516 class XMLDatabaseSelectImportContext
: public XMLDatabaseNextImportContext
518 const OUString sPropertySetNumber
;
525 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
526 XMLTextImportHelper
& rHlp
,
528 const OUString
& sLocalName
);
530 /// process attribute values
531 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
532 const OUString
& sAttrValue
) SAL_OVERRIDE
;
534 /// prepare XTextField for insertion into document
535 virtual void PrepareField(
536 const ::com::sun::star::uno::Reference
<
537 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
540 /** import database display number fields (<text:database-row-number>) */
541 class XMLDatabaseNumberImportContext
: public XMLDatabaseFieldImportContext
543 const OUString sPropertyNumberingType
;
544 const OUString sPropertySetNumber
;
545 OUString sNumberFormat
;
546 OUString sNumberSync
;
553 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
554 XMLTextImportHelper
& rHlp
,
556 const OUString
& sLocalName
);
558 /// process attribute values
559 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
560 const OUString
& sAttrValue
) SAL_OVERRIDE
;
562 /// prepare XTextField for insertion into document
563 virtual void PrepareField(
564 const ::com::sun::star::uno::Reference
<
565 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
568 /** import docinfo fields with only fixed attribute */
569 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
571 const OUString sPropertyFixed
;
572 const OUString sPropertyContent
;
573 const OUString sPropertyAuthor
;
574 const OUString sPropertyCurrentPresentation
;
584 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
585 XMLTextImportHelper
& rHlp
,
587 const OUString
& sLocalName
,
593 /// process attribute values
594 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
595 const OUString
& sAttrValue
) SAL_OVERRIDE
;
597 /// prepare XTextField for insertion into document
598 virtual void PrepareField(
599 const ::com::sun::star::uno::Reference
<
600 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
602 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
605 /** import docinfo fields with date or time attributes and numberformats */
606 class XMLDateTimeDocInfoImportContext
: public XMLSimpleDocInfoImportContext
608 const OUString sPropertyNumberFormat
;
609 const OUString sPropertyIsDate
;
610 const OUString sPropertyIsFixedLanguage
;
616 bool bIsDefaultLanguage
;
621 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
622 XMLTextImportHelper
& rHlp
,
624 const OUString
& sLocalName
,
628 /// process attribute values
629 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
630 const OUString
& sAttrValue
) SAL_OVERRIDE
;
632 /// prepare XTextField for insertion into document
633 virtual void PrepareField(
634 const ::com::sun::star::uno::Reference
<
635 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
638 /** import revision field (<text:editing-cycles>) */
639 class XMLRevisionDocInfoImportContext
: public XMLSimpleDocInfoImportContext
641 const OUString sPropertyRevision
;
646 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
647 XMLTextImportHelper
& rHlp
,
649 const OUString
& sLocalName
,
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
) SAL_OVERRIDE
;
659 /** import user docinfo field (<text:user-defined>) */
660 class XMLUserDocInfoImportContext
: public XMLSimpleDocInfoImportContext
663 const OUString sPropertyName
;
664 const OUString sPropertyNumberFormat
;
665 const OUString sPropertyIsFixedLanguage
;
668 bool bIsDefaultLanguage
;
673 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
674 XMLTextImportHelper
& rHlp
,
676 const OUString
& sLocalName
,
680 /// process attribute values
681 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
682 const OUString
& sAttrValue
) SAL_OVERRIDE
;
683 virtual void PrepareField(
684 const ::com::sun::star::uno::Reference
<
685 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
688 /** import hidden paragraph fields (<text:hidden-paragraph>) */
689 class XMLHiddenParagraphImportContext
: public XMLTextFieldImportContext
691 const OUString sPropertyCondition
;
692 const OUString sPropertyIsHidden
;
700 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
701 XMLTextImportHelper
& rHlp
,
703 const OUString
& sLocalName
);
706 /// process attribute values
707 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
708 const OUString
& sAttrValue
) SAL_OVERRIDE
;
710 /// prepare XTextField for insertion into document
711 virtual void PrepareField(
712 const ::com::sun::star::uno::Reference
<
713 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
716 /** import conditional text fields (<text:conditional-text>) */
717 class XMLConditionalTextImportContext
: public XMLTextFieldImportContext
719 const OUString sPropertyCondition
;
720 const OUString sPropertyTrueContent
;
721 const OUString sPropertyFalseContent
;
722 const OUString sPropertyIsConditionTrue
;
723 const OUString sPropertyCurrentPresentation
;
726 OUString sTrueContent
;
727 OUString sFalseContent
;
737 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
738 XMLTextImportHelper
& rHlp
,
740 const OUString
& sLocalName
);
743 /// process attribute values
744 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
745 const OUString
& sAttrValue
) SAL_OVERRIDE
;
747 /// prepare XTextField for insertion into document
748 virtual void PrepareField(
749 const ::com::sun::star::uno::Reference
<
750 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
753 /** import conditional text fields (<text:hidden-text>) */
754 class XMLHiddenTextImportContext
: public XMLTextFieldImportContext
756 const OUString sPropertyCondition
;
757 const OUString sPropertyContent
;
758 const OUString sPropertyIsHidden
;
770 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
771 XMLTextImportHelper
& rHlp
,
773 const OUString
& sLocalName
);
776 /// process attribute values
777 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
778 const OUString
& sAttrValue
) SAL_OVERRIDE
;
780 /// prepare XTextField for insertion into document
781 virtual void PrepareField(
782 const ::com::sun::star::uno::Reference
<
783 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
786 /** import file name fields (<text:file-name>) */
787 class XMLFileNameImportContext
: public XMLTextFieldImportContext
789 const OUString sPropertyFixed
;
790 const OUString sPropertyFileFormat
;
791 const OUString sPropertyCurrentPresentation
;
799 XMLFileNameImportContext(SvXMLImport
& rImport
,
800 XMLTextImportHelper
& rHlp
,
802 const OUString
& sLocalName
);
805 /// process attribute values
806 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
807 const OUString
& sAttrValue
) SAL_OVERRIDE
;
809 /// prepare XTextField for insertion into document
810 virtual void PrepareField(
811 const ::com::sun::star::uno::Reference
<
812 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
815 /** import document template name fields (<text:template-name>) */
816 class XMLTemplateNameImportContext
: public XMLTextFieldImportContext
818 const OUString sPropertyFileFormat
;
825 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
826 XMLTextImportHelper
& rHlp
,
828 const OUString
& sLocalName
);
831 /// process attribute values
832 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
833 const OUString
& sAttrValue
) SAL_OVERRIDE
;
835 /// prepare XTextField for insertion into document
836 virtual void PrepareField(
837 const ::com::sun::star::uno::Reference
<
838 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
841 /** import chapter fields (<text:chapter>) */
842 class XMLChapterImportContext
: public XMLTextFieldImportContext
844 const OUString sPropertyChapterFormat
;
845 const OUString sPropertyLevel
;
853 XMLChapterImportContext(SvXMLImport
& rImport
,
854 XMLTextImportHelper
& rHlp
,
856 const OUString
& sLocalName
);
859 /// process attribute values
860 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
861 const OUString
& sAttrValue
) SAL_OVERRIDE
;
863 /// prepare XTextField for insertion into document
864 virtual void PrepareField(
865 const ::com::sun::star::uno::Reference
<
866 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
869 /** import count fields (<text:[XXX]-count>) */
870 class XMLCountFieldImportContext
: public XMLTextFieldImportContext
872 const OUString sPropertyNumberingType
;
874 OUString sNumberFormat
;
875 OUString sLetterSync
;
877 bool bNumberFormatOK
;
882 XMLCountFieldImportContext(SvXMLImport
& rImport
,
883 XMLTextImportHelper
& rHlp
,
885 const OUString
& sLocalName
,
889 /// process attribute values
890 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
891 const OUString
& sAttrValue
) SAL_OVERRIDE
;
893 /// prepare XTextField for insertion into document
894 virtual void PrepareField(
895 const ::com::sun::star::uno::Reference
<
896 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
898 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
901 /** import page variable fields (<text:get-page-variable>) */
902 class XMLPageVarGetFieldImportContext
: public XMLTextFieldImportContext
904 const OUString sPropertyNumberingType
;
906 OUString sNumberFormat
;
907 OUString sLetterSync
;
909 bool bNumberFormatOK
;
914 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
915 XMLTextImportHelper
& rHlp
,
917 const OUString
& sLocalName
);
920 /// process attribute values
921 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
922 const OUString
& sAttrValue
) SAL_OVERRIDE
;
924 /// prepare XTextField for insertion into document
925 virtual void PrepareField(
926 const ::com::sun::star::uno::Reference
<
927 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
930 /** import page variable fields (<text:get-page-variable>) */
931 class XMLPageVarSetFieldImportContext
: public XMLTextFieldImportContext
933 const OUString sPropertyOn
;
934 const OUString sPropertyOffset
;
942 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
943 XMLTextImportHelper
& rHlp
,
945 const OUString
& sLocalName
);
948 /// process attribute values
949 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
950 const OUString
& sAttrValue
) SAL_OVERRIDE
;
952 /// prepare XTextField for insertion into document
953 virtual void PrepareField(
954 const ::com::sun::star::uno::Reference
<
955 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
958 /** import macro fields (<text:execute-macro>) */
959 class XMLMacroFieldImportContext
: public XMLTextFieldImportContext
961 const OUString sPropertyHint
;
962 const OUString sPropertyMacroName
;
963 const OUString sPropertyScriptURL
;
965 OUString sDescription
;
966 SvXMLImportContextRef xEventContext
;
968 OUString sMacro
; // macro for old documents (pre 638i)
975 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
976 XMLTextImportHelper
& rHlp
,
978 const OUString
& sLocalName
);
981 /// for <office:events> children
982 virtual SvXMLImportContext
*CreateChildContext(
984 const OUString
& rLocalName
,
985 const ::com::sun::star::uno::Reference
<
986 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
988 /// process attribute values
989 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
990 const OUString
& sAttrValue
) SAL_OVERRIDE
;
992 /// prepare XTextField for insertion into document
993 virtual void PrepareField(
994 const ::com::sun::star::uno::Reference
<
995 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
998 /** import reference fields (<text:reference-get>) */
999 class XMLReferenceFieldImportContext
: public XMLTextFieldImportContext
1001 const OUString sPropertyReferenceFieldPart
;
1002 const OUString sPropertyReferenceFieldSource
;
1003 const OUString sPropertySourceName
;
1004 const OUString sPropertyCurrentPresentation
;
1007 sal_uInt16 nElementToken
;
1015 TYPEINFO_OVERRIDE();
1017 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
1018 XMLTextImportHelper
& rHlp
,
1021 const OUString
& sLocalName
);
1025 virtual void StartElement(
1026 const ::com::sun::star::uno::Reference
<
1027 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
1029 /// process attribute values
1030 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1031 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1033 /// prepare XTextField for insertion into document
1034 virtual void PrepareField(
1035 const ::com::sun::star::uno::Reference
<
1036 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1039 /** import dde field declaration container (<text:dde-connection-decls>) */
1040 class XMLDdeFieldDeclsImportContext
: public SvXMLImportContext
1042 SvXMLTokenMap aTokenMap
;
1045 TYPEINFO_OVERRIDE();
1047 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
1049 const OUString
& sLocalName
);
1051 virtual SvXMLImportContext
*CreateChildContext(
1053 const OUString
& rLocalName
,
1054 const ::com::sun::star::uno::Reference
<
1055 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
1058 /** import dde field declaration (<text:dde-connection-decl>) */
1059 class XMLDdeFieldDeclImportContext
: public SvXMLImportContext
1061 const OUString sPropertyIsAutomaticUpdate
;
1062 const OUString sPropertyName
;
1063 const OUString sPropertyDDECommandType
;
1064 const OUString sPropertyDDECommandFile
;
1065 const OUString sPropertyDDECommandElement
;
1067 const SvXMLTokenMap
& rTokenMap
;
1070 TYPEINFO_OVERRIDE();
1072 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
1074 const OUString
& sLocalName
,
1075 const SvXMLTokenMap
& rMap
);
1077 // create fieldmaster
1078 virtual void StartElement(
1079 const ::com::sun::star::uno::Reference
<
1080 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
1083 /** import dde fields (<text:dde-connection>) */
1084 class XMLDdeFieldImportContext
: public XMLTextFieldImportContext
1087 OUString sPropertyContent
;
1090 TYPEINFO_OVERRIDE();
1092 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
1093 XMLTextImportHelper
& rHlp
,
1095 const OUString
& sLocalName
);
1098 /// process attribute values
1099 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1100 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1102 /// create textfield, attach master, and insert into document
1103 virtual void EndElement() SAL_OVERRIDE
;
1106 virtual void PrepareField(
1107 const ::com::sun::star::uno::Reference
<
1108 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1111 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1112 class XMLSheetNameImportContext
: public XMLTextFieldImportContext
1116 TYPEINFO_OVERRIDE();
1118 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1119 XMLTextImportHelper
& rHlp
,
1121 const OUString
& sLocalName
);
1124 /// no attributes -> empty method
1125 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1126 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1128 /// no attributes -> empty method
1129 virtual void PrepareField(
1130 const ::com::sun::star::uno::Reference
<
1131 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1134 /** import page|slide name fields (<text:page-name>) */
1135 class XMLPageNameFieldImportContext
: public XMLTextFieldImportContext
1138 TYPEINFO_OVERRIDE();
1140 XMLPageNameFieldImportContext(
1141 SvXMLImport
& rImport
, /// XML Import
1142 XMLTextImportHelper
& rHlp
, /// Text import helper
1143 sal_uInt16 nPrfx
, /// namespace prefix
1144 const OUString
& sLocalName
); /// element name w/o prefix
1146 /// process attribute values
1147 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1148 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1150 /// prepare XTextField for insertion into document
1151 virtual void PrepareField(
1152 const ::com::sun::star::uno::Reference
<
1153 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1156 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1157 class XMLUrlFieldImportContext
: public XMLTextFieldImportContext
1159 const OUString sPropertyURL
;
1160 const OUString sPropertyTargetFrame
;
1161 const OUString sPropertyRepresentation
;
1168 TYPEINFO_OVERRIDE();
1170 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1171 XMLTextImportHelper
& rHlp
,
1173 const OUString
& sLocalName
);
1176 /// no attributes -> empty method
1177 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1178 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1180 /// no attributes -> empty method
1181 virtual void PrepareField(
1182 const ::com::sun::star::uno::Reference
<
1183 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1186 /** import bibliography info fields (<text:bibliography-mark>) */
1187 class XMLBibliographyFieldImportContext
: public XMLTextFieldImportContext
1189 const OUString sPropertyFields
;
1191 ::std::vector
< ::com::sun::star::beans::PropertyValue
> aValues
;
1194 TYPEINFO_OVERRIDE();
1196 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1197 XMLTextImportHelper
& rHlp
,
1199 const OUString
& sLocalName
);
1202 /// process attributes (fill aValues)
1203 virtual void StartElement(
1204 const ::com::sun::star::uno::Reference
<
1205 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
) SAL_OVERRIDE
;
1207 /// empty method; all attributes are handled in StartElement
1208 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1209 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1211 /// convert aValues into sequence and set property
1212 virtual void PrepareField(
1213 const ::com::sun::star::uno::Reference
<
1214 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1216 static const sal_Char
* MapBibliographyFieldName(const OUString
& sName
);
1219 /** Import an annotation field (<text:annotation>) */
1220 class XMLAnnotationImportContext
: public XMLTextFieldImportContext
1222 const OUString sPropertyAuthor
;
1223 const OUString sPropertyInitials
;
1224 const OUString sPropertyContent
;
1225 const OUString sPropertyDate
;
1226 const OUString sPropertyTextRange
;
1227 const OUString sPropertyName
;
1229 OUStringBuffer aAuthorBuffer
;
1230 OUStringBuffer aInitialsBuffer
;
1232 OUStringBuffer aTextBuffer
;
1233 OUStringBuffer aDateBuffer
;
1235 com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySet
> mxField
;
1236 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxCursor
;
1237 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxOldCursor
;
1239 sal_uInt16 m_nToken
;
1242 TYPEINFO_OVERRIDE();
1244 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1245 XMLTextImportHelper
& rHlp
,
1248 const OUString
& sLocalName
);
1251 /// process attributes
1252 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1253 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1256 virtual void PrepareField(
1257 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1259 virtual SvXMLImportContext
*CreateChildContext(
1261 const OUString
& rLocalName
,
1262 const ::com::sun::star::uno::Reference
<
1263 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
1264 virtual void EndElement() SAL_OVERRIDE
;
1267 /** Import a script field (<text:script>) */
1268 class XMLScriptImportContext
: public XMLTextFieldImportContext
1270 const OUString sPropertyScriptType
;
1271 const OUString sPropertyURLContent
;
1272 const OUString sPropertyContent
;
1275 OUString sScriptType
;
1281 TYPEINFO_OVERRIDE();
1283 XMLScriptImportContext(SvXMLImport
& rImport
,
1284 XMLTextImportHelper
& rHlp
,
1286 const OUString
& sLocalName
);
1289 /// process attributes
1290 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1291 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1294 virtual void PrepareField(
1295 const ::com::sun::star::uno::Reference
<
1296 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1299 /** import measure fields (<text:measure>) */
1300 class XMLMeasureFieldImportContext
: public XMLTextFieldImportContext
1305 TYPEINFO_OVERRIDE();
1307 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1308 XMLTextImportHelper
& rHlp
,
1310 const OUString
& sLocalName
);
1313 /// process attribute values
1314 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1315 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1317 /// prepare XTextField for insertion into document
1318 virtual void PrepareField(
1319 const ::com::sun::star::uno::Reference
<
1320 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1323 /** dropdown field (filter legacy) */
1324 class XMLDropDownFieldImportContext
: public XMLTextFieldImportContext
1326 std::vector
<OUString
> aLabels
;
1330 sal_Int32 nSelected
;
1335 const OUString sPropertyItems
;
1336 const OUString sPropertySelectedItem
;
1337 const OUString sPropertyName
;
1338 const OUString sPropertyHelp
;
1339 const OUString sPropertyToolTip
;
1342 TYPEINFO_OVERRIDE();
1344 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1345 XMLTextImportHelper
& rHlp
,
1347 const OUString
& sLocalName
);
1349 virtual SvXMLImportContext
* CreateChildContext(
1351 const OUString
& rLocalName
,
1352 const ::com::sun::star::uno::Reference
<com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
1355 /// process attribute values
1356 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1357 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1359 /// prepare XTextField for insertion into document
1360 virtual void PrepareField(
1361 const ::com::sun::star::uno::Reference
<
1362 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1365 /** import header fields (<draw:header>) */
1366 class XMLHeaderFieldImportContext
: public XMLTextFieldImportContext
1369 TYPEINFO_OVERRIDE();
1371 XMLHeaderFieldImportContext(
1372 SvXMLImport
& rImport
, /// XML Import
1373 XMLTextImportHelper
& rHlp
, /// Text import helper
1374 sal_uInt16 nPrfx
, /// namespace prefix
1375 const OUString
& sLocalName
); /// element name w/o prefix
1377 /// process attribute values
1378 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1379 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1381 /// prepare XTextField for insertion into document
1382 virtual void PrepareField(
1383 const ::com::sun::star::uno::Reference
<
1384 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1387 /** import footer fields (<draw:footer>) */
1388 class XMLFooterFieldImportContext
: public XMLTextFieldImportContext
1391 TYPEINFO_OVERRIDE();
1393 XMLFooterFieldImportContext(
1394 SvXMLImport
& rImport
, /// XML Import
1395 XMLTextImportHelper
& rHlp
, /// Text import helper
1396 sal_uInt16 nPrfx
, /// namespace prefix
1397 const OUString
& sLocalName
); /// element name w/o prefix
1399 /// process attribute values
1400 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1401 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1403 /// prepare XTextField for insertion into document
1404 virtual void PrepareField(
1405 const ::com::sun::star::uno::Reference
<
1406 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1409 /** import footer fields (<draw:date-and-time>) */
1410 class XMLDateTimeFieldImportContext
: public XMLTextFieldImportContext
1413 TYPEINFO_OVERRIDE();
1415 XMLDateTimeFieldImportContext(
1416 SvXMLImport
& rImport
, /// XML Import
1417 XMLTextImportHelper
& rHlp
, /// Text import helper
1418 sal_uInt16 nPrfx
, /// namespace prefix
1419 const OUString
& sLocalName
); /// element name w/o prefix
1421 /// process attribute values
1422 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1423 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1425 /// prepare XTextField for insertion into document
1426 virtual void PrepareField(
1427 const ::com::sun::star::uno::Reference
<
1428 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1431 class XMLCustomPropertyFieldImportContext
: public XMLTextFieldImportContext
1434 ::com::sun::star::uno::Any aValue
;
1435 const OUString sPropertyName
;
1436 const OUString sPropertyValue
;
1439 TYPEINFO_OVERRIDE();
1441 XMLCustomPropertyFieldImportContext (SvXMLImport
& rImport
,
1442 XMLTextImportHelper
& rHlp
,
1444 const OUString
& sLocalName
);
1447 /// process attribute values
1448 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1449 const OUString
& sAttrValue
) SAL_OVERRIDE
;
1451 /// prepare XTextField for insertion into document
1452 virtual void PrepareField(
1453 const ::com::sun::star::uno::Reference
<
1454 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) SAL_OVERRIDE
;
1459 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */