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 _XMLOFF_TXTFLDI_HXX
27 #define _XMLOFF_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>
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
; }
48 class XMLTextImportHelper
;
54 enum XMLTextFieldAttrTokens
56 XML_TOK_TEXTFIELD_FIXED
= 0,
57 XML_TOK_TEXTFIELD_DESCRIPTION
,
58 XML_TOK_TEXTFIELD_HELP
,
59 XML_TOK_TEXTFIELD_HINT
,
60 XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE
,
61 XML_TOK_TEXTFIELD_TIME_ADJUST
,
62 XML_TOK_TEXTFIELD_DATE_ADJUST
,
63 XML_TOK_TEXTFIELD_PAGE_ADJUST
,
64 XML_TOK_TEXTFIELD_SELECT_PAGE
,
65 XML_TOK_TEXTFIELD_ACTIVE
,
67 XML_TOK_TEXTFIELD_NAME
,
68 XML_TOK_TEXTFIELD_FORMULA
,
69 XML_TOK_TEXTFIELD_NUM_FORMAT
,
70 XML_TOK_TEXTFIELD_NUM_LETTER_SYNC
,
71 XML_TOK_TEXTFIELD_DISPLAY_FORMULA
,
72 XML_TOK_TEXTFIELD_NUMBERING_LEVEL
,
73 XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR
,
74 XML_TOK_TEXTFIELD_DISPLAY
,
75 XML_TOK_TEXTFIELD_OUTLINE_LEVEL
,
77 XML_TOK_TEXTFIELD_VALUE_TYPE
,
78 XML_TOK_TEXTFIELD_VALUE
,
79 XML_TOK_TEXTFIELD_STRING_VALUE
,
80 XML_TOK_TEXTFIELD_DATE_VALUE
,
81 XML_TOK_TEXTFIELD_TIME_VALUE
,
82 XML_TOK_TEXTFIELD_BOOL_VALUE
,
83 XML_TOK_TEXTFIELD_CURRENCY
,
84 XML_TOK_TEXTFIELD_DATA_STYLE_NAME
,
86 XML_TOK_TEXTFIELD_DATABASE_NAME
,
87 XML_TOK_TEXTFIELD_TABLE_NAME
,
88 XML_TOK_TEXTFIELD_COLUMN_NAME
,
89 XML_TOK_TEXTFIELD_ROW_NUMBER
,
90 XML_TOK_TEXTFIELD_CONDITION
,
91 XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE
,
92 XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE
,
93 XML_TOK_TEXTFIELD_REVISION
,
94 XML_TOK_TEXTFIELD_IS_HIDDEN
,
95 XML_TOK_TEXTFIELD_CURRENT_VALUE
,
97 XML_TOK_TEXTFIELD_REFERENCE_FORMAT
,
98 XML_TOK_TEXTFIELD_REF_NAME
,
99 XML_TOK_TEXTFIELD_CONNECTION_NAME
,
101 XML_TOK_TEXTFIELD_HREF
,
102 XML_TOK_TEXTFIELD_TARGET_FRAME
,
104 XML_TOK_TEXTFIELD_OFFICE_CREATE_DATE
,
105 XML_TOK_TEXTFIELD_OFFICE_AUTHOR
,
106 XML_TOK_TEXTFIELD_ANNOTATION
,
107 XML_TOK_TEXTFIELD_LANGUAGE
,
109 XML_TOK_TEXTFIELD_MEASURE_KIND
,
110 XML_TOK_TEXTFIELD_TABLE_TYPE
,
112 XML_TOK_TEXTFIELD_NOTE_CLASS
,
114 XML_TOK_TEXTFIELD_UNKNOWN
121 /// abstract class for text field import
122 class XMLTextFieldImportContext
: public SvXMLImportContext
124 const OUString sIsFixed
;
127 OUStringBuffer sContentBuffer
; /// collect character data
128 OUString sContent
; /// character data after collection
129 OUString sServiceName
; /// service name for text field
130 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
133 OUString sServicePrefix
;
135 // data members for use in subclasses
136 sal_Bool bValid
; /// ist dieses Feld gültig?
142 XMLTextFieldImportContext(
143 SvXMLImport
& rImport
, /// XML Import
144 XMLTextImportHelper
& rHlp
, /// Text import helper
145 const sal_Char
* pService
, /// name of SO API service
146 sal_uInt16 nPrfx
, /// namespace prefix
147 const OUString
& rLocalName
); /// element name w/o prefix
149 virtual ~XMLTextFieldImportContext();
151 /// process character data: will be collected in member sContentBuffer
152 virtual void Characters( const OUString
& sContent
);
154 /// parses attributes and calls ProcessAttribute
155 virtual void StartElement(
156 const ::com::sun::star::uno::Reference
<
157 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
159 /// create XTextField and insert into document; calls PrepareTextField
160 virtual void EndElement();
162 /// create the appropriate field context from
163 /// (for use in paragraph import)
164 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
165 SvXMLImport
& rImport
,
166 XMLTextImportHelper
& rHlp
,
168 const OUString
& rName
,
175 inline XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
177 inline OUString
GetServiceName() { return sServiceName
; }
178 inline void SetServiceName(OUString sStr
) { sServiceName
= sStr
; }
180 OUString
GetContent();
182 /// process attribute values
183 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
184 const OUString
& sAttrValue
) = 0;
186 /// prepare XTextField for insertion into document
187 virtual void PrepareField(
188 const ::com::sun::star::uno::Reference
<
189 ::com::sun::star::beans::XPropertySet
> & xPropertySet
) = 0;
191 /// create field from ServiceName
192 sal_Bool
CreateField(::com::sun::star::uno::Reference
<
193 ::com::sun::star::beans::XPropertySet
> & xField
,
194 const OUString
& sServiceName
);
196 /// force an update of the field's value
197 /// call update on optional XUptadeable interface; (disable Fixed property)
199 const ::com::sun::star::uno::Reference
<
200 ::com::sun::star::beans::XPropertySet
> & rPropertySet
);
205 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
208 sal_Int16 nSubType
; /// API subtype for ExtUser field
210 const OUString sEmpty
; /// empty string
211 const OUString sPropertyFixed
;
212 const OUString sPropertyFieldSubType
;
213 const OUString sPropertyContent
;
217 // variables for access in subclass
219 sal_uInt16 nElementToken
; /// token for this elment field
225 XMLSenderFieldImportContext(
226 SvXMLImport
& rImport
, /// XML Import
227 XMLTextImportHelper
& rHlp
, /// Text import helper
228 sal_uInt16 nPrfx
, /// namespace prefix
229 const OUString
& sLocalName
, /// element name w/o prefix
230 sal_uInt16 nToken
); /// element token
235 virtual void StartElement(
236 const ::com::sun::star::uno::Reference
<
237 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
239 /// process attribute values
240 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
241 const OUString
& sAttrValue
);
243 /// prepare XTextField for insertion into document
244 virtual void PrepareField(
245 const ::com::sun::star::uno::Reference
<
246 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
250 /** inherit sender field because of fixed attribute in ProcessAttributes */
251 class XMLAuthorFieldImportContext
: public XMLSenderFieldImportContext
254 sal_Bool bAuthorFullName
;
255 const OUString sServiceAuthor
;
256 const OUString sPropertyAuthorFullName
;
257 const OUString sPropertyFixed
;
258 const OUString sPropertyContent
;
264 XMLAuthorFieldImportContext(
265 SvXMLImport
& rImport
, /// XML Import
266 XMLTextImportHelper
& rHlp
, /// Text import helper
267 sal_uInt16 nPrfx
, /// namespace prefix
268 const OUString
& sLocalName
, /// element name w/o prefix
269 sal_uInt16 nToken
); /// element token
274 virtual void StartElement(
275 const ::com::sun::star::uno::Reference
<
276 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
278 /// prepare XTextField for insertion into document
279 virtual void PrepareField(
280 const ::com::sun::star::uno::Reference
<
281 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
286 class XMLPlaceholderFieldImportContext
: public XMLTextFieldImportContext
289 const OUString sEmpty
; /// empty string
290 const OUString sServiceJumpEdit
;
291 const OUString sPropertyPlaceholderType
;
292 const OUString sPropertyPlaceholder
;
293 const OUString sPropertyHint
;
295 OUString sDescription
;
297 sal_Int16 nPlaceholderType
;
303 XMLPlaceholderFieldImportContext(
304 SvXMLImport
& rImport
, /// XML Import
305 XMLTextImportHelper
& rHlp
, /// Text import helper
306 sal_uInt16 nPrfx
, /// namespace prefix
307 const OUString
& sLocalName
); /// element name w/o prefix
311 /// process attribute values
312 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
313 const OUString
& sAttrValue
);
315 /// prepare XTextField for insertion into document
316 virtual void PrepareField(
317 const ::com::sun::star::uno::Reference
<
318 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
321 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
325 const OUString sPropertyNumberFormat
;
326 const OUString sPropertyFixed
;
327 const OUString sPropertyDateTimeValue
;
328 const OUString sPropertyDateTime
;
329 const OUString sPropertyAdjust
;
330 const OUString sPropertyIsDate
;
331 const OUString sPropertyIsFixedLanguage
;
334 ::com::sun::star::util::DateTime aDateTimeValue
;
336 sal_Int32 nFormatKey
;
340 sal_Bool bIsDate
; // is this a date?
341 // (for XMLDateFieldImportContext, really)
342 sal_Bool bIsDefaultLanguage
;
348 XMLTimeFieldImportContext(
349 SvXMLImport
& rImport
, /// XML Import
350 XMLTextImportHelper
& rHlp
, /// Text import helper
351 sal_uInt16 nPrfx
, /// namespace prefix
352 const OUString
& sLocalName
); /// element name w/o prefix
354 /// process attribute values
355 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
356 const OUString
& sAttrValue
);
358 /// prepare XTextField for insertion into document
359 virtual void PrepareField(
360 const ::com::sun::star::uno::Reference
<
361 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
365 /** import date fields (<text:date>);
366 inherit from TimeField to reuse implementation */
367 class XMLDateFieldImportContext
: public XMLTimeFieldImportContext
374 XMLDateFieldImportContext(
375 SvXMLImport
& rImport
, /// XML Import
376 XMLTextImportHelper
& rHlp
, /// Text import helper
377 sal_uInt16 nPrfx
, /// namespace prefix
378 const OUString
& sLocalName
); /// element name w/o prefix
380 /// process attribute values
381 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
382 const OUString
& sAttrValue
);
386 /** import page continuation fields (<text:page-continuation-string>) */
387 class XMLPageContinuationImportContext
: public XMLTextFieldImportContext
389 const OUString sPropertySubType
;
390 const OUString sPropertyUserText
;
391 const OUString sPropertyNumberingType
;
393 OUString sString
; /// continuation string
394 com::sun::star::text::PageNumberType eSelectPage
; /// previous, current
396 sal_Bool sStringOK
; /// continuation string encountered?
402 XMLPageContinuationImportContext(
403 SvXMLImport
& rImport
, /// XML Import
404 XMLTextImportHelper
& rHlp
, /// Text import helper
405 sal_uInt16 nPrfx
, /// namespace prefix
406 const OUString
& sLocalName
); /// element name w/o prefix
409 /// process attribute values
410 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
411 const OUString
& sAttrValue
);
413 /// prepare XTextField for insertion into document
414 virtual void PrepareField(
415 const ::com::sun::star::uno::Reference
<
416 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
420 /** import page number fields (<text:page-number>) */
421 class XMLPageNumberImportContext
: public XMLTextFieldImportContext
423 const OUString sPropertySubType
;
424 const OUString sPropertyNumberingType
;
425 const OUString sPropertyOffset
;
427 OUString sNumberFormat
;
428 OUString sNumberSync
;
429 sal_Int16 nPageAdjust
;
430 com::sun::star::text::PageNumberType eSelectPage
; /// previous, current
432 sal_Bool sNumberFormatOK
;
438 XMLPageNumberImportContext(
439 SvXMLImport
& rImport
, /// XML Import
440 XMLTextImportHelper
& rHlp
, /// Text import helper
441 sal_uInt16 nPrfx
, /// namespace prefix
442 const OUString
& sLocalName
); /// element name w/o prefix
445 /// process attribute values
446 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
447 const OUString
& sAttrValue
);
449 /// prepare XTextField for insertion into document
450 virtual void PrepareField(
451 const ::com::sun::star::uno::Reference
<
452 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
456 /** superclass for database fields: handle database and table names */
457 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
459 const OUString sPropertyDataBaseName
;
460 const OUString sPropertyDataBaseURL
;
461 const OUString sPropertyTableName
;
462 const OUString sPropertyDataCommandType
;
463 const OUString sPropertyIsVisible
;
465 OUString sDatabaseName
;
466 OUString sDatabaseURL
;
469 sal_Int32 nCommandType
;
470 sal_Bool bCommandTypeOK
;
477 sal_Bool bDatabaseOK
;
478 sal_Bool bDatabaseNameOK
;
479 sal_Bool bDatabaseURLOK
;
482 /// protected constructor: only for subclasses
483 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
484 XMLTextImportHelper
& rHlp
,
485 const sal_Char
* pServiceName
,
487 const OUString
& sLocalName
,
494 /// process attribute values
495 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
496 const OUString
& sAttrValue
);
498 /// prepare XTextField for insertion into document
499 virtual void PrepareField(
500 const ::com::sun::star::uno::Reference
<
501 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
503 /// handle database-location children
504 virtual SvXMLImportContext
*CreateChildContext(
506 const OUString
& rLocalName
,
507 const ::com::sun::star::uno::Reference
<
508 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
511 /** import database name fields (<text:database-name>) */
512 class XMLDatabaseNameImportContext
: public XMLDatabaseFieldImportContext
518 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
519 XMLTextImportHelper
& rHlp
,
521 const OUString
& sLocalName
);
523 /// process attribute values
524 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
525 const OUString
& sAttrValue
);
529 /** import database next fields (<text:database-next>) */
530 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
532 const OUString sPropertyCondition
;
533 const OUString sTrue
;
535 sal_Bool bConditionOK
;
539 // for use in child classes
540 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
541 XMLTextImportHelper
& rHlp
,
542 const sal_Char
* pServiceName
,
544 const OUString
& sLocalName
);
550 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
551 XMLTextImportHelper
& rHlp
,
553 const OUString
& sLocalName
);
555 /// process attribute values
556 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
557 const OUString
& sAttrValue
);
559 /// prepare XTextField for insertion into document
560 virtual void PrepareField(
561 const ::com::sun::star::uno::Reference
<
562 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
567 /** import database select fields (<text:database-select>) */
568 class XMLDatabaseSelectImportContext
: public XMLDatabaseNextImportContext
570 const OUString sPropertySetNumber
;
578 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
579 XMLTextImportHelper
& rHlp
,
581 const OUString
& sLocalName
);
583 /// process attribute values
584 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
585 const OUString
& sAttrValue
);
587 /// prepare XTextField for insertion into document
588 virtual void PrepareField(
589 const ::com::sun::star::uno::Reference
<
590 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
594 /** import database display number fields (<text:database-row-number>) */
595 class XMLDatabaseNumberImportContext
: public XMLDatabaseFieldImportContext
597 const OUString sPropertyNumberingType
;
598 const OUString sPropertySetNumber
;
599 OUString sNumberFormat
;
600 OUString sNumberSync
;
608 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
609 XMLTextImportHelper
& rHlp
,
611 const OUString
& sLocalName
);
613 /// process attribute values
614 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
615 const OUString
& sAttrValue
);
617 /// prepare XTextField for insertion into document
618 virtual void PrepareField(
619 const ::com::sun::star::uno::Reference
<
620 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
624 /** import docinfo fields with only fixed atribute */
625 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
627 const OUString sPropertyFixed
;
628 const OUString sPropertyContent
;
629 const OUString sPropertyAuthor
;
630 const OUString sPropertyCurrentPresentation
;
635 sal_Bool bHasContent
;
641 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
642 XMLTextImportHelper
& rHlp
,
644 const OUString
& sLocalName
,
651 /// process attribute values
652 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
653 const OUString
& sAttrValue
);
655 /// prepare XTextField for insertion into document
656 virtual void PrepareField(
657 const ::com::sun::star::uno::Reference
<
658 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
660 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
665 /** import docinfo fields with date or time attributes and numberformats */
666 class XMLDateTimeDocInfoImportContext
: public XMLSimpleDocInfoImportContext
668 const OUString sPropertyNumberFormat
;
669 const OUString sPropertyIsDate
;
670 const OUString sPropertyIsFixedLanguage
;
675 sal_Bool bHasDateTime
;
676 sal_Bool bIsDefaultLanguage
;
682 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
683 XMLTextImportHelper
& rHlp
,
685 const OUString
& sLocalName
,
690 /// process attribute values
691 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
692 const OUString
& sAttrValue
);
694 /// prepare XTextField for insertion into document
695 virtual void PrepareField(
696 const ::com::sun::star::uno::Reference
<
697 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
702 /** import revision field (<text:editing-cycles>) */
703 class XMLRevisionDocInfoImportContext
: public XMLSimpleDocInfoImportContext
705 const OUString sPropertyRevision
;
711 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
712 XMLTextImportHelper
& rHlp
,
714 const OUString
& sLocalName
,
719 /// prepare XTextField for insertion into document
720 virtual void PrepareField(
721 const ::com::sun::star::uno::Reference
<
722 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
727 /** import user docinfo field (<text:user-defined>) */
728 class XMLUserDocInfoImportContext
: public XMLSimpleDocInfoImportContext
731 const OUString sPropertyName
;
732 const OUString sPropertyNumberFormat
;
733 const OUString sPropertyIsFixedLanguage
;
736 sal_Bool bIsDefaultLanguage
;
742 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
743 XMLTextImportHelper
& rHlp
,
745 const OUString
& sLocalName
,
750 /// process attribute values
751 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
752 const OUString
& sAttrValue
);
753 virtual void PrepareField(
754 const ::com::sun::star::uno::Reference
<
755 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
760 /** import hidden paragraph fields (<text:hidden-paragraph>) */
761 class XMLHiddenParagraphImportContext
: public XMLTextFieldImportContext
763 const OUString sPropertyCondition
;
764 const OUString sPropertyIsHidden
;
773 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
774 XMLTextImportHelper
& rHlp
,
776 const OUString
& sLocalName
);
780 /// process attribute values
781 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
782 const OUString
& sAttrValue
);
784 /// prepare XTextField for insertion into document
785 virtual void PrepareField(
786 const ::com::sun::star::uno::Reference
<
787 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
792 /** import conditional text fields (<text:conditional-text>) */
793 class XMLConditionalTextImportContext
: public XMLTextFieldImportContext
795 const OUString sPropertyCondition
;
796 const OUString sPropertyTrueContent
;
797 const OUString sPropertyFalseContent
;
798 const OUString sPropertyIsConditionTrue
;
799 const OUString sPropertyCurrentPresentation
;
802 OUString sTrueContent
;
803 OUString sFalseContent
;
805 sal_Bool bConditionOK
;
808 sal_Bool bCurrentValue
;
814 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
815 XMLTextImportHelper
& rHlp
,
817 const OUString
& sLocalName
);
821 /// process attribute values
822 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
823 const OUString
& sAttrValue
);
825 /// prepare XTextField for insertion into document
826 virtual void PrepareField(
827 const ::com::sun::star::uno::Reference
<
828 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
833 /** import conditional text fields (<text:hidden-text>) */
834 class XMLHiddenTextImportContext
: public XMLTextFieldImportContext
836 const OUString sPropertyCondition
;
837 const OUString sPropertyContent
;
838 const OUString sPropertyIsHidden
;
843 sal_Bool bConditionOK
;
851 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
852 XMLTextImportHelper
& rHlp
,
854 const OUString
& sLocalName
);
858 /// process attribute values
859 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
860 const OUString
& sAttrValue
);
862 /// prepare XTextField for insertion into document
863 virtual void PrepareField(
864 const ::com::sun::star::uno::Reference
<
865 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
870 /** import file name fields (<text:file-name>) */
871 class XMLFileNameImportContext
: public XMLTextFieldImportContext
873 const OUString sPropertyFixed
;
874 const OUString sPropertyFileFormat
;
875 const OUString sPropertyCurrentPresentation
;
884 XMLFileNameImportContext(SvXMLImport
& rImport
,
885 XMLTextImportHelper
& rHlp
,
887 const OUString
& sLocalName
);
891 /// process attribute values
892 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
893 const OUString
& sAttrValue
);
895 /// prepare XTextField for insertion into document
896 virtual void PrepareField(
897 const ::com::sun::star::uno::Reference
<
898 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
903 /** import document template name fields (<text:template-name>) */
904 class XMLTemplateNameImportContext
: public XMLTextFieldImportContext
906 const OUString sPropertyFileFormat
;
914 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
915 XMLTextImportHelper
& rHlp
,
917 const OUString
& sLocalName
);
921 /// process attribute values
922 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
923 const OUString
& sAttrValue
);
925 /// prepare XTextField for insertion into document
926 virtual void PrepareField(
927 const ::com::sun::star::uno::Reference
<
928 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
932 /** import chapter fields (<text:chapter>) */
933 class XMLChapterImportContext
: public XMLTextFieldImportContext
935 const OUString sPropertyChapterFormat
;
936 const OUString sPropertyLevel
;
945 XMLChapterImportContext(SvXMLImport
& rImport
,
946 XMLTextImportHelper
& rHlp
,
948 const OUString
& sLocalName
);
952 /// process attribute values
953 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
954 const OUString
& sAttrValue
);
956 /// prepare XTextField for insertion into document
957 virtual void PrepareField(
958 const ::com::sun::star::uno::Reference
<
959 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
964 /** import count fields (<text:[XXX]-count>) */
965 class XMLCountFieldImportContext
: public XMLTextFieldImportContext
967 const OUString sPropertyNumberingType
;
969 OUString sNumberFormat
;
970 OUString sLetterSync
;
972 sal_Bool bNumberFormatOK
;
978 XMLCountFieldImportContext(SvXMLImport
& rImport
,
979 XMLTextImportHelper
& rHlp
,
981 const OUString
& sLocalName
,
986 /// process attribute values
987 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
988 const OUString
& sAttrValue
);
990 /// prepare XTextField for insertion into document
991 virtual void PrepareField(
992 const ::com::sun::star::uno::Reference
<
993 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
995 static const sal_Char
* MapTokenToServiceName(sal_uInt16 nToken
);
999 /** import page variable fields (<text:get-page-variable>) */
1000 class XMLPageVarGetFieldImportContext
: public XMLTextFieldImportContext
1002 const OUString sPropertyNumberingType
;
1004 OUString sNumberFormat
;
1005 OUString sLetterSync
;
1007 sal_Bool bNumberFormatOK
;
1013 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
1014 XMLTextImportHelper
& rHlp
,
1016 const OUString
& sLocalName
);
1020 /// process attribute values
1021 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1022 const OUString
& sAttrValue
);
1024 /// prepare XTextField for insertion into document
1025 virtual void PrepareField(
1026 const ::com::sun::star::uno::Reference
<
1027 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1031 /** import page variable fields (<text:get-page-variable>) */
1032 class XMLPageVarSetFieldImportContext
: public XMLTextFieldImportContext
1034 const OUString sPropertyOn
;
1035 const OUString sPropertyOffset
;
1044 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
1045 XMLTextImportHelper
& rHlp
,
1047 const OUString
& sLocalName
);
1051 /// process attribute values
1052 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1053 const OUString
& sAttrValue
);
1055 /// prepare XTextField for insertion into document
1056 virtual void PrepareField(
1057 const ::com::sun::star::uno::Reference
<
1058 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1062 /** import macro fields (<text:execute-macro>) */
1063 class XMLMacroFieldImportContext
: public XMLTextFieldImportContext
1066 const OUString sPropertyHint
;
1067 const OUString sPropertyMacroName
;
1068 const OUString sPropertyScriptURL
;
1069 const OUString sPropertyLibraryName
;
1071 OUString sDescription
;
1072 SvXMLImportContextRef xEventContext
;
1074 OUString sMacro
; // macro for old documents (pre 638i)
1076 sal_Bool bDescriptionOK
;
1082 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
1083 XMLTextImportHelper
& rHlp
,
1085 const OUString
& sLocalName
);
1089 /// for <office:events> children
1090 virtual SvXMLImportContext
*CreateChildContext(
1092 const OUString
& rLocalName
,
1093 const ::com::sun::star::uno::Reference
<
1094 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1096 /// process attribute values
1097 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1098 const OUString
& sAttrValue
);
1100 /// prepare XTextField for insertion into document
1101 virtual void PrepareField(
1102 const ::com::sun::star::uno::Reference
<
1103 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1108 /** import reference fields (<text:reference-get>) */
1109 class XMLReferenceFieldImportContext
: public XMLTextFieldImportContext
1111 const OUString sPropertyReferenceFieldPart
;
1112 const OUString sPropertyReferenceFieldSource
;
1113 const OUString sPropertySourceName
;
1114 const OUString sPropertyCurrentPresentation
;
1117 sal_uInt16 nElementToken
;
1128 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
1129 XMLTextImportHelper
& rHlp
,
1132 const OUString
& sLocalName
);
1137 virtual void StartElement(
1138 const ::com::sun::star::uno::Reference
<
1139 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1141 /// process attribute values
1142 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1143 const OUString
& sAttrValue
);
1145 /// prepare XTextField for insertion into document
1146 virtual void PrepareField(
1147 const ::com::sun::star::uno::Reference
<
1148 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1153 /** import dde field declaration container (<text:dde-connection-decls>) */
1154 class XMLDdeFieldDeclsImportContext
: public SvXMLImportContext
1157 SvXMLTokenMap aTokenMap
;
1163 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
1165 const OUString
& sLocalName
);
1167 virtual SvXMLImportContext
*CreateChildContext(
1169 const OUString
& rLocalName
,
1170 const ::com::sun::star::uno::Reference
<
1171 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1178 /** import dde field declaration (<text:dde-connection-decl>) */
1179 class XMLDdeFieldDeclImportContext
: public SvXMLImportContext
1181 const OUString sPropertyIsAutomaticUpdate
;
1182 const OUString sPropertyName
;
1183 const OUString sPropertyDDECommandType
;
1184 const OUString sPropertyDDECommandFile
;
1185 const OUString sPropertyDDECommandElement
;
1187 const SvXMLTokenMap
& rTokenMap
;
1193 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
,
1195 const OUString
& sLocalName
,
1196 const SvXMLTokenMap
& rMap
);
1198 // create fieldmaster
1199 virtual void StartElement(
1200 const ::com::sun::star::uno::Reference
<
1201 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1206 /** import dde fields (<text:dde-connection>) */
1207 class XMLDdeFieldImportContext
: public XMLTextFieldImportContext
1210 OUString sPropertyContent
;
1215 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
1216 XMLTextImportHelper
& rHlp
,
1218 const OUString
& sLocalName
);
1222 /// process attribute values
1223 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1224 const OUString
& sAttrValue
);
1226 /// create textfield, attach master, and insert into document
1227 virtual void EndElement();
1230 virtual void PrepareField(
1231 const ::com::sun::star::uno::Reference
<
1232 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1237 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
1238 class XMLSheetNameImportContext
: public XMLTextFieldImportContext
1245 XMLSheetNameImportContext(SvXMLImport
& rImport
,
1246 XMLTextImportHelper
& rHlp
,
1248 const OUString
& sLocalName
);
1252 /// no attributes -> empty method
1253 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1254 const OUString
& sAttrValue
);
1256 /// no atributes -> empty method
1257 virtual void PrepareField(
1258 const ::com::sun::star::uno::Reference
<
1259 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1262 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
1263 class XMLUrlFieldImportContext
: public XMLTextFieldImportContext
1266 const OUString sPropertyURL
;
1267 const OUString sPropertyTargetFrame
;
1268 const OUString sPropertyRepresentation
;
1278 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
1279 XMLTextImportHelper
& rHlp
,
1281 const OUString
& sLocalName
);
1285 /// no attributes -> empty method
1286 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1287 const OUString
& sAttrValue
);
1289 /// no atributes -> empty method
1290 virtual void PrepareField(
1291 const ::com::sun::star::uno::Reference
<
1292 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1295 /** import bibliography info fields (<text:bibliography-mark>) */
1296 class XMLBibliographyFieldImportContext
: public XMLTextFieldImportContext
1299 const OUString sPropertyFields
;
1301 ::std::vector
< ::com::sun::star::beans::PropertyValue
> aValues
;
1307 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1308 XMLTextImportHelper
& rHlp
,
1310 const OUString
& sLocalName
);
1314 /// process attributes (fill aValues)
1315 virtual void StartElement(
1316 const ::com::sun::star::uno::Reference
<
1317 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
1319 /// empty method; all attributes are handled in StartElement
1320 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1321 const OUString
& sAttrValue
);
1323 /// convert aValues into sequence and set property
1324 virtual void PrepareField(
1325 const ::com::sun::star::uno::Reference
<
1326 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1328 static const sal_Char
* MapBibliographyFieldName(OUString sName
);
1333 /** Import an annotation field (<text:annotation>) */
1334 class XMLAnnotationImportContext
: public XMLTextFieldImportContext
1336 const OUString sPropertyAuthor
;
1337 const OUString sPropertyInitials
;
1338 const OUString sPropertyContent
;
1339 const OUString sPropertyDate
;
1340 const OUString sPropertyTextRange
;
1341 const OUString sPropertyName
;
1343 OUStringBuffer aAuthorBuffer
;
1344 OUStringBuffer aInitialsBuffer
;
1346 OUStringBuffer aTextBuffer
;
1347 OUStringBuffer aDateBuffer
;
1349 com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySet
> mxField
;
1350 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxCursor
;
1351 com::sun::star::uno::Reference
< com::sun::star::text::XTextCursor
> mxOldCursor
;
1352 /// If this is an annotation end, then position of the start.
1353 com::sun::star::uno::Reference
< com::sun::star::text::XTextContent
> m_xStart
;
1354 sal_uInt16 m_nToken
;
1360 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1361 XMLTextImportHelper
& rHlp
,
1364 const OUString
& sLocalName
);
1368 /// process attributes
1369 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1370 const OUString
& sAttrValue
);
1373 virtual void PrepareField(
1374 const ::com::sun::star::uno::Reference
<
1375 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1377 virtual SvXMLImportContext
*CreateChildContext(
1379 const OUString
& rLocalName
,
1380 const ::com::sun::star::uno::Reference
<
1381 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
1382 virtual void EndElement();
1386 /** Import a script field (<text:script>) */
1387 class XMLScriptImportContext
: public XMLTextFieldImportContext
1389 const OUString sPropertyScriptType
;
1390 const OUString sPropertyURLContent
;
1391 const OUString sPropertyContent
;
1394 OUString sScriptType
;
1396 sal_Bool bContentOK
;
1397 sal_Bool bScriptTypeOK
;
1403 XMLScriptImportContext(SvXMLImport
& rImport
,
1404 XMLTextImportHelper
& rHlp
,
1406 const OUString
& sLocalName
);
1410 /// process attributes
1411 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1412 const OUString
& sAttrValue
);
1415 virtual void PrepareField(
1416 const ::com::sun::star::uno::Reference
<
1417 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1420 /** import measure fields (<text:measure>) */
1421 class XMLMeasureFieldImportContext
: public XMLTextFieldImportContext
1428 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1429 XMLTextImportHelper
& rHlp
,
1431 const OUString
& sLocalName
);
1435 /// process attribute values
1436 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1437 const OUString
& sAttrValue
);
1439 /// prepare XTextField for insertion into document
1440 virtual void PrepareField(
1441 const ::com::sun::star::uno::Reference
<
1442 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1446 /** dropdown field (filter legacy) */
1447 class XMLDropDownFieldImportContext
: public XMLTextFieldImportContext
1449 std::vector
<OUString
> aLabels
;
1453 sal_Int32 nSelected
;
1458 const OUString sPropertyItems
;
1459 const OUString sPropertySelectedItem
;
1460 const OUString sPropertyName
;
1461 const OUString sPropertyHelp
;
1462 const OUString sPropertyToolTip
;
1467 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1468 XMLTextImportHelper
& rHlp
,
1470 const OUString
& sLocalName
);
1472 virtual SvXMLImportContext
* CreateChildContext(
1474 const OUString
& rLocalName
,
1475 const ::com::sun::star::uno::Reference
<com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
1479 /// process attribute values
1480 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1481 const OUString
& sAttrValue
);
1483 /// prepare XTextField for insertion into document
1484 virtual void PrepareField(
1485 const ::com::sun::star::uno::Reference
<
1486 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1489 /** import header fields (<draw:header>) */
1490 class XMLHeaderFieldImportContext
: public XMLTextFieldImportContext
1495 XMLHeaderFieldImportContext(
1496 SvXMLImport
& rImport
, /// XML Import
1497 XMLTextImportHelper
& rHlp
, /// Text import helper
1498 sal_uInt16 nPrfx
, /// namespace prefix
1499 const OUString
& sLocalName
); /// element name w/o prefix
1501 /// process attribute values
1502 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1503 const OUString
& sAttrValue
);
1505 /// prepare XTextField for insertion into document
1506 virtual void PrepareField(
1507 const ::com::sun::star::uno::Reference
<
1508 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1511 /** import footer fields (<draw:footer>) */
1512 class XMLFooterFieldImportContext
: public XMLTextFieldImportContext
1517 XMLFooterFieldImportContext(
1518 SvXMLImport
& rImport
, /// XML Import
1519 XMLTextImportHelper
& rHlp
, /// Text import helper
1520 sal_uInt16 nPrfx
, /// namespace prefix
1521 const OUString
& sLocalName
); /// element name w/o prefix
1523 /// process attribute values
1524 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1525 const OUString
& sAttrValue
);
1527 /// prepare XTextField for insertion into document
1528 virtual void PrepareField(
1529 const ::com::sun::star::uno::Reference
<
1530 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1533 /** import footer fields (<draw:date-and-time>) */
1534 class XMLDateTimeFieldImportContext
: public XMLTextFieldImportContext
1539 XMLDateTimeFieldImportContext(
1540 SvXMLImport
& rImport
, /// XML Import
1541 XMLTextImportHelper
& rHlp
, /// Text import helper
1542 sal_uInt16 nPrfx
, /// namespace prefix
1543 const OUString
& sLocalName
); /// element name w/o prefix
1545 /// process attribute values
1546 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1547 const OUString
& sAttrValue
);
1549 /// prepare XTextField for insertion into document
1550 virtual void PrepareField(
1551 const ::com::sun::star::uno::Reference
<
1552 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1555 class XMLCustomPropertyFieldImportContext
: public XMLTextFieldImportContext
1558 ::com::sun::star::uno::Any aValue
;
1559 const OUString sPropertyName
;
1560 const OUString sPropertyValue
;
1566 XMLCustomPropertyFieldImportContext (SvXMLImport
& rImport
,
1567 XMLTextImportHelper
& rHlp
,
1569 const OUString
& sLocalName
);
1573 /// process attribute values
1574 virtual void ProcessAttribute( sal_uInt16 nAttrToken
,
1575 const OUString
& sAttrValue
);
1577 /// prepare XTextField for insertion into document
1578 virtual void PrepareField(
1579 const ::com::sun::star::uno::Reference
<
1580 ::com::sun::star::beans::XPropertySet
> & xPropertySet
);
1586 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */