LibreOffice Module xmloff (master) 1
txtfldi.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
27#include <sal/config.h>
28
29#include <cassert>
30
31#include <txtfldi.hxx>
32#include <txtvfldi.hxx>
33#include <utility>
34#include <xmloff/xmlimp.hxx>
35#include <xmloff/txtimp.hxx>
38#include <xmloff/xmltoken.hxx>
39#include <xmloff/xmluconv.hxx>
40#include <xmloff/xmlement.hxx>
43#include <com/sun/star/frame/XModel.hpp>
44#include <com/sun/star/xml/sax/XAttributeList.hpp>
45#include <com/sun/star/text/UserDataPart.hpp>
46#include <com/sun/star/style/NumberingType.hpp>
47#include <com/sun/star/text/PlaceholderType.hpp>
48#include <com/sun/star/text/ReferenceFieldPart.hpp>
49#include <com/sun/star/text/ReferenceFieldSource.hpp>
50#include <com/sun/star/text/XTextContent.hpp>
51#include <com/sun/star/beans/XPropertySet.hpp>
52#include <com/sun/star/beans/XPropertySetInfo.hpp>
53#include <com/sun/star/lang/XMultiServiceFactory.hpp>
54#include <com/sun/star/text/XTextFieldsSupplier.hpp>
55#include <com/sun/star/text/XDependentTextField.hpp>
56#include <com/sun/star/text/FilenameDisplayFormat.hpp>
57#include <com/sun/star/text/ChapterFormat.hpp>
58#include <com/sun/star/text/TemplateDisplayFormat.hpp>
59#include <com/sun/star/beans/PropertyValue.hpp>
60#include <com/sun/star/text/BibliographyDataType.hpp>
61#include <com/sun/star/util/XUpdatable.hpp>
62#include <com/sun/star/sdb/CommandType.hpp>
63#include <com/sun/star/container/XIndexReplace.hpp>
64
66
67#include <rtl/ustring.hxx>
68#include <rtl/ustrbuf.hxx>
69#include <sal/log.hxx>
70#include <rtl/math.hxx>
71#include <tools/debug.hxx>
72#include <osl/diagnose.h>
74
75using namespace ::com::sun::star;
76using namespace ::com::sun::star::uno;
77using namespace ::com::sun::star::text;
78using namespace ::com::sun::star::lang;
79using namespace ::com::sun::star::beans;
80using namespace ::com::sun::star::document;
81using namespace ::com::sun::star::util;
82using namespace ::com::sun::star::xml::sax;
83using namespace ::xmloff::token;
84
85
86// SO API string constants
87
88
89// service prefix and service names
90constexpr OUStringLiteral sAPI_textfield_prefix = u"com.sun.star.text.TextField.";
91constexpr char16_t sAPI_fieldmaster_prefix[] = u"com.sun.star.text.FieldMaster.";
92constexpr OUStringLiteral sAPI_presentation_prefix = u"com.sun.star.presentation.TextField.";
93
94constexpr OUStringLiteral sAPI_date_time = u"DateTime";
95constexpr OUStringLiteral sAPI_page_number = u"PageNumber";
96constexpr OUStringLiteral sAPI_docinfo_change_date_time = u"DocInfo.ChangeDateTime";
97constexpr OUStringLiteral sAPI_docinfo_create_date_time = u"DocInfo.CreateDateTime";
98constexpr OUStringLiteral sAPI_docinfo_custom = u"DocInfo.Custom";
99constexpr OUStringLiteral sAPI_docinfo_print_date_time = u"DocInfo.PrintDateTime";
100constexpr OUStringLiteral sAPI_dde = u"DDE";
101constexpr OUStringLiteral sAPI_url = u"URL";
102
103// property names
104constexpr OUStringLiteral sAPI_is_fixed = u"IsFixed";
105constexpr OUStringLiteral sAPI_content = u"Content";
106constexpr OUStringLiteral sAPI_author = u"Author";
107constexpr OUStringLiteral sAPI_hint = u"Hint";
108constexpr OUStringLiteral sAPI_name = u"Name";
109constexpr OUStringLiteral sAPI_sub_type = u"SubType";
110constexpr OUStringLiteral sAPI_date_time_value = u"DateTimeValue";
111constexpr OUStringLiteral sAPI_number_format = u"NumberFormat";
112constexpr OUStringLiteral sAPI_numbering_type = u"NumberingType";
113constexpr OUStringLiteral sAPI_offset = u"Offset";
114constexpr OUStringLiteral sAPI_condition = u"Condition";
115constexpr OUStringLiteral sAPI_set_number = u"SetNumber";
116constexpr OUStringLiteral sAPI_file_format = u"FileFormat";
117constexpr OUStringLiteral sAPI_is_date = u"IsDate";
118constexpr OUStringLiteral sAPI_current_presentation = u"CurrentPresentation";
119constexpr OUStringLiteral sAPI_is_hidden = u"IsHidden";
120constexpr OUStringLiteral sAPI_is_fixed_language = u"IsFixedLanguage";
121
122constexpr OUStringLiteral sAPI_true = u"TRUE";
123
124
126 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
127 OUString aService)
128: SvXMLImportContext( rImport )
129, sServiceName(std::move(aService))
130, rTextImportHelper(rHlp)
131, sServicePrefix(sAPI_textfield_prefix)
132, bValid(false)
133{
134}
135
137 sal_Int32 /*nElement*/,
138 const Reference<XFastAttributeList> & xAttrList)
139{
140 // process attributes
141 for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
142 ProcessAttribute(aIter.getToken(), aIter.toView() );
143}
144
146{
147 if (sContent.isEmpty())
148 {
149 sContent = sContentBuffer.makeStringAndClear();
150 }
151
152 return sContent;
153}
154
156{
157 if (bValid)
158 {
159
160 // create field/Service
161 Reference<XPropertySet> xPropSet;
162 if (CreateField(xPropSet, sServicePrefix + GetServiceName()))
163 {
164 // set field properties
165 PrepareField(xPropSet);
166
167 // attach field to document
168 Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
169
170 // workaround for #80606#
171 try
172 {
174 }
175 catch (const lang::IllegalArgumentException&)
176 {
177 // ignore
178 }
179 return;
180 }
181 }
182
183 // in case of error: write element content
185}
186
187void XMLTextFieldImportContext::characters(const OUString& rContent)
188{
189 sContentBuffer.append(rContent);
190}
191
193 Reference<XPropertySet> & xField,
194 const OUString& rServiceName)
195{
196 // instantiate new XTextField:
197 // ask import for model, model is factory, ask factory to create service
198
199 Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
200 if( xFactory.is() )
201 {
202 Reference<XInterface> xIfc = xFactory->createInstance(rServiceName);
203 if( xIfc.is() )
204 {
205 Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
206
207 xField = xTmp;
208 } else {
209 return false; // can't create instance
210 }
211 } else {
212 return false; // can't get MultiServiceFactory
213 }
214
215 return true;
216}
217
221 SvXMLImport& rImport,
223 sal_Int32 nToken)
224{
225 XMLTextFieldImportContext* pContext = nullptr;
226
227 switch (nToken)
228 {
231 case XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS):
237
246 pContext =
247 new XMLSenderFieldImportContext( rImport, rHlp );
248 break;
249
252 pContext =
253 new XMLAuthorFieldImportContext( rImport, rHlp );
254 break;
255
257 pContext =
258 new XMLPlaceholderFieldImportContext( rImport, rHlp);
259 break;
261 pContext =
262 new XMLSequenceFieldImportContext( rImport, rHlp );
263 break;
265 pContext =
266 new XMLTextInputFieldImportContext( rImport, rHlp );
267 break;
269 pContext =
270 new XMLExpressionFieldImportContext( rImport, rHlp );
271 break;
273 pContext =
274 new XMLVariableSetFieldImportContext( rImport, rHlp );
275 break;
277 pContext =
278 new XMLVariableInputFieldImportContext( rImport, rHlp );
279 break;
281 pContext =
282 new XMLVariableGetFieldImportContext( rImport, rHlp );
283 break;
285 pContext = new XMLUserFieldImportContext( rImport, rHlp );
286 break;
288 pContext = new XMLUserFieldInputImportContext( rImport, rHlp );
289 break;
291 pContext = new XMLTimeFieldImportContext( rImport, rHlp );
292 break;
295 pContext = new XMLPageContinuationImportContext( rImport, rHlp );
296 break;
297
299 pContext = new XMLPageNumberImportContext( rImport, rHlp );
300 break;
301
303 pContext = new XMLDateFieldImportContext( rImport, rHlp );
304 break;
305
307 pContext = new XMLDatabaseNameImportContext( rImport, rHlp );
308 break;
310 pContext = new XMLDatabaseNextImportContext( rImport, rHlp );
311 break;
313 pContext = new XMLDatabaseSelectImportContext( rImport, rHlp );
314 break;
316 pContext = new XMLDatabaseNumberImportContext( rImport, rHlp );
317 break;
319 pContext = new XMLDatabaseDisplayImportContext( rImport, rHlp );
320 break;
322 pContext = new XMLConditionalTextImportContext( rImport, rHlp );
323 break;
325 pContext = new XMLHiddenTextImportContext( rImport, rHlp );
326 break;
328 pContext = new XMLHiddenParagraphImportContext( rImport, rHlp );
329 break;
334 pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
335 nToken, true,
336 false );
337 break;
341 pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
342 nToken, false,
343 true );
344 break;
345
353 pContext = new XMLDateTimeDocInfoImportContext( rImport, rHlp,
354 nToken );
355 break;
356
358 pContext = new XMLRevisionDocInfoImportContext( rImport, rHlp,
359 nToken );
360 break;
361
363 pContext = new XMLUserDocInfoImportContext( rImport, rHlp,
364 nToken );
365 break;
366
368 pContext = new XMLFileNameImportContext( rImport, rHlp );
369 break;
370
372 pContext = new XMLChapterImportContext( rImport, rHlp );
373 break;
374
376 pContext = new XMLTemplateNameImportContext( rImport, rHlp );
377 break;
378
386 pContext = new XMLCountFieldImportContext( rImport, rHlp, nToken);
387 break;
388
390 pContext = new XMLPageVarGetFieldImportContext( rImport, rHlp );
391 break;
392
394 pContext = new XMLPageVarSetFieldImportContext( rImport, rHlp );
395 break;
396
398 pContext = new XMLMacroFieldImportContext( rImport, rHlp );
399 break;
400
402 pContext = new XMLDdeFieldImportContext( rImport, rHlp );
403 break;
404
409 pContext = new XMLReferenceFieldImportContext( rImport, rHlp, nToken );
410 break;
411
413 pContext = new XMLSheetNameImportContext( rImport, rHlp );
414 break;
415
417 case XML_ELEMENT(LO_EXT, XML_PAGE_NAME):
418 pContext = new XMLPageNameFieldImportContext( rImport, rHlp );
419 break;
420
422 pContext = new XMLBibliographyFieldImportContext( rImport, rHlp );
423 break;
424
427 pContext = new XMLAnnotationImportContext( rImport, rHlp, nToken);
428 break;
429
431 pContext = new XMLScriptImportContext( rImport, rHlp);
432 break;
433
435 pContext = new XMLMeasureFieldImportContext( rImport, rHlp );
436 break;
437
439 pContext = new XMLTableFormulaImportContext( rImport, rHlp );
440 break;
442 pContext = new XMLDropDownFieldImportContext( rImport, rHlp );
443 break;
444 case XML_ELEMENT(PRESENTATION, XML_HEADER):
445 pContext = new XMLHeaderFieldImportContext( rImport, rHlp );
446 break;
447 case XML_ELEMENT(PRESENTATION, XML_FOOTER):
448 pContext = new XMLFooterFieldImportContext( rImport, rHlp );
449 break;
450 case XML_ELEMENT(PRESENTATION, XML_DATE_TIME):
451 pContext = new XMLDateTimeFieldImportContext( rImport, rHlp );
452 break;
453
454 default:
455 // ignore! May not even be a textfield.
456 // (Reminder: This method is called inside default:-branch)
457 pContext = nullptr;
458 break;
459 }
460
461 return pContext;
462}
463
464
466 const Reference<XPropertySet> & rPropertySet)
467{
468 // force update
469 Reference<XUpdatable> xUpdate(rPropertySet, UNO_QUERY);
470 if (xUpdate.is())
471 {
472 xUpdate->update();
473 }
474 else
475 {
476 OSL_FAIL("Expected XUpdatable support!");
477 }
478}
479
480
481// XMLSenderFieldImportContext
482
483
484constexpr OUStringLiteral gsPropertyFieldSubType(u"UserDataType");
485
487 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
488 : XMLTextFieldImportContext(rImport, rHlp, "ExtendedUser")
489 , nSubType(0)
490 , sPropertyFixed(sAPI_is_fixed)
491 , sPropertyContent(sAPI_content)
492 , bFixed(true)
493{
494}
495
497 sal_Int32 nElement,
498 const Reference<XFastAttributeList> & xAttrList)
499{
500 bValid = true;
501 switch (nElement) {
503 nSubType = UserDataPart::FIRSTNAME;
504 break;
506 nSubType = UserDataPart::NAME;
507 break;
508 case XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS):
510 nSubType = UserDataPart::SHORTCUT;
511 break;
513 nSubType = UserDataPart::TITLE;
514 break;
516 nSubType = UserDataPart::POSITION;
517 break;
519 nSubType = UserDataPart::EMAIL;
520 break;
522 nSubType = UserDataPart::PHONE_PRIVATE;
523 break;
525 nSubType = UserDataPart::FAX;
526 break;
528 nSubType = UserDataPart::COMPANY;
529 break;
531 nSubType = UserDataPart::PHONE_COMPANY;
532 break;
534 nSubType = UserDataPart::STREET;
535 break;
537 nSubType = UserDataPart::CITY;
538 break;
540 nSubType = UserDataPart::ZIP;
541 break;
543 nSubType = UserDataPart::COUNTRY;
544 break;
546 nSubType = UserDataPart::STATE;
547 break;
548 default:
549 bValid = false;
550 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
551 break;
552 }
553
554 // process Attributes
556}
557
559 sal_Int32 nAttrToken,
560 std::string_view sAttrValue)
561{
562 if (XML_ELEMENT(TEXT, XML_FIXED) == nAttrToken) {
563
564 // set bVal
565 bool bVal(false);
566 bool const bRet = ::sax::Converter::convertBool(bVal, sAttrValue);
567
568 // set bFixed if successful
569 if (bRet) {
570 bFixed = bVal;
571 }
572 }
573 else
574 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
575}
576
578 const Reference<XPropertySet> & rPropSet)
579{
580 // set members
581 rPropSet->setPropertyValue(gsPropertyFieldSubType, Any(nSubType));
582
583 // set fixed
584 rPropSet->setPropertyValue(sPropertyFixed, Any(bFixed));
585
586 // set content if fixed
587 if (!bFixed)
588 return;
589
590 // in organizer or styles-only mode: force update
591 if (GetImport().GetTextImport()->IsOrganizerMode() ||
592 GetImport().GetTextImport()->IsStylesOnlyMode() )
593 {
594 ForceUpdate(rPropSet);
595 }
596 else
597 {
598 rPropSet->setPropertyValue(sPropertyContent, Any(GetContent()));
599 }
600}
601
602
603// XMLAuthorFieldImportContext
604
605constexpr OUStringLiteral gsPropertyAuthorFullName(u"FullName");
606
608 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
609: XMLSenderFieldImportContext(rImport, rHlp)
610, bAuthorFullName(true)
611, sPropertyFixed(sAPI_is_fixed)
612, sPropertyContent(sAPI_content)
613{
614 // overwrite service name from XMLSenderFieldImportContext
616}
617
619 sal_Int32 nElement,
620 const Reference<XFastAttributeList> & xAttrList)
621{
623 bValid = true;
624
625 // process Attributes
627}
628
629void XMLAuthorFieldImportContext::ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue)
630{
631 if(nAttrToken == XML_ELEMENT(TEXT, XML_FIXED))
632 {
633 bool bTmp(false);
634 if (::sax::Converter::convertBool(bTmp, sAttrValue))
635 bFixed = bTmp;
636 }
637 else
638 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
639}
640
642 const Reference<XPropertySet> & rPropSet)
643{
644 // set members
645 Any aAny;
646 rPropSet->setPropertyValue(gsPropertyAuthorFullName, Any(bAuthorFullName));
647
648 rPropSet->setPropertyValue(sPropertyFixed, Any(bFixed));
649
650 // set content if fixed
651 if (!bFixed)
652 return;
653
654 // organizer or styles-only mode: force update
655 if (GetImport().GetTextImport()->IsOrganizerMode() ||
656 GetImport().GetTextImport()->IsStylesOnlyMode() )
657 {
658 ForceUpdate(rPropSet);
659 }
660 else
661 {
662 aAny <<= GetContent();
663 rPropSet->setPropertyValue(sPropertyContent, aAny);
664 }
665}
666
667
668// page continuation string
669
670
672{
673 { XML_PREVIOUS, PageNumberType_PREV },
674 { XML_CURRENT, PageNumberType_CURRENT },
675 { XML_NEXT, PageNumberType_NEXT },
676 { XML_TOKEN_INVALID, PageNumberType(0) },
677};
678
679constexpr OUStringLiteral gsPropertyUserText(u"UserText");
680
682 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
684, sPropertySubType(sAPI_sub_type)
685, sPropertyNumberingType(sAPI_numbering_type)
686, eSelectPage(PageNumberType_CURRENT)
687, sStringOK(false)
688{
689 bValid = true;
690}
691
693 sal_Int32 nAttrToken, std::string_view sAttrValue )
694{
695 switch(nAttrToken)
696 {
698 {
699 PageNumberType nTmp;
700 if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
702 && (PageNumberType_CURRENT != nTmp) )
703 {
704 eSelectPage = nTmp;
705 }
706 break;
707 }
710 sString = OUString::fromUtf8(sAttrValue);
711 sStringOK = true;
712 break;
713 default:
714 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
715 }
716}
717
719 const Reference<XPropertySet> & xPropertySet)
720{
721 Any aAny;
722
723 xPropertySet->setPropertyValue(sPropertySubType, Any(eSelectPage));
724
725 aAny <<= (sStringOK ? sString : GetContent());
726 xPropertySet->setPropertyValue(gsPropertyUserText, aAny);
727
728 aAny <<= style::NumberingType::CHAR_SPECIAL;
729 xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
730}
731
732
733// page number field
734
735
737 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
739, sPropertySubType(sAPI_sub_type)
740, sPropertyNumberingType(sAPI_numbering_type)
741, sPropertyOffset(sAPI_offset)
742, sNumberSync(GetXMLToken(XML_FALSE))
743, nPageAdjust(0)
744, eSelectPage(PageNumberType_CURRENT)
745, sNumberFormatOK(false)
746{
747 bValid = true;
748}
749
751 sal_Int32 nAttrToken,
752 std::string_view sAttrValue )
753{
754 switch (nAttrToken)
755 {
757 sNumberFormat = OUString::fromUtf8(sAttrValue);
758 sNumberFormatOK = true;
759 break;
761 sNumberSync = OUString::fromUtf8(sAttrValue);
762 break;
766 break;
768 {
769 sal_Int32 nTmp;
770 if (::sax::Converter::convertNumber(nTmp, sAttrValue))
771 {
772 nPageAdjust = static_cast<sal_Int16>(nTmp);
773 }
774 break;
775 }
776 default:
777 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
778 }
779}
780
782 const Reference<XPropertySet> & xPropertySet)
783{
784 // all properties are optional
785 Reference<XPropertySetInfo> xPropertySetInfo(
786 xPropertySet->getPropertySetInfo());
787
788 if (xPropertySetInfo->hasPropertyByName(sPropertyNumberingType))
789 {
790 sal_Int16 nNumType;
791 if( sNumberFormatOK )
792 {
793 nNumType= style::NumberingType::ARABIC;
794 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
796 sNumberSync );
797 }
798 else
799 nNumType = style::NumberingType::PAGE_DESCRIPTOR;
800
801 xPropertySet->setPropertyValue(sPropertyNumberingType, Any(nNumType));
802 }
803
804 if (xPropertySetInfo->hasPropertyByName(sPropertyOffset))
805 {
806 // adjust offset
807 switch (eSelectPage)
808 {
809 case PageNumberType_PREV:
810 nPageAdjust--;
811 break;
812 case PageNumberType_CURRENT:
813 break;
814 case PageNumberType_NEXT:
815 nPageAdjust++;
816 break;
817 default:
818 SAL_WARN("xmloff.text", "unknown page number type");
819 }
820 xPropertySet->setPropertyValue(sPropertyOffset, Any(nPageAdjust));
821 }
822
823 if (xPropertySetInfo->hasPropertyByName(sPropertySubType))
824 {
825 xPropertySet->setPropertyValue(sPropertySubType, Any(eSelectPage));
826 }
827}
828
829
830// Placeholder
831
832
833constexpr OUStringLiteral gsPropertyPlaceholderType(u"PlaceHolderType");
834constexpr OUStringLiteral gsPropertyPlaceholder(u"PlaceHolder");
835
837 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
838: XMLTextFieldImportContext(rImport, rHlp, "JumpEdit")
839, sPropertyHint(sAPI_hint)
840, nPlaceholderType(PlaceholderType::TEXT)
841{
842}
843
846 sal_Int32 nAttrToken, std::string_view sAttrValue )
847{
848 switch (nAttrToken) {
850 sDescription = OUString::fromUtf8(sAttrValue);
851 break;
852
854 bValid = true;
855 if (IsXMLToken(sAttrValue, XML_TABLE))
856 {
857 nPlaceholderType = PlaceholderType::TABLE;
858 }
859 else if (IsXMLToken(sAttrValue, XML_TEXT))
860 {
861 nPlaceholderType = PlaceholderType::TEXT;
862 }
863 else if (IsXMLToken(sAttrValue, XML_TEXT_BOX))
864 {
865 nPlaceholderType = PlaceholderType::TEXTFRAME;
866 }
867 else if (IsXMLToken(sAttrValue, XML_IMAGE))
868 {
869 nPlaceholderType = PlaceholderType::GRAPHIC;
870 }
871 else if (IsXMLToken(sAttrValue, XML_OBJECT))
872 {
873 nPlaceholderType = PlaceholderType::OBJECT;
874 }
875 else
876 {
877 bValid = false;
878 }
879 break;
880
881 default:
882 // ignore
883 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
884 }
885}
886
888 const Reference<XPropertySet> & xPropertySet) {
889
890 Any aAny;
891 xPropertySet->setPropertyValue(sPropertyHint, Any(sDescription));
892
893 // remove <...> around content (if present)
894 OUString aContent = GetContent();
895 sal_Int32 nStart = 0;
896 sal_Int32 nLength = aContent.getLength();
897 if (aContent.startsWith("<"))
898 {
899 --nLength;
900 ++nStart;
901 }
902 if (aContent.endsWith(">"))
903 {
904 --nLength;
905 }
906 aAny <<= aContent.copy(nStart, nLength);
907 xPropertySet->setPropertyValue(gsPropertyPlaceholder, aAny);
908
909 xPropertySet->setPropertyValue(gsPropertyPlaceholderType, Any(nPlaceholderType));
910}
911
912
913// time field
914
915constexpr OUStringLiteral gsPropertyAdjust(u"Adjust");
916
918 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
920, sPropertyNumberFormat(sAPI_number_format)
921, sPropertyFixed(sAPI_is_fixed)
922, sPropertyDateTimeValue(sAPI_date_time_value)
923, sPropertyDateTime(sAPI_date_time)
924, sPropertyIsDate(sAPI_is_date)
925, sPropertyIsFixedLanguage(sAPI_is_fixed_language)
926, nAdjust(0)
927, nFormatKey(0)
928, bTimeOK(false)
929, bFormatOK(false)
930, bFixed(false)
931, bIsDate(false)
932, bIsDefaultLanguage( true )
933{
934 bValid = true; // always valid!
935}
936
938 sal_Int32 nAttrToken, std::string_view sAttrValue )
939{
940 switch (nAttrToken)
941 {
944 {
946 {
947 bTimeOK = true;
948 }
949 break;
950 }
952 {
953 bool bTmp(false);
954 if (::sax::Converter::convertBool(bTmp, sAttrValue))
955 {
956 bFixed = bTmp;
957 }
958 break;
959 }
961 {
962 sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
963 OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
964 if (-1 != nKey)
965 {
966 nFormatKey = nKey;
967 bFormatOK = true;
968 }
969 break;
970 }
972 {
973 double fTmp;
974
975 if (::sax::Converter::convertDuration(fTmp, sAttrValue))
976 {
977 // convert to minutes
978 nAdjust = static_cast<sal_Int32>(::rtl::math::approxFloor(fTmp * 60 * 24));
979 }
980 break;
981 }
982 default:
983 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
984 }
985}
986
988 const Reference<XPropertySet> & rPropertySet)
989{
990 // all properties are optional (except IsDate)
991 Reference<XPropertySetInfo> xPropertySetInfo(
992 rPropertySet->getPropertySetInfo());
993
994 if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
995 {
996 rPropertySet->setPropertyValue(sPropertyFixed, Any(bFixed));
997 }
998
999 rPropertySet->setPropertyValue(sPropertyIsDate, Any(bIsDate));
1000
1001 if (xPropertySetInfo->hasPropertyByName(gsPropertyAdjust))
1002 {
1003 rPropertySet->setPropertyValue(gsPropertyAdjust, Any(nAdjust));
1004 }
1005
1006 // set value
1007 if (bFixed)
1008 {
1009 // organizer or styles-only mode: force update
1010 if (GetImport().GetTextImport()->IsOrganizerMode() ||
1011 GetImport().GetTextImport()->IsStylesOnlyMode() )
1012 {
1013 ForceUpdate(rPropertySet);
1014 }
1015 else
1016 {
1017 // normal mode: set value (if present)
1018 if (bTimeOK)
1019 {
1020 if (xPropertySetInfo->hasPropertyByName(sPropertyDateTimeValue))
1021 {
1022 rPropertySet->setPropertyValue(sPropertyDateTimeValue, Any(aDateTimeValue));
1023 }
1024 else if (xPropertySetInfo->hasPropertyByName(sPropertyDateTime))
1025 {
1026 rPropertySet->setPropertyValue(sPropertyDateTime, Any(aDateTimeValue));
1027 }
1028 }
1029 }
1030 }
1031
1032 if (bFormatOK &&
1033 xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
1034 {
1035 rPropertySet->setPropertyValue(sPropertyNumberFormat, Any(nFormatKey));
1036
1037 if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
1038 {
1039 bool bIsFixedLanguage = ! bIsDefaultLanguage;
1040 rPropertySet->setPropertyValue( sPropertyIsFixedLanguage, Any(bIsFixedLanguage) );
1041 }
1042 }
1043}
1044
1045
1046// date field
1047
1048
1050 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1051 XMLTimeFieldImportContext(rImport, rHlp)
1052{
1053 bIsDate = true; // always a date!
1054}
1055
1057 sal_Int32 nAttrToken,
1058 std::string_view sAttrValue )
1059{
1060 switch (nAttrToken)
1061 {
1064 {
1066 {
1067 bTimeOK = true;
1068 }
1069 break;
1070 }
1072 // delegate to superclass, pretending it was a time-adjust attr.
1075 sAttrValue);
1076 break;
1080 ; // ignore time-adjust and time-value attributes
1081 break;
1082 default:
1083 // all others: delegate to super-class
1085 sAttrValue);
1086 break;
1087 }
1088}
1089
1090
1091// database field superclass
1092
1093
1094constexpr OUStringLiteral gsPropertyDataBaseName(u"DataBaseName");
1095constexpr OUStringLiteral gsPropertyDataBaseURL(u"DataBaseURL");
1096constexpr OUStringLiteral gsPropertyTableName(u"DataTableName");
1097constexpr OUStringLiteral gsPropertyDataCommandType(u"DataCommandType");
1098constexpr OUStringLiteral gsPropertyIsVisible(u"IsVisible");
1099
1101 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1102 const OUString& pServiceName, bool bUseDisplay)
1103: XMLTextFieldImportContext(rImport, rHlp, pServiceName)
1105, m_bCommandTypeOK(false)
1106, m_bDisplay( true )
1107, m_bDisplayOK( false )
1108, m_bUseDisplay( bUseDisplay )
1109, m_bDatabaseOK(false)
1110, m_bDatabaseNameOK(false)
1111, m_bDatabaseURLOK(false)
1112, m_bTableOK(false)
1113{
1114}
1115
1117 sal_Int32 nAttrToken, std::string_view sAttrValue )
1118{
1119 switch (nAttrToken)
1120 {
1122 m_sDatabaseName = OUString::fromUtf8(sAttrValue);
1123 m_bDatabaseOK = true;
1124 m_bDatabaseNameOK = true;
1125 break;
1127 m_sTableName = OUString::fromUtf8(sAttrValue);
1128 m_bTableOK = true;
1129 break;
1131 if( IsXMLToken( sAttrValue, XML_TABLE ) )
1132 {
1133 m_nCommandType = sdb::CommandType::TABLE;
1134 m_bCommandTypeOK = true;
1135 }
1136 else if( IsXMLToken( sAttrValue, XML_QUERY ) )
1137 {
1138 m_nCommandType = sdb::CommandType::QUERY;
1139 m_bCommandTypeOK = true;
1140 }
1141 else if( IsXMLToken( sAttrValue, XML_COMMAND ) )
1142 {
1143 m_nCommandType = sdb::CommandType::COMMAND;
1144 m_bCommandTypeOK = true;
1145 }
1146 break;
1148 if( IsXMLToken( sAttrValue, XML_NONE ) )
1149 {
1150 m_bDisplay = false;
1151 m_bDisplayOK = true;
1152 }
1153 else if( IsXMLToken( sAttrValue, XML_VALUE ) )
1154 {
1155 m_bDisplay = true;
1156 m_bDisplayOK = true;
1157 }
1158 break;
1159 default:
1160 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1161 }
1162}
1163
1164css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDatabaseFieldImportContext::createFastChildContext(
1165 sal_Int32 nElement,
1166 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
1167{
1168 if (nElement == XML_ELEMENT(FORM, XML_CONNECTION_RESOURCE) )
1169 {
1170 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
1171 {
1172 switch (aIter.getToken())
1173 {
1174 case XML_ELEMENT(XLINK, XML_HREF):
1175 {
1176 m_sDatabaseURL = aIter.toString();
1177 m_bDatabaseOK = true;
1178 m_bDatabaseURLOK = true;
1179 }
1180 break;
1181 default:;
1182 }
1183 }
1184
1185 // we call ProcessAttribute in order to set bValid appropriately
1187 }
1188 else
1189 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
1190
1191 return nullptr;
1192}
1193
1194
1196 const Reference<XPropertySet> & xPropertySet)
1197{
1198 xPropertySet->setPropertyValue(gsPropertyTableName, Any(m_sTableName));
1199
1200 if( m_bDatabaseNameOK )
1201 {
1202 xPropertySet->setPropertyValue(gsPropertyDataBaseName, Any(m_sDatabaseName));
1203 }
1204 else if( m_bDatabaseURLOK )
1205 {
1206 xPropertySet->setPropertyValue(gsPropertyDataBaseURL, Any(m_sDatabaseURL));
1207 }
1208
1209 // #99980# load/save command type for all fields; also load
1210 // old documents without command type
1211 if( m_bCommandTypeOK )
1212 {
1213 xPropertySet->setPropertyValue( gsPropertyDataCommandType, Any(m_nCommandType) );
1214 }
1215
1217 {
1218 xPropertySet->setPropertyValue( gsPropertyIsVisible, Any(m_bDisplay) );
1219 }
1220}
1221
1222
1223// database name field
1224
1225
1227 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1228 XMLDatabaseFieldImportContext(rImport, rHlp, "DatabaseName", true)
1229{
1230}
1231
1233 sal_Int32 nAttrToken, std::string_view sAttrValue )
1234{
1235 // delegate to superclass and check for success
1238}
1239
1240
1241// database next field
1242
1243
1245 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1246 const OUString& pServiceName) :
1247 XMLDatabaseFieldImportContext(rImport, rHlp, pServiceName, false),
1248 sPropertyCondition(sAPI_condition),
1249 sTrue(sAPI_true),
1250 bConditionOK(false)
1251{
1252}
1253
1255 SvXMLImport& rImport, XMLTextImportHelper& rHlp)
1256: XMLDatabaseFieldImportContext(rImport, rHlp, "DatabaseNextSet", false)
1257, sPropertyCondition(sAPI_condition)
1258, sTrue(sAPI_true)
1259, bConditionOK(false)
1260{
1261}
1262
1264 sal_Int32 nAttrToken, std::string_view sAttrValue )
1265{
1266 if (XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
1267 {
1268 OUString sTmp;
1269 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1270 OUString::fromUtf8(sAttrValue), &sTmp );
1271 if( XML_NAMESPACE_OOOW == nPrefix )
1272 {
1273 sCondition = sTmp;
1274 bConditionOK = true;
1275 }
1276 else
1277 sCondition = OUString::fromUtf8(sAttrValue);
1278 }
1279 else
1280 {
1282 sAttrValue);
1283 }
1284
1286}
1287
1289 const Reference<XPropertySet> & xPropertySet)
1290{
1291 Any aAny;
1292
1293 aAny <<= bConditionOK ? sCondition : sTrue;
1294 xPropertySet->setPropertyValue(sPropertyCondition, aAny);
1295
1297}
1298
1299
1300// database select field
1301
1302
1304 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1305 XMLDatabaseNextImportContext(rImport, rHlp, "DatabaseNumberOfSet"),
1306 sPropertySetNumber(sAPI_set_number),
1307 nNumber(0),
1308 bNumberOK(false)
1309{
1310}
1311
1313 sal_Int32 nAttrToken,
1314 std::string_view sAttrValue )
1315{
1316 if (XML_ELEMENT(TEXT, XML_ROW_NUMBER) == nAttrToken)
1317 {
1318 sal_Int32 nTmp;
1319 if (::sax::Converter::convertNumber( nTmp, sAttrValue
1320 /* , nMin, nMax ??? */ ))
1321 {
1322 nNumber = nTmp;
1323 bNumberOK = true;
1324 }
1325 }
1326 else
1327 {
1328 XMLDatabaseNextImportContext::ProcessAttribute(nAttrToken, sAttrValue);
1329 }
1330
1332}
1333
1335 const Reference<XPropertySet> & xPropertySet)
1336{
1337 xPropertySet->setPropertyValue(sPropertySetNumber, Any(nNumber));
1338
1340}
1341
1342
1343// database display row number field
1344
1345
1347 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1348 XMLDatabaseFieldImportContext(rImport, rHlp, "DatabaseSetNumber", true),
1349 sPropertyNumberingType(
1351 sPropertySetNumber(sAPI_set_number),
1352 sNumberFormat("1"),
1353 sNumberSync(GetXMLToken(XML_FALSE)),
1354 nValue(0),
1355 bValueOK(false)
1356{
1357}
1358
1360 sal_Int32 nAttrToken,
1361 std::string_view sAttrValue )
1362{
1363 switch (nAttrToken)
1364 {
1366 sNumberFormat = OUString::fromUtf8(sAttrValue);
1367 break;
1369 sNumberSync = OUString::fromUtf8(sAttrValue);
1370 break;
1373 {
1374 sal_Int32 nTmp;
1375 if (::sax::Converter::convertNumber( nTmp, sAttrValue ))
1376 {
1377 nValue = nTmp;
1378 bValueOK = true;
1379 }
1380 break;
1381 }
1382 default:
1384 sAttrValue);
1385 break;
1386 }
1387
1389}
1390
1392 const Reference<XPropertySet> & xPropertySet)
1393{
1394 sal_Int16 nNumType = style::NumberingType::ARABIC;
1395 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
1397 sNumberSync );
1398 xPropertySet->setPropertyValue(sPropertyNumberingType, Any(nNumType));
1399
1400 if (bValueOK)
1401 {
1402 xPropertySet->setPropertyValue(sPropertySetNumber, Any(nValue));
1403 }
1404
1406}
1407
1408
1409// Simple doc info fields
1410
1411
1413 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1414 sal_Int32 nElementToken,
1415 bool bContent, bool bAuthor)
1416: XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nElementToken) )
1417, sPropertyFixed(sAPI_is_fixed)
1418, sPropertyContent(sAPI_content)
1419, sPropertyAuthor(sAPI_author)
1420, sPropertyCurrentPresentation(sAPI_current_presentation)
1421, bFixed(false)
1422, bHasAuthor(bAuthor)
1423, bHasContent(bContent)
1424{
1425 bValid = true;
1426}
1427
1429 sal_Int32 nAttrToken,
1430 std::string_view sAttrValue )
1431{
1432 if (XML_ELEMENT(TEXT, XML_FIXED) == nAttrToken)
1433 {
1434 bool bTmp(false);
1435 if (::sax::Converter::convertBool(bTmp, sAttrValue))
1436 {
1437 bFixed = bTmp;
1438 }
1439 }
1440 else
1441 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1442}
1443
1445 const Reference<XPropertySet> & rPropertySet)
1446{
1447 // title field in Calc has no Fixed property
1448 Reference<XPropertySetInfo> xPropertySetInfo(rPropertySet->getPropertySetInfo());
1449 if (!xPropertySetInfo->hasPropertyByName(sPropertyFixed))
1450 return;
1451
1452 Any aAny;
1453 rPropertySet->setPropertyValue(sPropertyFixed, Any(bFixed));
1454
1455 // set Content and CurrentPresentation (if fixed)
1456 if (!bFixed)
1457 return;
1458
1459 // in organizer-mode or styles-only-mode, only force update
1460 if (GetImport().GetTextImport()->IsOrganizerMode() ||
1461 GetImport().GetTextImport()->IsStylesOnlyMode() )
1462 {
1463 ForceUpdate(rPropertySet);
1464 }
1465 else
1466 {
1467 // set content (author, if that's the name) and current
1468 // presentation
1469 aAny <<= GetContent();
1470
1471 if (bFixed && bHasAuthor)
1472 {
1473 rPropertySet->setPropertyValue(sPropertyAuthor, aAny);
1474 }
1475
1476 if (bFixed && bHasContent)
1477 {
1478 rPropertySet->setPropertyValue(sPropertyContent, aAny);
1479 }
1480
1481 rPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
1482 }
1483}
1484
1486 sal_Int32 nElementToken)
1487{
1488 OUString pServiceName;
1489
1490 switch(nElementToken)
1491 {
1493 pServiceName = "DocInfo.CreateAuthor";
1494 break;
1496 pServiceName = sAPI_docinfo_create_date_time;
1497 break;
1499 pServiceName = sAPI_docinfo_create_date_time;
1500 break;
1502 pServiceName = "DocInfo.Description";
1503 break;
1505 pServiceName = "DocInfo.EditTime";
1506 break;
1508 pServiceName = sAPI_docinfo_custom;
1509 break;
1511 pServiceName = "DocInfo.PrintAuthor";
1512 break;
1514 pServiceName = sAPI_docinfo_print_date_time;
1515 break;
1517 pServiceName = sAPI_docinfo_print_date_time;
1518 break;
1520 pServiceName = "DocInfo.KeyWords";
1521 break;
1523 pServiceName = "DocInfo.Subject";
1524 break;
1526 pServiceName = "DocInfo.Revision";
1527 break;
1529 pServiceName = "DocInfo.ChangeAuthor";
1530 break;
1532 pServiceName = sAPI_docinfo_change_date_time;
1533 break;
1535 pServiceName = sAPI_docinfo_change_date_time;
1536 break;
1537 case XML_ELEMENT(TEXT, XML_TITLE):
1538 pServiceName = "DocInfo.Title";
1539 break;
1540 default:
1541 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElementToken);
1542 assert(false);
1543 }
1544
1545 return pServiceName;
1546}
1547
1548
1549// revision field
1550
1551constexpr OUStringLiteral sPropertyRevision(u"Revision");
1552
1554 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_Int32 nElement) :
1555 XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1556{
1557 bValid = true;
1558}
1559
1561 const Reference<XPropertySet> & rPropertySet)
1562{
1564
1565 // set revision number
1566 // if fixed, if not in organizer-mode, if not in styles-only-mode
1567 if (!bFixed)
1568 return;
1569
1570 if ( GetImport().GetTextImport()->IsOrganizerMode() ||
1571 GetImport().GetTextImport()->IsStylesOnlyMode() )
1572 {
1573 ForceUpdate(rPropertySet);
1574 }
1575 else
1576 {
1577 sal_Int32 nTmp;
1579 {
1580 rPropertySet->setPropertyValue(sPropertyRevision, Any(nTmp));
1581 }
1582 }
1583}
1584
1585
1586// DocInfo fields with date/time attributes
1587
1588
1590 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_Int32 nElement)
1591 : XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1592 , sPropertyNumberFormat(sAPI_number_format)
1593 , sPropertyIsDate(sAPI_is_date)
1594 , sPropertyIsFixedLanguage(sAPI_is_fixed_language)
1595 , nFormat(0)
1596 , bFormatOK(false)
1597 , bIsDate(false)
1598 , bHasDateTime(false)
1599 , bIsDefaultLanguage(true)
1600{
1601 // we allow processing of EDIT_DURATION here, because import of actual
1602 // is not supported anyway. If it was, we'd need an extra import class
1603 // because times and time durations are presented differently!
1604
1605 bValid = true;
1606 switch (nElement)
1607 {
1611 bIsDate = true;
1612 bHasDateTime = true;
1613 break;
1617 bIsDate = false;
1618 bHasDateTime = true;
1619 break;
1621 bIsDate = false;
1622 bHasDateTime = false;
1623 break;
1624 default:
1625 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
1626 OSL_FAIL("XMLDateTimeDocInfoImportContext needs date/time doc. fields");
1627 bValid = false;
1628 break;
1629 }
1630}
1631
1633 sal_Int32 nAttrToken,
1634 std::string_view sAttrValue )
1635{
1636 switch (nAttrToken)
1637 {
1639 {
1640 sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
1641 OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1642 if (-1 != nKey)
1643 {
1644 nFormat = nKey;
1645 bFormatOK = true;
1646 }
1647 break;
1648 }
1649 case XML_ELEMENT(TEXT, XML_FIXED):
1651 sAttrValue);
1652 break;
1653 default:
1654 // ignore -> we can't set date/time value anyway!
1655 break;
1656 }
1657}
1658
1660 const Reference<XPropertySet> & xPropertySet)
1661{
1662 // process fixed and presentation
1664
1665 if (bHasDateTime)
1666 {
1667 xPropertySet->setPropertyValue(sPropertyIsDate, Any(bIsDate));
1668 }
1669
1670 if (bFormatOK)
1671 {
1672 xPropertySet->setPropertyValue(sPropertyNumberFormat, Any(nFormat));
1673
1674 if( xPropertySet->getPropertySetInfo()->
1675 hasPropertyByName( sPropertyIsFixedLanguage ) )
1676 {
1677 bool bIsFixedLanguage = ! bIsDefaultLanguage;
1678 xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, Any(bIsFixedLanguage) );
1679 }
1680 }
1681
1682 // can't set date/time/duration value! Sorry.
1683}
1684
1685
1686// user defined docinfo fields
1687
1688
1690 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1691 sal_Int32 nElement) :
1692 XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1693 , sPropertyName(sAPI_name)
1694 , sPropertyNumberFormat(sAPI_number_format)
1695 , sPropertyIsFixedLanguage(sAPI_is_fixed_language)
1696 , nFormat(0)
1697 , bFormatOK(false)
1698 , bIsDefaultLanguage( true )
1699{
1700 bValid = false;
1701}
1702
1704 sal_Int32 nAttrToken,
1705 std::string_view sAttrValue )
1706{
1707 switch (nAttrToken)
1708 {
1710 {
1711 sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
1712 OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1713 if (-1 != nKey)
1714 {
1715 nFormat = nKey;
1716 bFormatOK = true;
1717 }
1718 break;
1719 }
1720 case XML_ELEMENT(TEXT, XML_NAME):
1721 {
1722 if (!bValid)
1723 {
1725 aName = OUString::fromUtf8(sAttrValue);
1726 bValid = true;
1727 }
1728 break;
1729 }
1730
1731 default:
1733 sAttrValue);
1734 break;
1735 }
1736}
1737
1739 const css::uno::Reference<css::beans::XPropertySet> & xPropertySet)
1740{
1741 if ( !aName.isEmpty() )
1742 {
1743 xPropertySet->setPropertyValue(sPropertyName, Any(aName));
1744 }
1745 Reference<XPropertySetInfo> xPropertySetInfo(
1746 xPropertySet->getPropertySetInfo());
1747 if (bFormatOK &&
1748 xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
1749 {
1750 xPropertySet->setPropertyValue(sPropertyNumberFormat, Any(nFormat));
1751
1752 if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
1753 {
1754 bool bIsFixedLanguage = ! bIsDefaultLanguage;
1755 xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, Any(bIsFixedLanguage) );
1756 }
1757 }
1758
1759 // call superclass to handle "fixed"
1761}
1762
1763
1764// import hidden paragraph fields
1765
1766
1768 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1769 XMLTextFieldImportContext(rImport, rHlp, "HiddenParagraph"),
1770 sPropertyCondition(sAPI_condition),
1771 sPropertyIsHidden(sAPI_is_hidden),
1772 bIsHidden(false)
1773{
1774}
1775
1777 sal_Int32 nAttrToken,
1778 std::string_view sAttrValue )
1779{
1780 if ( XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
1781 {
1782 OUString sTmp;
1783 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1784 OUString::fromUtf8(sAttrValue), &sTmp );
1785 if( XML_NAMESPACE_OOOW == nPrefix )
1786 {
1787 sCondition = sTmp;
1788 bValid = true;
1789 }
1790 else
1791 sCondition = OUString::fromUtf8(sAttrValue);
1792 }
1793 else if ( XML_ELEMENT(TEXT, XML_IS_HIDDEN) == nAttrToken)
1794 {
1795 bool bTmp(false);
1796 if (::sax::Converter::convertBool(bTmp, sAttrValue))
1797 {
1798 bIsHidden = bTmp;
1799 }
1800 }
1801 else
1802 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1803}
1804
1806 const Reference<XPropertySet> & xPropertySet)
1807{
1808 xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1809 xPropertySet->setPropertyValue(sPropertyIsHidden, Any(bIsHidden));
1810}
1811
1812
1813// import conditional text (<text:conditional-text>)
1814
1815constexpr OUStringLiteral gsPropertyTrueContent(u"TrueContent");
1816constexpr OUStringLiteral gsPropertyFalseContent(u"FalseContent");
1817constexpr OUStringLiteral gsPropertyIsConditionTrue(u"IsConditionTrue");
1818
1820 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1821 XMLTextFieldImportContext(rImport, rHlp, "ConditionalText"),
1822 sPropertyCondition(sAPI_condition),
1823 sPropertyCurrentPresentation(sAPI_current_presentation),
1824 bConditionOK(false),
1825 bTrueOK(false),
1826 bFalseOK(false),
1827 bCurrentValue(false)
1828{
1829}
1830
1832 sal_Int32 nAttrToken,
1833 std::string_view sAttrValue )
1834{
1835 switch (nAttrToken)
1836 {
1838 {
1839 OUString sTmp;
1840 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
1841 GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1842 if( XML_NAMESPACE_OOOW == nPrefix )
1843 {
1844 sCondition = sTmp;
1845 bConditionOK = true;
1846 }
1847 else
1848 sCondition = OUString::fromUtf8(sAttrValue);
1849 }
1850 break;
1852 sFalseContent = OUString::fromUtf8(sAttrValue);
1853 bFalseOK = true;
1854 break;
1856 sTrueContent = OUString::fromUtf8(sAttrValue);
1857 bTrueOK = true;
1858 break;
1860 {
1861 bool bTmp(false);
1862 if (::sax::Converter::convertBool(bTmp, sAttrValue))
1863 {
1864 bCurrentValue = bTmp;
1865 }
1866 break;
1867 }
1868 default:
1869 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1870 }
1871
1873}
1874
1876 const Reference<XPropertySet> & xPropertySet)
1877{
1878 xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1879 xPropertySet->setPropertyValue(gsPropertyFalseContent, Any(sFalseContent));
1880 xPropertySet->setPropertyValue(gsPropertyTrueContent, Any(sTrueContent));
1881 xPropertySet->setPropertyValue(gsPropertyIsConditionTrue, Any(bCurrentValue));
1882 xPropertySet->setPropertyValue(sPropertyCurrentPresentation, Any(GetContent()));
1883}
1884
1885
1886// hidden text
1887
1888
1890 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1891 XMLTextFieldImportContext(rImport, rHlp, "HiddenText"),
1892 sPropertyCondition(sAPI_condition),
1893 sPropertyContent(sAPI_content),
1894 sPropertyIsHidden(sAPI_is_hidden),
1895 bConditionOK(false),
1896 bStringOK(false),
1897 bIsHidden(false)
1898{
1899}
1900
1902 sal_Int32 nAttrToken,
1903 std::string_view sAttrValue )
1904{
1905 switch (nAttrToken)
1906 {
1908 {
1909 OUString sTmp;
1910 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
1911 GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1912 if( XML_NAMESPACE_OOOW == nPrefix )
1913 {
1914 sCondition = sTmp;
1915 bConditionOK = true;
1916 }
1917 else
1918 sCondition = OUString::fromUtf8(sAttrValue);
1919 }
1920 break;
1923 sString = OUString::fromUtf8(sAttrValue);
1924 bStringOK = true;
1925 break;
1927 {
1928 bool bTmp(false);
1929 if (::sax::Converter::convertBool(bTmp, sAttrValue))
1930 {
1931 bIsHidden = bTmp;
1932 }
1933 break;
1934 }
1935 default:
1936 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1937 }
1938
1940}
1941
1943 const Reference<XPropertySet> & xPropertySet)
1944{
1945 xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1946 xPropertySet->setPropertyValue(sPropertyContent, Any(sString));
1947 xPropertySet->setPropertyValue(sPropertyIsHidden, Any(bIsHidden));
1948}
1949
1950
1951// file name fields
1952
1953
1955{
1956 { XML_PATH, FilenameDisplayFormat::PATH },
1957 { XML_NAME, FilenameDisplayFormat::NAME },
1958 { XML_NAME_AND_EXTENSION, FilenameDisplayFormat::NAME_AND_EXT },
1959 { XML_FULL, FilenameDisplayFormat::FULL },
1960 { XML_TOKEN_INVALID, 0 }
1961};
1962
1964 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1965 XMLTextFieldImportContext(rImport, rHlp, "FileName"),
1966 sPropertyFixed(sAPI_is_fixed),
1967 sPropertyFileFormat(sAPI_file_format),
1968 sPropertyCurrentPresentation(
1970 nFormat(FilenameDisplayFormat::FULL),
1971 bFixed(false)
1972{
1973 bValid = true;
1974}
1975
1977 sal_Int32 nAttrToken,
1978 std::string_view sAttrValue )
1979{
1980 switch (nAttrToken)
1981 {
1982 case XML_ELEMENT(TEXT, XML_FIXED):
1983 {
1984 bool bTmp(false);
1985 if (::sax::Converter::convertBool(bTmp, sAttrValue))
1986 {
1987 bFixed = bTmp;
1988 }
1989 break;
1990 }
1992 {
1993 sal_uInt16 nTmp;
1994 if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
1996 {
1997 nFormat = nTmp;
1998 }
1999 break;
2000 }
2001 default:
2002 // unknown attribute: ignore
2003 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2004 break;
2005 }
2006}
2007
2009 const Reference<XPropertySet> & xPropertySet)
2010{
2011 // properties are optional
2012 Reference<XPropertySetInfo> xPropertySetInfo(
2013 xPropertySet->getPropertySetInfo());
2014
2015 if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
2016 {
2017 xPropertySet->setPropertyValue(sPropertyFixed, Any(bFixed));
2018 }
2019
2020 if (xPropertySetInfo->hasPropertyByName(sPropertyFileFormat))
2021 {
2022 xPropertySet->setPropertyValue(sPropertyFileFormat, Any(nFormat));
2023 }
2024
2025 if (xPropertySetInfo->hasPropertyByName(sPropertyCurrentPresentation))
2026 {
2027 xPropertySet->setPropertyValue(sPropertyCurrentPresentation, Any(GetContent()));
2028 }
2029}
2030
2031
2032// template name field
2033
2034
2036{
2037 { XML_FULL, TemplateDisplayFormat::FULL },
2038 { XML_PATH, TemplateDisplayFormat::PATH },
2039 { XML_NAME, TemplateDisplayFormat::NAME },
2040 { XML_NAME_AND_EXTENSION, TemplateDisplayFormat::NAME_AND_EXT },
2041 { XML_AREA, TemplateDisplayFormat::AREA },
2042 { XML_TITLE, TemplateDisplayFormat::TITLE },
2043 { XML_TOKEN_INVALID, 0 }
2044};
2045
2046
2048 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2049 XMLTextFieldImportContext(rImport, rHlp, "TemplateName"),
2050 sPropertyFileFormat(sAPI_file_format),
2051 nFormat(TemplateDisplayFormat::FULL)
2052{
2053 bValid = true;
2054}
2055
2057 sal_Int32 nAttrToken,
2058 std::string_view sAttrValue )
2059{
2060 switch (nAttrToken)
2061 {
2063 {
2064 sal_uInt16 nTmp;
2065 if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
2067 {
2068 nFormat = nTmp;
2069 }
2070 break;
2071 }
2072 default:
2073 // unknown attribute: ignore
2074 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2075 break;
2076 }
2077}
2078
2080 const Reference<XPropertySet> & xPropertySet)
2081{
2082 xPropertySet->setPropertyValue(sPropertyFileFormat, Any(nFormat));
2083}
2084
2085
2086// import chapter fields
2087
2088
2090{
2091 { XML_NAME, ChapterFormat::NAME },
2092 { XML_NUMBER, ChapterFormat::NUMBER },
2093 { XML_NUMBER_AND_NAME, ChapterFormat::NAME_NUMBER },
2094 { XML_PLAIN_NUMBER_AND_NAME, ChapterFormat::NO_PREFIX_SUFFIX },
2095 { XML_PLAIN_NUMBER, ChapterFormat::DIGIT },
2096 { XML_TOKEN_INVALID, 0 }
2097};
2098
2099constexpr OUStringLiteral gsPropertyChapterFormat(u"ChapterFormat");
2100constexpr OUStringLiteral gsPropertyLevel(u"Level");
2101
2103 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2104 XMLTextFieldImportContext(rImport, rHlp, "Chapter"),
2105 nFormat(ChapterFormat::NAME_NUMBER),
2106 nLevel(0)
2107{
2108 bValid = true;
2109}
2110
2112 sal_Int32 nAttrToken,
2113 std::string_view sAttrValue )
2114{
2115 switch (nAttrToken)
2116 {
2118 {
2119 sal_uInt16 nTmp;
2120 if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
2122 {
2123 nFormat = static_cast<sal_Int16>(nTmp);
2124 }
2125 break;
2126 }
2128 {
2129 sal_Int32 nTmp;
2131 nTmp, sAttrValue, 1,
2132 GetImport().GetTextImport()->GetChapterNumbering()->getCount()
2133 ))
2134 {
2135 // API numbers 0..9, we number 1..10
2136 nLevel = static_cast<sal_Int8>(nTmp);
2137 nLevel--;
2138 }
2139 break;
2140 }
2141 default:
2142 // unknown attribute: ignore
2143 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2144 break;
2145 }
2146}
2147
2149 const Reference<XPropertySet> & xPropertySet)
2150{
2151 xPropertySet->setPropertyValue(gsPropertyChapterFormat, Any(nFormat));
2152 xPropertySet->setPropertyValue(gsPropertyLevel, Any(nLevel));
2153}
2154
2155
2156// counting fields
2157
2158
2160 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
2161 sal_Int32 nElement) :
2162 XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nElement)),
2163 sPropertyNumberingType(
2165 bNumberFormatOK(false)
2166{
2167 bValid = true;
2168}
2169
2171 sal_Int32 nAttrToken,
2172 std::string_view sAttrValue )
2173{
2174 switch (nAttrToken)
2175 {
2177 sNumberFormat = OUString::fromUtf8(sAttrValue);
2178 bNumberFormatOK = true;
2179 break;
2181 sLetterSync = OUString::fromUtf8(sAttrValue);
2182 break;
2183 default:
2184 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2185 }
2186}
2187
2189 const Reference<XPropertySet> & xPropertySet)
2190{
2191 // properties optional
2192 // (only page count, but do for all to save common implementation)
2193
2194 if (!xPropertySet->getPropertySetInfo()->
2195 hasPropertyByName(sPropertyNumberingType))
2196 return;
2197
2198 sal_Int16 nNumType;
2199 if( bNumberFormatOK )
2200 {
2201 nNumType= style::NumberingType::ARABIC;
2202 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
2204 sLetterSync );
2205 }
2206 else
2207 nNumType = style::NumberingType::PAGE_DESCRIPTOR;
2208 xPropertySet->setPropertyValue(sPropertyNumberingType, Any(nNumType));
2209}
2210
2212 sal_Int32 nElement)
2213{
2214 OUString pServiceName;
2215
2216 switch (nElement)
2217 {
2219 pServiceName = "WordCount";
2220 break;
2222 pServiceName = "ParagraphCount";
2223 break;
2225 pServiceName = "TableCount";
2226 break;
2228 pServiceName = "CharacterCount";
2229 break;
2231 pServiceName = "GraphicObjectCount";
2232 break;
2234 pServiceName = "EmbeddedObjectCount";
2235 break;
2237 pServiceName = "PageCount";
2238 break;
2239 default:
2240 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2241 assert(false);
2242 }
2243
2244 return pServiceName;
2245}
2246
2247
2248// page variable import
2249
2250
2252 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2253 XMLTextFieldImportContext(rImport, rHlp, "ReferencePageGet"),
2254 bNumberFormatOK(false)
2255{
2256 bValid = true;
2257}
2258
2260 sal_Int32 nAttrToken,
2261 std::string_view sAttrValue )
2262{
2263 switch (nAttrToken)
2264 {
2266 sNumberFormat = OUString::fromUtf8(sAttrValue);
2267 bNumberFormatOK = true;
2268 break;
2270 sLetterSync = OUString::fromUtf8(sAttrValue);
2271 break;
2272 default:
2273 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2274 }
2275}
2276
2278 const Reference<XPropertySet> & xPropertySet)
2279{
2280 sal_Int16 nNumType;
2281 if( bNumberFormatOK )
2282 {
2283 nNumType= style::NumberingType::ARABIC;
2284 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
2286 sLetterSync );
2287 }
2288 else
2289 nNumType = style::NumberingType::PAGE_DESCRIPTOR;
2290 xPropertySet->setPropertyValue(sAPI_numbering_type, Any(nNumType));
2291
2292 // display old content (#96657#)
2293 xPropertySet->setPropertyValue( sAPI_current_presentation, Any(GetContent()) );
2294}
2295
2296
2297// page variable set fields
2298
2299
2301 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2302 XMLTextFieldImportContext(rImport, rHlp, "ReferencePageSet"),
2303 nAdjust(0),
2304 bActive(true)
2305{
2306 bValid = true;
2307}
2308
2310 sal_Int32 nAttrToken,
2311 std::string_view sAttrValue )
2312{
2313 switch (nAttrToken)
2314 {
2316 {
2317 bool bTmp(false);
2318 if (::sax::Converter::convertBool(bTmp, sAttrValue))
2319 {
2320 bActive = bTmp;
2321 }
2322 break;
2323 }
2325 {
2326 sal_Int32 nTmp(0);
2327 if (::sax::Converter::convertNumber(nTmp, sAttrValue))
2328 {
2329 nAdjust = static_cast<sal_Int16>(nTmp);
2330 }
2331 break;
2332 }
2333 default:
2334 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2335 break;
2336 }
2337}
2338
2340 const Reference<XPropertySet> & xPropertySet)
2341{
2342 xPropertySet->setPropertyValue("On", Any(bActive));
2343 xPropertySet->setPropertyValue(sAPI_offset, Any(nAdjust));
2344}
2345
2346
2347// macro fields
2348
2349
2351 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2352 XMLTextFieldImportContext(rImport, rHlp, "Macro"),
2353 bDescriptionOK(false)
2354{
2355}
2356
2357css::uno::Reference< css::xml::sax::XFastContextHandler > XMLMacroFieldImportContext::createFastChildContext(
2358 sal_Int32 nElement,
2359 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
2360{
2361 if ( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
2362 {
2363 // create events context and remember it!
2365 bValid = true;
2366 return xEventContext;
2367 }
2368 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2369
2370 return nullptr;
2371}
2372
2374 sal_Int32 nAttrToken,
2375 std::string_view sAttrValue )
2376{
2377 switch (nAttrToken)
2378 {
2380 sDescription = OUString::fromUtf8(sAttrValue);
2381 bDescriptionOK = true;
2382 break;
2383 case XML_ELEMENT(TEXT, XML_NAME):
2384 sMacro = OUString::fromUtf8(sAttrValue);
2385 bValid = true;
2386 break;
2387 default:
2388 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2389 }
2390}
2391
2393 const Reference<XPropertySet> & xPropertySet)
2394{
2395 Any aAny;
2396 aAny <<= (bDescriptionOK ? sDescription : GetContent());
2397 xPropertySet->setPropertyValue(sAPI_hint, aAny);
2398
2399 // if we have an events child element, we'll look for the OnClick
2400 // event if not, it may be an old (pre-638i) document. Then, we'll
2401 // have to look at the name attribute.
2402 OUString sMacroName;
2403 OUString sLibraryName;
2404 OUString sScriptURL;
2405
2406 if ( xEventContext.is() )
2407 {
2408 // get event sequence
2409 XMLEventsImportContext* pEvents = xEventContext.get();
2410 Sequence<PropertyValue> aValues;
2411 pEvents->GetEventSequence( "OnClick", aValues );
2412
2413 for( const auto& rValue : std::as_const(aValues) )
2414 {
2415 if ( rValue.Name == "ScriptType" )
2416 {
2417 // ignore ScriptType
2418 }
2419 else if ( rValue.Name == "Library" )
2420 {
2421 rValue.Value >>= sLibraryName;
2422 }
2423 else if ( rValue.Name == "MacroName" )
2424 {
2425 rValue.Value >>= sMacroName;
2426 }
2427 if ( rValue.Name == "Script" )
2428 {
2429 rValue.Value >>= sScriptURL;
2430 }
2431 }
2432 }
2433 else
2434 {
2435 // disassemble old-style macro-name: Everything before the
2436 // third-last dot is the library
2437 sal_Int32 nPos = sMacro.getLength() + 1; // the loop starts with nPos--
2438 const sal_Unicode* pBuf = sMacro.getStr();
2439 for( sal_Int32 i = 0; (i < 3) && (nPos > 0); i++ )
2440 {
2441 nPos--;
2442 while ( (pBuf[nPos] != '.') && (nPos > 0) )
2443 nPos--;
2444 }
2445
2446 if (nPos > 0)
2447 {
2448 sLibraryName = sMacro.copy(0, nPos);
2449 sMacroName = sMacro.copy(nPos+1);
2450 }
2451 else
2453 }
2454
2455 xPropertySet->setPropertyValue("ScriptURL", Any(sScriptURL));
2456 xPropertySet->setPropertyValue("MacroName", Any(sMacroName));
2457 xPropertySet->setPropertyValue("MacroLibrary", Any(sLibraryName));
2458}
2459
2460
2461// reference field import
2462
2463
2465 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
2466 sal_Int32 nToken)
2467: XMLTextFieldImportContext(rImport, rHlp, "GetReference")
2468, nElementToken(nToken)
2469, nSource(0)
2470, nType(ReferenceFieldPart::PAGE_DESC)
2471, bNameOK(false)
2472, bTypeOK(false)
2473{
2474}
2475
2477{
2478 { XML_PAGE, ReferenceFieldPart::PAGE},
2479 { XML_CHAPTER, ReferenceFieldPart::CHAPTER },
2480 { XML_TEXT, ReferenceFieldPart::TEXT },
2481 { XML_DIRECTION, ReferenceFieldPart::UP_DOWN },
2482 { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
2483 { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
2484 { XML_VALUE, ReferenceFieldPart::ONLY_SEQUENCE_NUMBER },
2485 // Core implementation for direct cross-references (#i81002#)
2486 { XML_NUMBER, ReferenceFieldPart::NUMBER },
2487 { XML_NUMBER_NO_SUPERIOR, ReferenceFieldPart::NUMBER_NO_CONTEXT },
2488 { XML_NUMBER_ALL_SUPERIOR, ReferenceFieldPart::NUMBER_FULL_CONTEXT },
2489 { XML_TOKEN_INVALID, 0 }
2490};
2491
2493 sal_Int32 nElement,
2494 const Reference<XFastAttributeList> & xAttrList)
2495{
2496 bTypeOK = true;
2497 switch (nElementToken)
2498 {
2500 nSource = ReferenceFieldSource::REFERENCE_MARK;
2501 break;
2503 nSource = ReferenceFieldSource::BOOKMARK;
2504 break;
2506 nSource = ReferenceFieldSource::FOOTNOTE;
2507 break;
2509 nSource = ReferenceFieldSource::SEQUENCE_FIELD;
2510 break;
2511 default:
2513 bTypeOK = false;
2514 break;
2515 }
2516
2518}
2519
2520
2522 sal_Int32 nAttrToken,
2523 std::string_view sAttrValue )
2524{
2525 switch (nAttrToken)
2526 {
2528 if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
2529 nSource = ReferenceFieldSource::ENDNOTE;
2530 break;
2532 sName = OUString::fromUtf8(sAttrValue);
2533 bNameOK = true;
2534 break;
2536 {
2537 sal_uInt16 nToken;
2540 {
2541 nType = nToken;
2542 }
2543
2544 // check for sequence-only-attributes
2546 ( (nType == ReferenceFieldPart::CATEGORY_AND_NUMBER) ||
2547 (nType == ReferenceFieldPart::ONLY_CAPTION) ||
2548 (nType == ReferenceFieldPart::ONLY_SEQUENCE_NUMBER) ) )
2549 {
2550 nType = ReferenceFieldPart::PAGE_DESC;
2551 }
2552
2553 break;
2554 }
2555 case XML_ELEMENT(LO_EXT, XML_REFERENCE_LANGUAGE):
2557 sLanguage = OUString::fromUtf8(sAttrValue);
2558 break;
2559 default:
2560 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2561 }
2562
2563 // bValid: we need proper element type and name
2564 bValid = bTypeOK && bNameOK;
2565}
2566
2568 const Reference<XPropertySet> & xPropertySet)
2569{
2570 xPropertySet->setPropertyValue("ReferenceFieldPart", Any(nType));
2571
2572 xPropertySet->setPropertyValue("ReferenceFieldSource", Any(nSource));
2573
2574 xPropertySet->setPropertyValue("ReferenceFieldLanguage", Any(sLanguage));
2575 switch (nElementToken)
2576 {
2579 xPropertySet->setPropertyValue("SourceName", Any(sName));
2580 break;
2581
2584 break;
2585
2588 break;
2589 }
2590
2591 xPropertySet->setPropertyValue(sAPI_current_presentation, Any(GetContent()));
2592}
2593
2594
2595// field declarations container
2596
2598 SvXMLImportContext(rImport)
2599{
2600}
2601
2602css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDdeFieldDeclsImportContext::createFastChildContext(
2603 sal_Int32 nElement,
2604 const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
2605{
2606 if ( nElement == XML_ELEMENT(TEXT, XML_DDE_CONNECTION_DECL) )
2607 {
2609 }
2610 else
2611 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2612 return nullptr;
2613}
2614
2615
2616// import dde field declaration
2617
2618
2620: SvXMLImportContext(rImport)
2621{
2622}
2623
2625 sal_Int32 /*nElement*/,
2626 const Reference<XFastAttributeList> & xAttrList)
2627{
2628 OUString sName;
2629 OUString sCommandApplication;
2630 OUString sCommandTopic;
2631 OUString sCommandItem;
2632
2633 bool bUpdate = false;
2634 bool bNameOK = false;
2635 bool bCommandApplicationOK = false;
2636 bool bCommandTopicOK = false;
2637 bool bCommandItemOK = false;
2638
2639 // process attributes
2640 for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
2641 {
2642 switch (aIter.getToken())
2643 {
2645 sName = aIter.toString();
2646 bNameOK = true;
2647 break;
2649 sCommandApplication = aIter.toString();
2650 bCommandApplicationOK = true;
2651 break;
2653 sCommandTopic = aIter.toString();
2654 bCommandTopicOK = true;
2655 break;
2657 sCommandItem = aIter.toString();
2658 bCommandItemOK = true;
2659 break;
2661 {
2662 bool bTmp(false);
2663 if (::sax::Converter::convertBool(bTmp, aIter.toView()) )
2664 {
2665 bUpdate = bTmp;
2666 }
2667 break;
2668 }
2669 default:
2670 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
2671 }
2672 }
2673
2674 // valid data?
2675 if (!(bNameOK && bCommandApplicationOK && bCommandTopicOK && bCommandItemOK))
2676 return;
2677
2678 // create DDE TextFieldMaster
2679 Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
2680 UNO_QUERY);
2681 if( !xFactory.is() )
2682 return;
2683
2684 /* #i6432# There might be multiple occurrences of one DDE
2685 declaration if it is used in more than one of
2686 header/footer/body. createInstance will throw an exception if we
2687 try to create the second, third, etc. instance of such a
2688 declaration. Thus we ignore the exception. Otherwise this will
2689 lead to an unloadable document. */
2690 try
2691 {
2692 Reference<XInterface> xIfc =
2693 xFactory->createInstance(OUString::Concat(sAPI_fieldmaster_prefix) + sAPI_dde);
2694 if( xIfc.is() )
2695 {
2696 Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY );
2697 if (xPropSet.is() &&
2698 xPropSet->getPropertySetInfo()->hasPropertyByName(
2699 "DDECommandType"))
2700 {
2701 xPropSet->setPropertyValue(sAPI_name, Any(sName));
2702
2703 xPropSet->setPropertyValue("DDECommandType", Any(sCommandApplication));
2704
2705 xPropSet->setPropertyValue("DDECommandFile", Any(sCommandTopic));
2706
2707 xPropSet->setPropertyValue("DDECommandElement",
2708 Any(sCommandItem));
2709
2710 xPropSet->setPropertyValue("IsAutomaticUpdate",
2711 Any(bUpdate));
2712 }
2713 // else: ignore (can't get XPropertySet, or DDE
2714 // properties are not supported)
2715 }
2716 // else: ignore
2717 }
2718 catch (const Exception&)
2719 {
2720 //ignore
2721 }
2722 // else: ignore
2723 // else: ignore
2724}
2725
2726
2727// DDE field import
2728
2729
2731 SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2732 XMLTextFieldImportContext(rImport, rHlp, sAPI_dde),
2733 sPropertyContent(sAPI_content)
2734{
2735}
2736
2738 sal_Int32 nAttrToken,
2739 std::string_view sAttrValue )
2740{
2741 if ( XML_ELEMENT(TEXT, XML_CONNECTION_NAME) == nAttrToken)
2742 {
2743 sName = OUString::fromUtf8(sAttrValue);
2744 bValid = true;
2745 }
2746 else
2747 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2748}
2749
2750
2752{
2753 if (!bValid)
2754 return;
2755
2756 // find master
2757 OUString sMasterName = OUString::Concat(sAPI_fieldmaster_prefix) + sAPI_dde + "." + sName;
2758
2759 Reference<XTextFieldsSupplier> xTextFieldsSupp(GetImport().GetModel(),
2760 UNO_QUERY);
2761 Reference<container::XNameAccess> xFieldMasterNameAccess =
2762 xTextFieldsSupp->getTextFieldMasters();
2763
2764 if (!xFieldMasterNameAccess->hasByName(sMasterName))
2765 return;
2766
2767 Reference<XPropertySet> xMaster;
2768 Any aAny = xFieldMasterNameAccess->getByName(sMasterName);
2769 aAny >>= xMaster;
2770 //apply the content to the master
2771 xMaster->setPropertyValue( sPropertyContent, uno::Any( GetContent()));
2772 // master exists: create text field and attach
2773 Reference<XPropertySet> xField;
2774 OUString sFieldName = OUString::Concat(sAPI_textfield_prefix) + sAPI_dde;
2775 if (!CreateField(xField, sFieldName))
2776 return;
2777
2778 Reference<XDependentTextField> xDepTextField(xField,UNO_QUERY);
2779 xDepTextField->attachTextFieldMaster(xMaster);
2780
2781 // attach field to document
2782 Reference<XTextContent> xTextContent(xField, UNO_QUERY);
2783 if (xTextContent.is())
2784 {
2785 GetImportHelper().InsertTextContent(xTextContent);
2786
2787 // we're lucky. nothing else to prepare.
2788 }
2789 // else: fail, because text content could not be created
2790 // else: fail, because field could not be created
2791 // else: fail, because no master was found (faulty document?!)
2792 // not valid: ignore
2793}
2794
2796 const Reference<XPropertySet> &)
2797{
2798 // empty, since not needed.
2799}
2800
2801
2802// sheet name fields
2803
2804
2806 SvXMLImport& rImport,
2807 XMLTextImportHelper& rHlp) :
2808 XMLTextFieldImportContext(rImport, rHlp, "SheetName")
2809{
2810 bValid = true; // always valid!
2811}
2812
2814 sal_Int32 nAttrToken,
2815 std::string_view sAttrValue)
2816{
2817 // no attributes -> nothing to be done
2818 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2819}
2820
2822 const Reference<XPropertySet> &)
2823{
2824 // no attributes -> nothing to be done
2825}
2826
2830 SvXMLImport& rImport,
2831 XMLTextImportHelper& rHlp)
2832: XMLTextFieldImportContext(rImport, rHlp, "PageName" )
2833{
2834 bValid = true;
2835}
2836
2839 std::string_view sAttrValue )
2840{
2841 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2842}
2843
2846 const css::uno::Reference<css::beans::XPropertySet> &)
2847{
2848}
2849
2850
2851// URL fields (Calc, Impress, Draw)
2852
2853
2855 SvXMLImport& rImport,
2856 XMLTextImportHelper& rHlp) :
2857 XMLTextFieldImportContext(rImport, rHlp, sAPI_url),
2858 bFrameOK(false)
2859{
2860}
2861
2863 sal_Int32 nAttrToken,
2864 std::string_view sAttrValue )
2865{
2866 switch (nAttrToken)
2867 {
2868 case XML_ELEMENT(XLINK, XML_HREF):
2869 sURL = GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue) );
2870 bValid = true;
2871 break;
2873 sFrame = OUString::fromUtf8(sAttrValue);
2874 bFrameOK = true;
2875 break;
2876 default:
2877 // ignore
2878 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2879 break;
2880 }
2881}
2882
2884 const Reference<XPropertySet> & xPropertySet)
2885{
2886 xPropertySet->setPropertyValue(sAPI_url, Any(sURL));
2887
2888 if (bFrameOK)
2889 {
2890 xPropertySet->setPropertyValue("TargetFrame", Any(sFrame));
2891 }
2892
2893 xPropertySet->setPropertyValue("Representation", Any(GetContent()));
2894}
2895
2896
2898 SvXMLImport& rImport,
2899 XMLTextImportHelper& rHlp) :
2900 XMLTextFieldImportContext(rImport, rHlp, "Bibliography")
2901{
2902 bValid = true;
2903}
2904
2905// TODO: this is the same map as is used in the text field export
2907{
2908 { XML_ARTICLE, BibliographyDataType::ARTICLE },
2909 { XML_BOOK, BibliographyDataType::BOOK },
2910 { XML_BOOKLET, BibliographyDataType::BOOKLET },
2911 { XML_CONFERENCE, BibliographyDataType::CONFERENCE },
2912 { XML_CUSTOM1, BibliographyDataType::CUSTOM1 },
2913 { XML_CUSTOM2, BibliographyDataType::CUSTOM2 },
2914 { XML_CUSTOM3, BibliographyDataType::CUSTOM3 },
2915 { XML_CUSTOM4, BibliographyDataType::CUSTOM4 },
2916 { XML_CUSTOM5, BibliographyDataType::CUSTOM5 },
2917 { XML_EMAIL, BibliographyDataType::EMAIL },
2918 { XML_INBOOK, BibliographyDataType::INBOOK },
2919 { XML_INCOLLECTION, BibliographyDataType::INCOLLECTION },
2920 { XML_INPROCEEDINGS, BibliographyDataType::INPROCEEDINGS },
2921 { XML_JOURNAL, BibliographyDataType::JOURNAL },
2922 { XML_MANUAL, BibliographyDataType::MANUAL },
2923 { XML_MASTERSTHESIS, BibliographyDataType::MASTERSTHESIS },
2924 { XML_MISC, BibliographyDataType::MISC },
2925 { XML_PHDTHESIS, BibliographyDataType::PHDTHESIS },
2926 { XML_PROCEEDINGS, BibliographyDataType::PROCEEDINGS },
2927 { XML_TECHREPORT, BibliographyDataType::TECHREPORT },
2928 { XML_UNPUBLISHED, BibliographyDataType::UNPUBLISHED },
2929 { XML_WWW, BibliographyDataType::WWW },
2930 { XML_TOKEN_INVALID, 0 }
2931};
2932
2933
2934// we'll process attributes on our own and for fit the standard
2935// textfield mechanism, because our attributes have zero overlap with
2936// all the other textfields.
2938 sal_Int32 /*nElement*/,
2939 const Reference<XFastAttributeList> & xAttrList)
2940{
2941 // iterate over attributes
2942 for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
2943 {
2944 if (IsTokenInNamespace(aIter.getToken(), XML_NAMESPACE_TEXT)
2945 || IsTokenInNamespace(aIter.getToken(), XML_NAMESPACE_LO_EXT))
2946 {
2947 auto nToken = aIter.getToken() & TOKEN_MASK;
2948 PropertyValue aValue;
2949 aValue.Name = OUString::createFromAscii(
2951 Any aAny;
2952
2953 // special treatment for bibliography type
2954 // biblio vs bibilio: #96658#; also read old documents
2957 {
2958 sal_uInt16 nTmp;
2960 nTmp, aIter.toView(),
2962 {
2963 aAny <<= static_cast<sal_Int16>(nTmp);
2964 aValue.Value = aAny;
2965
2966 aValues.push_back(aValue);
2967 }
2968 }
2969 else
2970 {
2971 OUString aStringValue = aIter.toString();
2973 {
2974 aStringValue = GetImport().GetAbsoluteReference(aStringValue);
2975 }
2976 aAny <<= aStringValue;
2977 aValue.Value = aAny;
2978
2979 aValues.push_back(aValue);
2980 }
2981 }
2982 // else: unknown namespace -> ignore
2983 }
2984}
2985
2987 sal_Int32 ,
2988 std::string_view )
2989{
2990 // attributes are handled in StartElement
2991 assert(false && "This should not have happened.");
2992}
2993
2994
2996 const Reference<XPropertySet> & xPropertySet)
2997{
2998 // convert vector into sequence
2999 sal_Int32 nCount = aValues.size();
3000 Sequence<PropertyValue> aValueSequence(nCount);
3001 auto aValueSequenceRange = asNonConstRange(aValueSequence);
3002 for(sal_Int32 i = 0; i < nCount; i++)
3003 {
3004 aValueSequenceRange[i] = aValues[i];
3005 }
3006
3007 // set sequence
3008 xPropertySet->setPropertyValue("Fields", Any(aValueSequence));
3009}
3010
3012 sal_Int32 nElement)
3013{
3014 const char* pName = nullptr;
3015
3016 switch (nElement & TOKEN_MASK)
3017 {
3018 case XML_IDENTIFIER:
3019 pName = "Identifier";
3020 break;
3023 // biblio... vs bibilio...: #96658#: also read old documents
3024 pName = "BibiliographicType";
3025 break;
3026 case XML_ADDRESS:
3027 pName = "Address";
3028 break;
3029 case XML_ANNOTE:
3030 pName = "Annote";
3031 break;
3032 case XML_AUTHOR:
3033 pName = "Author";
3034 break;
3035 case XML_BOOKTITLE:
3036 pName = "Booktitle";
3037 break;
3038 case XML_CHAPTER:
3039 pName = "Chapter";
3040 break;
3041 case XML_EDITION:
3042 pName = "Edition";
3043 break;
3044 case XML_EDITOR:
3045 pName = "Editor";
3046 break;
3047 case XML_HOWPUBLISHED:
3048 pName = "Howpublished";
3049 break;
3050 case XML_INSTITUTION:
3051 pName = "Institution";
3052 break;
3053 case XML_JOURNAL:
3054 pName = "Journal";
3055 break;
3056 case XML_MONTH:
3057 pName = "Month";
3058 break;
3059 case XML_NOTE:
3060 pName = "Note";
3061 break;
3062 case XML_NUMBER:
3063 pName = "Number";
3064 break;
3065 case XML_ORGANIZATIONS:
3066 pName = "Organizations";
3067 break;
3068 case XML_PAGES:
3069 pName = "Pages";
3070 break;
3071 case XML_PUBLISHER:
3072 pName = "Publisher";
3073 break;
3074 case XML_SCHOOL:
3075 pName = "School";
3076 break;
3077 case XML_SERIES:
3078 pName = "Series";
3079 break;
3080 case XML_TITLE:
3081 pName = "Title";
3082 break;
3083 case XML_REPORT_TYPE:
3084 pName = "Report_Type";
3085 break;
3086 case XML_VOLUME:
3087 pName = "Volume";
3088 break;
3089 case XML_YEAR:
3090 pName = "Year";
3091 break;
3092 case XML_URL:
3093 pName = "URL";
3094 break;
3095 case XML_CUSTOM1:
3096 pName = "Custom1";
3097 break;
3098 case XML_CUSTOM2:
3099 pName = "Custom2";
3100 break;
3101 case XML_CUSTOM3:
3102 pName = "Custom3";
3103 break;
3104 case XML_CUSTOM4:
3105 pName = "Custom4";
3106 break;
3107 case XML_CUSTOM5:
3108 pName = "Custom5";
3109 break;
3110 case XML_ISBN:
3111 pName = "ISBN";
3112 break;
3113 case XML_LOCAL_URL:
3114 pName = "LocalURL";
3115 break;
3116 case XML_TARGET_TYPE:
3117 pName = "TargetType";
3118 break;
3119 case XML_TARGET_URL:
3120 pName = "TargetURL";
3121 break;
3122 default:
3123 assert(false && "Unknown bibliography info data");
3124 pName = nullptr;
3125 }
3126 return pName;
3127}
3128
3129// Annotation Field
3130
3131
3133 SvXMLImport& rImport,
3134 XMLTextImportHelper& rHlp,
3135 sal_Int32 nElement) :
3136 XMLTextFieldImportContext(rImport, rHlp, "Annotation"),
3137 mnElement(nElement)
3138{
3139 bValid = true;
3140
3141 // remember old list item and block (#91964#) and reset them
3142 // for the text frame
3143 // do this in the constructor, not in CreateChildContext (#i93392#)
3144 GetImport().GetTextImport()->PushListContext();
3145}
3146
3148 sal_Int32 nAttrToken,
3149 std::string_view sAttrValue )
3150{
3151 if (nAttrToken == XML_ELEMENT(OFFICE, XML_NAME))
3152 aName = OUString::fromUtf8(sAttrValue);
3153 else if (nAttrToken == XML_ELEMENT(LO_EXT, XML_RESOLVED))
3154 aResolved = OUString::fromUtf8(sAttrValue);
3155 else
3156 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3157}
3158
3159css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnnotationImportContext::createFastChildContext(
3160 sal_Int32 nElement,
3161 const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
3162{
3163 if( nElement == XML_ELEMENT(DC, XML_CREATOR) )
3165 else if( nElement == XML_ELEMENT(DC, XML_DATE) )
3167 else if (nElement == XML_ELEMENT(TEXT,XML_SENDER_INITIALS) ||
3168 nElement == XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS) ||
3171
3172 try
3173 {
3174 bool bOK = true;
3175 if ( !mxField.is() )
3177 if (bOK)
3178 {
3179 Any aAny = mxField->getPropertyValue( "TextRange" );
3180 Reference< XText > xText;
3181 aAny >>= xText;
3182 if( xText.is() )
3183 {
3184 rtl::Reference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
3185 if( !mxCursor.is() )
3186 {
3187 mxOldCursor = xTxtImport->GetCursor();
3188 mxCursor = xText->createTextCursor();
3189 }
3190
3191 if( mxCursor.is() )
3192 {
3193 xTxtImport->SetCursor( mxCursor );
3194 return xTxtImport->CreateTextChildContext( GetImport(), nElement, xAttrList );
3195 }
3196 }
3197 }
3198 }
3199 catch (const Exception&)
3200 {
3201 }
3202
3204}
3205
3207{
3208 DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
3209 if( mxCursor.is() )
3210 {
3211 // delete addition newline
3212 mxCursor->gotoEnd( false );
3213 mxCursor->goLeft( 1, true );
3214 mxCursor->setString( "" );
3215
3216 // reset cursor
3217 GetImport().GetTextImport()->ResetCursor();
3218 }
3219
3220 if( mxOldCursor.is() )
3221 GetImport().GetTextImport()->SetCursor( mxOldCursor );
3222
3223 // reinstall old list item #91964#
3224 GetImport().GetTextImport()->PopListContext();
3225
3226 if ( bValid )
3227 {
3229 {
3230 // Search for a previous annotation with the same name.
3231 uno::Reference< text::XTextContent > xPrevField;
3232 {
3233 Reference<XTextFieldsSupplier> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY);
3234 uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
3235 uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
3236 while (xFields->hasMoreElements())
3237 {
3238 uno::Reference<beans::XPropertySet> xCurrField(xFields->nextElement(), uno::UNO_QUERY);
3239 uno::Reference<beans::XPropertySetInfo> const xInfo(
3240 xCurrField->getPropertySetInfo());
3241 if (xInfo->hasPropertyByName(sAPI_name))
3242 {
3243 OUString aFieldName;
3244 xCurrField->getPropertyValue(sAPI_name) >>= aFieldName;
3245 if (aFieldName == aName)
3246 {
3247 xPrevField.set( xCurrField, uno::UNO_QUERY );
3248 break;
3249 }
3250 }
3251 }
3252 }
3253 if ( xPrevField.is() )
3254 {
3255 // So we are ending a previous annotation,
3256 // let's create a text range covering the old and the current position.
3257 uno::Reference<text::XText> xText = GetImportHelper().GetText();
3258 uno::Reference<text::XTextCursor> xCursor =
3259 xText->createTextCursorByRange(GetImportHelper().GetCursorAsRange());
3260 try
3261 {
3262 xCursor->gotoRange(xPrevField->getAnchor(), true);
3263 }
3264 catch (const uno::RuntimeException&)
3265 {
3266 // Losing the start of the anchor is better than not opening the document at
3267 // all.
3269 "xmloff.text",
3270 "XMLAnnotationImportContext::endFastElement: gotoRange() failed: ");
3271 }
3272
3273 xText->insertTextContent(xCursor, xPrevField, !xCursor->isCollapsed());
3274 }
3275 }
3276 else
3277 {
3279 {
3280 // set field properties
3282
3283 // attach field to document
3284 Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
3285
3286 // workaround for #80606#
3287 try
3288 {
3289 GetImportHelper().InsertTextContent( xTextContent );
3290 }
3291 catch (const lang::IllegalArgumentException&)
3292 {
3293 // ignore
3294 }
3295 }
3296 }
3297 }
3298 else
3300}
3301
3303 const Reference<XPropertySet> & xPropertySet )
3304{
3305 // import (possibly empty) author
3306 OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
3307 xPropertySet->setPropertyValue(sAPI_author, Any(sAuthor));
3308
3309 // import (possibly empty) initials
3310 OUString sInitials( aInitialsBuffer.makeStringAndClear() );
3311 xPropertySet->setPropertyValue("Initials", Any(sInitials));
3312
3313 //import resolved flag
3314 bool bTmp(false);
3316 xPropertySet->setPropertyValue("Resolved", Any(bTmp));
3317
3318 util::DateTime aDateTime;
3320 {
3321 /*
3322 Date aDate;
3323 aDate.Year = aDateTime.Year;
3324 aDate.Month = aDateTime.Month;
3325 aDate.Day = aDateTime.Day;
3326 xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
3327 */
3328 // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
3329 xPropertySet->setPropertyValue(sAPI_date_time_value, Any(aDateTime));
3330 }
3331 aDateBuffer.setLength(0);
3332
3333 if ( aTextBuffer.getLength() )
3334 {
3335 // delete last paragraph mark (if necessary)
3336 if (char(0x0a) == aTextBuffer[aTextBuffer.getLength()-1])
3337 aTextBuffer.setLength(aTextBuffer.getLength()-1);
3338 xPropertySet->setPropertyValue(sAPI_content, Any(aTextBuffer.makeStringAndClear()));
3339 }
3340
3341 if (!aName.isEmpty())
3342 xPropertySet->setPropertyValue(sAPI_name, Any(aName));
3343}
3344
3345
3346// script field
3347
3348
3350 SvXMLImport& rImport,
3351 XMLTextImportHelper& rHlp)
3352: XMLTextFieldImportContext(rImport, rHlp, "Script")
3353, bContentOK(false)
3354{
3355}
3356
3358 sal_Int32 nAttrToken,
3359 std::string_view sAttrValue )
3360{
3361 switch (nAttrToken)
3362 {
3363 case XML_ELEMENT(XLINK, XML_HREF):
3364 sContent = GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue) );
3365 bContentOK = true;
3366 break;
3367
3369 sScriptType = OUString::fromUtf8(sAttrValue);
3370 break;
3371
3372 default:
3373 // ignore
3374 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3375 break;
3376 }
3377
3378 // always valid (even without ScriptType; cf- #96531#)
3379 bValid = true;
3380}
3381
3383 const Reference<XPropertySet> & xPropertySet)
3384{
3385 // if href attribute was present, we use it. Else we use element content
3386 if (! bContentOK)
3387 {
3388 sContent = GetContent();
3389 }
3390 xPropertySet->setPropertyValue(sAPI_content, Any(sContent));
3391
3392 // URL or script text? We use URL if we have an href-attribute
3393 xPropertySet->setPropertyValue("URLContent", Any(bContentOK));
3394
3395 xPropertySet->setPropertyValue("ScriptType", Any(sScriptType));
3396}
3397
3398
3399// measure field
3400
3401
3403 SvXMLImport& rImport,
3404 XMLTextImportHelper& rHlp) :
3405 XMLTextFieldImportContext(rImport, rHlp, "Measure"),
3406 mnKind( 0 )
3407{
3408}
3409
3411 sal_Int32 nAttrToken,
3412 std::string_view sAttrValue )
3413{
3414 switch (nAttrToken)
3415 {
3416 case XML_ELEMENT(TEXT, XML_KIND):
3417 if( IsXMLToken( sAttrValue, XML_VALUE ) )
3418 {
3419 mnKind = 0; bValid = true;
3420 }
3421 else if( IsXMLToken( sAttrValue, XML_UNIT ) )
3422 {
3423 mnKind = 1; bValid = true;
3424 }
3425 else if( IsXMLToken( sAttrValue, XML_GAP ) )
3426 {
3427 mnKind = 2; bValid = true;
3428 }
3429 break;
3430 default:
3431 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3432 }
3433}
3434
3436 const Reference<XPropertySet> & xPropertySet)
3437{
3438 xPropertySet->setPropertyValue("Kind", Any(mnKind));
3439}
3440
3441
3442// dropdown field
3443
3444
3446 SvXMLImport& rImport,
3447 XMLTextImportHelper& rHlp) :
3448 XMLTextFieldImportContext( rImport, rHlp, "DropDown" ),
3449 nSelected( -1 ),
3450 bNameOK( false ),
3451 bHelpOK(false),
3452 bHintOK(false)
3453{
3454 bValid = true;
3455}
3456
3458 const Reference<XFastAttributeList>& xAttrList,
3459 OUString& rLabel,
3460 bool& rIsSelected )
3461{
3462 bool bValid = false;
3463 for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
3464 {
3465 switch (aIter.getToken())
3466 {
3467 case XML_ELEMENT(TEXT, XML_VALUE):
3468 {
3469 rLabel = aIter.toString();
3470 bValid = true;
3471 break;
3472 }
3474 {
3475 bool bTmp(false);
3476 if (::sax::Converter::convertBool( bTmp, aIter.toView() ))
3477 rIsSelected = bTmp;
3478 break;
3479 }
3480 default:
3481 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
3482 }
3483 }
3484 return bValid;
3485}
3486
3487css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDropDownFieldImportContext::createFastChildContext(
3488 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
3489{
3490 if( nElement == XML_ELEMENT(TEXT, XML_LABEL) )
3491 {
3492 OUString sLabel;
3493 bool bIsSelected = false;
3494 if( lcl_ProcessLabel( xAttrList, sLabel, bIsSelected ) )
3495 {
3496 if( bIsSelected )
3497 nSelected = static_cast<sal_Int32>( aLabels.size() );
3498 aLabels.push_back( sLabel );
3499 }
3500 }
3501 return new SvXMLImportContext( GetImport() );
3502}
3503
3505 sal_Int32 nAttrToken,
3506 std::string_view sAttrValue )
3507{
3508 if( nAttrToken == XML_ELEMENT(TEXT, XML_NAME))
3509 {
3510 sName = OUString::fromUtf8(sAttrValue);
3511 bNameOK = true;
3512 }
3513 else if (nAttrToken == XML_ELEMENT(TEXT, XML_HELP))
3514 {
3515 sHelp = OUString::fromUtf8(sAttrValue);
3516 bHelpOK = true;
3517 }
3518 else if (nAttrToken == XML_ELEMENT(TEXT, XML_HINT))
3519 {
3520 sHint = OUString::fromUtf8(sAttrValue);
3521 bHintOK = true;
3522 }
3523 else
3524 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3525}
3526
3528 const Reference<XPropertySet>& xPropertySet)
3529{
3530 // create sequence
3531 sal_Int32 nLength = static_cast<sal_Int32>( aLabels.size() );
3532 Sequence<OUString> aSequence( nLength );
3533 OUString* pSequence = aSequence.getArray();
3534 for( sal_Int32 n = 0; n < nLength; n++ )
3535 pSequence[n] = aLabels[n];
3536
3537 // now set values:
3538
3539 xPropertySet->setPropertyValue( "Items", Any(aSequence) );
3540
3541 if( nSelected >= 0 && nSelected < nLength )
3542 {
3543 xPropertySet->setPropertyValue( "SelectedItem", Any(pSequence[nSelected]) );
3544 }
3545
3546 // set name
3547 if( bNameOK )
3548 {
3549 xPropertySet->setPropertyValue( "Name", Any(sName) );
3550 }
3551 // set help
3552 if( bHelpOK )
3553 {
3554 xPropertySet->setPropertyValue( "Help", Any(sHelp) );
3555 }
3556 // set hint
3557 if( bHintOK )
3558 {
3559 xPropertySet->setPropertyValue( "Tooltip", Any(sHint) );
3560 }
3561
3562}
3563
3567 SvXMLImport& rImport,
3568 XMLTextImportHelper& rHlp)
3569: XMLTextFieldImportContext(rImport, rHlp, "Header" )
3570{
3572 bValid = true;
3573}
3574
3576void XMLHeaderFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, std::string_view sAttrValue )
3577{
3578 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3579}
3580
3582void XMLHeaderFieldImportContext::PrepareField(const Reference<XPropertySet> &)
3583{
3584}
3585
3589 SvXMLImport& rImport,
3590 XMLTextImportHelper& rHlp)
3591: XMLTextFieldImportContext(rImport, rHlp, "Footer" )
3592{
3594 bValid = true;
3595}
3596
3598void XMLFooterFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, std::string_view sAttrValue)
3599{
3600 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3601}
3602
3604void XMLFooterFieldImportContext::PrepareField(const Reference<XPropertySet> &)
3605{
3606}
3607
3608
3612 SvXMLImport& rImport,
3613 XMLTextImportHelper& rHlp)
3614: XMLTextFieldImportContext(rImport, rHlp, "DateTime" )
3615{
3617 bValid = true;
3618}
3619
3622 std::string_view sAttrValue )
3623{
3624 XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3625}
3626
3629 const css::uno::Reference<
3630 css::beans::XPropertySet> &)
3631{
3632}
3633
3634/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FULL
const char * pName
constexpr OUStringLiteral sServiceName
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
SvXMLImportContext(SvXMLImport &rImport)
A contexts constructor does anything that is required if an element starts.
Definition: xmlictxt.cxx:30
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
Import an annotation field (<text:annotation>)
Definition: txtfldi.hxx:960
OUStringBuffer aInitialsBuffer
Definition: txtfldi.hxx:962
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attributes
Definition: txtfldi.cxx:3147
OUStringBuffer aTextBuffer
Definition: txtfldi.hxx:964
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
set properties
Definition: txtfldi.cxx:3302
XMLAnnotationImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:3132
css::uno::Reference< css::text::XTextCursor > mxCursor
Definition: txtfldi.hxx:969
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
create XTextField and insert into document; calls PrepareTextField
Definition: txtfldi.cxx:3206
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: txtfldi.cxx:3159
css::uno::Reference< css::text::XTextCursor > mxOldCursor
Definition: txtfldi.hxx:970
OUStringBuffer aAuthorBuffer
Definition: txtfldi.hxx:961
css::uno::Reference< css::beans::XPropertySet > mxField
Definition: txtfldi.hxx:968
OUStringBuffer aDateBuffer
Definition: txtfldi.hxx:965
inherit sender field because of fixed attribute in ProcessAttributes
Definition: txtfldi.hxx:150
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Text import helper.
Definition: txtfldi.cxx:618
const OUString sPropertyFixed
Definition: txtfldi.hxx:152
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:629
XMLAuthorFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:607
const OUString sPropertyContent
Definition: txtfldi.hxx:153
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:641
import bibliography info fields (<text:bibliography-mark>)
Definition: txtfldi.hxx:933
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
empty method; all attributes are handled in StartElement
Definition: txtfldi.cxx:2986
static const char * MapBibliographyFieldName(sal_Int32 nElement)
Definition: txtfldi.cxx:3011
::std::vector< css::beans::PropertyValue > aValues
Definition: txtfldi.hxx:934
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
process attributes (fill aValues)
Definition: txtfldi.cxx:2937
XMLBibliographyFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2897
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
convert aValues into sequence and set property
Definition: txtfldi.cxx:2995
import chapter fields (<text:chapter>)
Definition: txtfldi.hxx:669
XMLChapterImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2102
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2148
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2111
import conditional text fields (<text:conditional-text>)
Definition: txtfldi.hxx:563
XMLConditionalTextImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1819
const OUString sPropertyCondition
Definition: txtfldi.hxx:564
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1831
const OUString sPropertyCurrentPresentation
Definition: txtfldi.hxx:565
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1875
import count fields (<text:[XXX]-count>)
Definition: txtfldi.hxx:690
const OUString sPropertyNumberingType
Definition: txtfldi.hxx:691
static OUString MapTokenToServiceName(sal_Int32 nElement)
Definition: txtfldi.cxx:2211
XMLCountFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:2159
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2188
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2170
import database display fields (<text:database-display>)
Definition: txtvfldi.hxx:426
superclass for database fields: handle database and table names
Definition: txtfldi.hxx:308
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
handle database-location children
Definition: txtfldi.cxx:1164
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1116
XMLDatabaseFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName, bool bUseDisplay)
protected constructor: only for subclasses
Definition: txtfldi.cxx:1100
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1195
import database name fields (<text:database-name>)
Definition: txtfldi.hxx:350
XMLDatabaseNameImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1226
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1232
import database next fields (<text:database-next>)
Definition: txtfldi.hxx:363
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1263
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1288
XMLDatabaseNextImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName)
Definition: txtfldi.cxx:1244
const OUString sPropertyCondition
Definition: txtfldi.hxx:364
import database display number fields (<text:database-row-number>)
Definition: txtfldi.hxx:413
XMLDatabaseNumberImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1346
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1359
const OUString sPropertyNumberingType
Definition: txtfldi.hxx:414
const OUString sPropertySetNumber
Definition: txtfldi.hxx:415
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1391
import database select fields (<text:database-select>)
Definition: txtfldi.hxx:391
const OUString sPropertySetNumber
Definition: txtfldi.hxx:392
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1312
XMLDatabaseSelectImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1303
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1334
import date fields (<text:date>); inherit from TimeField to reuse implementation
Definition: txtfldi.hxx:238
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:1056
XMLDateFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1049
import docinfo fields with date or time attributes and numberformats
Definition: txtfldi.hxx:470
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1659
XMLDateTimeDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1589
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1632
const OUString sPropertyIsDate
Definition: txtfldi.hxx:472
const OUString sPropertyIsFixedLanguage
Definition: txtfldi.hxx:473
const OUString sPropertyNumberFormat
Definition: txtfldi.hxx:471
import footer fields (<draw:date-and-time>)
Definition: txtfldi.hxx:1106
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3628
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:3621
XMLDateTimeFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
import footer fields (<draw:date-and-time>)
Definition: txtfldi.cxx:3611
import dde field declaration (<text:dde-connection-decl>)
Definition: txtfldi.hxx:837
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: txtfldi.cxx:2624
XMLDdeFieldDeclImportContext(SvXMLImport &rImport)
Definition: txtfldi.cxx:2619
XMLDdeFieldDeclsImportContext(SvXMLImport &rImport)
Definition: txtfldi.cxx:2597
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: txtfldi.cxx:2602
import dde fields (<text:dde-connection>)
Definition: txtfldi.hxx:850
XMLDdeFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2730
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
create textfield, attach master, and insert into document
Definition: txtfldi.cxx:2751
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
empty method
Definition: txtfldi.cxx:2795
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2737
dropdown field (filter legacy)
Definition: txtfldi.hxx:1040
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:3504
std::vector< OUString > aLabels
Definition: txtfldi.hxx:1041
XMLDropDownFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:3445
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3527
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: txtfldi.cxx:3487
Import <script:events> element.
void GetEventSequence(const OUString &rName, css::uno::Sequence< css::beans::PropertyValue > &rSequence)
if the import operates in delayed mode, you can use this method to obtain the value sequence for a sp...
import expression fields (<text:expression>)
Definition: txtvfldi.hxx:190
import file name fields (<text:file-name>)
Definition: txtfldi.hxx:622
const OUString sPropertyFileFormat
Definition: txtfldi.hxx:624
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1976
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2008
const OUString sPropertyCurrentPresentation
Definition: txtfldi.hxx:625
const OUString sPropertyFixed
Definition: txtfldi.hxx:623
XMLFileNameImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1963
import footer fields (<draw:footer>)
Definition: txtfldi.hxx:1088
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3604
XMLFooterFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
import footer fields (<draw:footer>)
Definition: txtfldi.cxx:3588
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:3598
import header fields (<draw:header>)
Definition: txtfldi.hxx:1070
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:3576
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3582
XMLHeaderFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
import header fields (<draw:header>)
Definition: txtfldi.cxx:3566
import hidden paragraph fields (<text:hidden-paragraph>)
Definition: txtfldi.hxx:539
XMLHiddenParagraphImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1767
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1776
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1805
const OUString sPropertyIsHidden
Definition: txtfldi.hxx:541
const OUString sPropertyCondition
Definition: txtfldi.hxx:540
import conditional text fields (<text:hidden-text>)
Definition: txtfldi.hxx:593
XMLHiddenTextImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1889
const OUString sPropertyCondition
Definition: txtfldi.hxx:594
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1942
const OUString sPropertyIsHidden
Definition: txtfldi.hxx:596
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1901
const OUString sPropertyContent
Definition: txtfldi.hxx:595
import macro fields (<text:execute-macro>)
Definition: txtfldi.hxx:762
XMLMacroFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2350
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2373
rtl::Reference< XMLEventsImportContext > xEventContext
Definition: txtfldi.hxx:764
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2392
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
for <office:events> children
Definition: txtfldi.cxx:2357
import measure fields (<text:measure>)
Definition: txtfldi.hxx:1020
XMLMeasureFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:3402
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:3410
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3435
import page continuation fields (<text:page-continuation-string>)
Definition: txtfldi.hxx:252
const OUString sPropertyNumberingType
Definition: txtfldi.hxx:254
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:692
XMLPageContinuationImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
continuation string encountered?
Definition: txtfldi.cxx:681
css::text::PageNumberType eSelectPage
continuation string
Definition: txtfldi.hxx:257
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:718
bool sStringOK
previous, current
Definition: txtfldi.hxx:259
import page|slide name fields (<text:page-name>)
Definition: txtfldi.hxx:893
XMLPageNameFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
import page|slide name fields (<text:page-name>)
Definition: txtfldi.cxx:2829
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:2838
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2845
import page number fields (<text:page-number>)
Definition: txtfldi.hxx:278
const OUString sPropertyOffset
Definition: txtfldi.hxx:281
const OUString sPropertyNumberingType
Definition: txtfldi.hxx:280
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:750
XMLPageNumberImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:736
css::text::PageNumberType eSelectPage
Definition: txtfldi.hxx:286
const OUString sPropertySubType
Definition: txtfldi.hxx:279
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:781
bool sNumberFormatOK
previous, current
Definition: txtfldi.hxx:288
import page variable fields (<text:get-page-variable>)
Definition: txtfldi.hxx:718
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2277
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2259
XMLPageVarGetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2251
import page variable fields (<text:get-page-variable>)
Definition: txtfldi.hxx:741
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2309
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2339
XMLPageVarSetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2300
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:845
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:887
XMLPlaceholderFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:836
import reference fields (<text:reference-get>)
Definition: txtfldi.hxx:792
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2521
XMLReferenceFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nToken)
Definition: txtfldi.cxx:2464
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2567
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
start element
Definition: txtfldi.cxx:2492
import revision field (<text:editing-cycles>)
Definition: txtfldi.hxx:499
XMLRevisionDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1553
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1560
Import a script field (<text:script>)
Definition: txtfldi.hxx:997
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
set properties
Definition: txtfldi.cxx:3382
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attributes
Definition: txtfldi.cxx:3357
XMLScriptImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:3349
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:577
const OUString sPropertyFixed
API subtype for ExtUser field.
Definition: txtfldi.hxx:120
const OUString sPropertyContent
Definition: txtfldi.hxx:121
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:558
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Text import helper.
Definition: txtfldi.cxx:496
XMLSenderFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:486
sequence fields (<text:sequence>)
Definition: txtvfldi.hxx:327
import sheet name fields (Calc) dde fields (<text:sheet-name>)
Definition: txtfldi.hxx:874
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
no attributes -> empty method
Definition: txtfldi.cxx:2813
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
no attributes -> empty method
Definition: txtfldi.cxx:2821
XMLSheetNameImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2805
import docinfo fields with only fixed attribute
Definition: txtfldi.hxx:437
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1444
XMLSimpleDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElementToken, bool bContent, bool bAuthor)
Definition: txtfldi.cxx:1412
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1428
const OUString sPropertyCurrentPresentation
Definition: txtfldi.hxx:441
static OUString MapTokenToServiceName(sal_Int32 nElementToken)
Definition: txtfldi.cxx:1485
const OUString sPropertyContent
Definition: txtfldi.hxx:439
const OUString sPropertyAuthor
Definition: txtfldi.hxx:440
const OUString sPropertyFixed
Definition: txtfldi.hxx:438
Import all text into a string buffer.
import table formula fields (deprecated; for Writer 2.0 compatibility)
Definition: txtvfldi.hxx:401
import document template name fields (<text:template-name>)
Definition: txtfldi.hxx:647
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2079
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2056
const OUString sPropertyFileFormat
Definition: txtfldi.hxx:648
XMLTemplateNameImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2047
abstract class for text field import
Definition: txtfldi.hxx:50
void SetServiceName(const OUString &sStr)
Definition: txtfldi.hxx:93
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
parses attributes and calls ProcessAttribute
Definition: txtfldi.cxx:136
virtual void SAL_CALL characters(const OUString &sContent) override
name of SO API service
Definition: txtfldi.cxx:187
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
create XTextField and insert into document; calls PrepareTextField
Definition: txtfldi.cxx:155
XMLTextFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, OUString aService)
whether this field is valid ?
Definition: txtfldi.cxx:125
OUString sContent
collect character data
Definition: txtfldi.hxx:53
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet)=0
prepare XTextField for insertion into document
XMLTextImportHelper & GetImportHelper()
get helper
Definition: txtfldi.hxx:90
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue)=0
process attribute values
OUString sServicePrefix
the import helper
Definition: txtfldi.hxx:58
XMLTextImportHelper & rTextImportHelper
service name for text field
Definition: txtfldi.hxx:55
OUStringBuffer sContentBuffer
Definition: txtfldi.hxx:52
static XMLTextFieldImportContext * CreateTextFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
create the appropriate field context from (for use in paragraph import)
Definition: txtfldi.cxx:220
const OUString & GetServiceName() const
Definition: txtfldi.hxx:92
OUString const & GetContent()
Definition: txtfldi.cxx:145
bool CreateField(css::uno::Reference< css::beans::XPropertySet > &xField, const OUString &sServiceName)
create field from ServiceName
Definition: txtfldi.cxx:192
static void ForceUpdate(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
force an update of the field's value call update on optional XUpdatable interface; (disable Fixed pro...
Definition: txtfldi.cxx:465
void InsertTextContent(css::uno::Reference< css::text::XTextContent > const &xContent)
Definition: txtimp.cxx:757
css::uno::Reference< css::text::XText > & GetText()
Definition: txtimp.cxx:211
void ProcessFootnoteReference(const OUString &sXMLId, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
set the proper footnote reference ID, or put into backpatch list if ID is unknown
sal_Int32 GetDataStyleKey(const OUString &sStyleName, bool *pIsSystemLanguage=nullptr)
return key appropriate for use with NumberFormat property return -1 if style is not found (may return...
Definition: txtimp.cxx:1944
void ProcessSequenceReference(const OUString &sXMLId, const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
set sequence ID or insert into backpatch list
void InsertString(const OUString &rChars)
Definition: txtimp.cxx:701
const OUString sPropertyDateTime
Definition: txtfldi.hxx:206
const OUString sPropertyFixed
Definition: txtfldi.hxx:204
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:987
css::util::DateTime aDateTimeValue
Definition: txtfldi.hxx:210
const OUString sPropertyNumberFormat
Definition: txtfldi.hxx:203
const OUString sPropertyIsFixedLanguage
Definition: txtfldi.hxx:208
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:937
const OUString sPropertyIsDate
Definition: txtfldi.hxx:207
XMLTimeFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:917
const OUString sPropertyDateTimeValue
Definition: txtfldi.hxx:205
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
no attributes -> empty method
Definition: txtfldi.cxx:2883
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
no attributes -> empty method
Definition: txtfldi.cxx:2862
XMLUrlFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2854
import user docinfo field (<text:user-defined>)
Definition: txtfldi.hxx:514
XMLUserDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1689
const OUString sPropertyIsFixedLanguage
Definition: txtfldi.hxx:518
const OUString sPropertyNumberFormat
Definition: txtfldi.hxx:517
const OUString sPropertyName
Definition: txtfldi.hxx:516
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1738
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1703
user fields (<text:user-field-get>)
Definition: txtvfldi.hxx:299
user input fields (<text:user-field-input>)
Definition: txtvfldi.hxx:311
import variable get fields (<text:variable-get>)
Definition: txtvfldi.hxx:171
variable input fields (<text:variable-input>)
Definition: txtvfldi.hxx:281
import variable set fields (<text:variable-set>)
Definition: txtvfldi.hxx:265
static bool parseTimeOrDateTime(css::util::DateTime &rDateTime, std::u16string_view rString)
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
static bool parseDateTime(css::util::DateTime &rDateTime, std::u16string_view rString)
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
static bool convertBool(bool &rBool, std::u16string_view rString)
sal_Int32 m_nCommandType
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
Reference< XSingleServiceFactory > xFactory
sal_Int16 nValue
OUString sName
sal_Int64 n
sal_uInt16 nPos
sal_Int16 nNumType
sal_Int16 nAdjust
#define SAL_WARN(area, stream)
@ Exception
FORM
int i
PlaceholderType
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
@ XML_NAME_AND_EXTENSION
Definition: xmltoken.hxx:1371
@ XML_REFERENCE_LANGUAGE
Definition: xmltoken.hxx:3458
@ XML_SENDER_PHONE_PRIVATE
Definition: xmltoken.hxx:1710
@ XML_STRING_VALUE_IF_TRUE
Definition: xmltoken.hxx:1875
@ XML_AUTOMATIC_UPDATE
Definition: xmltoken.hxx:304
@ XML_BIBLIOGRAPHY_MARK
Definition: xmltoken.hxx:331
@ XML_DDE_CONNECTION_DECL
Definition: xmltoken.hxx:637
@ XML_CONDITIONAL_TEXT
Definition: xmltoken.hxx:487
@ XML_DATABASE_ROW_SELECT
Definition: xmltoken.hxx:2747
@ XML_SENDER_POSTAL_CODE
Definition: xmltoken.hxx:1713
@ XML_DATABASE_ROW_NUMBER
Definition: xmltoken.hxx:617
@ XML_CATEGORY_AND_VALUE
Definition: xmltoken.hxx:406
@ XML_NUMBER_NO_SUPERIOR
Definition: xmltoken.hxx:3286
@ XML_PLAIN_NUMBER_AND_NAME
Definition: xmltoken.hxx:1527
@ XML_EDITING_DURATION
Definition: xmltoken.hxx:731
@ XML_CONNECTION_RESOURCE
Definition: xmltoken.hxx:2380
@ XML_BIBLIOGRAPHY_TYPE
Definition: xmltoken.hxx:333
@ XML_PAGE_CONTINUATION_STRING
Definition: xmltoken.hxx:1476
@ XML_NUMBER_ALL_SUPERIOR
Definition: xmltoken.hxx:3287
@ XML_BIBILIOGRAPHIC_TYPE
Definition: xmltoken.hxx:326
@ XML_DATABASE_DISPLAY
Definition: xmltoken.hxx:612
@ XML_SENDER_STATE_OR_PROVINCE
Definition: xmltoken.hxx:1714
@ XML_STRING_VALUE_IF_FALSE
Definition: xmltoken.hxx:1874
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3597
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
DefTokenId nToken
QPRO_FUNC_TYPE nType
TEXT
constexpr OUStringLiteral gsPropertyPlaceholderType(u"PlaceHolderType")
SvXMLEnumMapEntry< sal_uInt16 > const aBibliographyDataTypeMap[]
Definition: txtfldi.cxx:2906
constexpr OUStringLiteral sAPI_docinfo_change_date_time
Definition: txtfldi.cxx:96
constexpr OUStringLiteral gsPropertyDataBaseURL(u"DataBaseURL")
constexpr OUStringLiteral gsPropertyLevel(u"Level")
constexpr char16_t sAPI_fieldmaster_prefix[]
Definition: txtfldi.cxx:91
constexpr OUStringLiteral sAPI_condition
Definition: txtfldi.cxx:114
constexpr OUStringLiteral gsPropertyTableName(u"DataTableName")
constexpr OUStringLiteral sAPI_true
Definition: txtfldi.cxx:122
constexpr OUStringLiteral sAPI_docinfo_custom
Definition: txtfldi.cxx:98
constexpr OUStringLiteral sAPI_date_time
Definition: txtfldi.cxx:94
constexpr OUStringLiteral sAPI_page_number
Definition: txtfldi.cxx:95
constexpr OUStringLiteral gsPropertyAdjust(u"Adjust")
constexpr OUStringLiteral sAPI_offset
Definition: txtfldi.cxx:113
constexpr OUStringLiteral sAPI_current_presentation
Definition: txtfldi.cxx:118
constexpr OUStringLiteral gsPropertyDataBaseName(u"DataBaseName")
constexpr OUStringLiteral sPropertyRevision(u"Revision")
constexpr OUStringLiteral gsPropertyIsVisible(u"IsVisible")
constexpr OUStringLiteral sAPI_sub_type
Definition: txtfldi.cxx:109
SvXMLEnumMapEntry< sal_uInt16 > const lcl_aReferenceTypeTokenMap[]
Definition: txtfldi.cxx:2476
constexpr OUStringLiteral sAPI_name
Definition: txtfldi.cxx:108
constexpr OUStringLiteral gsPropertyIsConditionTrue(u"IsConditionTrue")
constexpr OUStringLiteral sAPI_author
Definition: txtfldi.cxx:106
constexpr OUStringLiteral sAPI_docinfo_create_date_time
Definition: txtfldi.cxx:97
constexpr OUStringLiteral gsPropertyPlaceholder(u"PlaceHolder")
constexpr OUStringLiteral sAPI_file_format
Definition: txtfldi.cxx:116
constexpr OUStringLiteral sAPI_set_number
Definition: txtfldi.cxx:115
const SvXMLEnumMapEntry< sal_uInt16 > aFilenameDisplayMap[]
Definition: txtfldi.cxx:1954
SvXMLEnumMapEntry< PageNumberType > const lcl_aSelectPageAttrMap[]
Definition: txtfldi.cxx:671
constexpr OUStringLiteral sAPI_url
Definition: txtfldi.cxx:101
constexpr OUStringLiteral gsPropertyDataCommandType(u"DataCommandType")
static bool lcl_ProcessLabel(const Reference< XFastAttributeList > &xAttrList, OUString &rLabel, bool &rIsSelected)
Definition: txtfldi.cxx:3457
constexpr OUStringLiteral sAPI_number_format
Definition: txtfldi.cxx:111
constexpr OUStringLiteral sAPI_dde
Definition: txtfldi.cxx:100
constexpr OUStringLiteral sAPI_hint
Definition: txtfldi.cxx:107
constexpr OUStringLiteral sAPI_numbering_type
Definition: txtfldi.cxx:112
const SvXMLEnumMapEntry< sal_uInt16 > aChapterDisplayMap[]
Definition: txtfldi.cxx:2089
constexpr OUStringLiteral gsPropertyUserText(u"UserText")
constexpr OUStringLiteral gsPropertyFalseContent(u"FalseContent")
constexpr OUStringLiteral sAPI_date_time_value
Definition: txtfldi.cxx:110
constexpr OUStringLiteral sAPI_is_date
Definition: txtfldi.cxx:117
constexpr OUStringLiteral gsPropertyChapterFormat(u"ChapterFormat")
const SvXMLEnumMapEntry< sal_uInt16 > aTemplateDisplayMap[]
Definition: txtfldi.cxx:2035
constexpr OUStringLiteral gsPropertyFieldSubType(u"UserDataType")
constexpr OUStringLiteral gsPropertyTrueContent(u"TrueContent")
constexpr OUStringLiteral sAPI_is_fixed
Definition: txtfldi.cxx:104
constexpr OUStringLiteral sAPI_presentation_prefix
Definition: txtfldi.cxx:92
constexpr OUStringLiteral sAPI_docinfo_print_date_time
Definition: txtfldi.cxx:99
constexpr OUStringLiteral sAPI_textfield_prefix
Definition: txtfldi.cxx:90
constexpr OUStringLiteral sAPI_is_fixed_language
Definition: txtfldi.cxx:120
constexpr OUStringLiteral sAPI_is_hidden
Definition: txtfldi.cxx:119
constexpr OUStringLiteral sAPI_content
Definition: txtfldi.cxx:105
constexpr OUStringLiteral gsPropertyAuthorFullName(u"FullName")
sal_uInt16 sal_Unicode
signed char sal_Int8
constexpr OUStringLiteral sMacroName
TABLE
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:120
#define XMLOFF_WARN_UNKNOWN_ATTR(area, token, value)
Definition: xmlictxt.hxx:117
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:114
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:104
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:94
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_OOOW
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
sal_Int32 nLength
Definition: xmltoken.cxx:38