1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 * import of all text fields
23 * (except variable related + database display field: see txtvfldi.hxx)
26 #ifndef INCLUDED_XMLOFF_INC_TXTFLDI_HXX
27 #define INCLUDED_XMLOFF_INC_TXTFLDI_HXX
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <com/sun/star/text/PageNumberType.hpp>
32 #include <com/sun/star/util/DateTime.hpp>
33 #include <xmloff/xmlictxt.hxx>
34 #include <xmloff/txtimp.hxx>
35 #include <xmloff/xmltkmap.hxx>
36 #include <rtl/ustrbuf.hxx>
39 namespace com::sun::star
{
40 namespace xml::sax
{ class XAttributeList
; }
41 namespace text
{ class XTextField
; }
42 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
46 class XMLTextImportHelper
;
49 /// abstract class for text field import
50 class XMLTextFieldImportContext
: public SvXMLImportContext
53 OUStringBuffer sContentBuffer
; /// collect character data
54 OUString sContent
; /// character data after collection
55 OUString sServiceName
; /// service name for text field
56 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
59 OUString sServicePrefix
;
61 // data members for use in subclasses
62 bool bValid
; /// whether this field is valid ?
66 XMLTextFieldImportContext(
67 SvXMLImport
& rImport
, /// XML Import
68 XMLTextImportHelper
& rHlp
, /// Text import helper
69 const char* pService
, /// name of SO API service
70 sal_uInt16 nPrfx
, /// namespace prefix
71 const OUString
& rLocalName
); /// element name w/o prefix
73 /// process character data: will be collected in member sContentBuffer
74 virtual void SAL_CALL
characters( const OUString
& sContent
) override
;
76 /// parses attributes and calls ProcessAttribute
77 virtual void SAL_CALL
startFastElement(
79 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
81 /// create XTextField and insert into document; calls PrepareTextField
82 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
84 /// create the appropriate field context from
85 /// (for use in paragraph import)
86 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
88 XMLTextImportHelper
& rHlp
,
90 const OUString
& rName
,
95 XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
97 const OUString
& GetServiceName() const { return sServiceName
; }
98 void SetServiceName(const OUString
& sStr
) { sServiceName
= sStr
; }
100 OUString
const & GetContent();
102 /// process attribute values
103 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
104 const OUString
& sAttrValue
) = 0;
106 /// prepare XTextField for insertion into document
107 virtual void PrepareField(
108 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) = 0;
110 /// create field from ServiceName
111 bool CreateField(css::uno::Reference
< css::beans::XPropertySet
> & xField
,
112 const OUString
& sServiceName
);
114 /// force an update of the field's value
115 /// call update on optional XUpdatable interface; (disable Fixed property)
116 static void ForceUpdate(
117 const css::uno::Reference
< css::beans::XPropertySet
> & rPropertySet
);
120 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
123 sal_Int16 nSubType
; /// API subtype for ExtUser field
125 const OUString sPropertyFixed
;
126 const OUString sPropertyContent
;
129 // variables for access in subclass
134 XMLSenderFieldImportContext(
135 SvXMLImport
& rImport
, /// XML Import
136 XMLTextImportHelper
& rHlp
, /// Text import helper
137 sal_uInt16 nPrfx
, /// namespace prefix
138 const OUString
& sLocalName
); /// element name w/o prefix
142 virtual void SAL_CALL
startFastElement(
144 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
146 /// process attribute values
147 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
148 const OUString
& sAttrValue
) override
;
150 /// prepare XTextField for insertion into document
151 virtual void PrepareField(
152 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
155 /** inherit sender field because of fixed attribute in ProcessAttributes */
156 class XMLAuthorFieldImportContext final
: public XMLSenderFieldImportContext
158 bool bAuthorFullName
;
159 const OUString sPropertyFixed
;
160 const OUString sPropertyContent
;
164 XMLAuthorFieldImportContext(
165 SvXMLImport
& rImport
, /// XML Import
166 XMLTextImportHelper
& rHlp
, /// Text import helper
167 sal_uInt16 nPrfx
, /// namespace prefix
168 const OUString
& sLocalName
); /// element name w/o prefix
172 virtual void SAL_CALL
startFastElement(
174 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
176 /// process attribute values
177 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
178 const OUString
& sAttrValue
) override
;
180 /// prepare XTextField for insertion into document
181 virtual void PrepareField(
182 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
185 class XMLPlaceholderFieldImportContext final
: public XMLTextFieldImportContext
187 const OUString sPropertyHint
;
189 OUString sDescription
;
191 sal_Int16 nPlaceholderType
;
195 XMLPlaceholderFieldImportContext(
196 SvXMLImport
& rImport
, /// XML Import
197 XMLTextImportHelper
& rHlp
, /// Text import helper
198 sal_uInt16 nPrfx
, /// namespace prefix
199 const OUString
& sLocalName
); /// element name w/o prefix
202 /// process attribute values
203 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
204 const OUString
& sAttrValue
) override
;
206 /// prepare XTextField for insertion into document
207 virtual void PrepareField(
208 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
211 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
214 const OUString sPropertyNumberFormat
;
215 const OUString sPropertyFixed
;
216 const OUString sPropertyDateTimeValue
;
217 const OUString sPropertyDateTime
;
218 const OUString sPropertyIsDate
;
219 const OUString sPropertyIsFixedLanguage
;
221 css::util::DateTime aDateTimeValue
;
223 sal_Int32 nFormatKey
;
227 bool bIsDate
; // is this a date?
228 // (for XMLDateFieldImportContext, really)
229 bool bIsDefaultLanguage
;
233 XMLTimeFieldImportContext(
234 SvXMLImport
& rImport
, /// XML Import
235 XMLTextImportHelper
& rHlp
, /// Text import helper
236 sal_uInt16 nPrfx
, /// namespace prefix
237 const OUString
& sLocalName
); /// element name w/o prefix
239 /// process attribute values
240 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
241 const OUString
& sAttrValue
) override
;
243 /// prepare XTextField for insertion into document
244 virtual void PrepareField(
245 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
248 /** import date fields (<text:date>);
249 inherit from TimeField to reuse implementation */
250 class XMLDateFieldImportContext final
: public XMLTimeFieldImportContext
254 XMLDateFieldImportContext(
255 SvXMLImport
& rImport
, /// XML Import
256 XMLTextImportHelper
& rHlp
, /// Text import helper
257 sal_uInt16 nPrfx
, /// namespace prefix
258 const OUString
& sLocalName
); /// element name w/o prefix
260 /// process attribute values
261 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
262 const OUString
& sAttrValue
) override
;
265 /** import page continuation fields (<text:page-continuation-string>) */
266 class XMLPageContinuationImportContext final
: public XMLTextFieldImportContext
268 const OUString sPropertySubType
;
269 const OUString sPropertyNumberingType
;
271 OUString sString
; /// continuation string
272 css::text::PageNumberType eSelectPage
; /// previous, current
274 bool sStringOK
; /// continuation string encountered?
278 XMLPageContinuationImportContext(
279 SvXMLImport
& rImport
, /// XML Import
280 XMLTextImportHelper
& rHlp
, /// Text import helper
281 sal_uInt16 nPrfx
, /// namespace prefix
282 const OUString
& sLocalName
); /// element name w/o prefix
284 /// process attribute values
285 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
286 const OUString
& sAttrValue
) override
;
288 /// prepare XTextField for insertion into document
289 virtual void PrepareField(
290 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
293 /** import page number fields (<text:page-number>) */
294 class XMLPageNumberImportContext final
: public XMLTextFieldImportContext
296 const OUString sPropertySubType
;
297 const OUString sPropertyNumberingType
;
298 const OUString sPropertyOffset
;
300 OUString sNumberFormat
;
301 OUString sNumberSync
;
302 sal_Int16 nPageAdjust
;
303 css::text::PageNumberType eSelectPage
; /// previous, current
305 bool sNumberFormatOK
;
309 XMLPageNumberImportContext(
310 SvXMLImport
& rImport
, /// XML Import
311 XMLTextImportHelper
& rHlp
, /// Text import helper
312 sal_uInt16 nPrfx
, /// namespace prefix
313 const OUString
& sLocalName
); /// element name w/o prefix
316 /// process attribute values
317 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
318 const OUString
& sAttrValue
) override
;
320 /// prepare XTextField for insertion into document
321 virtual void PrepareField(
322 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
325 /** superclass for database fields: handle database and table names */
326 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
328 OUString m_sDatabaseName
;
329 OUString m_sDatabaseURL
;
330 OUString m_sTableName
;
332 sal_Int32 m_nCommandType
;
333 bool m_bCommandTypeOK
;
341 bool m_bDatabaseNameOK
;
342 bool m_bDatabaseURLOK
;
345 /// protected constructor: only for subclasses
346 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
347 XMLTextImportHelper
& rHlp
,
348 const char* pServiceName
,
350 const OUString
& sLocalName
,
355 /// process attribute values
356 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
357 const OUString
& sAttrValue
) override
;
359 /// prepare XTextField for insertion into document
360 virtual void PrepareField(
361 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
363 /// handle database-location children
364 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
366 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
369 /** import database name fields (<text:database-name>) */
370 class XMLDatabaseNameImportContext final
: public XMLDatabaseFieldImportContext
374 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
375 XMLTextImportHelper
& rHlp
,
377 const OUString
& sLocalName
);
379 /// process attribute values
380 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
381 const OUString
& sAttrValue
) override
;
384 /** import database next fields (<text:database-next>) */
385 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
387 const OUString sPropertyCondition
;
388 const OUString sTrue
;
393 // for use in child classes
394 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
395 XMLTextImportHelper
& rHlp
,
396 const char* pServiceName
,
398 const OUString
& sLocalName
);
402 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
403 XMLTextImportHelper
& rHlp
,
405 const OUString
& sLocalName
);
407 /// process attribute values
408 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
409 const OUString
& sAttrValue
) override
;
411 /// prepare XTextField for insertion into document
412 virtual void PrepareField(
413 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
416 /** import database select fields (<text:database-select>) */
417 class XMLDatabaseSelectImportContext final
: public XMLDatabaseNextImportContext
419 const OUString sPropertySetNumber
;
425 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
426 XMLTextImportHelper
& rHlp
,
428 const OUString
& sLocalName
);
430 /// process attribute values
431 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
432 const OUString
& sAttrValue
) override
;
434 /// prepare XTextField for insertion into document
435 virtual void PrepareField(
436 const css::uno::Reference
<
437 css::beans::XPropertySet
> & xPropertySet
) override
;
440 /** import database display number fields (<text:database-row-number>) */
441 class XMLDatabaseNumberImportContext final
: public XMLDatabaseFieldImportContext
443 const OUString sPropertyNumberingType
;
444 const OUString sPropertySetNumber
;
445 OUString sNumberFormat
;
446 OUString sNumberSync
;
452 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
453 XMLTextImportHelper
& rHlp
,
455 const OUString
& sLocalName
);
457 /// process attribute values
458 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
459 const OUString
& sAttrValue
) override
;
461 /// prepare XTextField for insertion into document
462 virtual void PrepareField(
463 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
466 /** import docinfo fields with only fixed attribute */
467 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
469 const OUString sPropertyFixed
;
470 const OUString sPropertyContent
;
471 const OUString sPropertyAuthor
;
472 const OUString sPropertyCurrentPresentation
;
481 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
482 XMLTextImportHelper
& rHlp
,
484 const OUString
& sLocalName
,
490 /// process attribute values
491 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
492 const OUString
& sAttrValue
) override
;
494 /// prepare XTextField for insertion into document
495 virtual void PrepareField(
496 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
498 static const char* MapTokenToServiceName(sal_uInt16 nToken
);
501 /** import docinfo fields with date or time attributes and numberformats */
502 class XMLDateTimeDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
504 const OUString sPropertyNumberFormat
;
505 const OUString sPropertyIsDate
;
506 const OUString sPropertyIsFixedLanguage
;
512 bool bIsDefaultLanguage
;
516 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
517 XMLTextImportHelper
& rHlp
,
519 const OUString
& sLocalName
,
523 /// process attribute values
524 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
525 const OUString
& sAttrValue
) override
;
527 /// prepare XTextField for insertion into document
528 virtual void PrepareField(
529 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
532 /** import revision field (<text:editing-cycles>) */
533 class XMLRevisionDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
537 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
538 XMLTextImportHelper
& rHlp
,
540 const OUString
& sLocalName
,
544 /// prepare XTextField for insertion into document
545 virtual void PrepareField(
546 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
549 /** import user docinfo field (<text:user-defined>) */
550 class XMLUserDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
553 const OUString sPropertyName
;
554 const OUString sPropertyNumberFormat
;
555 const OUString sPropertyIsFixedLanguage
;
558 bool bIsDefaultLanguage
;
562 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
563 XMLTextImportHelper
& rHlp
,
565 const OUString
& sLocalName
,
569 /// process attribute values
570 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
571 const OUString
& sAttrValue
) override
;
572 virtual void PrepareField(
573 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
576 /** import hidden paragraph fields (<text:hidden-paragraph>) */
577 class XMLHiddenParagraphImportContext final
: public XMLTextFieldImportContext
579 const OUString sPropertyCondition
;
580 const OUString sPropertyIsHidden
;
587 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
588 XMLTextImportHelper
& rHlp
,
590 const OUString
& sLocalName
);
593 /// process attribute values
594 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
595 const OUString
& sAttrValue
) override
;
597 /// prepare XTextField for insertion into document
598 virtual void PrepareField(
599 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
602 /** import conditional text fields (<text:conditional-text>) */
603 class XMLConditionalTextImportContext final
: public XMLTextFieldImportContext
605 const OUString sPropertyCondition
;
606 const OUString sPropertyCurrentPresentation
;
609 OUString sTrueContent
;
610 OUString sFalseContent
;
619 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
620 XMLTextImportHelper
& rHlp
,
622 const OUString
& sLocalName
);
625 /// process attribute values
626 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
627 const OUString
& sAttrValue
) override
;
629 /// prepare XTextField for insertion into document
630 virtual void PrepareField(
631 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
634 /** import conditional text fields (<text:hidden-text>) */
635 class XMLHiddenTextImportContext final
: public XMLTextFieldImportContext
637 const OUString sPropertyCondition
;
638 const OUString sPropertyContent
;
639 const OUString sPropertyIsHidden
;
650 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
651 XMLTextImportHelper
& rHlp
,
653 const OUString
& sLocalName
);
656 /// process attribute values
657 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
658 const OUString
& sAttrValue
) override
;
660 /// prepare XTextField for insertion into document
661 virtual void PrepareField(
662 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
665 /** import file name fields (<text:file-name>) */
666 class XMLFileNameImportContext final
: public XMLTextFieldImportContext
668 const OUString sPropertyFixed
;
669 const OUString sPropertyFileFormat
;
670 const OUString sPropertyCurrentPresentation
;
677 XMLFileNameImportContext(SvXMLImport
& rImport
,
678 XMLTextImportHelper
& rHlp
,
680 const OUString
& sLocalName
);
683 /// process attribute values
684 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
685 const OUString
& sAttrValue
) override
;
687 /// prepare XTextField for insertion into document
688 virtual void PrepareField(
689 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
692 /** import document template name fields (<text:template-name>) */
693 class XMLTemplateNameImportContext final
: public XMLTextFieldImportContext
695 const OUString sPropertyFileFormat
;
701 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
702 XMLTextImportHelper
& rHlp
,
704 const OUString
& sLocalName
);
707 /// process attribute values
708 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
709 const OUString
& sAttrValue
) override
;
711 /// prepare XTextField for insertion into document
712 virtual void PrepareField(
713 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
716 /** import chapter fields (<text:chapter>) */
717 class XMLChapterImportContext final
: public XMLTextFieldImportContext
724 XMLChapterImportContext(SvXMLImport
& rImport
,
725 XMLTextImportHelper
& rHlp
,
727 const OUString
& sLocalName
);
730 /// process attribute values
731 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
732 const OUString
& sAttrValue
) override
;
734 /// prepare XTextField for insertion into document
735 virtual void PrepareField(
736 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
739 /** import count fields (<text:[XXX]-count>) */
740 class XMLCountFieldImportContext final
: public XMLTextFieldImportContext
742 const OUString sPropertyNumberingType
;
744 OUString sNumberFormat
;
745 OUString sLetterSync
;
747 bool bNumberFormatOK
;
751 XMLCountFieldImportContext(SvXMLImport
& rImport
,
752 XMLTextImportHelper
& rHlp
,
754 const OUString
& sLocalName
,
758 /// process attribute values
759 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
760 const OUString
& sAttrValue
) override
;
762 /// prepare XTextField for insertion into document
763 virtual void PrepareField(
764 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
766 static const char* MapTokenToServiceName(sal_uInt16 nToken
);
769 /** import page variable fields (<text:get-page-variable>) */
770 class XMLPageVarGetFieldImportContext final
: public XMLTextFieldImportContext
772 OUString sNumberFormat
;
773 OUString sLetterSync
;
775 bool bNumberFormatOK
;
779 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
780 XMLTextImportHelper
& rHlp
,
782 const OUString
& sLocalName
);
785 /// process attribute values
786 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
787 const OUString
& sAttrValue
) override
;
789 /// prepare XTextField for insertion into document
790 virtual void PrepareField(
791 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
794 /** import page variable fields (<text:get-page-variable>) */
795 class XMLPageVarSetFieldImportContext final
: public XMLTextFieldImportContext
802 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
803 XMLTextImportHelper
& rHlp
,
805 const OUString
& sLocalName
);
808 /// process attribute values
809 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
810 const OUString
& sAttrValue
) override
;
812 /// prepare XTextField for insertion into document
813 virtual void PrepareField(
814 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
817 /** import macro fields (<text:execute-macro>) */
818 class XMLMacroFieldImportContext final
: public XMLTextFieldImportContext
820 OUString sDescription
;
821 rtl::Reference
<XMLEventsImportContext
> xEventContext
;
823 OUString sMacro
; // macro for old documents (pre 638i)
829 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
830 XMLTextImportHelper
& rHlp
,
832 const OUString
& sLocalName
);
835 /// for <office:events> children
836 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
838 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
840 /// process attribute values
841 virtual void ProcessAttribute( sal_Int32 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
;
849 /** import reference fields (<text:reference-get>) */
850 class XMLReferenceFieldImportContext final
: public XMLTextFieldImportContext
854 sal_uInt16 nElementToken
;
863 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
864 XMLTextImportHelper
& rHlp
,
867 const OUString
& sLocalName
);
871 virtual void SAL_CALL
startFastElement(
873 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
875 /// process attribute values
876 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
877 const OUString
& sAttrValue
) override
;
879 /// prepare XTextField for insertion into document
880 virtual void PrepareField(
881 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
884 /** import dde field declaration container (<text:dde-connection-decls>) */
885 class XMLDdeFieldDeclsImportContext final
: public SvXMLImportContext
889 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
,
891 const OUString
& sLocalName
);
893 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
895 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
898 /** import dde field declaration (<text:dde-connection-decl>) */
899 class XMLDdeFieldDeclImportContext final
: public SvXMLImportContext
903 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
);
905 // create fieldmaster
906 virtual void SAL_CALL
startFastElement(
908 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
911 /** import dde fields (<text:dde-connection>) */
912 class XMLDdeFieldImportContext final
: public XMLTextFieldImportContext
915 OUString sPropertyContent
;
919 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
920 XMLTextImportHelper
& rHlp
,
922 const OUString
& sLocalName
);
925 /// process attribute values
926 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
927 const OUString
& sAttrValue
) override
;
929 /// create textfield, attach master, and insert into document
930 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
933 virtual void PrepareField(
934 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
937 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
938 class XMLSheetNameImportContext final
: public XMLTextFieldImportContext
943 XMLSheetNameImportContext(SvXMLImport
& rImport
,
944 XMLTextImportHelper
& rHlp
,
946 const OUString
& sLocalName
);
949 /// no attributes -> empty method
950 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
951 const OUString
& sAttrValue
) override
;
953 /// no attributes -> empty method
954 virtual void PrepareField(
955 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
958 /** import page|slide name fields (<text:page-name>) */
959 class XMLPageNameFieldImportContext final
: public XMLTextFieldImportContext
963 XMLPageNameFieldImportContext(
964 SvXMLImport
& rImport
, /// XML Import
965 XMLTextImportHelper
& rHlp
, /// Text import helper
966 sal_uInt16 nPrfx
, /// namespace prefix
967 const OUString
& sLocalName
); /// element name w/o prefix
969 /// process attribute values
970 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
971 const OUString
& sAttrValue
) override
;
973 /// prepare XTextField for insertion into document
974 virtual void PrepareField(
975 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
978 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
979 class XMLUrlFieldImportContext final
: public XMLTextFieldImportContext
987 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
988 XMLTextImportHelper
& rHlp
,
990 const OUString
& sLocalName
);
993 /// no attributes -> empty method
994 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
995 const OUString
& sAttrValue
) override
;
997 /// no attributes -> empty method
998 virtual void PrepareField(
999 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1002 /** import bibliography info fields (<text:bibliography-mark>) */
1003 class XMLBibliographyFieldImportContext final
: public XMLTextFieldImportContext
1005 ::std::vector
< css::beans::PropertyValue
> aValues
;
1009 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
1010 XMLTextImportHelper
& rHlp
,
1012 const OUString
& sLocalName
);
1015 /// process attributes (fill aValues)
1016 virtual void SAL_CALL
startFastElement(
1018 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
1020 /// empty method; all attributes are handled in startFastElement
1021 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1022 const OUString
& sAttrValue
) override
;
1024 /// convert aValues into sequence and set property
1025 virtual void PrepareField(
1026 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1028 static const char* MapBibliographyFieldName(const OUString
& sName
);
1031 /** Import an annotation field (<text:annotation>) */
1032 class XMLAnnotationImportContext final
: public XMLTextFieldImportContext
1034 OUStringBuffer aAuthorBuffer
;
1035 OUStringBuffer aInitialsBuffer
;
1037 OUStringBuffer aTextBuffer
;
1038 OUStringBuffer aDateBuffer
;
1041 css::uno::Reference
< css::beans::XPropertySet
> mxField
;
1042 css::uno::Reference
< css::text::XTextCursor
> mxCursor
;
1043 css::uno::Reference
< css::text::XTextCursor
> mxOldCursor
;
1045 sal_uInt16 m_nToken
;
1049 XMLAnnotationImportContext(SvXMLImport
& rImport
,
1050 XMLTextImportHelper
& rHlp
,
1053 const OUString
& sLocalName
);
1056 /// process attributes
1057 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1058 const OUString
& sAttrValue
) override
;
1061 virtual void PrepareField(
1062 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
1064 virtual SvXMLImportContextRef
CreateChildContext(
1066 const OUString
& rLocalName
,
1067 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
1068 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
1071 /** Import a script field (<text:script>) */
1072 class XMLScriptImportContext final
: public XMLTextFieldImportContext
1075 OUString sScriptType
;
1081 XMLScriptImportContext(SvXMLImport
& rImport
,
1082 XMLTextImportHelper
& rHlp
,
1084 const OUString
& sLocalName
);
1087 /// process attributes
1088 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1089 const OUString
& sAttrValue
) override
;
1092 virtual void PrepareField(
1093 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1096 /** import measure fields (<text:measure>) */
1097 class XMLMeasureFieldImportContext final
: public XMLTextFieldImportContext
1103 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1104 XMLTextImportHelper
& rHlp
,
1106 const OUString
& sLocalName
);
1109 /// process attribute values
1110 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1111 const OUString
& sAttrValue
) override
;
1113 /// prepare XTextField for insertion into document
1114 virtual void PrepareField(
1115 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1118 /** dropdown field (filter legacy) */
1119 class XMLDropDownFieldImportContext final
: public XMLTextFieldImportContext
1121 std::vector
<OUString
> aLabels
;
1125 sal_Int32 nSelected
;
1132 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1133 XMLTextImportHelper
& rHlp
,
1135 const OUString
& sLocalName
);
1137 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
1138 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
1141 /// process attribute values
1142 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1143 const OUString
& sAttrValue
) override
;
1145 /// prepare XTextField for insertion into document
1146 virtual void PrepareField(
1147 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1150 /** import header fields (<draw:header>) */
1151 class XMLHeaderFieldImportContext final
: public XMLTextFieldImportContext
1155 XMLHeaderFieldImportContext(
1156 SvXMLImport
& rImport
, /// XML Import
1157 XMLTextImportHelper
& rHlp
, /// Text import helper
1158 sal_uInt16 nPrfx
, /// namespace prefix
1159 const OUString
& sLocalName
); /// element name w/o prefix
1161 /// process attribute values
1162 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1163 const OUString
& sAttrValue
) override
;
1165 /// prepare XTextField for insertion into document
1166 virtual void PrepareField(
1167 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1170 /** import footer fields (<draw:footer>) */
1171 class XMLFooterFieldImportContext final
: public XMLTextFieldImportContext
1175 XMLFooterFieldImportContext(
1176 SvXMLImport
& rImport
, /// XML Import
1177 XMLTextImportHelper
& rHlp
, /// Text import helper
1178 sal_uInt16 nPrfx
, /// namespace prefix
1179 const OUString
& sLocalName
); /// element name w/o prefix
1181 /// process attribute values
1182 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1183 const OUString
& sAttrValue
) override
;
1185 /// prepare XTextField for insertion into document
1186 virtual void PrepareField(
1187 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1190 /** import footer fields (<draw:date-and-time>) */
1191 class XMLDateTimeFieldImportContext final
: public XMLTextFieldImportContext
1195 XMLDateTimeFieldImportContext(
1196 SvXMLImport
& rImport
, /// XML Import
1197 XMLTextImportHelper
& rHlp
, /// Text import helper
1198 sal_uInt16 nPrfx
, /// namespace prefix
1199 const OUString
& sLocalName
); /// element name w/o prefix
1201 /// process attribute values
1202 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1203 const OUString
& sAttrValue
) override
;
1205 /// prepare XTextField for insertion into document
1206 virtual void PrepareField(
1207 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */