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 .
23 * Import of all text fields except those from txtvfldi.cxx
24 * (variable related text fields and database display fields)
27 #include <o3tl/safeint.hxx>
28 #include <sal/config.h>
32 #include <txtfldi.hxx>
33 #include <txtvfldi.hxx>
35 #include <xmloff/xmlimp.hxx>
36 #include <xmloff/txtimp.hxx>
37 #include <xmloff/xmlnamespace.hxx>
38 #include <xmloff/namespacemap.hxx>
39 #include <xmloff/xmltoken.hxx>
40 #include <xmloff/xmluconv.hxx>
41 #include <xmloff/xmlement.hxx>
42 #include <XMLStringBufferImportContext.hxx>
43 #include <xmloff/XMLEventsImportContext.hxx>
44 #include <com/sun/star/frame/XModel.hpp>
45 #include <com/sun/star/xml/sax/XAttributeList.hpp>
46 #include <com/sun/star/text/UserDataPart.hpp>
47 #include <com/sun/star/style/NumberingType.hpp>
48 #include <com/sun/star/text/PlaceholderType.hpp>
49 #include <com/sun/star/text/ReferenceFieldPart.hpp>
50 #include <com/sun/star/text/ReferenceFieldSource.hpp>
51 #include <com/sun/star/text/XTextContent.hpp>
52 #include <com/sun/star/beans/XPropertySet.hpp>
53 #include <com/sun/star/beans/XPropertySetInfo.hpp>
54 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
55 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
56 #include <com/sun/star/text/XDependentTextField.hpp>
57 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
58 #include <com/sun/star/text/ChapterFormat.hpp>
59 #include <com/sun/star/text/TemplateDisplayFormat.hpp>
60 #include <com/sun/star/beans/PropertyValue.hpp>
61 #include <com/sun/star/text/BibliographyDataType.hpp>
62 #include <com/sun/star/util/XUpdatable.hpp>
63 #include <com/sun/star/sdb/CommandType.hpp>
64 #include <com/sun/star/container/XIndexReplace.hpp>
66 #include <sax/tools/converter.hxx>
68 #include <rtl/ustring.hxx>
69 #include <rtl/ustrbuf.hxx>
70 #include <sal/log.hxx>
71 #include <rtl/math.hxx>
72 #include <tools/debug.hxx>
73 #include <osl/diagnose.h>
74 #include <comphelper/diagnose_ex.hxx>
76 using namespace ::com::sun::star
;
77 using namespace ::com::sun::star::uno
;
78 using namespace ::com::sun::star::text
;
79 using namespace ::com::sun::star::lang
;
80 using namespace ::com::sun::star::beans
;
81 using namespace ::com::sun::star::document
;
82 using namespace ::com::sun::star::util
;
83 using namespace ::com::sun::star::xml::sax
;
84 using namespace ::xmloff::token
;
87 // SO API string constants
90 // service prefix and service names
91 constexpr OUString sAPI_textfield_prefix
= u
"com.sun.star.text.TextField."_ustr
;
92 constexpr char16_t sAPI_fieldmaster_prefix
[] = u
"com.sun.star.text.FieldMaster.";
93 constexpr OUString sAPI_presentation_prefix
= u
"com.sun.star.presentation.TextField."_ustr
;
95 constexpr OUString sAPI_date_time
= u
"DateTime"_ustr
;
96 constexpr OUString sAPI_page_number
= u
"PageNumber"_ustr
;
97 constexpr OUString sAPI_docinfo_change_date_time
= u
"DocInfo.ChangeDateTime"_ustr
;
98 constexpr OUString sAPI_docinfo_create_date_time
= u
"DocInfo.CreateDateTime"_ustr
;
99 constexpr OUString sAPI_docinfo_custom
= u
"DocInfo.Custom"_ustr
;
100 constexpr OUString sAPI_docinfo_print_date_time
= u
"DocInfo.PrintDateTime"_ustr
;
101 constexpr OUString sAPI_dde
= u
"DDE"_ustr
;
102 constexpr OUString sAPI_url
= u
"URL"_ustr
;
105 constexpr OUString sAPI_is_fixed
= u
"IsFixed"_ustr
;
106 constexpr OUString sAPI_content
= u
"Content"_ustr
;
107 constexpr OUString sAPI_author
= u
"Author"_ustr
;
108 constexpr OUString sAPI_hint
= u
"Hint"_ustr
;
109 constexpr OUString sAPI_name
= u
"Name"_ustr
;
110 constexpr OUStringLiteral sAPI_parent_name
= u
"ParentName";
111 constexpr OUString sAPI_sub_type
= u
"SubType"_ustr
;
112 constexpr OUString sAPI_date_time_value
= u
"DateTimeValue"_ustr
;
113 constexpr OUString sAPI_number_format
= u
"NumberFormat"_ustr
;
114 constexpr OUString sAPI_numbering_type
= u
"NumberingType"_ustr
;
115 constexpr OUString sAPI_offset
= u
"Offset"_ustr
;
116 constexpr OUString sAPI_condition
= u
"Condition"_ustr
;
117 constexpr OUString sAPI_set_number
= u
"SetNumber"_ustr
;
118 constexpr OUString sAPI_file_format
= u
"FileFormat"_ustr
;
119 constexpr OUString sAPI_is_date
= u
"IsDate"_ustr
;
120 constexpr OUString sAPI_current_presentation
= u
"CurrentPresentation"_ustr
;
121 constexpr OUString sAPI_is_hidden
= u
"IsHidden"_ustr
;
122 constexpr OUString sAPI_is_fixed_language
= u
"IsFixedLanguage"_ustr
;
124 constexpr OUString sAPI_true
= u
"TRUE"_ustr
;
127 XMLTextFieldImportContext::XMLTextFieldImportContext(
128 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
130 : SvXMLImportContext( rImport
)
131 , sServiceName(std::move(aService
))
132 , rTextImportHelper(rHlp
)
133 , sServicePrefix(sAPI_textfield_prefix
)
138 void XMLTextFieldImportContext::startFastElement(
139 sal_Int32
/*nElement*/,
140 const Reference
<XFastAttributeList
> & xAttrList
)
142 // process attributes
143 for( auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
) )
144 ProcessAttribute(aIter
.getToken(), aIter
.toView() );
147 OUString
const & XMLTextFieldImportContext::GetContent()
149 if (sContent
.isEmpty())
151 sContent
= sContentBuffer
.makeStringAndClear();
157 void XMLTextFieldImportContext::endFastElement(sal_Int32
)
162 // create field/Service
163 Reference
<XPropertySet
> xPropSet
;
164 if (CreateField(xPropSet
, sServicePrefix
+ GetServiceName()))
166 // set field properties
167 PrepareField(xPropSet
);
169 // attach field to document
170 Reference
<XTextContent
> xTextContent(xPropSet
, UNO_QUERY
);
172 // workaround for #80606#
175 rTextImportHelper
.InsertTextContent(xTextContent
);
177 catch (const lang::IllegalArgumentException
&)
185 // in case of error: write element content
186 rTextImportHelper
.InsertString(GetContent());
189 void XMLTextFieldImportContext::characters(const OUString
& rContent
)
191 sContentBuffer
.append(rContent
);
194 bool XMLTextFieldImportContext::CreateField(
195 Reference
<XPropertySet
> & xField
,
196 const OUString
& rServiceName
)
198 // instantiate new XTextField:
199 // ask import for model, model is factory, ask factory to create service
201 Reference
<XMultiServiceFactory
> xFactory(GetImport().GetModel(),UNO_QUERY
);
204 Reference
<XInterface
> xIfc
= xFactory
->createInstance(rServiceName
);
207 Reference
<XPropertySet
> xTmp( xIfc
, UNO_QUERY
);
211 return false; // can't create instance
214 return false; // can't get MultiServiceFactory
220 /// create the appropriate field context from
221 XMLTextFieldImportContext
*
222 XMLTextFieldImportContext::CreateTextFieldImportContext(
223 SvXMLImport
& rImport
,
224 XMLTextImportHelper
& rHlp
,
227 XMLTextFieldImportContext
* pContext
= nullptr;
231 case XML_ELEMENT(TEXT
, XML_SENDER_FIRSTNAME
):
232 case XML_ELEMENT(TEXT
, XML_SENDER_LASTNAME
):
233 case XML_ELEMENT(LO_EXT
, XML_SENDER_INITIALS
):
234 case XML_ELEMENT(TEXT
, XML_SENDER_INITIALS
):
235 case XML_ELEMENT(TEXT
, XML_SENDER_TITLE
):
236 case XML_ELEMENT(TEXT
, XML_SENDER_POSITION
):
237 case XML_ELEMENT(TEXT
, XML_SENDER_EMAIL
):
238 case XML_ELEMENT(TEXT
, XML_SENDER_PHONE_PRIVATE
):
240 case XML_ELEMENT(TEXT
, XML_SENDER_FAX
):
241 case XML_ELEMENT(TEXT
, XML_SENDER_COMPANY
):
242 case XML_ELEMENT(TEXT
, XML_SENDER_PHONE_WORK
):
243 case XML_ELEMENT(TEXT
, XML_SENDER_STREET
):
244 case XML_ELEMENT(TEXT
, XML_SENDER_CITY
):
245 case XML_ELEMENT(TEXT
, XML_SENDER_POSTAL_CODE
):
246 case XML_ELEMENT(TEXT
, XML_SENDER_COUNTRY
):
247 case XML_ELEMENT(TEXT
, XML_SENDER_STATE_OR_PROVINCE
):
249 new XMLSenderFieldImportContext( rImport
, rHlp
);
252 case XML_ELEMENT(TEXT
, XML_AUTHOR_NAME
):
253 case XML_ELEMENT(TEXT
, XML_AUTHOR_INITIALS
):
255 new XMLAuthorFieldImportContext( rImport
, rHlp
);
258 case XML_ELEMENT(TEXT
, XML_PLACEHOLDER
):
260 new XMLPlaceholderFieldImportContext( rImport
, rHlp
);
262 case XML_ELEMENT(TEXT
, XML_SEQUENCE
):
264 new XMLSequenceFieldImportContext( rImport
, rHlp
);
266 case XML_ELEMENT(TEXT
, XML_TEXT_INPUT
):
268 new XMLTextInputFieldImportContext( rImport
, rHlp
);
270 case XML_ELEMENT(TEXT
, XML_EXPRESSION
):
272 new XMLExpressionFieldImportContext( rImport
, rHlp
);
274 case XML_ELEMENT(TEXT
, XML_VARIABLE_SET
):
276 new XMLVariableSetFieldImportContext( rImport
, rHlp
);
278 case XML_ELEMENT(TEXT
, XML_VARIABLE_INPUT
):
280 new XMLVariableInputFieldImportContext( rImport
, rHlp
);
282 case XML_ELEMENT(TEXT
, XML_VARIABLE_GET
):
284 new XMLVariableGetFieldImportContext( rImport
, rHlp
);
286 case XML_ELEMENT(TEXT
, XML_USER_FIELD_GET
):
287 pContext
= new XMLUserFieldImportContext( rImport
, rHlp
);
289 case XML_ELEMENT(TEXT
, XML_USER_FIELD_INPUT
):
290 pContext
= new XMLUserFieldInputImportContext( rImport
, rHlp
);
292 case XML_ELEMENT(TEXT
, XML_TIME
):
293 pContext
= new XMLTimeFieldImportContext( rImport
, rHlp
);
295 case XML_ELEMENT(TEXT
, XML_PAGE_CONTINUATION_STRING
):
296 case XML_ELEMENT(TEXT
, XML_PAGE_CONTINUATION
):
297 pContext
= new XMLPageContinuationImportContext( rImport
, rHlp
);
300 case XML_ELEMENT(TEXT
, XML_PAGE_NUMBER
):
301 pContext
= new XMLPageNumberImportContext( rImport
, rHlp
);
304 case XML_ELEMENT(TEXT
, XML_DATE
):
305 pContext
= new XMLDateFieldImportContext( rImport
, rHlp
);
308 case XML_ELEMENT(TEXT
, XML_DATABASE_NAME
):
309 pContext
= new XMLDatabaseNameImportContext( rImport
, rHlp
);
311 case XML_ELEMENT(TEXT
, XML_DATABASE_NEXT
):
312 pContext
= new XMLDatabaseNextImportContext( rImport
, rHlp
);
314 case XML_ELEMENT(TEXT
, XML_DATABASE_ROW_SELECT
):
315 pContext
= new XMLDatabaseSelectImportContext( rImport
, rHlp
);
317 case XML_ELEMENT(TEXT
, XML_DATABASE_ROW_NUMBER
):
318 pContext
= new XMLDatabaseNumberImportContext( rImport
, rHlp
);
320 case XML_ELEMENT(TEXT
, XML_DATABASE_DISPLAY
):
321 pContext
= new XMLDatabaseDisplayImportContext( rImport
, rHlp
);
323 case XML_ELEMENT(TEXT
, XML_CONDITIONAL_TEXT
):
324 pContext
= new XMLConditionalTextImportContext( rImport
, rHlp
);
326 case XML_ELEMENT(TEXT
, XML_HIDDEN_TEXT
):
327 pContext
= new XMLHiddenTextImportContext( rImport
, rHlp
);
329 case XML_ELEMENT(TEXT
, XML_HIDDEN_PARAGRAPH
):
330 pContext
= new XMLHiddenParagraphImportContext( rImport
, rHlp
);
332 case XML_ELEMENT(TEXT
, XML_DESCRIPTION
):
333 case XML_ELEMENT(TEXT
, XML_TITLE
):
334 case XML_ELEMENT(TEXT
, XML_SUBJECT
):
335 case XML_ELEMENT(TEXT
, XML_KEYWORDS
):
336 pContext
= new XMLSimpleDocInfoImportContext( rImport
, rHlp
,
340 case XML_ELEMENT(TEXT
, XML_INITIAL_CREATOR
):
341 case XML_ELEMENT(TEXT
, XML_PRINTED_BY
):
342 case XML_ELEMENT(TEXT
, XML_CREATOR
):
343 pContext
= new XMLSimpleDocInfoImportContext( rImport
, rHlp
,
348 case XML_ELEMENT(TEXT
, XML_CREATION_DATE
):
349 case XML_ELEMENT(TEXT
, XML_CREATION_TIME
):
350 case XML_ELEMENT(TEXT
, XML_PRINT_DATE
):
351 case XML_ELEMENT(TEXT
, XML_PRINT_TIME
):
352 case XML_ELEMENT(TEXT
, XML_MODIFICATION_DATE
):
353 case XML_ELEMENT(TEXT
, XML_MODIFICATION_TIME
):
354 case XML_ELEMENT(TEXT
, XML_EDITING_DURATION
):
355 pContext
= new XMLDateTimeDocInfoImportContext( rImport
, rHlp
,
359 case XML_ELEMENT(TEXT
, XML_EDITING_CYCLES
):
360 pContext
= new XMLRevisionDocInfoImportContext( rImport
, rHlp
,
364 case XML_ELEMENT(TEXT
, XML_USER_DEFINED
):
365 pContext
= new XMLUserDocInfoImportContext( rImport
, rHlp
,
369 case XML_ELEMENT(TEXT
, XML_FILE_NAME
):
370 pContext
= new XMLFileNameImportContext( rImport
, rHlp
);
373 case XML_ELEMENT(TEXT
, XML_CHAPTER
):
374 pContext
= new XMLChapterImportContext( rImport
, rHlp
);
377 case XML_ELEMENT(TEXT
, XML_TEMPLATE_NAME
):
378 pContext
= new XMLTemplateNameImportContext( rImport
, rHlp
);
381 case XML_ELEMENT(TEXT
, XML_WORD_COUNT
):
382 case XML_ELEMENT(TEXT
, XML_PARAGRAPH_COUNT
):
383 case XML_ELEMENT(TEXT
, XML_TABLE_COUNT
):
384 case XML_ELEMENT(TEXT
, XML_CHARACTER_COUNT
):
385 case XML_ELEMENT(TEXT
, XML_IMAGE_COUNT
):
386 case XML_ELEMENT(TEXT
, XML_OBJECT_COUNT
):
387 case XML_ELEMENT(TEXT
, XML_PAGE_COUNT
):
388 pContext
= new XMLCountFieldImportContext( rImport
, rHlp
, nToken
);
391 case XML_ELEMENT(TEXT
, XML_PAGE_VARIABLE_GET
):
392 pContext
= new XMLPageVarGetFieldImportContext( rImport
, rHlp
);
395 case XML_ELEMENT(TEXT
, XML_PAGE_VARIABLE_SET
):
396 pContext
= new XMLPageVarSetFieldImportContext( rImport
, rHlp
);
399 case XML_ELEMENT(TEXT
, XML_EXECUTE_MACRO
):
400 pContext
= new XMLMacroFieldImportContext( rImport
, rHlp
);
403 case XML_ELEMENT(TEXT
, XML_DDE_CONNECTION
):
404 pContext
= new XMLDdeFieldImportContext( rImport
, rHlp
);
407 case XML_ELEMENT(TEXT
, XML_REFERENCE_REF
):
408 case XML_ELEMENT(TEXT
, XML_BOOKMARK_REF
):
409 case XML_ELEMENT(TEXT
, XML_NOTE_REF
):
410 case XML_ELEMENT(TEXT
, XML_SEQUENCE_REF
):
411 case XML_ELEMENT(TEXT
, XML_STYLE_REF
):
412 case XML_ELEMENT(LO_EXT
, XML_STYLE_REF
):
413 pContext
= new XMLReferenceFieldImportContext( rImport
, rHlp
, nToken
);
416 case XML_ELEMENT(TEXT
, XML_SHEET_NAME
):
417 pContext
= new XMLSheetNameImportContext( rImport
, rHlp
);
420 case XML_ELEMENT(TEXT
, XML_PAGE_NAME
):
421 case XML_ELEMENT(LO_EXT
, XML_PAGE_NAME
):
422 pContext
= new XMLPageNameFieldImportContext( rImport
, rHlp
);
425 case XML_ELEMENT(TEXT
, XML_BIBLIOGRAPHY_MARK
):
426 pContext
= new XMLBibliographyFieldImportContext( rImport
, rHlp
);
429 case XML_ELEMENT(OFFICE
, XML_ANNOTATION
):
430 case XML_ELEMENT(OFFICE
, XML_ANNOTATION_END
):
431 pContext
= new XMLAnnotationImportContext( rImport
, rHlp
, nToken
);
434 case XML_ELEMENT(TEXT
, XML_SCRIPT
):
435 pContext
= new XMLScriptImportContext( rImport
, rHlp
);
438 case XML_ELEMENT(TEXT
, XML_MEASURE
):
439 pContext
= new XMLMeasureFieldImportContext( rImport
, rHlp
);
442 case XML_ELEMENT(TEXT
, XML_TABLE_FORMULA
):
443 pContext
= new XMLTableFormulaImportContext( rImport
, rHlp
);
445 case XML_ELEMENT(TEXT
, XML_DROP_DOWN
):
446 pContext
= new XMLDropDownFieldImportContext( rImport
, rHlp
);
448 case XML_ELEMENT(PRESENTATION
, XML_HEADER
):
449 pContext
= new XMLHeaderFieldImportContext( rImport
, rHlp
);
451 case XML_ELEMENT(PRESENTATION
, XML_FOOTER
):
452 pContext
= new XMLFooterFieldImportContext( rImport
, rHlp
);
454 case XML_ELEMENT(PRESENTATION
, XML_DATE_TIME
):
455 pContext
= new XMLDateTimeFieldImportContext( rImport
, rHlp
);
459 // ignore! May not even be a textfield.
460 // (Reminder: This method is called inside default:-branch)
469 void XMLTextFieldImportContext::ForceUpdate(
470 const Reference
<XPropertySet
> & rPropertySet
)
473 Reference
<XUpdatable
> xUpdate(rPropertySet
, UNO_QUERY
);
480 OSL_FAIL("Expected XUpdatable support!");
485 // XMLSenderFieldImportContext
488 constexpr OUStringLiteral
gsPropertyFieldSubType(u
"UserDataType");
490 XMLSenderFieldImportContext::XMLSenderFieldImportContext(
491 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
492 : XMLTextFieldImportContext(rImport
, rHlp
, "ExtendedUser")
494 , sPropertyFixed(sAPI_is_fixed
)
495 , sPropertyContent(sAPI_content
)
500 void XMLSenderFieldImportContext::startFastElement(
502 const Reference
<XFastAttributeList
> & xAttrList
)
506 case XML_ELEMENT(TEXT
, XML_SENDER_FIRSTNAME
):
507 nSubType
= UserDataPart::FIRSTNAME
;
509 case XML_ELEMENT(TEXT
, XML_SENDER_LASTNAME
):
510 nSubType
= UserDataPart::NAME
;
512 case XML_ELEMENT(LO_EXT
, XML_SENDER_INITIALS
):
513 case XML_ELEMENT(TEXT
, XML_SENDER_INITIALS
):
514 nSubType
= UserDataPart::SHORTCUT
;
516 case XML_ELEMENT(TEXT
, XML_SENDER_TITLE
):
517 nSubType
= UserDataPart::TITLE
;
519 case XML_ELEMENT(TEXT
, XML_SENDER_POSITION
):
520 nSubType
= UserDataPart::POSITION
;
522 case XML_ELEMENT(TEXT
, XML_SENDER_EMAIL
):
523 nSubType
= UserDataPart::EMAIL
;
525 case XML_ELEMENT(TEXT
, XML_SENDER_PHONE_PRIVATE
):
526 nSubType
= UserDataPart::PHONE_PRIVATE
;
528 case XML_ELEMENT(TEXT
, XML_SENDER_FAX
):
529 nSubType
= UserDataPart::FAX
;
531 case XML_ELEMENT(TEXT
, XML_SENDER_COMPANY
):
532 nSubType
= UserDataPart::COMPANY
;
534 case XML_ELEMENT(TEXT
, XML_SENDER_PHONE_WORK
):
535 nSubType
= UserDataPart::PHONE_COMPANY
;
537 case XML_ELEMENT(TEXT
, XML_SENDER_STREET
):
538 nSubType
= UserDataPart::STREET
;
540 case XML_ELEMENT(TEXT
, XML_SENDER_CITY
):
541 nSubType
= UserDataPart::CITY
;
543 case XML_ELEMENT(TEXT
, XML_SENDER_POSTAL_CODE
):
544 nSubType
= UserDataPart::ZIP
;
546 case XML_ELEMENT(TEXT
, XML_SENDER_COUNTRY
):
547 nSubType
= UserDataPart::COUNTRY
;
549 case XML_ELEMENT(TEXT
, XML_SENDER_STATE_OR_PROVINCE
):
550 nSubType
= UserDataPart::STATE
;
554 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
558 // process Attributes
559 XMLTextFieldImportContext::startFastElement(nElement
, xAttrList
);
562 void XMLSenderFieldImportContext::ProcessAttribute(
563 sal_Int32 nAttrToken
,
564 std::string_view sAttrValue
)
566 if (XML_ELEMENT(TEXT
, XML_FIXED
) == nAttrToken
) {
570 bool const bRet
= ::sax::Converter::convertBool(bVal
, sAttrValue
);
572 // set bFixed if successful
578 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
581 void XMLSenderFieldImportContext::PrepareField(
582 const Reference
<XPropertySet
> & rPropSet
)
585 rPropSet
->setPropertyValue(gsPropertyFieldSubType
, Any(nSubType
));
588 rPropSet
->setPropertyValue(sPropertyFixed
, Any(bFixed
));
590 // set content if fixed
594 // in organizer or styles-only mode: force update
595 if (GetImport().GetTextImport()->IsOrganizerMode() ||
596 GetImport().GetTextImport()->IsStylesOnlyMode() )
598 ForceUpdate(rPropSet
);
602 rPropSet
->setPropertyValue(sPropertyContent
, Any(GetContent()));
607 // XMLAuthorFieldImportContext
609 constexpr OUStringLiteral
gsPropertyAuthorFullName(u
"FullName");
611 XMLAuthorFieldImportContext::XMLAuthorFieldImportContext(
612 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
613 : XMLSenderFieldImportContext(rImport
, rHlp
)
614 , bAuthorFullName(true)
615 , sPropertyFixed(sAPI_is_fixed
)
616 , sPropertyContent(sAPI_content
)
618 // overwrite service name from XMLSenderFieldImportContext
619 SetServiceName(sAPI_author
);
622 void XMLAuthorFieldImportContext::startFastElement(
624 const Reference
<XFastAttributeList
> & xAttrList
)
626 bAuthorFullName
= ( XML_ELEMENT(TEXT
, XML_AUTHOR_INITIALS
) != nElement
);
629 // process Attributes
630 XMLTextFieldImportContext::startFastElement(nElement
, xAttrList
);
633 void XMLAuthorFieldImportContext::ProcessAttribute(sal_Int32 nAttrToken
, std::string_view sAttrValue
)
635 if(nAttrToken
== XML_ELEMENT(TEXT
, XML_FIXED
))
638 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
642 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
645 void XMLAuthorFieldImportContext::PrepareField(
646 const Reference
<XPropertySet
> & rPropSet
)
650 rPropSet
->setPropertyValue(gsPropertyAuthorFullName
, Any(bAuthorFullName
));
652 rPropSet
->setPropertyValue(sPropertyFixed
, Any(bFixed
));
654 // set content if fixed
658 // organizer or styles-only mode: force update
659 if (GetImport().GetTextImport()->IsOrganizerMode() ||
660 GetImport().GetTextImport()->IsStylesOnlyMode() )
662 ForceUpdate(rPropSet
);
666 aAny
<<= GetContent();
667 rPropSet
->setPropertyValue(sPropertyContent
, aAny
);
672 // page continuation string
675 SvXMLEnumMapEntry
<PageNumberType
> const lcl_aSelectPageAttrMap
[] =
677 { XML_PREVIOUS
, PageNumberType_PREV
},
678 { XML_CURRENT
, PageNumberType_CURRENT
},
679 { XML_NEXT
, PageNumberType_NEXT
},
680 { XML_TOKEN_INVALID
, PageNumberType(0) },
683 constexpr OUStringLiteral
gsPropertyUserText(u
"UserText");
685 XMLPageContinuationImportContext::XMLPageContinuationImportContext(
686 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
687 : XMLTextFieldImportContext(rImport
, rHlp
, sAPI_page_number
)
688 , sPropertySubType(sAPI_sub_type
)
689 , sPropertyNumberingType(sAPI_numbering_type
)
690 , eSelectPage(PageNumberType_CURRENT
)
696 void XMLPageContinuationImportContext::ProcessAttribute(
697 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
701 case XML_ELEMENT(TEXT
, XML_SELECT_PAGE
):
704 if (SvXMLUnitConverter::convertEnum(nTmp
, sAttrValue
,
705 lcl_aSelectPageAttrMap
)
706 && (PageNumberType_CURRENT
!= nTmp
) )
712 case XML_ELEMENT(TEXT
, XML_STRING_VALUE
):
713 case XML_ELEMENT(OFFICE
, XML_STRING_VALUE
):
714 sString
= OUString::fromUtf8(sAttrValue
);
718 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
722 void XMLPageContinuationImportContext::PrepareField(
723 const Reference
<XPropertySet
> & xPropertySet
)
727 xPropertySet
->setPropertyValue(sPropertySubType
, Any(eSelectPage
));
729 aAny
<<= (sStringOK
? sString
: GetContent());
730 xPropertySet
->setPropertyValue(gsPropertyUserText
, aAny
);
732 aAny
<<= style::NumberingType::CHAR_SPECIAL
;
733 xPropertySet
->setPropertyValue(sPropertyNumberingType
, aAny
);
740 XMLPageNumberImportContext::XMLPageNumberImportContext(
741 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
742 : XMLTextFieldImportContext(rImport
, rHlp
, sAPI_page_number
)
743 , sPropertySubType(sAPI_sub_type
)
744 , sPropertyNumberingType(sAPI_numbering_type
)
745 , sPropertyOffset(sAPI_offset
)
746 , sNumberSync(GetXMLToken(XML_FALSE
))
748 , eSelectPage(PageNumberType_CURRENT
)
749 , sNumberFormatOK(false)
754 void XMLPageNumberImportContext::ProcessAttribute(
755 sal_Int32 nAttrToken
,
756 std::string_view sAttrValue
)
760 case XML_ELEMENT(STYLE
, XML_NUM_FORMAT
):
761 sNumberFormat
= OUString::fromUtf8(sAttrValue
);
762 sNumberFormatOK
= true;
764 case XML_ELEMENT(STYLE
, XML_NUM_LETTER_SYNC
):
765 sNumberSync
= OUString::fromUtf8(sAttrValue
);
767 case XML_ELEMENT(TEXT
, XML_SELECT_PAGE
):
768 SvXMLUnitConverter::convertEnum(eSelectPage
, sAttrValue
,
769 lcl_aSelectPageAttrMap
);
771 case XML_ELEMENT(TEXT
, XML_PAGE_ADJUST
):
774 if (::sax::Converter::convertNumber(nTmp
, sAttrValue
))
776 nPageAdjust
= static_cast<sal_Int16
>(nTmp
);
781 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
785 void XMLPageNumberImportContext::PrepareField(
786 const Reference
<XPropertySet
> & xPropertySet
)
788 // all properties are optional
789 Reference
<XPropertySetInfo
> xPropertySetInfo(
790 xPropertySet
->getPropertySetInfo());
792 if (xPropertySetInfo
->hasPropertyByName(sPropertyNumberingType
))
795 if( sNumberFormatOK
)
797 nNumType
= style::NumberingType::ARABIC
;
798 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType
,
803 nNumType
= style::NumberingType::PAGE_DESCRIPTOR
;
805 xPropertySet
->setPropertyValue(sPropertyNumberingType
, Any(nNumType
));
808 if (xPropertySetInfo
->hasPropertyByName(sPropertyOffset
))
813 case PageNumberType_PREV
:
816 case PageNumberType_CURRENT
:
818 case PageNumberType_NEXT
:
822 SAL_WARN("xmloff.text", "unknown page number type");
824 xPropertySet
->setPropertyValue(sPropertyOffset
, Any(nPageAdjust
));
827 if (xPropertySetInfo
->hasPropertyByName(sPropertySubType
))
829 xPropertySet
->setPropertyValue(sPropertySubType
, Any(eSelectPage
));
837 constexpr OUStringLiteral
gsPropertyPlaceholderType(u
"PlaceHolderType");
838 constexpr OUStringLiteral
gsPropertyPlaceholder(u
"PlaceHolder");
840 XMLPlaceholderFieldImportContext::XMLPlaceholderFieldImportContext(
841 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
842 : XMLTextFieldImportContext(rImport
, rHlp
, "JumpEdit")
843 , sPropertyHint(sAPI_hint
)
844 , nPlaceholderType(PlaceholderType::TEXT
)
848 /// process attribute values
849 void XMLPlaceholderFieldImportContext::ProcessAttribute(
850 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
852 switch (nAttrToken
) {
853 case XML_ELEMENT(TEXT
, XML_DESCRIPTION
):
854 sDescription
= OUString::fromUtf8(sAttrValue
);
857 case XML_ELEMENT(TEXT
, XML_PLACEHOLDER_TYPE
):
859 if (IsXMLToken(sAttrValue
, XML_TABLE
))
861 nPlaceholderType
= PlaceholderType::TABLE
;
863 else if (IsXMLToken(sAttrValue
, XML_TEXT
))
865 nPlaceholderType
= PlaceholderType::TEXT
;
867 else if (IsXMLToken(sAttrValue
, XML_TEXT_BOX
))
869 nPlaceholderType
= PlaceholderType::TEXTFRAME
;
871 else if (IsXMLToken(sAttrValue
, XML_IMAGE
))
873 nPlaceholderType
= PlaceholderType::GRAPHIC
;
875 else if (IsXMLToken(sAttrValue
, XML_OBJECT
))
877 nPlaceholderType
= PlaceholderType::OBJECT
;
887 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
891 void XMLPlaceholderFieldImportContext::PrepareField(
892 const Reference
<XPropertySet
> & xPropertySet
) {
895 xPropertySet
->setPropertyValue(sPropertyHint
, Any(sDescription
));
897 // remove <...> around content (if present)
898 OUString aContent
= GetContent();
899 sal_Int32 nStart
= 0;
900 sal_Int32 nLength
= aContent
.getLength();
901 if (aContent
.startsWith("<"))
906 if (aContent
.endsWith(">"))
910 aAny
<<= aContent
.copy(nStart
, nLength
);
911 xPropertySet
->setPropertyValue(gsPropertyPlaceholder
, aAny
);
913 xPropertySet
->setPropertyValue(gsPropertyPlaceholderType
, Any(nPlaceholderType
));
919 constexpr OUString
gsPropertyAdjust(u
"Adjust"_ustr
);
921 XMLTimeFieldImportContext::XMLTimeFieldImportContext(
922 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
923 : XMLTextFieldImportContext(rImport
, rHlp
, sAPI_date_time
)
924 , sPropertyNumberFormat(sAPI_number_format
)
925 , sPropertyFixed(sAPI_is_fixed
)
926 , sPropertyDateTimeValue(sAPI_date_time_value
)
927 , sPropertyDateTime(sAPI_date_time
)
928 , sPropertyIsDate(sAPI_is_date
)
929 , sPropertyIsFixedLanguage(sAPI_is_fixed_language
)
936 , bIsDefaultLanguage( true )
938 bValid
= true; // always valid!
941 void XMLTimeFieldImportContext::ProcessAttribute(
942 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
946 case XML_ELEMENT(TEXT
, XML_TIME_VALUE
):
947 case XML_ELEMENT(OFFICE
, XML_TIME_VALUE
):
949 if (::sax::Converter::parseTimeOrDateTime(aDateTimeValue
, sAttrValue
))
955 case XML_ELEMENT(TEXT
, XML_FIXED
):
958 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
964 case XML_ELEMENT(STYLE
, XML_DATA_STYLE_NAME
):
966 sal_Int32 nKey
= GetImportHelper().GetDataStyleKey(
967 OUString::fromUtf8(sAttrValue
), &bIsDefaultLanguage
);
975 case XML_ELEMENT(TEXT
, XML_TIME_ADJUST
):
979 if (::sax::Converter::convertDuration(fTmp
, sAttrValue
))
981 // convert to minutes
982 nAdjust
= static_cast<sal_Int32
>(::rtl::math::approxFloor(fTmp
* 60 * 24));
987 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
991 void XMLTimeFieldImportContext::PrepareField(
992 const Reference
<XPropertySet
> & rPropertySet
)
994 // all properties are optional (except IsDate)
995 Reference
<XPropertySetInfo
> xPropertySetInfo(
996 rPropertySet
->getPropertySetInfo());
998 if (xPropertySetInfo
->hasPropertyByName(sPropertyFixed
))
1000 rPropertySet
->setPropertyValue(sPropertyFixed
, Any(bFixed
));
1003 rPropertySet
->setPropertyValue(sPropertyIsDate
, Any(bIsDate
));
1005 if (xPropertySetInfo
->hasPropertyByName(gsPropertyAdjust
))
1007 rPropertySet
->setPropertyValue(gsPropertyAdjust
, Any(nAdjust
));
1013 // organizer or styles-only mode: force update
1014 if (GetImport().GetTextImport()->IsOrganizerMode() ||
1015 GetImport().GetTextImport()->IsStylesOnlyMode() )
1017 ForceUpdate(rPropertySet
);
1021 // normal mode: set value (if present)
1024 if (xPropertySetInfo
->hasPropertyByName(sPropertyDateTimeValue
))
1026 rPropertySet
->setPropertyValue(sPropertyDateTimeValue
, Any(aDateTimeValue
));
1028 else if (xPropertySetInfo
->hasPropertyByName(sPropertyDateTime
))
1030 rPropertySet
->setPropertyValue(sPropertyDateTime
, Any(aDateTimeValue
));
1037 xPropertySetInfo
->hasPropertyByName(sPropertyNumberFormat
))
1039 rPropertySet
->setPropertyValue(sPropertyNumberFormat
, Any(nFormatKey
));
1041 if( xPropertySetInfo
->hasPropertyByName( sPropertyIsFixedLanguage
) )
1043 bool bIsFixedLanguage
= ! bIsDefaultLanguage
;
1044 rPropertySet
->setPropertyValue( sPropertyIsFixedLanguage
, Any(bIsFixedLanguage
) );
1053 XMLDateFieldImportContext::XMLDateFieldImportContext(
1054 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1055 XMLTimeFieldImportContext(rImport
, rHlp
)
1057 bIsDate
= true; // always a date!
1060 void XMLDateFieldImportContext::ProcessAttribute(
1061 sal_Int32 nAttrToken
,
1062 std::string_view sAttrValue
)
1066 case XML_ELEMENT(TEXT
, XML_DATE_VALUE
):
1067 case XML_ELEMENT(OFFICE
, XML_DATE_VALUE
):
1069 if (::sax::Converter::parseDateTime(aDateTimeValue
, sAttrValue
))
1075 case XML_ELEMENT(TEXT
, XML_DATE_ADJUST
):
1076 // delegate to superclass, pretending it was a time-adjust attr.
1077 XMLTimeFieldImportContext::ProcessAttribute(
1078 XML_ELEMENT(TEXT
, XML_TIME_ADJUST
),
1081 case XML_ELEMENT(TEXT
, XML_TIME_VALUE
):
1082 case XML_ELEMENT(OFFICE
, XML_TIME_VALUE
):
1083 case XML_ELEMENT(TEXT
, XML_TIME_ADJUST
):
1084 ; // ignore time-adjust and time-value attributes
1087 // all others: delegate to super-class
1088 return XMLTimeFieldImportContext::ProcessAttribute(nAttrToken
,
1095 // database field superclass
1098 constexpr OUStringLiteral
gsPropertyDataBaseName(u
"DataBaseName");
1099 constexpr OUStringLiteral
gsPropertyDataBaseURL(u
"DataBaseURL");
1100 constexpr OUStringLiteral
gsPropertyTableName(u
"DataTableName");
1101 constexpr OUStringLiteral
gsPropertyDataCommandType(u
"DataCommandType");
1102 constexpr OUStringLiteral
gsPropertyIsVisible(u
"IsVisible");
1104 XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext(
1105 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
1106 const OUString
& pServiceName
, bool bUseDisplay
)
1107 : XMLTextFieldImportContext(rImport
, rHlp
, pServiceName
)
1108 , m_nCommandType( sdb::CommandType::TABLE
)
1109 , m_bCommandTypeOK(false)
1110 , m_bDisplay( true )
1111 , m_bDisplayOK( false )
1112 , m_bUseDisplay( bUseDisplay
)
1113 , m_bDatabaseOK(false)
1114 , m_bDatabaseNameOK(false)
1115 , m_bDatabaseURLOK(false)
1120 void XMLDatabaseFieldImportContext::ProcessAttribute(
1121 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
1125 case XML_ELEMENT(TEXT
, XML_DATABASE_NAME
):
1126 m_sDatabaseName
= OUString::fromUtf8(sAttrValue
);
1127 m_bDatabaseOK
= true;
1128 m_bDatabaseNameOK
= true;
1130 case XML_ELEMENT(TEXT
, XML_TABLE_NAME
):
1131 m_sTableName
= OUString::fromUtf8(sAttrValue
);
1134 case XML_ELEMENT(TEXT
, XML_TABLE_TYPE
):
1135 if( IsXMLToken( sAttrValue
, XML_TABLE
) )
1137 m_nCommandType
= sdb::CommandType::TABLE
;
1138 m_bCommandTypeOK
= true;
1140 else if( IsXMLToken( sAttrValue
, XML_QUERY
) )
1142 m_nCommandType
= sdb::CommandType::QUERY
;
1143 m_bCommandTypeOK
= true;
1145 else if( IsXMLToken( sAttrValue
, XML_COMMAND
) )
1147 m_nCommandType
= sdb::CommandType::COMMAND
;
1148 m_bCommandTypeOK
= true;
1151 case XML_ELEMENT(TEXT
, XML_DISPLAY
):
1152 if( IsXMLToken( sAttrValue
, XML_NONE
) )
1155 m_bDisplayOK
= true;
1157 else if( IsXMLToken( sAttrValue
, XML_VALUE
) )
1160 m_bDisplayOK
= true;
1164 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
1168 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLDatabaseFieldImportContext::createFastChildContext(
1170 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
1172 if (nElement
== XML_ELEMENT(FORM
, XML_CONNECTION_RESOURCE
) )
1174 for( auto& aIter
: sax_fastparser::castToFastAttributeList(xAttrList
) )
1176 switch (aIter
.getToken())
1178 case XML_ELEMENT(XLINK
, XML_HREF
):
1180 m_sDatabaseURL
= aIter
.toString();
1181 m_bDatabaseOK
= true;
1182 m_bDatabaseURLOK
= true;
1189 // we call ProcessAttribute in order to set bValid appropriately
1190 ProcessAttribute( XML_TOKEN_INVALID
, "" );
1193 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
1199 void XMLDatabaseFieldImportContext::PrepareField(
1200 const Reference
<XPropertySet
> & xPropertySet
)
1202 xPropertySet
->setPropertyValue(gsPropertyTableName
, Any(m_sTableName
));
1204 if( m_bDatabaseNameOK
)
1206 xPropertySet
->setPropertyValue(gsPropertyDataBaseName
, Any(m_sDatabaseName
));
1208 else if( m_bDatabaseURLOK
)
1210 xPropertySet
->setPropertyValue(gsPropertyDataBaseURL
, Any(m_sDatabaseURL
));
1213 // #99980# load/save command type for all fields; also load
1214 // old documents without command type
1215 if( m_bCommandTypeOK
)
1217 xPropertySet
->setPropertyValue( gsPropertyDataCommandType
, Any(m_nCommandType
) );
1220 if( m_bUseDisplay
&& m_bDisplayOK
)
1222 xPropertySet
->setPropertyValue( gsPropertyIsVisible
, Any(m_bDisplay
) );
1227 // database name field
1230 XMLDatabaseNameImportContext::XMLDatabaseNameImportContext(
1231 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1232 XMLDatabaseFieldImportContext(rImport
, rHlp
, "DatabaseName", true)
1236 void XMLDatabaseNameImportContext::ProcessAttribute(
1237 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
1239 // delegate to superclass and check for success
1240 XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken
, sAttrValue
);
1241 bValid
= m_bDatabaseOK
&& m_bTableOK
;
1245 // database next field
1248 XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
1249 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
1250 const OUString
& pServiceName
) :
1251 XMLDatabaseFieldImportContext(rImport
, rHlp
, pServiceName
, false),
1252 sPropertyCondition(sAPI_condition
),
1258 XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
1259 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
)
1260 : XMLDatabaseFieldImportContext(rImport
, rHlp
, "DatabaseNextSet", false)
1261 , sPropertyCondition(sAPI_condition
)
1263 , bConditionOK(false)
1267 void XMLDatabaseNextImportContext::ProcessAttribute(
1268 sal_Int32 nAttrToken
, std::string_view sAttrValue
)
1270 if (XML_ELEMENT(TEXT
, XML_CONDITION
) == nAttrToken
)
1273 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1274 OUString::fromUtf8(sAttrValue
), &sTmp
);
1275 if( XML_NAMESPACE_OOOW
== nPrefix
)
1278 bConditionOK
= true;
1281 sCondition
= OUString::fromUtf8(sAttrValue
);
1285 XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken
,
1289 bValid
= m_bDatabaseOK
&& m_bTableOK
;
1292 void XMLDatabaseNextImportContext::PrepareField(
1293 const Reference
<XPropertySet
> & xPropertySet
)
1297 aAny
<<= bConditionOK
? sCondition
: sTrue
;
1298 xPropertySet
->setPropertyValue(sPropertyCondition
, aAny
);
1300 XMLDatabaseFieldImportContext::PrepareField(xPropertySet
);
1304 // database select field
1307 XMLDatabaseSelectImportContext::XMLDatabaseSelectImportContext(
1308 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1309 XMLDatabaseNextImportContext(rImport
, rHlp
, "DatabaseNumberOfSet"),
1310 sPropertySetNumber(sAPI_set_number
),
1316 void XMLDatabaseSelectImportContext::ProcessAttribute(
1317 sal_Int32 nAttrToken
,
1318 std::string_view sAttrValue
)
1320 if (XML_ELEMENT(TEXT
, XML_ROW_NUMBER
) == nAttrToken
)
1323 if (::sax::Converter::convertNumber( nTmp
, sAttrValue
1324 /* , nMin, nMax ??? */ ))
1332 XMLDatabaseNextImportContext::ProcessAttribute(nAttrToken
, sAttrValue
);
1335 bValid
= m_bTableOK
&& m_bDatabaseOK
&& bNumberOK
;
1338 void XMLDatabaseSelectImportContext::PrepareField(
1339 const Reference
<XPropertySet
> & xPropertySet
)
1341 xPropertySet
->setPropertyValue(sPropertySetNumber
, Any(nNumber
));
1343 XMLDatabaseNextImportContext::PrepareField(xPropertySet
);
1347 // database display row number field
1350 XMLDatabaseNumberImportContext::XMLDatabaseNumberImportContext(
1351 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1352 XMLDatabaseFieldImportContext(rImport
, rHlp
, "DatabaseSetNumber", true),
1353 sPropertyNumberingType(
1354 sAPI_numbering_type
),
1355 sPropertySetNumber(sAPI_set_number
),
1357 sNumberSync(GetXMLToken(XML_FALSE
)),
1363 void XMLDatabaseNumberImportContext::ProcessAttribute(
1364 sal_Int32 nAttrToken
,
1365 std::string_view sAttrValue
)
1369 case XML_ELEMENT(STYLE
, XML_NUM_FORMAT
):
1370 sNumberFormat
= OUString::fromUtf8(sAttrValue
);
1372 case XML_ELEMENT(STYLE
, XML_NUM_LETTER_SYNC
):
1373 sNumberSync
= OUString::fromUtf8(sAttrValue
);
1375 case XML_ELEMENT(TEXT
, XML_VALUE_TYPE
):
1376 case XML_ELEMENT(OFFICE
, XML_VALUE_TYPE
):
1379 if (::sax::Converter::convertNumber( nTmp
, sAttrValue
))
1387 XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken
,
1392 bValid
= m_bTableOK
&& m_bDatabaseOK
;
1395 void XMLDatabaseNumberImportContext::PrepareField(
1396 const Reference
<XPropertySet
> & xPropertySet
)
1398 sal_Int16 nNumType
= style::NumberingType::ARABIC
;
1399 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType
,
1402 xPropertySet
->setPropertyValue(sPropertyNumberingType
, Any(nNumType
));
1406 xPropertySet
->setPropertyValue(sPropertySetNumber
, Any(nValue
));
1409 XMLDatabaseFieldImportContext::PrepareField(xPropertySet
);
1413 // Simple doc info fields
1416 XMLSimpleDocInfoImportContext::XMLSimpleDocInfoImportContext(
1417 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
1418 sal_Int32 nElementToken
,
1419 bool bContent
, bool bAuthor
)
1420 : XMLTextFieldImportContext(rImport
, rHlp
, MapTokenToServiceName(nElementToken
) )
1421 , sPropertyFixed(sAPI_is_fixed
)
1422 , sPropertyContent(sAPI_content
)
1423 , sPropertyAuthor(sAPI_author
)
1424 , sPropertyCurrentPresentation(sAPI_current_presentation
)
1426 , bHasAuthor(bAuthor
)
1427 , bHasContent(bContent
)
1432 void XMLSimpleDocInfoImportContext::ProcessAttribute(
1433 sal_Int32 nAttrToken
,
1434 std::string_view sAttrValue
)
1436 if (XML_ELEMENT(TEXT
, XML_FIXED
) == nAttrToken
)
1439 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
1445 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
1448 void XMLSimpleDocInfoImportContext::PrepareField(
1449 const Reference
<XPropertySet
> & rPropertySet
)
1451 // title field in Calc has no Fixed property
1452 Reference
<XPropertySetInfo
> xPropertySetInfo(rPropertySet
->getPropertySetInfo());
1453 if (!xPropertySetInfo
->hasPropertyByName(sPropertyFixed
))
1457 rPropertySet
->setPropertyValue(sPropertyFixed
, Any(bFixed
));
1459 // set Content and CurrentPresentation (if fixed)
1463 // in organizer-mode or styles-only-mode, only force update
1464 if (GetImport().GetTextImport()->IsOrganizerMode() ||
1465 GetImport().GetTextImport()->IsStylesOnlyMode() )
1467 ForceUpdate(rPropertySet
);
1471 // set content (author, if that's the name) and current
1473 aAny
<<= GetContent();
1475 if (bFixed
&& bHasAuthor
)
1477 rPropertySet
->setPropertyValue(sPropertyAuthor
, aAny
);
1480 if (bFixed
&& bHasContent
)
1482 rPropertySet
->setPropertyValue(sPropertyContent
, aAny
);
1485 rPropertySet
->setPropertyValue(sPropertyCurrentPresentation
, aAny
);
1489 OUString
XMLSimpleDocInfoImportContext::MapTokenToServiceName(
1490 sal_Int32 nElementToken
)
1492 OUString pServiceName
;
1494 switch(nElementToken
)
1496 case XML_ELEMENT(TEXT
, XML_INITIAL_CREATOR
):
1497 pServiceName
= "DocInfo.CreateAuthor";
1499 case XML_ELEMENT(TEXT
, XML_CREATION_DATE
):
1500 pServiceName
= sAPI_docinfo_create_date_time
;
1502 case XML_ELEMENT(TEXT
, XML_CREATION_TIME
):
1503 pServiceName
= sAPI_docinfo_create_date_time
;
1505 case XML_ELEMENT(TEXT
, XML_DESCRIPTION
):
1506 pServiceName
= "DocInfo.Description";
1508 case XML_ELEMENT(TEXT
, XML_EDITING_DURATION
):
1509 pServiceName
= "DocInfo.EditTime";
1511 case XML_ELEMENT(TEXT
, XML_USER_DEFINED
):
1512 pServiceName
= sAPI_docinfo_custom
;
1514 case XML_ELEMENT(TEXT
, XML_PRINTED_BY
):
1515 pServiceName
= "DocInfo.PrintAuthor";
1517 case XML_ELEMENT(TEXT
, XML_PRINT_DATE
):
1518 pServiceName
= sAPI_docinfo_print_date_time
;
1520 case XML_ELEMENT(TEXT
, XML_PRINT_TIME
):
1521 pServiceName
= sAPI_docinfo_print_date_time
;
1523 case XML_ELEMENT(TEXT
, XML_KEYWORDS
):
1524 pServiceName
= "DocInfo.KeyWords";
1526 case XML_ELEMENT(TEXT
, XML_SUBJECT
):
1527 pServiceName
= "DocInfo.Subject";
1529 case XML_ELEMENT(TEXT
, XML_EDITING_CYCLES
):
1530 pServiceName
= "DocInfo.Revision";
1532 case XML_ELEMENT(TEXT
, XML_CREATOR
):
1533 pServiceName
= "DocInfo.ChangeAuthor";
1535 case XML_ELEMENT(TEXT
, XML_MODIFICATION_DATE
):
1536 pServiceName
= sAPI_docinfo_change_date_time
;
1538 case XML_ELEMENT(TEXT
, XML_MODIFICATION_TIME
):
1539 pServiceName
= sAPI_docinfo_change_date_time
;
1541 case XML_ELEMENT(TEXT
, XML_TITLE
):
1542 pServiceName
= "DocInfo.Title";
1545 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElementToken
);
1549 return pServiceName
;
1555 constexpr OUStringLiteral
sPropertyRevision(u
"Revision");
1557 XMLRevisionDocInfoImportContext::XMLRevisionDocInfoImportContext(
1558 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
, sal_Int32 nElement
) :
1559 XMLSimpleDocInfoImportContext(rImport
, rHlp
, nElement
, false, false)
1564 void XMLRevisionDocInfoImportContext::PrepareField(
1565 const Reference
<XPropertySet
> & rPropertySet
)
1567 XMLSimpleDocInfoImportContext::PrepareField(rPropertySet
);
1569 // set revision number
1570 // if fixed, if not in organizer-mode, if not in styles-only-mode
1574 if ( GetImport().GetTextImport()->IsOrganizerMode() ||
1575 GetImport().GetTextImport()->IsStylesOnlyMode() )
1577 ForceUpdate(rPropertySet
);
1582 if (::sax::Converter::convertNumber(nTmp
, GetContent()))
1584 rPropertySet
->setPropertyValue(sPropertyRevision
, Any(nTmp
));
1590 // DocInfo fields with date/time attributes
1593 XMLDateTimeDocInfoImportContext::XMLDateTimeDocInfoImportContext(
1594 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
, sal_Int32 nElement
)
1595 : XMLSimpleDocInfoImportContext(rImport
, rHlp
, nElement
, false, false)
1596 , sPropertyNumberFormat(sAPI_number_format
)
1597 , sPropertyIsDate(sAPI_is_date
)
1598 , sPropertyIsFixedLanguage(sAPI_is_fixed_language
)
1602 , bHasDateTime(false)
1603 , bIsDefaultLanguage(true)
1605 // we allow processing of EDIT_DURATION here, because import of actual
1606 // is not supported anyway. If it was, we'd need an extra import class
1607 // because times and time durations are presented differently!
1612 case XML_ELEMENT(TEXT
, XML_CREATION_DATE
):
1613 case XML_ELEMENT(TEXT
, XML_PRINT_DATE
):
1614 case XML_ELEMENT(TEXT
, XML_MODIFICATION_DATE
):
1616 bHasDateTime
= true;
1618 case XML_ELEMENT(TEXT
, XML_CREATION_TIME
):
1619 case XML_ELEMENT(TEXT
, XML_PRINT_TIME
):
1620 case XML_ELEMENT(TEXT
, XML_MODIFICATION_TIME
):
1622 bHasDateTime
= true;
1624 case XML_ELEMENT(TEXT
, XML_EDITING_DURATION
):
1626 bHasDateTime
= false;
1629 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
1630 OSL_FAIL("XMLDateTimeDocInfoImportContext needs date/time doc. fields");
1636 void XMLDateTimeDocInfoImportContext::ProcessAttribute(
1637 sal_Int32 nAttrToken
,
1638 std::string_view sAttrValue
)
1642 case XML_ELEMENT(STYLE
, XML_DATA_STYLE_NAME
):
1644 sal_Int32 nKey
= GetImportHelper().GetDataStyleKey(
1645 OUString::fromUtf8(sAttrValue
), &bIsDefaultLanguage
);
1653 case XML_ELEMENT(TEXT
, XML_FIXED
):
1654 XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken
,
1658 // ignore -> we can't set date/time value anyway!
1663 void XMLDateTimeDocInfoImportContext::PrepareField(
1664 const Reference
<XPropertySet
> & xPropertySet
)
1666 // process fixed and presentation
1667 XMLSimpleDocInfoImportContext::PrepareField(xPropertySet
);
1671 xPropertySet
->setPropertyValue(sPropertyIsDate
, Any(bIsDate
));
1676 xPropertySet
->setPropertyValue(sPropertyNumberFormat
, Any(nFormat
));
1678 if( xPropertySet
->getPropertySetInfo()->
1679 hasPropertyByName( sPropertyIsFixedLanguage
) )
1681 bool bIsFixedLanguage
= ! bIsDefaultLanguage
;
1682 xPropertySet
->setPropertyValue( sPropertyIsFixedLanguage
, Any(bIsFixedLanguage
) );
1686 // can't set date/time/duration value! Sorry.
1690 // user defined docinfo fields
1693 XMLUserDocInfoImportContext::XMLUserDocInfoImportContext(
1694 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
1695 sal_Int32 nElement
) :
1696 XMLSimpleDocInfoImportContext(rImport
, rHlp
, nElement
, false, false)
1697 , sPropertyName(sAPI_name
)
1698 , sPropertyNumberFormat(sAPI_number_format
)
1699 , sPropertyIsFixedLanguage(sAPI_is_fixed_language
)
1702 , bIsDefaultLanguage( true )
1707 void XMLUserDocInfoImportContext::ProcessAttribute(
1708 sal_Int32 nAttrToken
,
1709 std::string_view sAttrValue
)
1713 case XML_ELEMENT(STYLE
, XML_DATA_STYLE_NAME
):
1715 sal_Int32 nKey
= GetImportHelper().GetDataStyleKey(
1716 OUString::fromUtf8(sAttrValue
), &bIsDefaultLanguage
);
1724 case XML_ELEMENT(TEXT
, XML_NAME
):
1728 SetServiceName(sAPI_docinfo_custom
);
1729 aName
= OUString::fromUtf8(sAttrValue
);
1736 XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken
,
1742 void XMLUserDocInfoImportContext::PrepareField(
1743 const css::uno::Reference
<css::beans::XPropertySet
> & xPropertySet
)
1745 if ( !aName
.isEmpty() )
1747 xPropertySet
->setPropertyValue(sPropertyName
, Any(aName
));
1749 Reference
<XPropertySetInfo
> xPropertySetInfo(
1750 xPropertySet
->getPropertySetInfo());
1752 xPropertySetInfo
->hasPropertyByName(sPropertyNumberFormat
))
1754 xPropertySet
->setPropertyValue(sPropertyNumberFormat
, Any(nFormat
));
1756 if( xPropertySetInfo
->hasPropertyByName( sPropertyIsFixedLanguage
) )
1758 bool bIsFixedLanguage
= ! bIsDefaultLanguage
;
1759 xPropertySet
->setPropertyValue( sPropertyIsFixedLanguage
, Any(bIsFixedLanguage
) );
1763 // call superclass to handle "fixed"
1764 XMLSimpleDocInfoImportContext::PrepareField(xPropertySet
);
1768 // import hidden paragraph fields
1771 XMLHiddenParagraphImportContext::XMLHiddenParagraphImportContext(
1772 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1773 XMLTextFieldImportContext(rImport
, rHlp
, "HiddenParagraph"),
1774 sPropertyCondition(sAPI_condition
),
1775 sPropertyIsHidden(sAPI_is_hidden
),
1780 void XMLHiddenParagraphImportContext::ProcessAttribute(
1781 sal_Int32 nAttrToken
,
1782 std::string_view sAttrValue
)
1784 if ( XML_ELEMENT(TEXT
, XML_CONDITION
) == nAttrToken
)
1787 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1788 OUString::fromUtf8(sAttrValue
), &sTmp
);
1789 if( XML_NAMESPACE_OOOW
== nPrefix
)
1795 sCondition
= OUString::fromUtf8(sAttrValue
);
1797 else if ( XML_ELEMENT(TEXT
, XML_IS_HIDDEN
) == nAttrToken
)
1800 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
1806 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
1809 void XMLHiddenParagraphImportContext::PrepareField(
1810 const Reference
<XPropertySet
> & xPropertySet
)
1812 xPropertySet
->setPropertyValue(sPropertyCondition
, Any(sCondition
));
1813 xPropertySet
->setPropertyValue(sPropertyIsHidden
, Any(bIsHidden
));
1817 // import conditional text (<text:conditional-text>)
1819 constexpr OUStringLiteral
gsPropertyTrueContent(u
"TrueContent");
1820 constexpr OUStringLiteral
gsPropertyFalseContent(u
"FalseContent");
1821 constexpr OUStringLiteral
gsPropertyIsConditionTrue(u
"IsConditionTrue");
1823 XMLConditionalTextImportContext::XMLConditionalTextImportContext(
1824 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1825 XMLTextFieldImportContext(rImport
, rHlp
, "ConditionalText"),
1826 sPropertyCondition(sAPI_condition
),
1827 sPropertyCurrentPresentation(sAPI_current_presentation
),
1828 bConditionOK(false),
1831 bCurrentValue(false)
1835 void XMLConditionalTextImportContext::ProcessAttribute(
1836 sal_Int32 nAttrToken
,
1837 std::string_view sAttrValue
)
1841 case XML_ELEMENT(TEXT
, XML_CONDITION
):
1844 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().
1845 GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue
), &sTmp
);
1846 if( XML_NAMESPACE_OOOW
== nPrefix
)
1849 bConditionOK
= true;
1852 sCondition
= OUString::fromUtf8(sAttrValue
);
1855 case XML_ELEMENT(TEXT
, XML_STRING_VALUE_IF_FALSE
):
1856 sFalseContent
= OUString::fromUtf8(sAttrValue
);
1859 case XML_ELEMENT(TEXT
, XML_STRING_VALUE_IF_TRUE
):
1860 sTrueContent
= OUString::fromUtf8(sAttrValue
);
1863 case XML_ELEMENT(TEXT
, XML_CURRENT_VALUE
):
1866 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
1868 bCurrentValue
= bTmp
;
1873 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
1876 bValid
= bConditionOK
&& bFalseOK
&& bTrueOK
;
1879 void XMLConditionalTextImportContext::PrepareField(
1880 const Reference
<XPropertySet
> & xPropertySet
)
1882 xPropertySet
->setPropertyValue(sPropertyCondition
, Any(sCondition
));
1883 xPropertySet
->setPropertyValue(gsPropertyFalseContent
, Any(sFalseContent
));
1884 xPropertySet
->setPropertyValue(gsPropertyTrueContent
, Any(sTrueContent
));
1885 xPropertySet
->setPropertyValue(gsPropertyIsConditionTrue
, Any(bCurrentValue
));
1886 xPropertySet
->setPropertyValue(sPropertyCurrentPresentation
, Any(GetContent()));
1893 XMLHiddenTextImportContext::XMLHiddenTextImportContext(
1894 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1895 XMLTextFieldImportContext(rImport
, rHlp
, "HiddenText"),
1896 sPropertyCondition(sAPI_condition
),
1897 sPropertyContent(sAPI_content
),
1898 sPropertyIsHidden(sAPI_is_hidden
),
1899 bConditionOK(false),
1905 void XMLHiddenTextImportContext::ProcessAttribute(
1906 sal_Int32 nAttrToken
,
1907 std::string_view sAttrValue
)
1911 case XML_ELEMENT(TEXT
, XML_CONDITION
):
1914 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().
1915 GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue
), &sTmp
);
1916 if( XML_NAMESPACE_OOOW
== nPrefix
)
1919 bConditionOK
= true;
1922 sCondition
= OUString::fromUtf8(sAttrValue
);
1925 case XML_ELEMENT(TEXT
, XML_STRING_VALUE
):
1926 case XML_ELEMENT(OFFICE
, XML_STRING_VALUE
):
1927 sString
= OUString::fromUtf8(sAttrValue
);
1930 case XML_ELEMENT(TEXT
, XML_IS_HIDDEN
):
1933 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
1940 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
1943 bValid
= bConditionOK
&& bStringOK
;
1946 void XMLHiddenTextImportContext::PrepareField(
1947 const Reference
<XPropertySet
> & xPropertySet
)
1949 xPropertySet
->setPropertyValue(sPropertyCondition
, Any(sCondition
));
1950 xPropertySet
->setPropertyValue(sPropertyContent
, Any(sString
));
1951 xPropertySet
->setPropertyValue(sPropertyIsHidden
, Any(bIsHidden
));
1958 const SvXMLEnumMapEntry
<sal_uInt16
> aFilenameDisplayMap
[] =
1960 { XML_PATH
, FilenameDisplayFormat::PATH
},
1961 { XML_NAME
, FilenameDisplayFormat::NAME
},
1962 { XML_NAME_AND_EXTENSION
, FilenameDisplayFormat::NAME_AND_EXT
},
1963 { XML_FULL
, FilenameDisplayFormat::FULL
},
1964 { XML_TOKEN_INVALID
, 0 }
1967 XMLFileNameImportContext::XMLFileNameImportContext(
1968 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
1969 XMLTextFieldImportContext(rImport
, rHlp
, "FileName"),
1970 sPropertyFixed(sAPI_is_fixed
),
1971 sPropertyFileFormat(sAPI_file_format
),
1972 sPropertyCurrentPresentation(
1973 sAPI_current_presentation
),
1974 nFormat(FilenameDisplayFormat::FULL
),
1980 void XMLFileNameImportContext::ProcessAttribute(
1981 sal_Int32 nAttrToken
,
1982 std::string_view sAttrValue
)
1986 case XML_ELEMENT(TEXT
, XML_FIXED
):
1989 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
1995 case XML_ELEMENT(TEXT
, XML_DISPLAY
):
1998 if (SvXMLUnitConverter::convertEnum(nTmp
, sAttrValue
,
1999 aFilenameDisplayMap
))
2006 // unknown attribute: ignore
2007 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2012 void XMLFileNameImportContext::PrepareField(
2013 const Reference
<XPropertySet
> & xPropertySet
)
2015 // properties are optional
2016 Reference
<XPropertySetInfo
> xPropertySetInfo(
2017 xPropertySet
->getPropertySetInfo());
2019 if (xPropertySetInfo
->hasPropertyByName(sPropertyFixed
))
2021 xPropertySet
->setPropertyValue(sPropertyFixed
, Any(bFixed
));
2024 if (xPropertySetInfo
->hasPropertyByName(sPropertyFileFormat
))
2026 xPropertySet
->setPropertyValue(sPropertyFileFormat
, Any(nFormat
));
2029 if (xPropertySetInfo
->hasPropertyByName(sPropertyCurrentPresentation
))
2031 xPropertySet
->setPropertyValue(sPropertyCurrentPresentation
, Any(GetContent()));
2036 // template name field
2039 const SvXMLEnumMapEntry
<sal_uInt16
> aTemplateDisplayMap
[] =
2041 { XML_FULL
, TemplateDisplayFormat::FULL
},
2042 { XML_PATH
, TemplateDisplayFormat::PATH
},
2043 { XML_NAME
, TemplateDisplayFormat::NAME
},
2044 { XML_NAME_AND_EXTENSION
, TemplateDisplayFormat::NAME_AND_EXT
},
2045 { XML_AREA
, TemplateDisplayFormat::AREA
},
2046 { XML_TITLE
, TemplateDisplayFormat::TITLE
},
2047 { XML_TOKEN_INVALID
, 0 }
2051 XMLTemplateNameImportContext::XMLTemplateNameImportContext(
2052 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2053 XMLTextFieldImportContext(rImport
, rHlp
, "TemplateName"),
2054 sPropertyFileFormat(sAPI_file_format
),
2055 nFormat(TemplateDisplayFormat::FULL
)
2060 void XMLTemplateNameImportContext::ProcessAttribute(
2061 sal_Int32 nAttrToken
,
2062 std::string_view sAttrValue
)
2066 case XML_ELEMENT(TEXT
, XML_DISPLAY
):
2069 if (SvXMLUnitConverter::convertEnum(nTmp
, sAttrValue
,
2070 aTemplateDisplayMap
))
2077 // unknown attribute: ignore
2078 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2083 void XMLTemplateNameImportContext::PrepareField(
2084 const Reference
<XPropertySet
> & xPropertySet
)
2086 xPropertySet
->setPropertyValue(sPropertyFileFormat
, Any(nFormat
));
2090 // import chapter fields
2093 const SvXMLEnumMapEntry
<sal_uInt16
> aChapterDisplayMap
[] =
2095 { XML_NAME
, ChapterFormat::NAME
},
2096 { XML_NUMBER
, ChapterFormat::NUMBER
},
2097 { XML_NUMBER_AND_NAME
, ChapterFormat::NAME_NUMBER
},
2098 { XML_PLAIN_NUMBER_AND_NAME
, ChapterFormat::NO_PREFIX_SUFFIX
},
2099 { XML_PLAIN_NUMBER
, ChapterFormat::DIGIT
},
2100 { XML_TOKEN_INVALID
, 0 }
2103 constexpr OUStringLiteral
gsPropertyChapterFormat(u
"ChapterFormat");
2104 constexpr OUStringLiteral
gsPropertyLevel(u
"Level");
2106 XMLChapterImportContext::XMLChapterImportContext(
2107 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2108 XMLTextFieldImportContext(rImport
, rHlp
, "Chapter"),
2109 nFormat(ChapterFormat::NAME_NUMBER
),
2115 void XMLChapterImportContext::ProcessAttribute(
2116 sal_Int32 nAttrToken
,
2117 std::string_view sAttrValue
)
2121 case XML_ELEMENT(TEXT
, XML_DISPLAY
):
2124 if (SvXMLUnitConverter::convertEnum(nTmp
, sAttrValue
,
2125 aChapterDisplayMap
))
2127 nFormat
= static_cast<sal_Int16
>(nTmp
);
2131 case XML_ELEMENT(TEXT
, XML_OUTLINE_LEVEL
):
2134 if (::sax::Converter::convertNumber(
2135 nTmp
, sAttrValue
, 1,
2136 GetImport().GetTextImport()->GetChapterNumbering()->getCount()
2139 // API numbers 0..9, we number 1..10
2140 nLevel
= static_cast<sal_Int8
>(nTmp
);
2146 // unknown attribute: ignore
2147 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2152 void XMLChapterImportContext::PrepareField(
2153 const Reference
<XPropertySet
> & xPropertySet
)
2155 xPropertySet
->setPropertyValue(gsPropertyChapterFormat
, Any(nFormat
));
2156 xPropertySet
->setPropertyValue(gsPropertyLevel
, Any(nLevel
));
2163 XMLCountFieldImportContext::XMLCountFieldImportContext(
2164 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
2165 sal_Int32 nElement
) :
2166 XMLTextFieldImportContext(rImport
, rHlp
, MapTokenToServiceName(nElement
)),
2167 sPropertyNumberingType(
2168 sAPI_numbering_type
),
2169 bNumberFormatOK(false)
2174 void XMLCountFieldImportContext::ProcessAttribute(
2175 sal_Int32 nAttrToken
,
2176 std::string_view sAttrValue
)
2180 case XML_ELEMENT(STYLE
, XML_NUM_FORMAT
):
2181 sNumberFormat
= OUString::fromUtf8(sAttrValue
);
2182 bNumberFormatOK
= true;
2184 case XML_ELEMENT(STYLE
, XML_NUM_LETTER_SYNC
):
2185 sLetterSync
= OUString::fromUtf8(sAttrValue
);
2188 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2192 void XMLCountFieldImportContext::PrepareField(
2193 const Reference
<XPropertySet
> & xPropertySet
)
2195 // properties optional
2196 // (only page count, but do for all to save common implementation)
2198 if (!xPropertySet
->getPropertySetInfo()->
2199 hasPropertyByName(sPropertyNumberingType
))
2203 if( bNumberFormatOK
)
2205 nNumType
= style::NumberingType::ARABIC
;
2206 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType
,
2211 nNumType
= style::NumberingType::PAGE_DESCRIPTOR
;
2212 xPropertySet
->setPropertyValue(sPropertyNumberingType
, Any(nNumType
));
2215 OUString
XMLCountFieldImportContext::MapTokenToServiceName(
2218 OUString pServiceName
;
2222 case XML_ELEMENT(TEXT
, XML_WORD_COUNT
):
2223 pServiceName
= "WordCount";
2225 case XML_ELEMENT(TEXT
, XML_PARAGRAPH_COUNT
):
2226 pServiceName
= "ParagraphCount";
2228 case XML_ELEMENT(TEXT
, XML_TABLE_COUNT
):
2229 pServiceName
= "TableCount";
2231 case XML_ELEMENT(TEXT
, XML_CHARACTER_COUNT
):
2232 pServiceName
= "CharacterCount";
2234 case XML_ELEMENT(TEXT
, XML_IMAGE_COUNT
):
2235 pServiceName
= "GraphicObjectCount";
2237 case XML_ELEMENT(TEXT
, XML_OBJECT_COUNT
):
2238 pServiceName
= "EmbeddedObjectCount";
2240 case XML_ELEMENT(TEXT
, XML_PAGE_COUNT
):
2241 pServiceName
= "PageCount";
2244 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
2248 return pServiceName
;
2252 // page variable import
2255 XMLPageVarGetFieldImportContext::XMLPageVarGetFieldImportContext(
2256 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2257 XMLTextFieldImportContext(rImport
, rHlp
, "ReferencePageGet"),
2258 bNumberFormatOK(false)
2263 void XMLPageVarGetFieldImportContext::ProcessAttribute(
2264 sal_Int32 nAttrToken
,
2265 std::string_view sAttrValue
)
2269 case XML_ELEMENT(STYLE
, XML_NUM_FORMAT
):
2270 sNumberFormat
= OUString::fromUtf8(sAttrValue
);
2271 bNumberFormatOK
= true;
2273 case XML_ELEMENT(STYLE
, XML_NUM_LETTER_SYNC
):
2274 sLetterSync
= OUString::fromUtf8(sAttrValue
);
2277 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2281 void XMLPageVarGetFieldImportContext::PrepareField(
2282 const Reference
<XPropertySet
> & xPropertySet
)
2285 if( bNumberFormatOK
)
2287 nNumType
= style::NumberingType::ARABIC
;
2288 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType
,
2293 nNumType
= style::NumberingType::PAGE_DESCRIPTOR
;
2294 xPropertySet
->setPropertyValue(sAPI_numbering_type
, Any(nNumType
));
2296 // display old content (#96657#)
2297 xPropertySet
->setPropertyValue( sAPI_current_presentation
, Any(GetContent()) );
2301 // page variable set fields
2304 XMLPageVarSetFieldImportContext::XMLPageVarSetFieldImportContext(
2305 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2306 XMLTextFieldImportContext(rImport
, rHlp
, "ReferencePageSet"),
2313 void XMLPageVarSetFieldImportContext::ProcessAttribute(
2314 sal_Int32 nAttrToken
,
2315 std::string_view sAttrValue
)
2319 case XML_ELEMENT(TEXT
, XML_ACTIVE
):
2322 if (::sax::Converter::convertBool(bTmp
, sAttrValue
))
2328 case XML_ELEMENT(TEXT
, XML_PAGE_ADJUST
):
2331 if (::sax::Converter::convertNumber(nTmp
, sAttrValue
))
2333 nAdjust
= static_cast<sal_Int16
>(nTmp
);
2338 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2343 void XMLPageVarSetFieldImportContext::PrepareField(
2344 const Reference
<XPropertySet
> & xPropertySet
)
2346 xPropertySet
->setPropertyValue("On", Any(bActive
));
2347 xPropertySet
->setPropertyValue(sAPI_offset
, Any(nAdjust
));
2354 XMLMacroFieldImportContext::XMLMacroFieldImportContext(
2355 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2356 XMLTextFieldImportContext(rImport
, rHlp
, "Macro"),
2357 bDescriptionOK(false)
2361 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLMacroFieldImportContext::createFastChildContext(
2363 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& )
2365 if ( nElement
== XML_ELEMENT(OFFICE
, XML_EVENT_LISTENERS
) )
2367 // create events context and remember it!
2368 xEventContext
= new XMLEventsImportContext( GetImport() );
2370 return xEventContext
;
2372 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
2377 void XMLMacroFieldImportContext::ProcessAttribute(
2378 sal_Int32 nAttrToken
,
2379 std::string_view sAttrValue
)
2383 case XML_ELEMENT(TEXT
, XML_DESCRIPTION
):
2384 sDescription
= OUString::fromUtf8(sAttrValue
);
2385 bDescriptionOK
= true;
2387 case XML_ELEMENT(TEXT
, XML_NAME
):
2388 sMacro
= OUString::fromUtf8(sAttrValue
);
2392 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2396 void XMLMacroFieldImportContext::PrepareField(
2397 const Reference
<XPropertySet
> & xPropertySet
)
2400 aAny
<<= (bDescriptionOK
? sDescription
: GetContent());
2401 xPropertySet
->setPropertyValue(sAPI_hint
, aAny
);
2403 // if we have an events child element, we'll look for the OnClick
2404 // event if not, it may be an old (pre-638i) document. Then, we'll
2405 // have to look at the name attribute.
2406 OUString sMacroName
;
2407 OUString sLibraryName
;
2408 OUString sScriptURL
;
2410 if ( xEventContext
.is() )
2412 // get event sequence
2413 XMLEventsImportContext
* pEvents
= xEventContext
.get();
2414 Sequence
<PropertyValue
> aValues
;
2415 pEvents
->GetEventSequence( "OnClick", aValues
);
2417 for( const auto& rValue
: std::as_const(aValues
) )
2419 if ( rValue
.Name
== "ScriptType" )
2421 // ignore ScriptType
2423 else if ( rValue
.Name
== "Library" )
2425 rValue
.Value
>>= sLibraryName
;
2427 else if ( rValue
.Name
== "MacroName" )
2429 rValue
.Value
>>= sMacroName
;
2431 if ( rValue
.Name
== "Script" )
2433 rValue
.Value
>>= sScriptURL
;
2439 // disassemble old-style macro-name: Everything before the
2440 // third-last dot is the library
2441 sal_Int32 nPos
= sMacro
.getLength() + 1; // the loop starts with nPos--
2442 const sal_Unicode
* pBuf
= sMacro
.getStr();
2443 for( sal_Int32 i
= 0; (i
< 3) && (nPos
> 0); i
++ )
2446 while ( (pBuf
[nPos
] != '.') && (nPos
> 0) )
2452 sLibraryName
= sMacro
.copy(0, nPos
);
2453 sMacroName
= sMacro
.copy(nPos
+1);
2456 sMacroName
= sMacro
;
2459 xPropertySet
->setPropertyValue("ScriptURL", Any(sScriptURL
));
2460 xPropertySet
->setPropertyValue("MacroName", Any(sMacroName
));
2461 xPropertySet
->setPropertyValue("MacroLibrary", Any(sLibraryName
));
2465 // reference field import
2468 XMLReferenceFieldImportContext::XMLReferenceFieldImportContext(
2469 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
,
2471 : XMLTextFieldImportContext(rImport
, rHlp
, "GetReference")
2472 , nElementToken(nToken
)
2474 , nType(ReferenceFieldPart::PAGE_DESC
)
2481 SvXMLEnumMapEntry
<sal_uInt16
> const lcl_aReferenceTypeTokenMap
[] =
2483 { XML_PAGE
, ReferenceFieldPart::PAGE
},
2484 { XML_CHAPTER
, ReferenceFieldPart::CHAPTER
},
2485 { XML_TEXT
, ReferenceFieldPart::TEXT
},
2486 { XML_DIRECTION
, ReferenceFieldPart::UP_DOWN
},
2487 { XML_CATEGORY_AND_VALUE
, ReferenceFieldPart::CATEGORY_AND_NUMBER
},
2488 { XML_CAPTION
, ReferenceFieldPart::ONLY_CAPTION
},
2489 { XML_VALUE
, ReferenceFieldPart::ONLY_SEQUENCE_NUMBER
},
2490 // Core implementation for direct cross-references (#i81002#)
2491 { XML_NUMBER
, ReferenceFieldPart::NUMBER
},
2492 { XML_NUMBER_NO_SUPERIOR
, ReferenceFieldPart::NUMBER_NO_CONTEXT
},
2493 { XML_NUMBER_ALL_SUPERIOR
, ReferenceFieldPart::NUMBER_FULL_CONTEXT
},
2494 { XML_TOKEN_INVALID
, 0 }
2497 void XMLReferenceFieldImportContext::startFastElement(
2499 const Reference
<XFastAttributeList
> & xAttrList
)
2502 switch (nElementToken
)
2504 case XML_ELEMENT(TEXT
, XML_REFERENCE_REF
):
2505 nSource
= ReferenceFieldSource::REFERENCE_MARK
;
2507 case XML_ELEMENT(TEXT
, XML_BOOKMARK_REF
):
2508 nSource
= ReferenceFieldSource::BOOKMARK
;
2510 case XML_ELEMENT(TEXT
, XML_NOTE_REF
):
2511 nSource
= ReferenceFieldSource::FOOTNOTE
;
2513 case XML_ELEMENT(TEXT
, XML_SEQUENCE_REF
):
2514 nSource
= ReferenceFieldSource::SEQUENCE_FIELD
;
2516 case XML_ELEMENT(TEXT
, XML_STYLE_REF
):
2517 case XML_ELEMENT(LO_EXT
, XML_STYLE_REF
):
2518 nSource
= ReferenceFieldSource::STYLE
;
2521 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElementToken
);
2526 XMLTextFieldImportContext::startFastElement(nElement
, xAttrList
);
2530 void XMLReferenceFieldImportContext::ProcessAttribute(
2531 sal_Int32 nAttrToken
,
2532 std::string_view sAttrValue
)
2536 case XML_ELEMENT(TEXT
, XML_NOTE_CLASS
):
2537 if( IsXMLToken( sAttrValue
, XML_ENDNOTE
) )
2538 nSource
= ReferenceFieldSource::ENDNOTE
;
2540 case XML_ELEMENT(TEXT
, XML_REF_NAME
):
2541 sName
= OUString::fromUtf8(sAttrValue
);
2544 case XML_ELEMENT(TEXT
, XML_REFERENCE_FORMAT
):
2547 if (SvXMLUnitConverter::convertEnum(nToken
, sAttrValue
,
2548 lcl_aReferenceTypeTokenMap
))
2553 // check for sequence-only-attributes
2554 if ( (XML_ELEMENT(TEXT
, XML_SEQUENCE_REF
) != nElementToken
) &&
2555 ( (nType
== ReferenceFieldPart::CATEGORY_AND_NUMBER
) ||
2556 (nType
== ReferenceFieldPart::ONLY_CAPTION
) ||
2557 (nType
== ReferenceFieldPart::ONLY_SEQUENCE_NUMBER
) ) )
2559 nType
= ReferenceFieldPart::PAGE_DESC
;
2564 case XML_ELEMENT(LO_EXT
, XML_REFERENCE_LANGUAGE
):
2565 case XML_ELEMENT(TEXT
, XML_REFERENCE_LANGUAGE
):
2566 sLanguage
= OUString::fromUtf8(sAttrValue
);
2568 case XML_ELEMENT(LO_EXT
, XML_REFERENCE_HIDE_NON_NUMERICAL
):
2569 case XML_ELEMENT(TEXT
, XML_REFERENCE_HIDE_NON_NUMERICAL
):
2570 if (OUString::fromUtf8(sAttrValue
).toBoolean())
2571 nFlags
|= REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
;
2573 case XML_ELEMENT(LO_EXT
, XML_REFERENCE_FROM_BOTTOM
):
2574 case XML_ELEMENT(TEXT
, XML_REFERENCE_FROM_BOTTOM
):
2575 if (OUString::fromUtf8(sAttrValue
).toBoolean())
2576 nFlags
|= REFFLDFLAG_STYLE_FROM_BOTTOM
;
2579 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2582 // bValid: we need proper element type and name
2583 bValid
= bTypeOK
&& bNameOK
;
2586 void XMLReferenceFieldImportContext::PrepareField(
2587 const Reference
<XPropertySet
> & xPropertySet
)
2589 xPropertySet
->setPropertyValue("ReferenceFieldPart", Any(nType
));
2591 xPropertySet
->setPropertyValue("ReferenceFieldSource", Any(nSource
));
2593 xPropertySet
->setPropertyValue("ReferenceFieldLanguage", Any(sLanguage
));
2594 switch (nElementToken
)
2596 case XML_ELEMENT(TEXT
, XML_REFERENCE_REF
):
2597 case XML_ELEMENT(TEXT
, XML_BOOKMARK_REF
):
2598 case XML_ELEMENT(TEXT
, XML_STYLE_REF
):
2599 case XML_ELEMENT(LO_EXT
, XML_STYLE_REF
):
2600 xPropertySet
->setPropertyValue("SourceName", Any(sName
));
2601 xPropertySet
->setPropertyValue("ReferenceFieldFlags", Any(nFlags
));
2604 case XML_ELEMENT(TEXT
, XML_NOTE_REF
):
2605 GetImportHelper().ProcessFootnoteReference(sName
, xPropertySet
);
2608 case XML_ELEMENT(TEXT
, XML_SEQUENCE_REF
):
2609 GetImportHelper().ProcessSequenceReference(sName
, xPropertySet
);
2613 xPropertySet
->setPropertyValue(sAPI_current_presentation
, Any(GetContent()));
2617 // field declarations container
2619 XMLDdeFieldDeclsImportContext::XMLDdeFieldDeclsImportContext(SvXMLImport
& rImport
) :
2620 SvXMLImportContext(rImport
)
2624 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLDdeFieldDeclsImportContext::createFastChildContext(
2626 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& )
2628 if ( nElement
== XML_ELEMENT(TEXT
, XML_DDE_CONNECTION_DECL
) )
2630 return new XMLDdeFieldDeclImportContext(GetImport());
2633 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement
);
2638 // import dde field declaration
2641 XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext(SvXMLImport
& rImport
)
2642 : SvXMLImportContext(rImport
)
2646 void XMLDdeFieldDeclImportContext::startFastElement(
2647 sal_Int32
/*nElement*/,
2648 const Reference
<XFastAttributeList
> & xAttrList
)
2651 OUString sCommandApplication
;
2652 OUString sCommandTopic
;
2653 OUString sCommandItem
;
2655 bool bUpdate
= false;
2656 bool bNameOK
= false;
2657 bool bCommandApplicationOK
= false;
2658 bool bCommandTopicOK
= false;
2659 bool bCommandItemOK
= false;
2661 // process attributes
2662 for( auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
) )
2664 switch (aIter
.getToken())
2666 case XML_ELEMENT(OFFICE
, XML_NAME
):
2667 sName
= aIter
.toString();
2670 case XML_ELEMENT(OFFICE
, XML_DDE_APPLICATION
):
2671 sCommandApplication
= aIter
.toString();
2672 bCommandApplicationOK
= true;
2674 case XML_ELEMENT(OFFICE
, XML_DDE_TOPIC
):
2675 sCommandTopic
= aIter
.toString();
2676 bCommandTopicOK
= true;
2678 case XML_ELEMENT(OFFICE
, XML_DDE_ITEM
):
2679 sCommandItem
= aIter
.toString();
2680 bCommandItemOK
= true;
2682 case XML_ELEMENT(OFFICE
, XML_AUTOMATIC_UPDATE
):
2685 if (::sax::Converter::convertBool(bTmp
, aIter
.toView()) )
2692 XMLOFF_WARN_UNKNOWN("xmloff", aIter
);
2697 if (!(bNameOK
&& bCommandApplicationOK
&& bCommandTopicOK
&& bCommandItemOK
))
2700 // create DDE TextFieldMaster
2701 Reference
<XMultiServiceFactory
> xFactory(GetImport().GetModel(),
2703 if( !xFactory
.is() )
2706 /* #i6432# There might be multiple occurrences of one DDE
2707 declaration if it is used in more than one of
2708 header/footer/body. createInstance will throw an exception if we
2709 try to create the second, third, etc. instance of such a
2710 declaration. Thus we ignore the exception. Otherwise this will
2711 lead to an unloadable document. */
2714 Reference
<XInterface
> xIfc
=
2715 xFactory
->createInstance(OUString::Concat(sAPI_fieldmaster_prefix
) + sAPI_dde
);
2718 Reference
<XPropertySet
> xPropSet( xIfc
, UNO_QUERY
);
2719 if (xPropSet
.is() &&
2720 xPropSet
->getPropertySetInfo()->hasPropertyByName(
2723 xPropSet
->setPropertyValue(sAPI_name
, Any(sName
));
2725 xPropSet
->setPropertyValue("DDECommandType", Any(sCommandApplication
));
2727 xPropSet
->setPropertyValue("DDECommandFile", Any(sCommandTopic
));
2729 xPropSet
->setPropertyValue("DDECommandElement",
2732 xPropSet
->setPropertyValue("IsAutomaticUpdate",
2735 // else: ignore (can't get XPropertySet, or DDE
2736 // properties are not supported)
2740 catch (const Exception
&)
2752 XMLDdeFieldImportContext::XMLDdeFieldImportContext(
2753 SvXMLImport
& rImport
, XMLTextImportHelper
& rHlp
) :
2754 XMLTextFieldImportContext(rImport
, rHlp
, sAPI_dde
),
2755 sPropertyContent(sAPI_content
)
2759 void XMLDdeFieldImportContext::ProcessAttribute(
2760 sal_Int32 nAttrToken
,
2761 std::string_view sAttrValue
)
2763 if ( XML_ELEMENT(TEXT
, XML_CONNECTION_NAME
) == nAttrToken
)
2765 sName
= OUString::fromUtf8(sAttrValue
);
2769 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2773 void XMLDdeFieldImportContext::endFastElement(sal_Int32
)
2779 OUString sMasterName
= OUString::Concat(sAPI_fieldmaster_prefix
) + sAPI_dde
+ "." + sName
;
2781 Reference
<XTextFieldsSupplier
> xTextFieldsSupp(GetImport().GetModel(),
2783 Reference
<container::XNameAccess
> xFieldMasterNameAccess
=
2784 xTextFieldsSupp
->getTextFieldMasters();
2786 if (!xFieldMasterNameAccess
->hasByName(sMasterName
))
2789 Reference
<XPropertySet
> xMaster
;
2790 Any aAny
= xFieldMasterNameAccess
->getByName(sMasterName
);
2792 //apply the content to the master
2793 xMaster
->setPropertyValue( sPropertyContent
, uno::Any( GetContent()));
2794 // master exists: create text field and attach
2795 Reference
<XPropertySet
> xField
;
2796 OUString sFieldName
= OUString::Concat(sAPI_textfield_prefix
) + sAPI_dde
;
2797 if (!CreateField(xField
, sFieldName
))
2800 Reference
<XDependentTextField
> xDepTextField(xField
,UNO_QUERY
);
2801 xDepTextField
->attachTextFieldMaster(xMaster
);
2803 // attach field to document
2804 Reference
<XTextContent
> xTextContent(xField
, UNO_QUERY
);
2805 if (xTextContent
.is())
2807 GetImportHelper().InsertTextContent(xTextContent
);
2809 // we're lucky. nothing else to prepare.
2811 // else: fail, because text content could not be created
2812 // else: fail, because field could not be created
2813 // else: fail, because no master was found (faulty document?!)
2814 // not valid: ignore
2817 void XMLDdeFieldImportContext::PrepareField(
2818 const Reference
<XPropertySet
> &)
2820 // empty, since not needed.
2824 // sheet name fields
2827 XMLSheetNameImportContext::XMLSheetNameImportContext(
2828 SvXMLImport
& rImport
,
2829 XMLTextImportHelper
& rHlp
) :
2830 XMLTextFieldImportContext(rImport
, rHlp
, "SheetName")
2832 bValid
= true; // always valid!
2835 void XMLSheetNameImportContext::ProcessAttribute(
2836 sal_Int32 nAttrToken
,
2837 std::string_view sAttrValue
)
2839 // no attributes -> nothing to be done
2840 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2843 void XMLSheetNameImportContext::PrepareField(
2844 const Reference
<XPropertySet
> &)
2846 // no attributes -> nothing to be done
2849 /** import page|slide name fields (<text:page-name>) */
2851 XMLPageNameFieldImportContext::XMLPageNameFieldImportContext(
2852 SvXMLImport
& rImport
, /// XML Import
2853 XMLTextImportHelper
& rHlp
) /// Text import helper
2854 : XMLTextFieldImportContext(rImport
, rHlp
, "PageName" )
2859 /// process attribute values
2860 void XMLPageNameFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken
,
2861 std::string_view sAttrValue
)
2863 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2866 /// prepare XTextField for insertion into document
2867 void XMLPageNameFieldImportContext::PrepareField(
2868 const css::uno::Reference
<css::beans::XPropertySet
> &)
2873 // URL fields (Calc, Impress, Draw)
2876 XMLUrlFieldImportContext::XMLUrlFieldImportContext(
2877 SvXMLImport
& rImport
,
2878 XMLTextImportHelper
& rHlp
) :
2879 XMLTextFieldImportContext(rImport
, rHlp
, sAPI_url
),
2884 void XMLUrlFieldImportContext::ProcessAttribute(
2885 sal_Int32 nAttrToken
,
2886 std::string_view sAttrValue
)
2890 case XML_ELEMENT(XLINK
, XML_HREF
):
2891 sURL
= GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue
) );
2894 case XML_ELEMENT(OFFICE
, XML_TARGET_FRAME_NAME
):
2895 sFrame
= OUString::fromUtf8(sAttrValue
);
2900 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
2905 void XMLUrlFieldImportContext::PrepareField(
2906 const Reference
<XPropertySet
> & xPropertySet
)
2908 xPropertySet
->setPropertyValue(sAPI_url
, Any(sURL
));
2912 xPropertySet
->setPropertyValue("TargetFrame", Any(sFrame
));
2915 xPropertySet
->setPropertyValue("Representation", Any(GetContent()));
2919 XMLBibliographyFieldImportContext::XMLBibliographyFieldImportContext(
2920 SvXMLImport
& rImport
,
2921 XMLTextImportHelper
& rHlp
) :
2922 XMLTextFieldImportContext(rImport
, rHlp
, "Bibliography")
2927 // TODO: this is the same map as is used in the text field export
2928 SvXMLEnumMapEntry
<sal_uInt16
> const aBibliographyDataTypeMap
[] =
2930 { XML_ARTICLE
, BibliographyDataType::ARTICLE
},
2931 { XML_BOOK
, BibliographyDataType::BOOK
},
2932 { XML_BOOKLET
, BibliographyDataType::BOOKLET
},
2933 { XML_CONFERENCE
, BibliographyDataType::CONFERENCE
},
2934 { XML_CUSTOM1
, BibliographyDataType::CUSTOM1
},
2935 { XML_CUSTOM2
, BibliographyDataType::CUSTOM2
},
2936 { XML_CUSTOM3
, BibliographyDataType::CUSTOM3
},
2937 { XML_CUSTOM4
, BibliographyDataType::CUSTOM4
},
2938 { XML_CUSTOM5
, BibliographyDataType::CUSTOM5
},
2939 { XML_EMAIL
, BibliographyDataType::EMAIL
},
2940 { XML_INBOOK
, BibliographyDataType::INBOOK
},
2941 { XML_INCOLLECTION
, BibliographyDataType::INCOLLECTION
},
2942 { XML_INPROCEEDINGS
, BibliographyDataType::INPROCEEDINGS
},
2943 { XML_JOURNAL
, BibliographyDataType::JOURNAL
},
2944 { XML_MANUAL
, BibliographyDataType::MANUAL
},
2945 { XML_MASTERSTHESIS
, BibliographyDataType::MASTERSTHESIS
},
2946 { XML_MISC
, BibliographyDataType::MISC
},
2947 { XML_PHDTHESIS
, BibliographyDataType::PHDTHESIS
},
2948 { XML_PROCEEDINGS
, BibliographyDataType::PROCEEDINGS
},
2949 { XML_TECHREPORT
, BibliographyDataType::TECHREPORT
},
2950 { XML_UNPUBLISHED
, BibliographyDataType::UNPUBLISHED
},
2951 { XML_WWW
, BibliographyDataType::WWW
},
2952 { XML_TOKEN_INVALID
, 0 }
2956 // we'll process attributes on our own and for fit the standard
2957 // textfield mechanism, because our attributes have zero overlap with
2958 // all the other textfields.
2959 void XMLBibliographyFieldImportContext::startFastElement(
2960 sal_Int32
/*nElement*/,
2961 const Reference
<XFastAttributeList
> & xAttrList
)
2963 // iterate over attributes
2964 for( auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
) )
2966 if (IsTokenInNamespace(aIter
.getToken(), XML_NAMESPACE_TEXT
)
2967 || IsTokenInNamespace(aIter
.getToken(), XML_NAMESPACE_LO_EXT
))
2969 auto nToken
= aIter
.getToken() & TOKEN_MASK
;
2970 PropertyValue aValue
;
2971 aValue
.Name
= OUString::createFromAscii(
2972 MapBibliographyFieldName(nToken
));
2975 // special treatment for bibliography type
2976 // biblio vs bibilio: #96658#; also read old documents
2977 if (nToken
== XML_BIBILIOGRAPHIC_TYPE
||
2978 nToken
== XML_BIBLIOGRAPHY_TYPE
)
2981 if (SvXMLUnitConverter::convertEnum(
2982 nTmp
, aIter
.toView(),
2983 aBibliographyDataTypeMap
))
2985 aAny
<<= static_cast<sal_Int16
>(nTmp
);
2986 aValue
.Value
= aAny
;
2988 aValues
.push_back(aValue
);
2993 OUString aStringValue
= aIter
.toString();
2994 if (nToken
== XML_URL
|| nToken
== XML_LOCAL_URL
|| nToken
== XML_TARGET_URL
)
2996 aStringValue
= GetImport().GetAbsoluteReference(aStringValue
);
2998 aAny
<<= aStringValue
;
2999 aValue
.Value
= aAny
;
3001 aValues
.push_back(aValue
);
3004 // else: unknown namespace -> ignore
3008 void XMLBibliographyFieldImportContext::ProcessAttribute(
3012 // attributes are handled in StartElement
3013 assert(false && "This should not have happened.");
3017 void XMLBibliographyFieldImportContext::PrepareField(
3018 const Reference
<XPropertySet
> & xPropertySet
)
3020 // convert vector into sequence
3021 sal_Int32 nCount
= aValues
.size();
3022 Sequence
<PropertyValue
> aValueSequence(nCount
);
3023 auto aValueSequenceRange
= asNonConstRange(aValueSequence
);
3024 for(sal_Int32 i
= 0; i
< nCount
; i
++)
3026 aValueSequenceRange
[i
] = aValues
[i
];
3030 xPropertySet
->setPropertyValue("Fields", Any(aValueSequence
));
3033 const char* XMLBibliographyFieldImportContext::MapBibliographyFieldName(
3036 const char* pName
= nullptr;
3038 switch (nElement
& TOKEN_MASK
)
3040 case XML_IDENTIFIER
:
3041 pName
= "Identifier";
3043 case XML_BIBILIOGRAPHIC_TYPE
:
3044 case XML_BIBLIOGRAPHY_TYPE
:
3045 // biblio... vs bibilio...: #96658#: also read old documents
3046 pName
= "BibiliographicType";
3058 pName
= "Booktitle";
3069 case XML_HOWPUBLISHED
:
3070 pName
= "Howpublished";
3072 case XML_INSTITUTION
:
3073 pName
= "Institution";
3087 case XML_ORGANIZATIONS
:
3088 pName
= "Organizations";
3094 pName
= "Publisher";
3105 case XML_REPORT_TYPE
:
3106 pName
= "Report_Type";
3138 case XML_TARGET_TYPE
:
3139 pName
= "TargetType";
3141 case XML_TARGET_URL
:
3142 pName
= "TargetURL";
3145 assert(false && "Unknown bibliography info data");
3154 XMLAnnotationImportContext::XMLAnnotationImportContext(
3155 SvXMLImport
& rImport
,
3156 XMLTextImportHelper
& rHlp
,
3157 sal_Int32 nElement
) :
3158 XMLTextFieldImportContext(rImport
, rHlp
, "Annotation"),
3163 // remember old list item and block (#91964#) and reset them
3164 // for the text frame
3165 // do this in the constructor, not in CreateChildContext (#i93392#)
3166 GetImport().GetTextImport()->PushListContext();
3169 void XMLAnnotationImportContext::ProcessAttribute(
3170 sal_Int32 nAttrToken
,
3171 std::string_view sAttrValue
)
3173 if (nAttrToken
== XML_ELEMENT(OFFICE
, XML_NAME
))
3174 aName
= OUString::fromUtf8(sAttrValue
);
3175 else if (nAttrToken
== XML_ELEMENT(LO_EXT
, XML_RESOLVED
))
3176 aResolved
= OUString::fromUtf8(sAttrValue
);
3177 else if (nAttrToken
== XML_ELEMENT(LO_EXT
, XML_PARENT_NAME
))
3178 aParentName
= OUString::fromUtf8(sAttrValue
);
3180 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3183 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLAnnotationImportContext::createFastChildContext(
3185 const uno::Reference
< xml::sax::XFastAttributeList
>& xAttrList
)
3187 if( nElement
== XML_ELEMENT(DC
, XML_CREATOR
) )
3188 return new XMLStringBufferImportContext(GetImport(), aAuthorBuffer
);
3189 else if( nElement
== XML_ELEMENT(DC
, XML_DATE
) )
3190 return new XMLStringBufferImportContext(GetImport(), aDateBuffer
);
3191 else if (nElement
== XML_ELEMENT(TEXT
,XML_SENDER_INITIALS
) ||
3192 nElement
== XML_ELEMENT(LO_EXT
, XML_SENDER_INITIALS
) ||
3193 nElement
== XML_ELEMENT(META
, XML_CREATOR_INITIALS
))
3194 return new XMLStringBufferImportContext(GetImport(), aInitialsBuffer
);
3199 if ( !mxField
.is() )
3200 bOK
= CreateField( mxField
, sServicePrefix
+ GetServiceName() );
3203 Any aAny
= mxField
->getPropertyValue( "TextRange" );
3204 Reference
< XText
> xText
;
3208 rtl::Reference
< XMLTextImportHelper
> xTxtImport
= GetImport().GetTextImport();
3209 if( !mxCursor
.is() )
3211 mxOldCursor
= xTxtImport
->GetCursor();
3212 mxCursor
= xText
->createTextCursor();
3217 xTxtImport
->SetCursor( mxCursor
);
3218 return xTxtImport
->CreateTextChildContext( GetImport(), nElement
, xAttrList
);
3223 catch (const Exception
&)
3227 return new XMLStringBufferImportContext(GetImport(), aTextBuffer
);
3230 void XMLAnnotationImportContext::endFastElement(sal_Int32
/*nElement*/)
3232 DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
3235 // delete addition newline
3236 mxCursor
->gotoEnd( false );
3237 mxCursor
->goLeft( 1, true );
3238 mxCursor
->setString( "" );
3241 GetImport().GetTextImport()->ResetCursor();
3244 if( mxOldCursor
.is() )
3245 GetImport().GetTextImport()->SetCursor( mxOldCursor
);
3247 // reinstall old list item #91964#
3248 GetImport().GetTextImport()->PopListContext();
3252 if ( mnElement
== XML_ELEMENT(OFFICE
, XML_ANNOTATION_END
) )
3254 // Search for a previous annotation with the same name.
3255 uno::Reference
< text::XTextContent
> xPrevField
;
3257 Reference
<XTextFieldsSupplier
> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY
);
3258 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
3259 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
3260 while (xFields
->hasMoreElements())
3262 uno::Reference
<beans::XPropertySet
> xCurrField(xFields
->nextElement(), uno::UNO_QUERY
);
3263 uno::Reference
<beans::XPropertySetInfo
> const xInfo(
3264 xCurrField
->getPropertySetInfo());
3265 if (xInfo
->hasPropertyByName(sAPI_name
))
3267 OUString aFieldName
;
3268 xCurrField
->getPropertyValue(sAPI_name
) >>= aFieldName
;
3269 if (aFieldName
== aName
)
3271 xPrevField
.set( xCurrField
, uno::UNO_QUERY
);
3277 if ( xPrevField
.is() )
3279 // So we are ending a previous annotation,
3280 // let's create a text range covering the old and the current position.
3281 uno::Reference
<text::XText
> xText
= GetImportHelper().GetText();
3282 uno::Reference
<text::XTextCursor
> xCursor
=
3283 xText
->createTextCursorByRange(GetImportHelper().GetCursorAsRange());
3286 xCursor
->gotoRange(xPrevField
->getAnchor(), true);
3288 catch (const uno::RuntimeException
&)
3290 // Losing the start of the anchor is better than not opening the document at
3292 TOOLS_WARN_EXCEPTION(
3294 "XMLAnnotationImportContext::endFastElement: gotoRange() failed: ");
3297 xText
->insertTextContent(xCursor
, xPrevField
, !xCursor
->isCollapsed());
3302 if ( mxField
.is() || CreateField( mxField
, sServicePrefix
+ GetServiceName() ) )
3304 // set field properties
3305 PrepareField( mxField
);
3307 // attach field to document
3308 Reference
< XTextContent
> xTextContent( mxField
, UNO_QUERY
);
3310 // workaround for #80606#
3313 GetImportHelper().InsertTextContent( xTextContent
);
3315 catch (const lang::IllegalArgumentException
&)
3323 GetImportHelper().InsertString(GetContent());
3326 void XMLAnnotationImportContext::PrepareField(
3327 const Reference
<XPropertySet
> & xPropertySet
)
3329 // import (possibly empty) author
3330 OUString
sAuthor( aAuthorBuffer
.makeStringAndClear() );
3331 xPropertySet
->setPropertyValue(sAPI_author
, Any(sAuthor
));
3333 // import (possibly empty) initials
3334 OUString
sInitials( aInitialsBuffer
.makeStringAndClear() );
3335 xPropertySet
->setPropertyValue("Initials", Any(sInitials
));
3337 //import resolved flag
3339 (void)::sax::Converter::convertBool(bTmp
, aResolved
);
3340 xPropertySet
->setPropertyValue("Resolved", Any(bTmp
));
3342 util::DateTime aDateTime
;
3343 if (::sax::Converter::parseDateTime(aDateTime
, aDateBuffer
))
3347 aDate.Year = aDateTime.Year;
3348 aDate.Month = aDateTime.Month;
3349 aDate.Day = aDateTime.Day;
3350 xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
3352 // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
3353 xPropertySet
->setPropertyValue(sAPI_date_time_value
, Any(aDateTime
));
3355 aDateBuffer
.setLength(0);
3357 if ( aTextBuffer
.getLength() )
3359 // delete last paragraph mark (if necessary)
3360 if (char(0x0a) == aTextBuffer
[aTextBuffer
.getLength()-1])
3361 aTextBuffer
.setLength(aTextBuffer
.getLength()-1);
3362 xPropertySet
->setPropertyValue(sAPI_content
, Any(aTextBuffer
.makeStringAndClear()));
3365 if (!aName
.isEmpty())
3366 xPropertySet
->setPropertyValue(sAPI_name
, Any(aName
));
3368 if (!aParentName
.isEmpty())
3369 xPropertySet
->setPropertyValue(sAPI_parent_name
, Any(aParentName
));
3376 XMLScriptImportContext::XMLScriptImportContext(
3377 SvXMLImport
& rImport
,
3378 XMLTextImportHelper
& rHlp
)
3379 : XMLTextFieldImportContext(rImport
, rHlp
, "Script")
3384 void XMLScriptImportContext::ProcessAttribute(
3385 sal_Int32 nAttrToken
,
3386 std::string_view sAttrValue
)
3390 case XML_ELEMENT(XLINK
, XML_HREF
):
3391 sContent
= GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue
) );
3395 case XML_ELEMENT(SCRIPT
, XML_LANGUAGE
):
3396 sScriptType
= OUString::fromUtf8(sAttrValue
);
3401 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3405 // always valid (even without ScriptType; cf- #96531#)
3409 void XMLScriptImportContext::PrepareField(
3410 const Reference
<XPropertySet
> & xPropertySet
)
3412 // if href attribute was present, we use it. Else we use element content
3415 sContent
= GetContent();
3417 xPropertySet
->setPropertyValue(sAPI_content
, Any(sContent
));
3419 // URL or script text? We use URL if we have an href-attribute
3420 xPropertySet
->setPropertyValue("URLContent", Any(bContentOK
));
3422 xPropertySet
->setPropertyValue("ScriptType", Any(sScriptType
));
3429 XMLMeasureFieldImportContext::XMLMeasureFieldImportContext(
3430 SvXMLImport
& rImport
,
3431 XMLTextImportHelper
& rHlp
) :
3432 XMLTextFieldImportContext(rImport
, rHlp
, "Measure"),
3437 void XMLMeasureFieldImportContext::ProcessAttribute(
3438 sal_Int32 nAttrToken
,
3439 std::string_view sAttrValue
)
3443 case XML_ELEMENT(TEXT
, XML_KIND
):
3444 if( IsXMLToken( sAttrValue
, XML_VALUE
) )
3446 mnKind
= 0; bValid
= true;
3448 else if( IsXMLToken( sAttrValue
, XML_UNIT
) )
3450 mnKind
= 1; bValid
= true;
3452 else if( IsXMLToken( sAttrValue
, XML_GAP
) )
3454 mnKind
= 2; bValid
= true;
3458 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3462 void XMLMeasureFieldImportContext::PrepareField(
3463 const Reference
<XPropertySet
> & xPropertySet
)
3465 xPropertySet
->setPropertyValue("Kind", Any(mnKind
));
3472 XMLDropDownFieldImportContext::XMLDropDownFieldImportContext(
3473 SvXMLImport
& rImport
,
3474 XMLTextImportHelper
& rHlp
) :
3475 XMLTextFieldImportContext( rImport
, rHlp
, "DropDown" ),
3484 static bool lcl_ProcessLabel(
3485 const Reference
<XFastAttributeList
>& xAttrList
,
3489 bool bValid
= false;
3490 for( auto& aIter
: sax_fastparser::castToFastAttributeList(xAttrList
) )
3492 switch (aIter
.getToken())
3494 case XML_ELEMENT(TEXT
, XML_VALUE
):
3496 rLabel
= aIter
.toString();
3500 case XML_ELEMENT(TEXT
, XML_CURRENT_SELECTED
):
3503 if (::sax::Converter::convertBool( bTmp
, aIter
.toView() ))
3508 XMLOFF_WARN_UNKNOWN("xmloff", aIter
);
3514 css::uno::Reference
< css::xml::sax::XFastContextHandler
> XMLDropDownFieldImportContext::createFastChildContext(
3515 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
3517 if( nElement
== XML_ELEMENT(TEXT
, XML_LABEL
) )
3520 bool bIsSelected
= false;
3521 if( lcl_ProcessLabel( xAttrList
, sLabel
, bIsSelected
) )
3524 nSelected
= static_cast<sal_Int32
>( aLabels
.size() );
3525 aLabels
.push_back( sLabel
);
3528 return new SvXMLImportContext( GetImport() );
3531 void XMLDropDownFieldImportContext::ProcessAttribute(
3532 sal_Int32 nAttrToken
,
3533 std::string_view sAttrValue
)
3535 if( nAttrToken
== XML_ELEMENT(TEXT
, XML_NAME
))
3537 sName
= OUString::fromUtf8(sAttrValue
);
3540 else if (nAttrToken
== XML_ELEMENT(TEXT
, XML_HELP
))
3542 sHelp
= OUString::fromUtf8(sAttrValue
);
3545 else if (nAttrToken
== XML_ELEMENT(TEXT
, XML_HINT
))
3547 sHint
= OUString::fromUtf8(sAttrValue
);
3551 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3554 void XMLDropDownFieldImportContext::PrepareField(
3555 const Reference
<XPropertySet
>& xPropertySet
)
3558 sal_Int32 nLength
= static_cast<sal_Int32
>( aLabels
.size() );
3559 Sequence
<OUString
> aSequence( nLength
);
3560 OUString
* pSequence
= aSequence
.getArray();
3561 for( sal_Int32 n
= 0; n
< nLength
; n
++ )
3562 pSequence
[n
] = aLabels
[n
];
3566 xPropertySet
->setPropertyValue( "Items", Any(aSequence
) );
3568 if( nSelected
>= 0 && nSelected
< nLength
)
3570 xPropertySet
->setPropertyValue( "SelectedItem", Any(pSequence
[nSelected
]) );
3576 xPropertySet
->setPropertyValue( "Name", Any(sName
) );
3581 xPropertySet
->setPropertyValue( "Help", Any(sHelp
) );
3586 xPropertySet
->setPropertyValue( "Tooltip", Any(sHint
) );
3591 /** import header fields (<draw:header>) */
3593 XMLHeaderFieldImportContext::XMLHeaderFieldImportContext(
3594 SvXMLImport
& rImport
, /// XML Import
3595 XMLTextImportHelper
& rHlp
) /// Text import helper
3596 : XMLTextFieldImportContext(rImport
, rHlp
, "Header" )
3598 sServicePrefix
= sAPI_presentation_prefix
;
3602 /// process attribute values
3603 void XMLHeaderFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken
, std::string_view sAttrValue
)
3605 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3608 /// prepare XTextField for insertion into document
3609 void XMLHeaderFieldImportContext::PrepareField(const Reference
<XPropertySet
> &)
3613 /** import footer fields (<draw:footer>) */
3615 XMLFooterFieldImportContext::XMLFooterFieldImportContext(
3616 SvXMLImport
& rImport
, /// XML Import
3617 XMLTextImportHelper
& rHlp
) /// Text import helper
3618 : XMLTextFieldImportContext(rImport
, rHlp
, "Footer" )
3620 sServicePrefix
= sAPI_presentation_prefix
;
3624 /// process attribute values
3625 void XMLFooterFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken
, std::string_view sAttrValue
)
3627 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3630 /// prepare XTextField for insertion into document
3631 void XMLFooterFieldImportContext::PrepareField(const Reference
<XPropertySet
> &)
3636 /** import footer fields (<draw:date-and-time>) */
3638 XMLDateTimeFieldImportContext::XMLDateTimeFieldImportContext(
3639 SvXMLImport
& rImport
, /// XML Import
3640 XMLTextImportHelper
& rHlp
) /// Text import helper
3641 : XMLTextFieldImportContext(rImport
, rHlp
, "DateTime" )
3643 sServicePrefix
= sAPI_presentation_prefix
;
3647 /// process attribute values
3648 void XMLDateTimeFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken
,
3649 std::string_view sAttrValue
)
3651 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken
, sAttrValue
);
3654 /// prepare XTextField for insertion into document
3655 void XMLDateTimeFieldImportContext::PrepareField(
3656 const css::uno::Reference
<
3657 css::beans::XPropertySet
> &)
3661 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */