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)
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/text/PageNumberType.hpp>
31 #include <com/sun/star/util/DateTime.hpp>
32 #include <xmloff/xmlictxt.hxx>
33 #include <xmloff/txtimp.hxx>
34 #include <xmloff/xmltkmap.hxx>
35 #include <rtl/ustrbuf.hxx>
38 namespace com::sun::star
{
39 namespace xml::sax
{ class XAttributeList
; }
40 namespace text
{ class XTextField
; }
41 namespace beans
{ class XPropertySet
; struct PropertyValue
; }
45 class XMLTextImportHelper
;
48 /// abstract class for text field import
49 class XMLTextFieldImportContext
: public SvXMLImportContext
52 OUStringBuffer sContentBuffer
; /// collect character data
53 OUString sContent
; /// character data after collection
54 OUString sServiceName
; /// service name for text field
55 XMLTextImportHelper
& rTextImportHelper
; /// the import helper
58 OUString sServicePrefix
;
60 // data members for use in subclasses
61 bool bValid
; /// whether this field is valid ?
65 XMLTextFieldImportContext(
66 SvXMLImport
& rImport
, /// XML Import
67 XMLTextImportHelper
& rHlp
, /// Text import helper
68 const OUString
& pService
); /// name of SO API service
70 /// process character data: will be collected in member sContentBuffer
71 virtual void SAL_CALL
characters( const OUString
& sContent
) override
;
73 /// parses attributes and calls ProcessAttribute
74 virtual void SAL_CALL
startFastElement(
76 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
78 /// create XTextField and insert into document; calls PrepareTextField
79 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
81 /// create the appropriate field context from
82 /// (for use in paragraph import)
83 static XMLTextFieldImportContext
* CreateTextFieldImportContext(
85 XMLTextImportHelper
& rHlp
,
90 XMLTextImportHelper
& GetImportHelper() { return rTextImportHelper
; }
92 const OUString
& GetServiceName() const { return sServiceName
; }
93 void SetServiceName(const OUString
& sStr
) { sServiceName
= sStr
; }
95 OUString
const & GetContent();
97 /// process attribute values
98 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
99 std::string_view sAttrValue
) = 0;
101 /// prepare XTextField for insertion into document
102 virtual void PrepareField(
103 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) = 0;
105 /// create field from ServiceName
106 bool CreateField(css::uno::Reference
< css::beans::XPropertySet
> & xField
,
107 const OUString
& sServiceName
);
109 /// force an update of the field's value
110 /// call update on optional XUpdatable interface; (disable Fixed property)
111 static void ForceUpdate(
112 const css::uno::Reference
< css::beans::XPropertySet
> & rPropertySet
);
115 class XMLSenderFieldImportContext
: public XMLTextFieldImportContext
118 sal_Int16 nSubType
; /// API subtype for ExtUser field
120 const OUString sPropertyFixed
;
121 const OUString sPropertyContent
;
124 // variables for access in subclass
129 XMLSenderFieldImportContext(
130 SvXMLImport
& rImport
, /// XML Import
131 XMLTextImportHelper
& rHlp
); /// Text import helper
135 virtual void SAL_CALL
startFastElement(
137 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
139 /// process attribute values
140 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
141 std::string_view sAttrValue
) override
;
143 /// prepare XTextField for insertion into document
144 virtual void PrepareField(
145 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
148 /** inherit sender field because of fixed attribute in ProcessAttributes */
149 class XMLAuthorFieldImportContext final
: public XMLSenderFieldImportContext
151 bool bAuthorFullName
;
152 const OUString sPropertyFixed
;
153 const OUString sPropertyContent
;
157 XMLAuthorFieldImportContext(
158 SvXMLImport
& rImport
, /// XML Import
159 XMLTextImportHelper
& rHlp
); /// Text import helper
163 virtual void SAL_CALL
startFastElement(
165 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
167 /// process attribute values
168 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
169 std::string_view sAttrValue
) override
;
171 /// prepare XTextField for insertion into document
172 virtual void PrepareField(
173 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
176 class XMLPlaceholderFieldImportContext final
: public XMLTextFieldImportContext
178 const OUString sPropertyHint
;
180 OUString sDescription
;
182 sal_Int16 nPlaceholderType
;
186 XMLPlaceholderFieldImportContext(
187 SvXMLImport
& rImport
, /// XML Import
188 XMLTextImportHelper
& rHlp
); /// Text import helper
191 /// process attribute values
192 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
193 std::string_view sAttrValue
) override
;
195 /// prepare XTextField for insertion into document
196 virtual void PrepareField(
197 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
200 class XMLTimeFieldImportContext
: public XMLTextFieldImportContext
203 const OUString sPropertyNumberFormat
;
204 const OUString sPropertyFixed
;
205 const OUString sPropertyDateTimeValue
;
206 const OUString sPropertyDateTime
;
207 const OUString sPropertyIsDate
;
208 const OUString sPropertyIsFixedLanguage
;
210 css::util::DateTime aDateTimeValue
;
212 sal_Int32 nFormatKey
;
216 bool bIsDate
; // is this a date?
217 // (for XMLDateFieldImportContext, really)
218 bool bIsDefaultLanguage
;
222 XMLTimeFieldImportContext(
223 SvXMLImport
& rImport
, /// XML Import
224 XMLTextImportHelper
& rHlp
); /// Text import helper
226 /// process attribute values
227 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
228 std::string_view sAttrValue
) override
;
230 /// prepare XTextField for insertion into document
231 virtual void PrepareField(
232 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
235 /** import date fields (<text:date>);
236 inherit from TimeField to reuse implementation */
237 class XMLDateFieldImportContext final
: public XMLTimeFieldImportContext
241 XMLDateFieldImportContext(
242 SvXMLImport
& rImport
, /// XML Import
243 XMLTextImportHelper
& rHlp
); /// Text import helper
245 /// process attribute values
246 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
247 std::string_view sAttrValue
) override
;
250 /** import page continuation fields (<text:page-continuation-string>) */
251 class XMLPageContinuationImportContext final
: public XMLTextFieldImportContext
253 const OUString sPropertySubType
;
254 const OUString sPropertyNumberingType
;
256 OUString sString
; /// continuation string
257 css::text::PageNumberType eSelectPage
; /// previous, current
259 bool sStringOK
; /// continuation string encountered?
263 XMLPageContinuationImportContext(
264 SvXMLImport
& rImport
, /// XML Import
265 XMLTextImportHelper
& rHlp
); /// Text import helper
267 /// process attribute values
268 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
269 std::string_view sAttrValue
) override
;
271 /// prepare XTextField for insertion into document
272 virtual void PrepareField(
273 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
276 /** import page number fields (<text:page-number>) */
277 class XMLPageNumberImportContext final
: public XMLTextFieldImportContext
279 const OUString sPropertySubType
;
280 const OUString sPropertyNumberingType
;
281 const OUString sPropertyOffset
;
283 OUString sNumberFormat
;
284 OUString sNumberSync
;
285 sal_Int16 nPageAdjust
;
286 css::text::PageNumberType eSelectPage
; /// previous, current
288 bool sNumberFormatOK
;
292 XMLPageNumberImportContext(
293 SvXMLImport
& rImport
, /// XML Import
294 XMLTextImportHelper
& rHlp
); /// Text import helper
297 /// process attribute values
298 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
299 std::string_view sAttrValue
) override
;
301 /// prepare XTextField for insertion into document
302 virtual void PrepareField(
303 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
306 /** superclass for database fields: handle database and table names */
307 class XMLDatabaseFieldImportContext
: public XMLTextFieldImportContext
309 OUString m_sDatabaseName
;
310 OUString m_sDatabaseURL
;
311 OUString m_sTableName
;
313 sal_Int32 m_nCommandType
;
314 bool m_bCommandTypeOK
;
322 bool m_bDatabaseNameOK
;
323 bool m_bDatabaseURLOK
;
326 /// protected constructor: only for subclasses
327 XMLDatabaseFieldImportContext(SvXMLImport
& rImport
,
328 XMLTextImportHelper
& rHlp
,
329 const OUString
& pServiceName
,
334 /// process attribute values
335 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
336 std::string_view sAttrValue
) override
;
338 /// prepare XTextField for insertion into document
339 virtual void PrepareField(
340 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
342 /// handle database-location children
343 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
345 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
348 /** import database name fields (<text:database-name>) */
349 class XMLDatabaseNameImportContext final
: public XMLDatabaseFieldImportContext
353 XMLDatabaseNameImportContext(SvXMLImport
& rImport
,
354 XMLTextImportHelper
& rHlp
);
356 /// process attribute values
357 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
358 std::string_view sAttrValue
) override
;
361 /** import database next fields (<text:database-next>) */
362 class XMLDatabaseNextImportContext
: public XMLDatabaseFieldImportContext
364 const OUString sPropertyCondition
;
365 const OUString sTrue
;
370 // for use in child classes
371 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
372 XMLTextImportHelper
& rHlp
,
373 const OUString
& pServiceName
);
377 XMLDatabaseNextImportContext(SvXMLImport
& rImport
,
378 XMLTextImportHelper
& rHlp
);
380 /// process attribute values
381 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
382 std::string_view sAttrValue
) override
;
384 /// prepare XTextField for insertion into document
385 virtual void PrepareField(
386 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
389 /** import database select fields (<text:database-select>) */
390 class XMLDatabaseSelectImportContext final
: public XMLDatabaseNextImportContext
392 const OUString sPropertySetNumber
;
398 XMLDatabaseSelectImportContext(SvXMLImport
& rImport
,
399 XMLTextImportHelper
& rHlp
);
401 /// process attribute values
402 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
403 std::string_view sAttrValue
) override
;
405 /// prepare XTextField for insertion into document
406 virtual void PrepareField(
407 const css::uno::Reference
<
408 css::beans::XPropertySet
> & xPropertySet
) override
;
411 /** import database display number fields (<text:database-row-number>) */
412 class XMLDatabaseNumberImportContext final
: public XMLDatabaseFieldImportContext
414 const OUString sPropertyNumberingType
;
415 const OUString sPropertySetNumber
;
416 OUString sNumberFormat
;
417 OUString sNumberSync
;
423 XMLDatabaseNumberImportContext(SvXMLImport
& rImport
,
424 XMLTextImportHelper
& rHlp
);
426 /// process attribute values
427 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
428 std::string_view sAttrValue
) override
;
430 /// prepare XTextField for insertion into document
431 virtual void PrepareField(
432 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
435 /** import docinfo fields with only fixed attribute */
436 class XMLSimpleDocInfoImportContext
: public XMLTextFieldImportContext
438 const OUString sPropertyFixed
;
439 const OUString sPropertyContent
;
440 const OUString sPropertyAuthor
;
441 const OUString sPropertyCurrentPresentation
;
450 XMLSimpleDocInfoImportContext(SvXMLImport
& rImport
,
451 XMLTextImportHelper
& rHlp
,
452 sal_Int32 nElementToken
,
457 /// process attribute values
458 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
459 std::string_view sAttrValue
) override
;
461 /// prepare XTextField for insertion into document
462 virtual void PrepareField(
463 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
465 static OUString
MapTokenToServiceName(sal_Int32 nElementToken
);
468 /** import docinfo fields with date or time attributes and numberformats */
469 class XMLDateTimeDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
471 const OUString sPropertyNumberFormat
;
472 const OUString sPropertyIsDate
;
473 const OUString sPropertyIsFixedLanguage
;
479 bool bIsDefaultLanguage
;
483 XMLDateTimeDocInfoImportContext(SvXMLImport
& rImport
,
484 XMLTextImportHelper
& rHlp
,
488 /// process attribute values
489 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
490 std::string_view sAttrValue
) override
;
492 /// prepare XTextField for insertion into document
493 virtual void PrepareField(
494 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
497 /** import revision field (<text:editing-cycles>) */
498 class XMLRevisionDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
502 XMLRevisionDocInfoImportContext(SvXMLImport
& rImport
,
503 XMLTextImportHelper
& rHlp
,
507 /// prepare XTextField for insertion into document
508 virtual void PrepareField(
509 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
512 /** import user docinfo field (<text:user-defined>) */
513 class XMLUserDocInfoImportContext final
: public XMLSimpleDocInfoImportContext
516 const OUString sPropertyName
;
517 const OUString sPropertyNumberFormat
;
518 const OUString sPropertyIsFixedLanguage
;
521 bool bIsDefaultLanguage
;
525 XMLUserDocInfoImportContext(SvXMLImport
& rImport
,
526 XMLTextImportHelper
& rHlp
,
530 /// process attribute values
531 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
532 std::string_view sAttrValue
) override
;
533 virtual void PrepareField(
534 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
537 /** import hidden paragraph fields (<text:hidden-paragraph>) */
538 class XMLHiddenParagraphImportContext final
: public XMLTextFieldImportContext
540 const OUString sPropertyCondition
;
541 const OUString sPropertyIsHidden
;
548 XMLHiddenParagraphImportContext(SvXMLImport
& rImport
,
549 XMLTextImportHelper
& rHlp
);
552 /// process attribute values
553 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
554 std::string_view sAttrValue
) override
;
556 /// prepare XTextField for insertion into document
557 virtual void PrepareField(
558 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
561 /** import conditional text fields (<text:conditional-text>) */
562 class XMLConditionalTextImportContext final
: public XMLTextFieldImportContext
564 const OUString sPropertyCondition
;
565 const OUString sPropertyCurrentPresentation
;
568 OUString sTrueContent
;
569 OUString sFalseContent
;
578 XMLConditionalTextImportContext(SvXMLImport
& rImport
,
579 XMLTextImportHelper
& rHlp
);
582 /// process attribute values
583 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
584 std::string_view sAttrValue
) override
;
586 /// prepare XTextField for insertion into document
587 virtual void PrepareField(
588 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
591 /** import conditional text fields (<text:hidden-text>) */
592 class XMLHiddenTextImportContext final
: public XMLTextFieldImportContext
594 const OUString sPropertyCondition
;
595 const OUString sPropertyContent
;
596 const OUString sPropertyIsHidden
;
607 XMLHiddenTextImportContext(SvXMLImport
& rImport
,
608 XMLTextImportHelper
& rHlp
);
611 /// process attribute values
612 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
613 std::string_view sAttrValue
) override
;
615 /// prepare XTextField for insertion into document
616 virtual void PrepareField(
617 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
620 /** import file name fields (<text:file-name>) */
621 class XMLFileNameImportContext final
: public XMLTextFieldImportContext
623 const OUString sPropertyFixed
;
624 const OUString sPropertyFileFormat
;
625 const OUString sPropertyCurrentPresentation
;
632 XMLFileNameImportContext(SvXMLImport
& rImport
,
633 XMLTextImportHelper
& rHlp
);
636 /// process attribute values
637 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
638 std::string_view sAttrValue
) override
;
640 /// prepare XTextField for insertion into document
641 virtual void PrepareField(
642 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
645 /** import document template name fields (<text:template-name>) */
646 class XMLTemplateNameImportContext final
: public XMLTextFieldImportContext
648 const OUString sPropertyFileFormat
;
654 XMLTemplateNameImportContext(SvXMLImport
& rImport
,
655 XMLTextImportHelper
& rHlp
);
658 /// process attribute values
659 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
660 std::string_view sAttrValue
) override
;
662 /// prepare XTextField for insertion into document
663 virtual void PrepareField(
664 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
667 /** import chapter fields (<text:chapter>) */
668 class XMLChapterImportContext final
: public XMLTextFieldImportContext
675 XMLChapterImportContext(SvXMLImport
& rImport
,
676 XMLTextImportHelper
& rHlp
);
679 /// process attribute values
680 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
681 std::string_view sAttrValue
) override
;
683 /// prepare XTextField for insertion into document
684 virtual void PrepareField(
685 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
688 /** import count fields (<text:[XXX]-count>) */
689 class XMLCountFieldImportContext final
: public XMLTextFieldImportContext
691 const OUString sPropertyNumberingType
;
693 OUString sNumberFormat
;
694 OUString sLetterSync
;
696 bool bNumberFormatOK
;
700 XMLCountFieldImportContext(SvXMLImport
& rImport
,
701 XMLTextImportHelper
& rHlp
,
705 /// process attribute values
706 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
707 std::string_view sAttrValue
) override
;
709 /// prepare XTextField for insertion into document
710 virtual void PrepareField(
711 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
713 static OUString
MapTokenToServiceName(sal_Int32 nElement
);
716 /** import page variable fields (<text:get-page-variable>) */
717 class XMLPageVarGetFieldImportContext final
: public XMLTextFieldImportContext
719 OUString sNumberFormat
;
720 OUString sLetterSync
;
722 bool bNumberFormatOK
;
726 XMLPageVarGetFieldImportContext(SvXMLImport
& rImport
,
727 XMLTextImportHelper
& rHlp
);
730 /// process attribute values
731 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
732 std::string_view 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 page variable fields (<text:get-page-variable>) */
740 class XMLPageVarSetFieldImportContext final
: public XMLTextFieldImportContext
747 XMLPageVarSetFieldImportContext(SvXMLImport
& rImport
,
748 XMLTextImportHelper
& rHlp
);
751 /// process attribute values
752 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
753 std::string_view sAttrValue
) override
;
755 /// prepare XTextField for insertion into document
756 virtual void PrepareField(
757 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
760 /** import macro fields (<text:execute-macro>) */
761 class XMLMacroFieldImportContext final
: public XMLTextFieldImportContext
763 OUString sDescription
;
764 rtl::Reference
<XMLEventsImportContext
> xEventContext
;
766 OUString sMacro
; // macro for old documents (pre 638i)
772 XMLMacroFieldImportContext(SvXMLImport
& rImport
,
773 XMLTextImportHelper
& rHlp
);
776 /// for <office:events> children
777 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
779 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
781 /// process attribute values
782 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
783 std::string_view sAttrValue
) override
;
785 /// prepare XTextField for insertion into document
786 virtual void PrepareField(
787 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
790 /** import reference fields (<text:reference-get>) */
791 class XMLReferenceFieldImportContext final
: public XMLTextFieldImportContext
795 sal_Int32 nElementToken
;
804 XMLReferenceFieldImportContext(SvXMLImport
& rImport
,
805 XMLTextImportHelper
& rHlp
,
810 virtual void SAL_CALL
startFastElement(
812 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
814 /// process attribute values
815 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
816 std::string_view sAttrValue
) override
;
818 /// prepare XTextField for insertion into document
819 virtual void PrepareField(
820 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
823 /** import dde field declaration container (<text:dde-connection-decls>) */
824 class XMLDdeFieldDeclsImportContext final
: public SvXMLImportContext
828 XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
);
830 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
832 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
835 /** import dde field declaration (<text:dde-connection-decl>) */
836 class XMLDdeFieldDeclImportContext final
: public SvXMLImportContext
840 XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
);
842 // create fieldmaster
843 virtual void SAL_CALL
startFastElement(
845 const css::uno::Reference
<css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
848 /** import dde fields (<text:dde-connection>) */
849 class XMLDdeFieldImportContext final
: public XMLTextFieldImportContext
852 OUString sPropertyContent
;
856 XMLDdeFieldImportContext(SvXMLImport
& rImport
,
857 XMLTextImportHelper
& rHlp
);
860 /// process attribute values
861 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
862 std::string_view sAttrValue
) override
;
864 /// create textfield, attach master, and insert into document
865 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
868 virtual void PrepareField(
869 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
872 /** import sheet name fields (Calc) dde fields (<text:sheet-name>) */
873 class XMLSheetNameImportContext final
: public XMLTextFieldImportContext
878 XMLSheetNameImportContext(SvXMLImport
& rImport
,
879 XMLTextImportHelper
& rHlp
);
882 /// no attributes -> empty method
883 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
884 std::string_view sAttrValue
) override
;
886 /// no attributes -> empty method
887 virtual void PrepareField(
888 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
891 /** import page|slide name fields (<text:page-name>) */
892 class XMLPageNameFieldImportContext final
: public XMLTextFieldImportContext
896 XMLPageNameFieldImportContext(
897 SvXMLImport
& rImport
, /// XML Import
898 XMLTextImportHelper
& rHlp
); /// Text import helper
900 /// process attribute values
901 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
902 std::string_view sAttrValue
) override
;
904 /// prepare XTextField for insertion into document
905 virtual void PrepareField(
906 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
909 /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */
910 class XMLUrlFieldImportContext final
: public XMLTextFieldImportContext
918 XMLUrlFieldImportContext(SvXMLImport
& rImport
,
919 XMLTextImportHelper
& rHlp
);
922 /// no attributes -> empty method
923 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
924 std::string_view sAttrValue
) override
;
926 /// no attributes -> empty method
927 virtual void PrepareField(
928 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
931 /** import bibliography info fields (<text:bibliography-mark>) */
932 class XMLBibliographyFieldImportContext final
: public XMLTextFieldImportContext
934 ::std::vector
< css::beans::PropertyValue
> aValues
;
938 XMLBibliographyFieldImportContext(SvXMLImport
& rImport
,
939 XMLTextImportHelper
& rHlp
);
942 /// process attributes (fill aValues)
943 virtual void SAL_CALL
startFastElement(
945 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
947 /// empty method; all attributes are handled in StartElement
948 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
949 std::string_view sAttrValue
) override
;
951 /// convert aValues into sequence and set property
952 virtual void PrepareField(
953 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
955 static const char* MapBibliographyFieldName(sal_Int32 nElement
);
958 /** Import an annotation field (<text:annotation>) */
959 class XMLAnnotationImportContext final
: public XMLTextFieldImportContext
961 OUStringBuffer aAuthorBuffer
;
962 OUStringBuffer aInitialsBuffer
;
964 OUStringBuffer aTextBuffer
;
965 OUStringBuffer aDateBuffer
;
968 css::uno::Reference
< css::beans::XPropertySet
> mxField
;
969 css::uno::Reference
< css::text::XTextCursor
> mxCursor
;
970 css::uno::Reference
< css::text::XTextCursor
> mxOldCursor
;
976 XMLAnnotationImportContext(SvXMLImport
& rImport
,
977 XMLTextImportHelper
& rHlp
,
981 /// process attributes
982 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
983 std::string_view sAttrValue
) override
;
986 virtual void PrepareField(
987 const css::uno::Reference
< css::beans::XPropertySet
> & xPropertySet
) override
;
989 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
991 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
992 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
995 /** Import a script field (<text:script>) */
996 class XMLScriptImportContext final
: public XMLTextFieldImportContext
999 OUString sScriptType
;
1005 XMLScriptImportContext(SvXMLImport
& rImport
,
1006 XMLTextImportHelper
& rHlp
);
1009 /// process attributes
1010 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1011 std::string_view sAttrValue
) override
;
1014 virtual void PrepareField(
1015 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1018 /** import measure fields (<text:measure>) */
1019 class XMLMeasureFieldImportContext final
: public XMLTextFieldImportContext
1025 XMLMeasureFieldImportContext(SvXMLImport
& rImport
,
1026 XMLTextImportHelper
& rHlp
);
1029 /// process attribute values
1030 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1031 std::string_view sAttrValue
) override
;
1033 /// prepare XTextField for insertion into document
1034 virtual void PrepareField(
1035 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1038 /** dropdown field (filter legacy) */
1039 class XMLDropDownFieldImportContext final
: public XMLTextFieldImportContext
1041 std::vector
<OUString
> aLabels
;
1045 sal_Int32 nSelected
;
1052 XMLDropDownFieldImportContext(SvXMLImport
& rImport
,
1053 XMLTextImportHelper
& rHlp
);
1055 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
1056 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
1059 /// process attribute values
1060 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1061 std::string_view sAttrValue
) override
;
1063 /// prepare XTextField for insertion into document
1064 virtual void PrepareField(
1065 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1068 /** import header fields (<draw:header>) */
1069 class XMLHeaderFieldImportContext final
: public XMLTextFieldImportContext
1073 XMLHeaderFieldImportContext(
1074 SvXMLImport
& rImport
, /// XML Import
1075 XMLTextImportHelper
& rHlp
); /// Text import helper
1077 /// process attribute values
1078 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1079 std::string_view sAttrValue
) override
;
1081 /// prepare XTextField for insertion into document
1082 virtual void PrepareField(
1083 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1086 /** import footer fields (<draw:footer>) */
1087 class XMLFooterFieldImportContext final
: public XMLTextFieldImportContext
1091 XMLFooterFieldImportContext(
1092 SvXMLImport
& rImport
, /// XML Import
1093 XMLTextImportHelper
& rHlp
); /// Text import helper
1095 /// process attribute values
1096 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1097 std::string_view sAttrValue
) override
;
1099 /// prepare XTextField for insertion into document
1100 virtual void PrepareField(
1101 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1104 /** import footer fields (<draw:date-and-time>) */
1105 class XMLDateTimeFieldImportContext final
: public XMLTextFieldImportContext
1109 XMLDateTimeFieldImportContext(
1110 SvXMLImport
& rImport
, /// XML Import
1111 XMLTextImportHelper
& rHlp
); /// Text import helper
1113 /// process attribute values
1114 virtual void ProcessAttribute( sal_Int32 nAttrToken
,
1115 std::string_view sAttrValue
) override
;
1117 /// prepare XTextField for insertion into document
1118 virtual void PrepareField(
1119 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
) override
;
1122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */