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