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