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 
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  sCondition(),
1250  bConditionOK(false)
1251 {
1252 }
1253 
1255  SvXMLImport& rImport, XMLTextImportHelper& rHlp)
1256 : XMLDatabaseFieldImportContext(rImport, rHlp, "DatabaseNextSet", false)
1257 , sPropertyCondition(sAPI_condition)
1258 , sTrue(sAPI_true)
1259 , bConditionOK(false)
1260 {
1261 }
1262 
1264  sal_Int32 nAttrToken, std::string_view sAttrValue )
1265 {
1266  if (XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
1267  {
1268  OUString sTmp;
1269  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1270  OUString::fromUtf8(sAttrValue), &sTmp );
1271  if( XML_NAMESPACE_OOOW == nPrefix )
1272  {
1273  sCondition = sTmp;
1274  bConditionOK = true;
1275  }
1276  else
1277  sCondition = OUString::fromUtf8(sAttrValue);
1278  }
1279  else
1280  {
1282  sAttrValue);
1283  }
1284 
1286 }
1287 
1289  const Reference<XPropertySet> & xPropertySet)
1290 {
1291  Any aAny;
1292 
1293  aAny <<= bConditionOK ? sCondition : sTrue;
1294  xPropertySet->setPropertyValue(sPropertyCondition, aAny);
1295 
1297 }
1298 
1299 
1300 // database select field
1301 
1302 
1304  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1305  XMLDatabaseNextImportContext(rImport, rHlp, "DatabaseNumberOfSet"),
1306  sPropertySetNumber(sAPI_set_number),
1307  nNumber(0),
1308  bNumberOK(false)
1309 {
1310 }
1311 
1313  sal_Int32 nAttrToken,
1314  std::string_view sAttrValue )
1315 {
1316  if (XML_ELEMENT(TEXT, XML_ROW_NUMBER) == nAttrToken)
1317  {
1318  sal_Int32 nTmp;
1319  if (::sax::Converter::convertNumber( nTmp, sAttrValue
1320  /* , nMin, nMax ??? */ ))
1321  {
1322  nNumber = nTmp;
1323  bNumberOK = true;
1324  }
1325  }
1326  else
1327  {
1328  XMLDatabaseNextImportContext::ProcessAttribute(nAttrToken, sAttrValue);
1329  }
1330 
1332 }
1333 
1335  const Reference<XPropertySet> & xPropertySet)
1336 {
1337  xPropertySet->setPropertyValue(sPropertySetNumber, Any(nNumber));
1338 
1340 }
1341 
1342 
1343 // database display row number field
1344 
1345 
1347  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1348  XMLDatabaseFieldImportContext(rImport, rHlp, "DatabaseSetNumber", true),
1349  sPropertyNumberingType(
1351  sPropertySetNumber(sAPI_set_number),
1352  sNumberFormat("1"),
1353  sNumberSync(GetXMLToken(XML_FALSE)),
1354  nValue(0),
1355  bValueOK(false)
1356 {
1357 }
1358 
1360  sal_Int32 nAttrToken,
1361  std::string_view sAttrValue )
1362 {
1363  switch (nAttrToken)
1364  {
1366  sNumberFormat = OUString::fromUtf8(sAttrValue);
1367  break;
1369  sNumberSync = OUString::fromUtf8(sAttrValue);
1370  break;
1373  {
1374  sal_Int32 nTmp;
1375  if (::sax::Converter::convertNumber( nTmp, sAttrValue ))
1376  {
1377  nValue = nTmp;
1378  bValueOK = true;
1379  }
1380  break;
1381  }
1382  default:
1384  sAttrValue);
1385  break;
1386  }
1387 
1389 }
1390 
1392  const Reference<XPropertySet> & xPropertySet)
1393 {
1394  sal_Int16 nNumType = style::NumberingType::ARABIC;
1396  sNumberFormat,
1397  sNumberSync );
1398  xPropertySet->setPropertyValue(sPropertyNumberingType, Any(nNumType));
1399 
1400  if (bValueOK)
1401  {
1402  xPropertySet->setPropertyValue(sPropertySetNumber, Any(nValue));
1403  }
1404 
1406 }
1407 
1408 
1409 // Simple doc info fields
1410 
1411 
1413  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1414  sal_Int32 nElementToken,
1415  bool bContent, bool bAuthor)
1416 : XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nElementToken) )
1417 , sPropertyFixed(sAPI_is_fixed)
1418 , sPropertyContent(sAPI_content)
1419 , sPropertyAuthor(sAPI_author)
1420 , sPropertyCurrentPresentation(sAPI_current_presentation)
1421 , bFixed(false)
1422 , bHasAuthor(bAuthor)
1423 , bHasContent(bContent)
1424 {
1425  bValid = true;
1426 }
1427 
1429  sal_Int32 nAttrToken,
1430  std::string_view sAttrValue )
1431 {
1432  if (XML_ELEMENT(TEXT, XML_FIXED) == nAttrToken)
1433  {
1434  bool bTmp(false);
1435  if (::sax::Converter::convertBool(bTmp, sAttrValue))
1436  {
1437  bFixed = bTmp;
1438  }
1439  }
1440  else
1441  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1442 }
1443 
1445  const Reference<XPropertySet> & rPropertySet)
1446 {
1447  // title field in Calc has no Fixed property
1448  Reference<XPropertySetInfo> xPropertySetInfo(rPropertySet->getPropertySetInfo());
1449  if (!xPropertySetInfo->hasPropertyByName(sPropertyFixed))
1450  return;
1451 
1452  Any aAny;
1453  rPropertySet->setPropertyValue(sPropertyFixed, Any(bFixed));
1454 
1455  // set Content and CurrentPresentation (if fixed)
1456  if (!bFixed)
1457  return;
1458 
1459  // in organizer-mode or styles-only-mode, only force update
1460  if (GetImport().GetTextImport()->IsOrganizerMode() ||
1461  GetImport().GetTextImport()->IsStylesOnlyMode() )
1462  {
1463  ForceUpdate(rPropertySet);
1464  }
1465  else
1466  {
1467  // set content (author, if that's the name) and current
1468  // presentation
1469  aAny <<= GetContent();
1470 
1471  if (bFixed && bHasAuthor)
1472  {
1473  rPropertySet->setPropertyValue(sPropertyAuthor, aAny);
1474  }
1475 
1476  if (bFixed && bHasContent)
1477  {
1478  rPropertySet->setPropertyValue(sPropertyContent, aAny);
1479  }
1480 
1481  rPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
1482  }
1483 }
1484 
1486  sal_Int32 nElementToken)
1487 {
1488  OUString pServiceName;
1489 
1490  switch(nElementToken)
1491  {
1493  pServiceName = "DocInfo.CreateAuthor";
1494  break;
1496  pServiceName = sAPI_docinfo_create_date_time;
1497  break;
1499  pServiceName = sAPI_docinfo_create_date_time;
1500  break;
1502  pServiceName = "DocInfo.Description";
1503  break;
1505  pServiceName = "DocInfo.EditTime";
1506  break;
1508  pServiceName = sAPI_docinfo_custom;
1509  break;
1511  pServiceName = "DocInfo.PrintAuthor";
1512  break;
1514  pServiceName = sAPI_docinfo_print_date_time;
1515  break;
1517  pServiceName = sAPI_docinfo_print_date_time;
1518  break;
1519  case XML_ELEMENT(TEXT, XML_KEYWORDS):
1520  pServiceName = "DocInfo.KeyWords";
1521  break;
1522  case XML_ELEMENT(TEXT, XML_SUBJECT):
1523  pServiceName = "DocInfo.Subject";
1524  break;
1526  pServiceName = "DocInfo.Revision";
1527  break;
1528  case XML_ELEMENT(TEXT, XML_CREATOR):
1529  pServiceName = "DocInfo.ChangeAuthor";
1530  break;
1532  pServiceName = sAPI_docinfo_change_date_time;
1533  break;
1535  pServiceName = sAPI_docinfo_change_date_time;
1536  break;
1537  case XML_ELEMENT(TEXT, XML_TITLE):
1538  pServiceName = "DocInfo.Title";
1539  break;
1540  default:
1541  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElementToken);
1542  assert(false);
1543  }
1544 
1545  return pServiceName;
1546 }
1547 
1548 
1549 // revision field
1550 
1551 constexpr OUStringLiteral sPropertyRevision(u"Revision");
1552 
1554  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_Int32 nElement) :
1555  XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1556 {
1557  bValid = true;
1558 }
1559 
1561  const Reference<XPropertySet> & rPropertySet)
1562 {
1564 
1565  // set revision number
1566  // if fixed, if not in organizer-mode, if not in styles-only-mode
1567  if (!bFixed)
1568  return;
1569 
1570  if ( GetImport().GetTextImport()->IsOrganizerMode() ||
1571  GetImport().GetTextImport()->IsStylesOnlyMode() )
1572  {
1573  ForceUpdate(rPropertySet);
1574  }
1575  else
1576  {
1577  sal_Int32 nTmp;
1579  {
1580  rPropertySet->setPropertyValue(sPropertyRevision, Any(nTmp));
1581  }
1582  }
1583 }
1584 
1585 
1586 // DocInfo fields with date/time attributes
1587 
1588 
1590  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_Int32 nElement)
1591  : XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1592  , sPropertyNumberFormat(sAPI_number_format)
1593  , sPropertyIsDate(sAPI_is_date)
1594  , sPropertyIsFixedLanguage(sAPI_is_fixed_language)
1595  , nFormat(0)
1596  , bFormatOK(false)
1597  , bIsDate(false)
1598  , bHasDateTime(false)
1599  , bIsDefaultLanguage(true)
1600 {
1601  // we allow processing of EDIT_DURATION here, because import of actual
1602  // is not supported anyway. If it was, we'd need an extra import class
1603  // because times and time durations are presented differently!
1604 
1605  bValid = true;
1606  switch (nElement)
1607  {
1611  bIsDate = true;
1612  bHasDateTime = true;
1613  break;
1617  bIsDate = false;
1618  bHasDateTime = true;
1619  break;
1621  bIsDate = false;
1622  bHasDateTime = false;
1623  break;
1624  default:
1625  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
1626  OSL_FAIL("XMLDateTimeDocInfoImportContext needs date/time doc. fields");
1627  bValid = false;
1628  break;
1629  }
1630 }
1631 
1633  sal_Int32 nAttrToken,
1634  std::string_view sAttrValue )
1635 {
1636  switch (nAttrToken)
1637  {
1639  {
1640  sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
1641  OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1642  if (-1 != nKey)
1643  {
1644  nFormat = nKey;
1645  bFormatOK = true;
1646  }
1647  break;
1648  }
1649  case XML_ELEMENT(TEXT, XML_FIXED):
1651  sAttrValue);
1652  break;
1653  default:
1654  // ignore -> we can't set date/time value anyway!
1655  break;
1656  }
1657 }
1658 
1660  const Reference<XPropertySet> & xPropertySet)
1661 {
1662  // process fixed and presentation
1664 
1665  if (bHasDateTime)
1666  {
1667  xPropertySet->setPropertyValue(sPropertyIsDate, Any(bIsDate));
1668  }
1669 
1670  if (bFormatOK)
1671  {
1672  xPropertySet->setPropertyValue(sPropertyNumberFormat, Any(nFormat));
1673 
1674  if( xPropertySet->getPropertySetInfo()->
1675  hasPropertyByName( sPropertyIsFixedLanguage ) )
1676  {
1677  bool bIsFixedLanguage = ! bIsDefaultLanguage;
1678  xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, Any(bIsFixedLanguage) );
1679  }
1680  }
1681 
1682  // can't set date/time/duration value! Sorry.
1683 }
1684 
1685 
1686 // user defined docinfo fields
1687 
1688 
1690  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
1691  sal_Int32 nElement) :
1692  XMLSimpleDocInfoImportContext(rImport, rHlp, nElement, false, false)
1693  , sPropertyName(sAPI_name)
1694  , sPropertyNumberFormat(sAPI_number_format)
1695  , sPropertyIsFixedLanguage(sAPI_is_fixed_language)
1696  , nFormat(0)
1697  , bFormatOK(false)
1698  , bIsDefaultLanguage( true )
1699 {
1700  bValid = false;
1701 }
1702 
1704  sal_Int32 nAttrToken,
1705  std::string_view sAttrValue )
1706 {
1707  switch (nAttrToken)
1708  {
1710  {
1711  sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
1712  OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1713  if (-1 != nKey)
1714  {
1715  nFormat = nKey;
1716  bFormatOK = true;
1717  }
1718  break;
1719  }
1720  case XML_ELEMENT(TEXT, XML_NAME):
1721  {
1722  if (!bValid)
1723  {
1725  aName = OUString::fromUtf8(sAttrValue);
1726  bValid = true;
1727  }
1728  break;
1729  }
1730 
1731  default:
1733  sAttrValue);
1734  break;
1735  }
1736 }
1737 
1739  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet)
1740 {
1741  if ( !aName.isEmpty() )
1742  {
1743  xPropertySet->setPropertyValue(sPropertyName, Any(aName));
1744  }
1745  Reference<XPropertySetInfo> xPropertySetInfo(
1746  xPropertySet->getPropertySetInfo());
1747  if (bFormatOK &&
1748  xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
1749  {
1750  xPropertySet->setPropertyValue(sPropertyNumberFormat, Any(nFormat));
1751 
1752  if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
1753  {
1754  bool bIsFixedLanguage = ! bIsDefaultLanguage;
1755  xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, Any(bIsFixedLanguage) );
1756  }
1757  }
1758 
1759  // call superclass to handle "fixed"
1761 }
1762 
1763 
1764 // import hidden paragraph fields
1765 
1766 
1768  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1769  XMLTextFieldImportContext(rImport, rHlp, "HiddenParagraph"),
1770  sPropertyCondition(sAPI_condition),
1771  sPropertyIsHidden(sAPI_is_hidden),
1772  sCondition(),
1773  bIsHidden(false)
1774 {
1775 }
1776 
1778  sal_Int32 nAttrToken,
1779  std::string_view sAttrValue )
1780 {
1781  if ( XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
1782  {
1783  OUString sTmp;
1784  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
1785  OUString::fromUtf8(sAttrValue), &sTmp );
1786  if( XML_NAMESPACE_OOOW == nPrefix )
1787  {
1788  sCondition = sTmp;
1789  bValid = true;
1790  }
1791  else
1792  sCondition = OUString::fromUtf8(sAttrValue);
1793  }
1794  else if ( XML_ELEMENT(TEXT, XML_IS_HIDDEN) == nAttrToken)
1795  {
1796  bool bTmp(false);
1797  if (::sax::Converter::convertBool(bTmp, sAttrValue))
1798  {
1799  bIsHidden = bTmp;
1800  }
1801  }
1802  else
1803  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1804 }
1805 
1807  const Reference<XPropertySet> & xPropertySet)
1808 {
1809  xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1810  xPropertySet->setPropertyValue(sPropertyIsHidden, Any(bIsHidden));
1811 }
1812 
1813 
1814 // import conditional text (<text:conditional-text>)
1815 
1816 constexpr OUStringLiteral gsPropertyTrueContent(u"TrueContent");
1817 constexpr OUStringLiteral gsPropertyFalseContent(u"FalseContent");
1818 constexpr OUStringLiteral gsPropertyIsConditionTrue(u"IsConditionTrue");
1819 
1821  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1822  XMLTextFieldImportContext(rImport, rHlp, "ConditionalText"),
1823  sPropertyCondition(sAPI_condition),
1824  sPropertyCurrentPresentation(sAPI_current_presentation),
1825  bConditionOK(false),
1826  bTrueOK(false),
1827  bFalseOK(false),
1828  bCurrentValue(false)
1829 {
1830 }
1831 
1833  sal_Int32 nAttrToken,
1834  std::string_view sAttrValue )
1835 {
1836  switch (nAttrToken)
1837  {
1839  {
1840  OUString sTmp;
1841  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
1842  GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1843  if( XML_NAMESPACE_OOOW == nPrefix )
1844  {
1845  sCondition = sTmp;
1846  bConditionOK = true;
1847  }
1848  else
1849  sCondition = OUString::fromUtf8(sAttrValue);
1850  }
1851  break;
1853  sFalseContent = OUString::fromUtf8(sAttrValue);
1854  bFalseOK = true;
1855  break;
1857  sTrueContent = OUString::fromUtf8(sAttrValue);
1858  bTrueOK = true;
1859  break;
1861  {
1862  bool bTmp(false);
1863  if (::sax::Converter::convertBool(bTmp, sAttrValue))
1864  {
1865  bCurrentValue = bTmp;
1866  }
1867  break;
1868  }
1869  default:
1870  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1871  }
1872 
1874 }
1875 
1877  const Reference<XPropertySet> & xPropertySet)
1878 {
1879  xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1880  xPropertySet->setPropertyValue(gsPropertyFalseContent, Any(sFalseContent));
1881  xPropertySet->setPropertyValue(gsPropertyTrueContent, Any(sTrueContent));
1882  xPropertySet->setPropertyValue(gsPropertyIsConditionTrue, Any(bCurrentValue));
1883  xPropertySet->setPropertyValue(sPropertyCurrentPresentation, Any(GetContent()));
1884 }
1885 
1886 
1887 // hidden text
1888 
1889 
1891  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1892  XMLTextFieldImportContext(rImport, rHlp, "HiddenText"),
1893  sPropertyCondition(sAPI_condition),
1894  sPropertyContent(sAPI_content),
1895  sPropertyIsHidden(sAPI_is_hidden),
1896  bConditionOK(false),
1897  bStringOK(false),
1898  bIsHidden(false)
1899 {
1900 }
1901 
1903  sal_Int32 nAttrToken,
1904  std::string_view sAttrValue )
1905 {
1906  switch (nAttrToken)
1907  {
1909  {
1910  OUString sTmp;
1911  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
1912  GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1913  if( XML_NAMESPACE_OOOW == nPrefix )
1914  {
1915  sCondition = sTmp;
1916  bConditionOK = true;
1917  }
1918  else
1919  sCondition = OUString::fromUtf8(sAttrValue);
1920  }
1921  break;
1924  sString = OUString::fromUtf8(sAttrValue);
1925  bStringOK = true;
1926  break;
1928  {
1929  bool bTmp(false);
1930  if (::sax::Converter::convertBool(bTmp, sAttrValue))
1931  {
1932  bIsHidden = bTmp;
1933  }
1934  break;
1935  }
1936  default:
1937  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1938  }
1939 
1941 }
1942 
1944  const Reference<XPropertySet> & xPropertySet)
1945 {
1946  xPropertySet->setPropertyValue(sPropertyCondition, Any(sCondition));
1947  xPropertySet->setPropertyValue(sPropertyContent, Any(sString));
1948  xPropertySet->setPropertyValue(sPropertyIsHidden, Any(bIsHidden));
1949 }
1950 
1951 
1952 // file name fields
1953 
1954 
1956 {
1957  { XML_PATH, FilenameDisplayFormat::PATH },
1958  { XML_NAME, FilenameDisplayFormat::NAME },
1959  { XML_NAME_AND_EXTENSION, FilenameDisplayFormat::NAME_AND_EXT },
1960  { XML_FULL, FilenameDisplayFormat::FULL },
1961  { XML_TOKEN_INVALID, 0 }
1962 };
1963 
1965  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
1966  XMLTextFieldImportContext(rImport, rHlp, "FileName"),
1967  sPropertyFixed(sAPI_is_fixed),
1968  sPropertyFileFormat(sAPI_file_format),
1969  sPropertyCurrentPresentation(
1971  nFormat(FilenameDisplayFormat::FULL),
1972  bFixed(false)
1973 {
1974  bValid = true;
1975 }
1976 
1978  sal_Int32 nAttrToken,
1979  std::string_view sAttrValue )
1980 {
1981  switch (nAttrToken)
1982  {
1983  case XML_ELEMENT(TEXT, XML_FIXED):
1984  {
1985  bool bTmp(false);
1986  if (::sax::Converter::convertBool(bTmp, sAttrValue))
1987  {
1988  bFixed = bTmp;
1989  }
1990  break;
1991  }
1992  case XML_ELEMENT(TEXT, XML_DISPLAY):
1993  {
1994  sal_uInt16 nTmp;
1995  if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
1996  aFilenameDisplayMap))
1997  {
1998  nFormat = nTmp;
1999  }
2000  break;
2001  }
2002  default:
2003  // unknown attribute: ignore
2004  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2005  break;
2006  }
2007 }
2008 
2010  const Reference<XPropertySet> & xPropertySet)
2011 {
2012  // properties are optional
2013  Reference<XPropertySetInfo> xPropertySetInfo(
2014  xPropertySet->getPropertySetInfo());
2015 
2016  if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
2017  {
2018  xPropertySet->setPropertyValue(sPropertyFixed, Any(bFixed));
2019  }
2020 
2021  if (xPropertySetInfo->hasPropertyByName(sPropertyFileFormat))
2022  {
2023  xPropertySet->setPropertyValue(sPropertyFileFormat, Any(nFormat));
2024  }
2025 
2026  if (xPropertySetInfo->hasPropertyByName(sPropertyCurrentPresentation))
2027  {
2028  xPropertySet->setPropertyValue(sPropertyCurrentPresentation, Any(GetContent()));
2029  }
2030 }
2031 
2032 
2033 // template name field
2034 
2035 
2037 {
2038  { XML_FULL, TemplateDisplayFormat::FULL },
2039  { XML_PATH, TemplateDisplayFormat::PATH },
2040  { XML_NAME, TemplateDisplayFormat::NAME },
2041  { XML_NAME_AND_EXTENSION, TemplateDisplayFormat::NAME_AND_EXT },
2042  { XML_AREA, TemplateDisplayFormat::AREA },
2043  { XML_TITLE, TemplateDisplayFormat::TITLE },
2044  { XML_TOKEN_INVALID, 0 }
2045 };
2046 
2047 
2049  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2050  XMLTextFieldImportContext(rImport, rHlp, "TemplateName"),
2051  sPropertyFileFormat(sAPI_file_format),
2052  nFormat(TemplateDisplayFormat::FULL)
2053 {
2054  bValid = true;
2055 }
2056 
2058  sal_Int32 nAttrToken,
2059  std::string_view sAttrValue )
2060 {
2061  switch (nAttrToken)
2062  {
2063  case XML_ELEMENT(TEXT, XML_DISPLAY):
2064  {
2065  sal_uInt16 nTmp;
2066  if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
2067  aTemplateDisplayMap))
2068  {
2069  nFormat = nTmp;
2070  }
2071  break;
2072  }
2073  default:
2074  // unknown attribute: ignore
2075  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2076  break;
2077  }
2078 }
2079 
2081  const Reference<XPropertySet> & xPropertySet)
2082 {
2083  xPropertySet->setPropertyValue(sPropertyFileFormat, Any(nFormat));
2084 }
2085 
2086 
2087 // import chapter fields
2088 
2089 
2091 {
2092  { XML_NAME, ChapterFormat::NAME },
2093  { XML_NUMBER, ChapterFormat::NUMBER },
2094  { XML_NUMBER_AND_NAME, ChapterFormat::NAME_NUMBER },
2095  { XML_PLAIN_NUMBER_AND_NAME, ChapterFormat::NO_PREFIX_SUFFIX },
2096  { XML_PLAIN_NUMBER, ChapterFormat::DIGIT },
2097  { XML_TOKEN_INVALID, 0 }
2098 };
2099 
2100 constexpr OUStringLiteral gsPropertyChapterFormat(u"ChapterFormat");
2101 constexpr OUStringLiteral gsPropertyLevel(u"Level");
2102 
2104  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2105  XMLTextFieldImportContext(rImport, rHlp, "Chapter"),
2106  nFormat(ChapterFormat::NAME_NUMBER),
2107  nLevel(0)
2108 {
2109  bValid = true;
2110 }
2111 
2113  sal_Int32 nAttrToken,
2114  std::string_view sAttrValue )
2115 {
2116  switch (nAttrToken)
2117  {
2118  case XML_ELEMENT(TEXT, XML_DISPLAY):
2119  {
2120  sal_uInt16 nTmp;
2121  if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
2122  aChapterDisplayMap))
2123  {
2124  nFormat = static_cast<sal_Int16>(nTmp);
2125  }
2126  break;
2127  }
2129  {
2130  sal_Int32 nTmp;
2132  nTmp, sAttrValue, 1,
2133  GetImport().GetTextImport()->GetChapterNumbering()->getCount()
2134  ))
2135  {
2136  // API numbers 0..9, we number 1..10
2137  nLevel = static_cast<sal_Int8>(nTmp);
2138  nLevel--;
2139  }
2140  break;
2141  }
2142  default:
2143  // unknown attribute: ignore
2144  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2145  break;
2146  }
2147 }
2148 
2150  const Reference<XPropertySet> & xPropertySet)
2151 {
2152  xPropertySet->setPropertyValue(gsPropertyChapterFormat, Any(nFormat));
2153  xPropertySet->setPropertyValue(gsPropertyLevel, Any(nLevel));
2154 }
2155 
2156 
2157 // counting fields
2158 
2159 
2161  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
2162  sal_Int32 nElement) :
2163  XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nElement)),
2164  sPropertyNumberingType(
2166  sNumberFormat(),
2167  sLetterSync(),
2168  bNumberFormatOK(false)
2169 {
2170  bValid = true;
2171 }
2172 
2174  sal_Int32 nAttrToken,
2175  std::string_view sAttrValue )
2176 {
2177  switch (nAttrToken)
2178  {
2180  sNumberFormat = OUString::fromUtf8(sAttrValue);
2181  bNumberFormatOK = true;
2182  break;
2184  sLetterSync = OUString::fromUtf8(sAttrValue);
2185  break;
2186  default:
2187  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2188  }
2189 }
2190 
2192  const Reference<XPropertySet> & xPropertySet)
2193 {
2194  // properties optional
2195  // (only page count, but do for all to save common implementation)
2196 
2197  if (!xPropertySet->getPropertySetInfo()->
2198  hasPropertyByName(sPropertyNumberingType))
2199  return;
2200 
2201  sal_Int16 nNumType;
2202  if( bNumberFormatOK )
2203  {
2204  nNumType= style::NumberingType::ARABIC;
2206  sNumberFormat,
2207  sLetterSync );
2208  }
2209  else
2210  nNumType = style::NumberingType::PAGE_DESCRIPTOR;
2211  xPropertySet->setPropertyValue(sPropertyNumberingType, Any(nNumType));
2212 }
2213 
2215  sal_Int32 nElement)
2216 {
2217  OUString pServiceName;
2218 
2219  switch (nElement)
2220  {
2222  pServiceName = "WordCount";
2223  break;
2225  pServiceName = "ParagraphCount";
2226  break;
2228  pServiceName = "TableCount";
2229  break;
2231  pServiceName = "CharacterCount";
2232  break;
2234  pServiceName = "GraphicObjectCount";
2235  break;
2237  pServiceName = "EmbeddedObjectCount";
2238  break;
2240  pServiceName = "PageCount";
2241  break;
2242  default:
2243  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2244  assert(false);
2245  }
2246 
2247  return pServiceName;
2248 }
2249 
2250 
2251 // page variable import
2252 
2253 
2255  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2256  XMLTextFieldImportContext(rImport, rHlp, "ReferencePageGet"),
2257  sNumberFormat(),
2258  sLetterSync(),
2259  bNumberFormatOK(false)
2260 {
2261  bValid = true;
2262 }
2263 
2265  sal_Int32 nAttrToken,
2266  std::string_view sAttrValue )
2267 {
2268  switch (nAttrToken)
2269  {
2271  sNumberFormat = OUString::fromUtf8(sAttrValue);
2272  bNumberFormatOK = true;
2273  break;
2275  sLetterSync = OUString::fromUtf8(sAttrValue);
2276  break;
2277  default:
2278  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2279  }
2280 }
2281 
2283  const Reference<XPropertySet> & xPropertySet)
2284 {
2285  sal_Int16 nNumType;
2286  if( bNumberFormatOK )
2287  {
2288  nNumType= style::NumberingType::ARABIC;
2290  sNumberFormat,
2291  sLetterSync );
2292  }
2293  else
2294  nNumType = style::NumberingType::PAGE_DESCRIPTOR;
2295  xPropertySet->setPropertyValue(sAPI_numbering_type, Any(nNumType));
2296 
2297  // display old content (#96657#)
2298  xPropertySet->setPropertyValue( sAPI_current_presentation, Any(GetContent()) );
2299 }
2300 
2301 
2302 // page variable set fields
2303 
2304 
2306  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2307  XMLTextFieldImportContext(rImport, rHlp, "ReferencePageSet"),
2308  nAdjust(0),
2309  bActive(true)
2310 {
2311  bValid = true;
2312 }
2313 
2315  sal_Int32 nAttrToken,
2316  std::string_view sAttrValue )
2317 {
2318  switch (nAttrToken)
2319  {
2320  case XML_ELEMENT(TEXT, XML_ACTIVE):
2321  {
2322  bool bTmp(false);
2323  if (::sax::Converter::convertBool(bTmp, sAttrValue))
2324  {
2325  bActive = bTmp;
2326  }
2327  break;
2328  }
2330  {
2331  sal_Int32 nTmp(0);
2332  if (::sax::Converter::convertNumber(nTmp, sAttrValue))
2333  {
2334  nAdjust = static_cast<sal_Int16>(nTmp);
2335  }
2336  break;
2337  }
2338  default:
2339  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2340  break;
2341  }
2342 }
2343 
2345  const Reference<XPropertySet> & xPropertySet)
2346 {
2347  xPropertySet->setPropertyValue("On", Any(bActive));
2348  xPropertySet->setPropertyValue(sAPI_offset, Any(nAdjust));
2349 }
2350 
2351 
2352 // macro fields
2353 
2354 
2356  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2357  XMLTextFieldImportContext(rImport, rHlp, "Macro"),
2358  bDescriptionOK(false)
2359 {
2360 }
2361 
2362 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLMacroFieldImportContext::createFastChildContext(
2363  sal_Int32 nElement,
2364  const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
2365 {
2366  if ( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
2367  {
2368  // create events context and remember it!
2370  bValid = true;
2371  return xEventContext;
2372  }
2373  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2374 
2375  return nullptr;
2376 }
2377 
2379  sal_Int32 nAttrToken,
2380  std::string_view sAttrValue )
2381 {
2382  switch (nAttrToken)
2383  {
2385  sDescription = OUString::fromUtf8(sAttrValue);
2386  bDescriptionOK = true;
2387  break;
2388  case XML_ELEMENT(TEXT, XML_NAME):
2389  sMacro = OUString::fromUtf8(sAttrValue);
2390  bValid = true;
2391  break;
2392  default:
2393  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2394  }
2395 }
2396 
2398  const Reference<XPropertySet> & xPropertySet)
2399 {
2400  Any aAny;
2401  aAny <<= (bDescriptionOK ? sDescription : GetContent());
2402  xPropertySet->setPropertyValue(sAPI_hint, aAny);
2403 
2404  // if we have an events child element, we'll look for the OnClick
2405  // event if not, it may be an old (pre-638i) document. Then, we'll
2406  // have to look at the name attribute.
2407  OUString sMacroName;
2408  OUString sLibraryName;
2409  OUString sScriptURL;
2410 
2411  if ( xEventContext.is() )
2412  {
2413  // get event sequence
2414  XMLEventsImportContext* pEvents = xEventContext.get();
2415  Sequence<PropertyValue> aValues;
2416  pEvents->GetEventSequence( "OnClick", aValues );
2417 
2418  for( const auto& rValue : std::as_const(aValues) )
2419  {
2420  if ( rValue.Name == "ScriptType" )
2421  {
2422  // ignore ScriptType
2423  }
2424  else if ( rValue.Name == "Library" )
2425  {
2426  rValue.Value >>= sLibraryName;
2427  }
2428  else if ( rValue.Name == "MacroName" )
2429  {
2430  rValue.Value >>= sMacroName;
2431  }
2432  if ( rValue.Name == "Script" )
2433  {
2434  rValue.Value >>= sScriptURL;
2435  }
2436  }
2437  }
2438  else
2439  {
2440  // disassemble old-style macro-name: Everything before the
2441  // third-last dot is the library
2442  sal_Int32 nPos = sMacro.getLength() + 1; // the loop starts with nPos--
2443  const sal_Unicode* pBuf = sMacro.getStr();
2444  for( sal_Int32 i = 0; (i < 3) && (nPos > 0); i++ )
2445  {
2446  nPos--;
2447  while ( (pBuf[nPos] != '.') && (nPos > 0) )
2448  nPos--;
2449  }
2450 
2451  if (nPos > 0)
2452  {
2453  sLibraryName = sMacro.copy(0, nPos);
2454  sMacroName = sMacro.copy(nPos+1);
2455  }
2456  else
2457  sMacroName = sMacro;
2458  }
2459 
2460  xPropertySet->setPropertyValue("ScriptURL", Any(sScriptURL));
2461  xPropertySet->setPropertyValue("MacroName", Any(sMacroName));
2462  xPropertySet->setPropertyValue("MacroLibrary", Any(sLibraryName));
2463 }
2464 
2465 
2466 // reference field import
2467 
2468 
2470  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
2471  sal_Int32 nToken)
2472 : XMLTextFieldImportContext(rImport, rHlp, "GetReference")
2473 , nElementToken(nToken)
2474 , nSource(0)
2475 , nType(ReferenceFieldPart::PAGE_DESC)
2476 , bNameOK(false)
2477 , bTypeOK(false)
2478 {
2479 }
2480 
2482 {
2483  { XML_PAGE, ReferenceFieldPart::PAGE},
2484  { XML_CHAPTER, ReferenceFieldPart::CHAPTER },
2485  { XML_TEXT, ReferenceFieldPart::TEXT },
2486  { XML_DIRECTION, ReferenceFieldPart::UP_DOWN },
2487  { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
2488  { XML_CAPTION, ReferenceFieldPart::ONLY_CAPTION },
2489  { XML_VALUE, ReferenceFieldPart::ONLY_SEQUENCE_NUMBER },
2490  // Core implementation for direct cross-references (#i81002#)
2491  { XML_NUMBER, ReferenceFieldPart::NUMBER },
2492  { XML_NUMBER_NO_SUPERIOR, ReferenceFieldPart::NUMBER_NO_CONTEXT },
2493  { XML_NUMBER_ALL_SUPERIOR, ReferenceFieldPart::NUMBER_FULL_CONTEXT },
2494  { XML_TOKEN_INVALID, 0 }
2495 };
2496 
2498  sal_Int32 nElement,
2499  const Reference<XFastAttributeList> & xAttrList)
2500 {
2501  bTypeOK = true;
2502  switch (nElementToken)
2503  {
2505  nSource = ReferenceFieldSource::REFERENCE_MARK;
2506  break;
2508  nSource = ReferenceFieldSource::BOOKMARK;
2509  break;
2510  case XML_ELEMENT(TEXT, XML_NOTE_REF):
2511  nSource = ReferenceFieldSource::FOOTNOTE;
2512  break;
2514  nSource = ReferenceFieldSource::SEQUENCE_FIELD;
2515  break;
2516  default:
2518  bTypeOK = false;
2519  break;
2520  }
2521 
2522  XMLTextFieldImportContext::startFastElement(nElement, xAttrList);
2523 }
2524 
2525 
2527  sal_Int32 nAttrToken,
2528  std::string_view sAttrValue )
2529 {
2530  switch (nAttrToken)
2531  {
2533  if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
2534  nSource = ReferenceFieldSource::ENDNOTE;
2535  break;
2536  case XML_ELEMENT(TEXT, XML_REF_NAME):
2537  sName = OUString::fromUtf8(sAttrValue);
2538  bNameOK = true;
2539  break;
2541  {
2542  sal_uInt16 nToken;
2543  if (SvXMLUnitConverter::convertEnum(nToken, sAttrValue,
2544  lcl_aReferenceTypeTokenMap))
2545  {
2546  nType = nToken;
2547  }
2548 
2549  // check for sequence-only-attributes
2551  ( (nType == ReferenceFieldPart::CATEGORY_AND_NUMBER) ||
2552  (nType == ReferenceFieldPart::ONLY_CAPTION) ||
2553  (nType == ReferenceFieldPart::ONLY_SEQUENCE_NUMBER) ) )
2554  {
2555  nType = ReferenceFieldPart::PAGE_DESC;
2556  }
2557 
2558  break;
2559  }
2560  case XML_ELEMENT(LO_EXT, XML_REFERENCE_LANGUAGE):
2562  sLanguage = OUString::fromUtf8(sAttrValue);
2563  break;
2564  default:
2565  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2566  }
2567 
2568  // bValid: we need proper element type and name
2569  bValid = bTypeOK && bNameOK;
2570 }
2571 
2573  const Reference<XPropertySet> & xPropertySet)
2574 {
2575  xPropertySet->setPropertyValue("ReferenceFieldPart", Any(nType));
2576 
2577  xPropertySet->setPropertyValue("ReferenceFieldSource", Any(nSource));
2578 
2579  xPropertySet->setPropertyValue("ReferenceFieldLanguage", Any(sLanguage));
2580  switch (nElementToken)
2581  {
2584  xPropertySet->setPropertyValue("SourceName", Any(sName));
2585  break;
2586 
2587  case XML_ELEMENT(TEXT, XML_NOTE_REF):
2589  break;
2590 
2593  break;
2594  }
2595 
2596  xPropertySet->setPropertyValue(sAPI_current_presentation, Any(GetContent()));
2597 }
2598 
2599 
2600 // field declarations container
2601 
2603  SvXMLImportContext(rImport)
2604 {
2605 }
2606 
2607 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDdeFieldDeclsImportContext::createFastChildContext(
2608  sal_Int32 nElement,
2609  const css::uno::Reference< css::xml::sax::XFastAttributeList >& )
2610 {
2611  if ( nElement == XML_ELEMENT(TEXT, XML_DDE_CONNECTION_DECL) )
2612  {
2614  }
2615  else
2616  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
2617  return nullptr;
2618 }
2619 
2620 
2621 // import dde field declaration
2622 
2623 
2625 : SvXMLImportContext(rImport)
2626 {
2627 }
2628 
2630  sal_Int32 /*nElement*/,
2631  const Reference<XFastAttributeList> & xAttrList)
2632 {
2633  OUString sName;
2634  OUString sCommandApplication;
2635  OUString sCommandTopic;
2636  OUString sCommandItem;
2637 
2638  bool bUpdate = false;
2639  bool bNameOK = false;
2640  bool bCommandApplicationOK = false;
2641  bool bCommandTopicOK = false;
2642  bool bCommandItemOK = false;
2643 
2644  // process attributes
2645  for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
2646  {
2647  switch (aIter.getToken())
2648  {
2649  case XML_ELEMENT(OFFICE, XML_NAME):
2650  sName = aIter.toString();
2651  bNameOK = true;
2652  break;
2654  sCommandApplication = aIter.toString();
2655  bCommandApplicationOK = true;
2656  break;
2658  sCommandTopic = aIter.toString();
2659  bCommandTopicOK = true;
2660  break;
2662  sCommandItem = aIter.toString();
2663  bCommandItemOK = true;
2664  break;
2666  {
2667  bool bTmp(false);
2668  if (::sax::Converter::convertBool(bTmp, aIter.toView()) )
2669  {
2670  bUpdate = bTmp;
2671  }
2672  break;
2673  }
2674  default:
2675  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
2676  }
2677  }
2678 
2679  // valid data?
2680  if (!(bNameOK && bCommandApplicationOK && bCommandTopicOK && bCommandItemOK))
2681  return;
2682 
2683  // create DDE TextFieldMaster
2684  Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
2685  UNO_QUERY);
2686  if( !xFactory.is() )
2687  return;
2688 
2689  /* #i6432# There might be multiple occurrences of one DDE
2690  declaration if it is used in more than one of
2691  header/footer/body. createInstance will throw an exception if we
2692  try to create the second, third, etc. instance of such a
2693  declaration. Thus we ignore the exception. Otherwise this will
2694  lead to an unloadable document. */
2695  try
2696  {
2697  Reference<XInterface> xIfc =
2698  xFactory->createInstance(OUString::Concat(sAPI_fieldmaster_prefix) + sAPI_dde);
2699  if( xIfc.is() )
2700  {
2701  Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY );
2702  if (xPropSet.is() &&
2703  xPropSet->getPropertySetInfo()->hasPropertyByName(
2704  "DDECommandType"))
2705  {
2706  xPropSet->setPropertyValue(sAPI_name, Any(sName));
2707 
2708  xPropSet->setPropertyValue("DDECommandType", Any(sCommandApplication));
2709 
2710  xPropSet->setPropertyValue("DDECommandFile", Any(sCommandTopic));
2711 
2712  xPropSet->setPropertyValue("DDECommandElement",
2713  Any(sCommandItem));
2714 
2715  xPropSet->setPropertyValue("IsAutomaticUpdate",
2716  Any(bUpdate));
2717  }
2718  // else: ignore (can't get XPropertySet, or DDE
2719  // properties are not supported)
2720  }
2721  // else: ignore
2722  }
2723  catch (const Exception&)
2724  {
2725  //ignore
2726  }
2727  // else: ignore
2728  // else: ignore
2729 }
2730 
2731 
2732 // DDE field import
2733 
2734 
2736  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
2737  XMLTextFieldImportContext(rImport, rHlp, sAPI_dde),
2738  sName()
2739  ,sPropertyContent(sAPI_content)
2740 {
2741 }
2742 
2744  sal_Int32 nAttrToken,
2745  std::string_view sAttrValue )
2746 {
2747  if ( XML_ELEMENT(TEXT, XML_CONNECTION_NAME) == nAttrToken)
2748  {
2749  sName = OUString::fromUtf8(sAttrValue);
2750  bValid = true;
2751  }
2752  else
2753  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2754 }
2755 
2756 
2758 {
2759  if (!bValid)
2760  return;
2761 
2762  // find master
2763  OUString sMasterName = OUString::Concat(sAPI_fieldmaster_prefix) + sAPI_dde + "." + sName;
2764 
2765  Reference<XTextFieldsSupplier> xTextFieldsSupp(GetImport().GetModel(),
2766  UNO_QUERY);
2767  Reference<container::XNameAccess> xFieldMasterNameAccess =
2768  xTextFieldsSupp->getTextFieldMasters();
2769 
2770  if (!xFieldMasterNameAccess->hasByName(sMasterName))
2771  return;
2772 
2773  Reference<XPropertySet> xMaster;
2774  Any aAny = xFieldMasterNameAccess->getByName(sMasterName);
2775  aAny >>= xMaster;
2776  //apply the content to the master
2777  xMaster->setPropertyValue( sPropertyContent, uno::makeAny( GetContent()));
2778  // master exists: create text field and attach
2779  Reference<XPropertySet> xField;
2780  OUString sFieldName = OUString::Concat(sAPI_textfield_prefix) + sAPI_dde;
2781  if (!CreateField(xField, sFieldName))
2782  return;
2783 
2784  Reference<XDependentTextField> xDepTextField(xField,UNO_QUERY);
2785  xDepTextField->attachTextFieldMaster(xMaster);
2786 
2787  // attach field to document
2788  Reference<XTextContent> xTextContent(xField, UNO_QUERY);
2789  if (xTextContent.is())
2790  {
2791  GetImportHelper().InsertTextContent(xTextContent);
2792 
2793  // we're lucky. nothing else to prepare.
2794  }
2795  // else: fail, because text content could not be created
2796  // else: fail, because field could not be created
2797  // else: fail, because no master was found (faulty document?!)
2798  // not valid: ignore
2799 }
2800 
2802  const Reference<XPropertySet> &)
2803 {
2804  // empty, since not needed.
2805 }
2806 
2807 
2808 // sheet name fields
2809 
2810 
2812  SvXMLImport& rImport,
2813  XMLTextImportHelper& rHlp) :
2814  XMLTextFieldImportContext(rImport, rHlp, "SheetName")
2815 {
2816  bValid = true; // always valid!
2817 }
2818 
2820  sal_Int32 nAttrToken,
2821  std::string_view sAttrValue)
2822 {
2823  // no attributes -> nothing to be done
2824  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2825 }
2826 
2828  const Reference<XPropertySet> &)
2829 {
2830  // no attributes -> nothing to be done
2831 }
2832 
2836  SvXMLImport& rImport,
2837  XMLTextImportHelper& rHlp)
2838 : XMLTextFieldImportContext(rImport, rHlp, "PageName" )
2839 {
2840  bValid = true;
2841 }
2842 
2845  std::string_view sAttrValue )
2846 {
2847  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2848 }
2849 
2852  const css::uno::Reference<css::beans::XPropertySet> &)
2853 {
2854 }
2855 
2856 
2857 // URL fields (Calc, Impress, Draw)
2858 
2859 
2861  SvXMLImport& rImport,
2862  XMLTextImportHelper& rHlp) :
2863  XMLTextFieldImportContext(rImport, rHlp, sAPI_url),
2864  bFrameOK(false)
2865 {
2866 }
2867 
2869  sal_Int32 nAttrToken,
2870  std::string_view sAttrValue )
2871 {
2872  switch (nAttrToken)
2873  {
2874  case XML_ELEMENT(XLINK, XML_HREF):
2875  sURL = GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue) );
2876  bValid = true;
2877  break;
2879  sFrame = OUString::fromUtf8(sAttrValue);
2880  bFrameOK = true;
2881  break;
2882  default:
2883  // ignore
2884  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
2885  break;
2886  }
2887 }
2888 
2890  const Reference<XPropertySet> & xPropertySet)
2891 {
2892  xPropertySet->setPropertyValue(sAPI_url, Any(sURL));
2893 
2894  if (bFrameOK)
2895  {
2896  xPropertySet->setPropertyValue("TargetFrame", Any(sFrame));
2897  }
2898 
2899  xPropertySet->setPropertyValue("Representation", Any(GetContent()));
2900 }
2901 
2902 
2904  SvXMLImport& rImport,
2905  XMLTextImportHelper& rHlp) :
2906  XMLTextFieldImportContext(rImport, rHlp, "Bibliography"),
2907  aValues()
2908 {
2909  bValid = true;
2910 }
2911 
2912 // TODO: this is the same map as is used in the text field export
2914 {
2915  { XML_ARTICLE, BibliographyDataType::ARTICLE },
2916  { XML_BOOK, BibliographyDataType::BOOK },
2917  { XML_BOOKLET, BibliographyDataType::BOOKLET },
2918  { XML_CONFERENCE, BibliographyDataType::CONFERENCE },
2919  { XML_CUSTOM1, BibliographyDataType::CUSTOM1 },
2920  { XML_CUSTOM2, BibliographyDataType::CUSTOM2 },
2921  { XML_CUSTOM3, BibliographyDataType::CUSTOM3 },
2922  { XML_CUSTOM4, BibliographyDataType::CUSTOM4 },
2923  { XML_CUSTOM5, BibliographyDataType::CUSTOM5 },
2924  { XML_EMAIL, BibliographyDataType::EMAIL },
2925  { XML_INBOOK, BibliographyDataType::INBOOK },
2926  { XML_INCOLLECTION, BibliographyDataType::INCOLLECTION },
2927  { XML_INPROCEEDINGS, BibliographyDataType::INPROCEEDINGS },
2928  { XML_JOURNAL, BibliographyDataType::JOURNAL },
2929  { XML_MANUAL, BibliographyDataType::MANUAL },
2930  { XML_MASTERSTHESIS, BibliographyDataType::MASTERSTHESIS },
2931  { XML_MISC, BibliographyDataType::MISC },
2932  { XML_PHDTHESIS, BibliographyDataType::PHDTHESIS },
2933  { XML_PROCEEDINGS, BibliographyDataType::PROCEEDINGS },
2934  { XML_TECHREPORT, BibliographyDataType::TECHREPORT },
2935  { XML_UNPUBLISHED, BibliographyDataType::UNPUBLISHED },
2936  { XML_WWW, BibliographyDataType::WWW },
2937  { XML_TOKEN_INVALID, 0 }
2938 };
2939 
2940 
2941 // we'll process attributes on our own and for fit the standard
2942 // textfield mechanism, because our attributes have zero overlap with
2943 // all the other textfields.
2945  sal_Int32 /*nElement*/,
2946  const Reference<XFastAttributeList> & xAttrList)
2947 {
2948  // iterate over attributes
2949  for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
2950  {
2951  if (IsTokenInNamespace(aIter.getToken(), XML_NAMESPACE_TEXT)
2952  || IsTokenInNamespace(aIter.getToken(), XML_NAMESPACE_LO_EXT))
2953  {
2954  auto nToken = aIter.getToken() & TOKEN_MASK;
2955  PropertyValue aValue;
2956  aValue.Name = OUString::createFromAscii(
2958  Any aAny;
2959 
2960  // special treatment for bibliography type
2961  // biblio vs bibilio: #96658#; also read old documents
2964  {
2965  sal_uInt16 nTmp;
2967  nTmp, aIter.toView(),
2969  {
2970  aAny <<= static_cast<sal_Int16>(nTmp);
2971  aValue.Value = aAny;
2972 
2973  aValues.push_back(aValue);
2974  }
2975  }
2976  else
2977  {
2978  OUString aStringValue = aIter.toString();
2979  if (nToken == XML_URL || nToken == XML_LOCAL_URL)
2980  {
2981  aStringValue = GetImport().GetAbsoluteReference(aStringValue);
2982  }
2983  aAny <<= aStringValue;
2984  aValue.Value = aAny;
2985 
2986  aValues.push_back(aValue);
2987  }
2988  }
2989  // else: unknown namespace -> ignore
2990  }
2991 }
2992 
2994  sal_Int32 ,
2995  std::string_view )
2996 {
2997  // attributes are handled in StartElement
2998  assert(false && "This should not have happened.");
2999 }
3000 
3001 
3003  const Reference<XPropertySet> & xPropertySet)
3004 {
3005  // convert vector into sequence
3006  sal_Int32 nCount = aValues.size();
3007  Sequence<PropertyValue> aValueSequence(nCount);
3008  for(sal_Int32 i = 0; i < nCount; i++)
3009  {
3010  aValueSequence[i] = aValues[i];
3011  }
3012 
3013  // set sequence
3014  xPropertySet->setPropertyValue("Fields", Any(aValueSequence));
3015 }
3016 
3018  sal_Int32 nElement)
3019 {
3020  const char* pName = nullptr;
3021 
3022  switch (nElement & TOKEN_MASK)
3023  {
3024  case XML_IDENTIFIER:
3025  pName = "Identifier";
3026  break;
3028  case XML_BIBLIOGRAPHY_TYPE:
3029  // biblio... vs bibilio...: #96658#: also read old documents
3030  pName = "BibiliographicType";
3031  break;
3032  case XML_ADDRESS:
3033  pName = "Address";
3034  break;
3035  case XML_ANNOTE:
3036  pName = "Annote";
3037  break;
3038  case XML_AUTHOR:
3039  pName = "Author";
3040  break;
3041  case XML_BOOKTITLE:
3042  pName = "Booktitle";
3043  break;
3044  case XML_CHAPTER:
3045  pName = "Chapter";
3046  break;
3047  case XML_EDITION:
3048  pName = "Edition";
3049  break;
3050  case XML_EDITOR:
3051  pName = "Editor";
3052  break;
3053  case XML_HOWPUBLISHED:
3054  pName = "Howpublished";
3055  break;
3056  case XML_INSTITUTION:
3057  pName = "Institution";
3058  break;
3059  case XML_JOURNAL:
3060  pName = "Journal";
3061  break;
3062  case XML_MONTH:
3063  pName = "Month";
3064  break;
3065  case XML_NOTE:
3066  pName = "Note";
3067  break;
3068  case XML_NUMBER:
3069  pName = "Number";
3070  break;
3071  case XML_ORGANIZATIONS:
3072  pName = "Organizations";
3073  break;
3074  case XML_PAGES:
3075  pName = "Pages";
3076  break;
3077  case XML_PUBLISHER:
3078  pName = "Publisher";
3079  break;
3080  case XML_SCHOOL:
3081  pName = "School";
3082  break;
3083  case XML_SERIES:
3084  pName = "Series";
3085  break;
3086  case XML_TITLE:
3087  pName = "Title";
3088  break;
3089  case XML_REPORT_TYPE:
3090  pName = "Report_Type";
3091  break;
3092  case XML_VOLUME:
3093  pName = "Volume";
3094  break;
3095  case XML_YEAR:
3096  pName = "Year";
3097  break;
3098  case XML_URL:
3099  pName = "URL";
3100  break;
3101  case XML_CUSTOM1:
3102  pName = "Custom1";
3103  break;
3104  case XML_CUSTOM2:
3105  pName = "Custom2";
3106  break;
3107  case XML_CUSTOM3:
3108  pName = "Custom3";
3109  break;
3110  case XML_CUSTOM4:
3111  pName = "Custom4";
3112  break;
3113  case XML_CUSTOM5:
3114  pName = "Custom5";
3115  break;
3116  case XML_ISBN:
3117  pName = "ISBN";
3118  break;
3119  case XML_LOCAL_URL:
3120  pName = "LocalURL";
3121  break;
3122  default:
3123  assert(false && "Unknown bibliography info data");
3124  pName = nullptr;
3125  }
3126  return pName;
3127 }
3128 
3129 // Annotation Field
3130 
3131 
3133  SvXMLImport& rImport,
3134  XMLTextImportHelper& rHlp,
3135  sal_Int32 nElement) :
3136  XMLTextFieldImportContext(rImport, rHlp, "Annotation"),
3137  mnElement(nElement)
3138 {
3139  bValid = true;
3140 
3141  // remember old list item and block (#91964#) and reset them
3142  // for the text frame
3143  // do this in the constructor, not in CreateChildContext (#i93392#)
3144  GetImport().GetTextImport()->PushListContext();
3145 }
3146 
3148  sal_Int32 nAttrToken,
3149  std::string_view sAttrValue )
3150 {
3151  if (nAttrToken == XML_ELEMENT(OFFICE, XML_NAME))
3152  aName = OUString::fromUtf8(sAttrValue);
3153  else if (nAttrToken == XML_ELEMENT(LO_EXT, XML_RESOLVED))
3154  aResolved = OUString::fromUtf8(sAttrValue);
3155  else
3156  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3157 }
3158 
3159 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnnotationImportContext::createFastChildContext(
3160  sal_Int32 nElement,
3161  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
3162 {
3163  if( nElement == XML_ELEMENT(DC, XML_CREATOR) )
3165  else if( nElement == XML_ELEMENT(DC, XML_DATE) )
3167  else if (nElement == XML_ELEMENT(TEXT,XML_SENDER_INITIALS) ||
3168  nElement == XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS) ||
3169  nElement == XML_ELEMENT(META, XML_CREATOR_INITIALS))
3171 
3172  try
3173  {
3174  bool bOK = true;
3175  if ( !mxField.is() )
3177  if (bOK)
3178  {
3179  Any aAny = mxField->getPropertyValue( "TextRange" );
3180  Reference< XText > xText;
3181  aAny >>= xText;
3182  if( xText.is() )
3183  {
3185  if( !mxCursor.is() )
3186  {
3187  mxOldCursor = xTxtImport->GetCursor();
3188  mxCursor = xText->createTextCursor();
3189  }
3190 
3191  if( mxCursor.is() )
3192  {
3193  xTxtImport->SetCursor( mxCursor );
3194  return xTxtImport->CreateTextChildContext( GetImport(), nElement, xAttrList );
3195  }
3196  }
3197  }
3198  }
3199  catch (const Exception&)
3200  {
3201  }
3202 
3204 }
3205 
3207 {
3208  DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
3209  if( mxCursor.is() )
3210  {
3211  // delete addition newline
3212  mxCursor->gotoEnd( false );
3213  mxCursor->goLeft( 1, true );
3214  mxCursor->setString( "" );
3215 
3216  // reset cursor
3217  GetImport().GetTextImport()->ResetCursor();
3218  }
3219 
3220  if( mxOldCursor.is() )
3221  GetImport().GetTextImport()->SetCursor( mxOldCursor );
3222 
3223  // reinstall old list item #91964#
3224  GetImport().GetTextImport()->PopListContext();
3225 
3226  if ( bValid )
3227  {
3229  {
3230  // Search for a previous annotation with the same name.
3231  uno::Reference< text::XTextContent > xPrevField;
3232  {
3233  Reference<XTextFieldsSupplier> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY);
3234  uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
3235  uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
3236  while (xFields->hasMoreElements())
3237  {
3238  uno::Reference<beans::XPropertySet> xCurrField(xFields->nextElement(), uno::UNO_QUERY);
3239  uno::Reference<beans::XPropertySetInfo> const xInfo(
3240  xCurrField->getPropertySetInfo());
3241  if (xInfo->hasPropertyByName(sAPI_name))
3242  {
3243  OUString aFieldName;
3244  xCurrField->getPropertyValue(sAPI_name) >>= aFieldName;
3245  if (aFieldName == aName)
3246  {
3247  xPrevField.set( xCurrField, uno::UNO_QUERY );
3248  break;
3249  }
3250  }
3251  }
3252  }
3253  if ( xPrevField.is() )
3254  {
3255  // So we are ending a previous annotation,
3256  // let's create a text range covering the old and the current position.
3257  uno::Reference<text::XText> xText = GetImportHelper().GetText();
3258  uno::Reference<text::XTextCursor> xCursor =
3259  xText->createTextCursorByRange(GetImportHelper().GetCursorAsRange());
3260  xCursor->gotoRange(xPrevField->getAnchor(), true);
3261 
3262  xText->insertTextContent(xCursor, xPrevField, !xCursor->isCollapsed());
3263  }
3264  }
3265  else
3266  {
3268  {
3269  // set field properties
3270  PrepareField( mxField );
3271 
3272  // attach field to document
3273  Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
3274 
3275  // workaround for #80606#
3276  try
3277  {
3278  GetImportHelper().InsertTextContent( xTextContent );
3279  }
3280  catch (const lang::IllegalArgumentException&)
3281  {
3282  // ignore
3283  }
3284  }
3285  }
3286  }
3287  else
3289 }
3290 
3292  const Reference<XPropertySet> & xPropertySet )
3293 {
3294  // import (possibly empty) author
3295  OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
3296  xPropertySet->setPropertyValue(sAPI_author, makeAny(sAuthor));
3297 
3298  // import (possibly empty) initials
3299  OUString sInitials( aInitialsBuffer.makeStringAndClear() );
3300  xPropertySet->setPropertyValue("Initials", makeAny(sInitials));
3301 
3302  //import resolved flag
3303  bool bTmp(false);
3305  xPropertySet->setPropertyValue("Resolved", makeAny(bTmp));
3306 
3307  util::DateTime aDateTime;
3308  if (::sax::Converter::parseDateTime(aDateTime,
3309  aDateBuffer.makeStringAndClear()))
3310  {
3311  /*
3312  Date aDate;
3313  aDate.Year = aDateTime.Year;
3314  aDate.Month = aDateTime.Month;
3315  aDate.Day = aDateTime.Day;
3316  xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
3317  */
3318  // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
3319  xPropertySet->setPropertyValue(sAPI_date_time_value, makeAny(aDateTime));
3320  }
3321 
3322  OUString sBuffer = aTextBuffer.makeStringAndClear();
3323  if ( sBuffer.getLength() )
3324  {
3325  // delete last paragraph mark (if necessary)
3326  if (char(0x0a) == sBuffer[sBuffer.getLength()-1])
3327  sBuffer = sBuffer.copy(0, sBuffer.getLength()-1);
3328  xPropertySet->setPropertyValue(sAPI_content, makeAny(sBuffer));
3329  }
3330 
3331  if (!aName.isEmpty())
3332  xPropertySet->setPropertyValue(sAPI_name, makeAny(aName));
3333 }
3334 
3335 
3336 // script field
3337 
3338 
3340  SvXMLImport& rImport,
3341  XMLTextImportHelper& rHlp)
3342 : XMLTextFieldImportContext(rImport, rHlp, "Script")
3343 , bContentOK(false)
3344 {
3345 }
3346 
3348  sal_Int32 nAttrToken,
3349  std::string_view sAttrValue )
3350 {
3351  switch (nAttrToken)
3352  {
3353  case XML_ELEMENT(XLINK, XML_HREF):
3354  sContent = GetImport().GetAbsoluteReference( OUString::fromUtf8(sAttrValue) );
3355  bContentOK = true;
3356  break;
3357 
3359  sScriptType = OUString::fromUtf8(sAttrValue);
3360  break;
3361 
3362  default:
3363  // ignore
3364  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3365  break;
3366  }
3367 
3368  // always valid (even without ScriptType; cf- #96531#)
3369  bValid = true;
3370 }
3371 
3373  const Reference<XPropertySet> & xPropertySet)
3374 {
3375  // if href attribute was present, we use it. Else we use element content
3376  if (! bContentOK)
3377  {
3378  sContent = GetContent();
3379  }
3380  xPropertySet->setPropertyValue(sAPI_content, Any(sContent));
3381 
3382  // URL or script text? We use URL if we have an href-attribute
3383  xPropertySet->setPropertyValue("URLContent", Any(bContentOK));
3384 
3385  xPropertySet->setPropertyValue("ScriptType", Any(sScriptType));
3386 }
3387 
3388 
3389 // measure field
3390 
3391 
3393  SvXMLImport& rImport,
3394  XMLTextImportHelper& rHlp) :
3395  XMLTextFieldImportContext(rImport, rHlp, "Measure"),
3396  mnKind( 0 )
3397 {
3398 }
3399 
3401  sal_Int32 nAttrToken,
3402  std::string_view sAttrValue )
3403 {
3404  switch (nAttrToken)
3405  {
3406  case XML_ELEMENT(TEXT, XML_KIND):
3407  if( IsXMLToken( sAttrValue, XML_VALUE ) )
3408  {
3409  mnKind = 0; bValid = true;
3410  }
3411  else if( IsXMLToken( sAttrValue, XML_UNIT ) )
3412  {
3413  mnKind = 1; bValid = true;
3414  }
3415  else if( IsXMLToken( sAttrValue, XML_GAP ) )
3416  {
3417  mnKind = 2; bValid = true;
3418  }
3419  break;
3420  default:
3421  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3422  }
3423 }
3424 
3426  const Reference<XPropertySet> & xPropertySet)
3427 {
3428  xPropertySet->setPropertyValue("Kind", Any(mnKind));
3429 }
3430 
3431 
3432 // dropdown field
3433 
3434 
3436  SvXMLImport& rImport,
3437  XMLTextImportHelper& rHlp) :
3438  XMLTextFieldImportContext( rImport, rHlp, "DropDown" ),
3439  aLabels(),
3440  sName(),
3441  nSelected( -1 ),
3442  bNameOK( false ),
3443  bHelpOK(false),
3444  bHintOK(false)
3445 {
3446  bValid = true;
3447 }
3448 
3449 static bool lcl_ProcessLabel(
3450  const Reference<XFastAttributeList>& xAttrList,
3451  OUString& rLabel,
3452  bool& rIsSelected )
3453 {
3454  bool bValid = false;
3455  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
3456  {
3457  switch (aIter.getToken())
3458  {
3459  case XML_ELEMENT(TEXT, XML_VALUE):
3460  {
3461  rLabel = aIter.toString();
3462  bValid = true;
3463  break;
3464  }
3466  {
3467  bool bTmp(false);
3468  if (::sax::Converter::convertBool( bTmp, aIter.toView() ))
3469  rIsSelected = bTmp;
3470  break;
3471  }
3472  default:
3473  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
3474  }
3475  }
3476  return bValid;
3477 }
3478 
3479 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDropDownFieldImportContext::createFastChildContext(
3480  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
3481 {
3482  if( nElement == XML_ELEMENT(TEXT, XML_LABEL) )
3483  {
3484  OUString sLabel;
3485  bool bIsSelected = false;
3486  if( lcl_ProcessLabel( xAttrList, sLabel, bIsSelected ) )
3487  {
3488  if( bIsSelected )
3489  nSelected = static_cast<sal_Int32>( aLabels.size() );
3490  aLabels.push_back( sLabel );
3491  }
3492  }
3493  return new SvXMLImportContext( GetImport() );
3494 }
3495 
3497  sal_Int32 nAttrToken,
3498  std::string_view sAttrValue )
3499 {
3500  if( nAttrToken == XML_ELEMENT(TEXT, XML_NAME))
3501  {
3502  sName = OUString::fromUtf8(sAttrValue);
3503  bNameOK = true;
3504  }
3505  else if (nAttrToken == XML_ELEMENT(TEXT, XML_HELP))
3506  {
3507  sHelp = OUString::fromUtf8(sAttrValue);
3508  bHelpOK = true;
3509  }
3510  else if (nAttrToken == XML_ELEMENT(TEXT, XML_HINT))
3511  {
3512  sHint = OUString::fromUtf8(sAttrValue);
3513  bHintOK = true;
3514  }
3515  else
3516  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3517 }
3518 
3520  const Reference<XPropertySet>& xPropertySet)
3521 {
3522  // create sequence
3523  sal_Int32 nLength = static_cast<sal_Int32>( aLabels.size() );
3524  Sequence<OUString> aSequence( nLength );
3525  OUString* pSequence = aSequence.getArray();
3526  for( sal_Int32 n = 0; n < nLength; n++ )
3527  pSequence[n] = aLabels[n];
3528 
3529  // now set values:
3530 
3531  xPropertySet->setPropertyValue( "Items", Any(aSequence) );
3532 
3533  if( nSelected >= 0 && nSelected < nLength )
3534  {
3535  xPropertySet->setPropertyValue( "SelectedItem", Any(pSequence[nSelected]) );
3536  }
3537 
3538  // set name
3539  if( bNameOK )
3540  {
3541  xPropertySet->setPropertyValue( "Name", Any(sName) );
3542  }
3543  // set help
3544  if( bHelpOK )
3545  {
3546  xPropertySet->setPropertyValue( "Help", Any(sHelp) );
3547  }
3548  // set hint
3549  if( bHintOK )
3550  {
3551  xPropertySet->setPropertyValue( "Tooltip", Any(sHint) );
3552  }
3553 
3554 }
3555 
3559  SvXMLImport& rImport,
3560  XMLTextImportHelper& rHlp)
3561 : XMLTextFieldImportContext(rImport, rHlp, "Header" )
3562 {
3564  bValid = true;
3565 }
3566 
3568 void XMLHeaderFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, std::string_view sAttrValue )
3569 {
3570  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3571 }
3572 
3575 {
3576 }
3577 
3581  SvXMLImport& rImport,
3582  XMLTextImportHelper& rHlp)
3583 : XMLTextFieldImportContext(rImport, rHlp, "Footer" )
3584 {
3586  bValid = true;
3587 }
3588 
3590 void XMLFooterFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, std::string_view sAttrValue)
3591 {
3592  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3593 }
3594 
3597 {
3598 }
3599 
3600 
3604  SvXMLImport& rImport,
3605  XMLTextImportHelper& rHlp)
3606 : XMLTextFieldImportContext(rImport, rHlp, "DateTime" )
3607 {
3609  bValid = true;
3610 }
3611 
3614  std::string_view sAttrValue )
3615 {
3616  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
3617 }
3618 
3621  const css::uno::Reference<
3622  css::beans::XPropertySet> &)
3623 {
3624 }
3625 
3626 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XMLRevisionDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1553
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attributes
Definition: txtfldi.cxx:3347
::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:1428
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:2191
constexpr OUStringLiteral gsPropertyDataBaseURL(u"DataBaseURL")
const OUString sPropertyNumberingType
Definition: txtfldi.hxx:254
static OUString MapTokenToServiceName(sal_Int32 nElement)
Definition: txtfldi.cxx:2214
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:2009
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1659
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:1444
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:1890
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:2112
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:2944
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:2602
XMLCountFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:2160
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:3017
XMLDropDownFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:3435
import hidden paragraph fields ()
Definition: txtfldi.hxx:538
XMLMacroFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2355
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:2844
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:2397
XMLFileNameImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1964
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1359
#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:1943
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:2264
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:3485
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:3580
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:2314
XMLAnnotationImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:3132
XMLDatabaseSelectImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1303
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:1876
const OUString sPropertyIsDate
Definition: txtfldi.hxx:207
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1777
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:1832
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:2080
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1632
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2378
const SvXMLEnumMapEntry< sal_uInt16 > aChapterDisplayMap[]
Definition: txtfldi.cxx:2090
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
no attributes -> empty method
Definition: txtfldi.cxx:2827
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:3291
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:3568
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:3339
sal_uInt16 sal_Unicode
XMLUrlFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2860
XMLTextImportHelper & rTextImportHelper
service name for text field
Definition: txtfldi.hxx:55
XMLHeaderFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
import header fields ()
Definition: txtfldi.cxx:3558
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:2344
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2149
XMLUserDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1689
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:2048
import expression fields ()
Definition: txtvfldi.hxx:189
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:2057
import bibliography info fields ()
Definition: txtfldi.hxx:932
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attributes
Definition: txtfldi.cxx:3147
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
set properties
Definition: txtfldi.cxx:3372
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:2811
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:2801
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:1955
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:2624
css::util::DateTime aDateTimeValue
Definition: txtfldi.hxx:210
sal_uInt16 char * pName
XMLConditionalTextImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1820
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
no attributes -> empty method
Definition: txtfldi.cxx:2889
constexpr OUStringLiteral sAPI_url
Definition: txtfldi.cxx:100
const OUString sPropertyCurrentPresentation
Definition: txtfldi.hxx:625
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:3449
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:2362
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:1391
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:2819
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:2572
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:3574
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:3519
OUString sContent
collect character data
Definition: txtfldi.hxx:53
XMLDatabaseNumberImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1346
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:3613
float u
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1806
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:2851
import user docinfo field ()
Definition: txtfldi.hxx:513
XMLMeasureFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:3392
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:2103
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:2481
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:2743
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:2282
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:1738
Import all text into a string buffer.
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1263
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:1902
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1288
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:3206
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:2757
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:1608
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:3429
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:3479
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:1312
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:2305
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:3496
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:2173
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:2735
QPRO_FUNC_TYPE nType
XMLHiddenParagraphImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:1767
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:3159
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:1703
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:2835
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:2607
static OUString MapTokenToServiceName(sal_Int32 nElementToken)
Definition: txtfldi.cxx:1485
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1334
XMLDateTimeDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement)
Definition: txtfldi.cxx:1589
const SvXMLEnumMapEntry< sal_uInt16 > aTemplateDisplayMap[]
Definition: txtfldi.cxx:2036
#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:3620
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: txtfldi.cxx:2629
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1560
sal_Int32 nLength
Definition: xmltoken.cxx:36
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:3603
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:3002
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:2868
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:3425
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:3596
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:2469
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:1977
TEXT
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtfldi.cxx:3590
XMLPageVarGetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2254
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
start element
Definition: txtfldi.cxx:2497
XMLBibliographyFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtfldi.cxx:2903
OUStringBuffer aTextBuffer
Definition: txtfldi.hxx:964
sal_uInt16 nPos
import footer fields ()
Definition: txtfldi.hxx:1087
XMLSimpleDocInfoImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElementToken, bool bContent, bool bAuthor)
Definition: txtfldi.cxx:1412
sal_Int16 nValue