LibreOffice Module xmloff (master)  1
txtvfldi.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 
25 #include <txtvfldi.hxx>
26 #include <xmloff/xmltoken.hxx>
27 #include <xmloff/txtimp.hxx>
28 #include <xmloff/xmlnamespace.hxx>
29 #include <xmloff/namespacemap.hxx>
30 #include <xmloff/i18nmap.hxx>
31 #include <xmloff/xmlimp.hxx>
32 #include <xmloff/xmluconv.hxx>
33 #include <xmloff/xmlement.hxx>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/text/SetVariableType.hpp>
36 #include <com/sun/star/text/XDependentTextField.hpp>
37 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/beans/XPropertySetInfo.hpp>
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include <com/sun/star/xml/sax/XAttributeList.hpp>
42 #include <com/sun/star/style/NumberingType.hpp>
43 #include <com/sun/star/container/XIndexReplace.hpp>
44 
45 #include <sax/tools/converter.hxx>
46 
47 #include <rtl/ustring.hxx>
48 #include <osl/diagnose.h>
49 #include <sal/log.hxx>
50 
51 #include <tools/debug.hxx>
52 #include <tools/diagnose_ex.h>
53 
54 
55 // service names
56 constexpr char16_t sAPI_fieldmaster_prefix[] = u"com.sun.star.text.FieldMaster.";
57 constexpr OUStringLiteral sAPI_get_expression = u"GetExpression";
58 constexpr OUStringLiteral sAPI_set_expression = u"SetExpression";
59 constexpr OUStringLiteral sAPI_user = u"User";
60 constexpr OUStringLiteral sAPI_database = u"com.sun.star.text.TextField.Database";
61 
62 // property names
63 constexpr OUStringLiteral sAPI_content = u"Content";
64 constexpr OUStringLiteral sAPI_sub_type = u"SubType";
65 constexpr OUStringLiteral sAPI_number_format = u"NumberFormat";
66 constexpr OUStringLiteral sAPI_is_visible = u"IsVisible";
67 constexpr OUStringLiteral sAPI_current_presentation = u"CurrentPresentation";
68 
69 
70 using namespace ::com::sun::star;
71 using namespace ::com::sun::star::uno;
72 using namespace ::com::sun::star::beans;
73 using namespace ::com::sun::star::text;
74 using namespace ::com::sun::star::style;
75 using namespace ::xmloff::token;
76 
77 
78 // XMLVarFieldImportContext: superclass for all variable related fields
79 
80 
82  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
83  const OUString& pServiceName,
84  bool bFormula, bool bFormulaDefault,
85  bool bDescription, bool bHelp, bool bHint, bool bVisible,
86  bool bIsDisplayFormula,
87  bool bType, bool bStyle, bool bValue,
88  bool bPresentation) :
89  XMLTextFieldImportContext(rImport, rHlp, pServiceName),
90  aValueHelper(rImport, rHlp, bType, bStyle, bValue, false),
91  bDisplayFormula(false),
92  bDisplayNone(false),
93  bFormulaOK(false),
94  bDescriptionOK(false),
95  bHelpOK(false),
96  bHintOK(false),
97  bDisplayOK(false),
98  bSetFormula(bFormula),
99  bSetFormulaDefault(bFormulaDefault),
100  bSetDescription(bDescription),
101  bSetHelp(bHelp),
102  bSetHint(bHint),
103  bSetVisible(bVisible),
104  bSetDisplayFormula(bIsDisplayFormula),
105  bSetPresentation(bPresentation)
106 {
107 }
108 
110  sal_Int32 nAttrToken,
111  std::string_view sAttrValue )
112 {
113  switch (nAttrToken)
114  {
115  case XML_ELEMENT(TEXT, XML_NAME):
116  sName = OUString::fromUtf8(sAttrValue);
117  bValid = true; // we assume: field with name is valid!
118  break;
120  sDescription = OUString::fromUtf8(sAttrValue);
121  bDescriptionOK = true;
122  break;
123  case XML_ELEMENT(TEXT, XML_HELP):
124  sHelp = OUString::fromUtf8(sAttrValue);
125  bHelpOK = true;
126  break;
127  case XML_ELEMENT(TEXT, XML_HINT):
128  sHint = OUString::fromUtf8(sAttrValue);
129  bHintOK = true;
130  break;
132  {
133  OUString sTmp;
134  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
135  GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
136  if( XML_NAMESPACE_OOOW == nPrefix )
137  {
138  sFormula = sTmp;
139  bFormulaOK = true;
140  }
141  else
142  sFormula = OUString::fromUtf8(sAttrValue);
143  }
144  break;
146  if (IsXMLToken(sAttrValue, XML_FORMULA))
147  {
148  bDisplayFormula = true;
149  bDisplayNone = false;
150  bDisplayOK = true;
151  }
152  else if (IsXMLToken(sAttrValue, XML_VALUE))
153  {
154  bDisplayFormula = false;
155  bDisplayNone = false;
156  bDisplayOK = true;
157  }
158  else if (IsXMLToken(sAttrValue, XML_NONE))
159  {
160  bDisplayFormula = false;
161  bDisplayNone = true;
162  bDisplayOK = true;
163  } // else: no change
165  "illegal display values");
166  break;
167  default:
168  // delegate all others to value helper
169  aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
170  break;
171  }
172 }
173 
175  const Reference<XPropertySet> & xPropertySet)
176 {
177  // bSetName: not implemented
178 
179  if (bSetFormula)
180  {
182  {
183  sFormula = GetContent();
184  bFormulaOK = true;
185  }
186 
187  if (bFormulaOK)
188  {
189  xPropertySet->setPropertyValue(sAPI_content, Any(sFormula));
190  }
191  }
192 
194  {
195  xPropertySet->setPropertyValue("Hint", Any(sDescription));
196  }
197 
198  if (bSetHelp && bHelpOK)
199  {
200  xPropertySet->setPropertyValue("Help", Any(sHelp));
201  }
202 
203  if (bSetHint && bHintOK)
204  {
205  xPropertySet->setPropertyValue("Tooltip", Any(sHint));
206  }
207 
208  if (bSetVisible && bDisplayOK)
209  {
210  bool bTmp = !bDisplayNone;
211  xPropertySet->setPropertyValue(sAPI_is_visible, Any(bTmp));
212  }
213 
214  // workaround for #no-bug#: display formula by default
215  if (xPropertySet->getPropertySetInfo()->
216  hasPropertyByName("IsShowFormula") &&
218  {
219  bDisplayFormula = false;
220  bSetDisplayFormula = true;
221  }
222 
223 
224  if (bSetDisplayFormula)
225  {
226  bool bTmp = bDisplayFormula && bDisplayOK;
227  xPropertySet->setPropertyValue("IsShowFormula", Any(bTmp));
228  }
229 
230  // delegate to value helper
232  aValueHelper.PrepareField(xPropertySet);
233 
234  // finally, set the current presentation
235  if (bSetPresentation)
236  {
237  Any aAny;
238  aAny <<= GetContent();
239  xPropertySet->setPropertyValue(sAPI_current_presentation, aAny);
240  }
241 }
242 
243 
244 // variable set fields
245 
246 
248  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
249  const OUString& pServiceName, VarType eVarType,
250  bool bFormula, bool bFormulaDefault,
251  bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bIsDisplayFormula,
252  bool bType, bool bStyle, bool bValue, bool bPresentation) :
253  XMLVarFieldImportContext(rImport, rHlp, pServiceName,
254  bFormula, bFormulaDefault,
255  bDescription, bHelp, bHint, bVisible, bIsDisplayFormula,
256  bType, bStyle, bValue, bPresentation),
257  eFieldType(eVarType)
258 {
259 }
260 
262 {
263  // should we call PrepareField on the field, or rather on it's master?
264  // currently: call on field (just like superclass)
265  // possible alternatives: call on master
266  // call field or master depending on variable
267  // PrepareMaster() in addition to PrepareField()
268 
269  DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
270 
271  if (bValid)
272  {
273  DBG_ASSERT(!GetName().isEmpty(), "variable name needed!");
274 
275  // find field master
276  Reference<XPropertySet> xMaster;
277  if (FindFieldMaster(xMaster))
278  {
279  // create field/Service
280  Reference<XPropertySet> xPropSet;
281  if (CreateField(xPropSet, "com.sun.star.text.TextField." + GetServiceName()))
282  {
283  Reference<XDependentTextField> xDepTextField(xPropSet, UNO_QUERY);
284  if (xDepTextField.is())
285  {
286  // attach field to field master
287  xDepTextField->attachTextFieldMaster(xMaster);
288 
289  // attach field to document
290  Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
291  if (xTextContent.is())
292  {
293  try {
294  // insert, set field properties and exit!
295  GetImportHelper().InsertTextContent(xTextContent);
296  PrepareField(xPropSet);
297  } catch (lang::IllegalArgumentException & /*e*/)
298  {
299  // ignore e: #i54023#
300  };
301  return;
302  }
303  }
304  }
305  }
306  }
307 
308  // above: exit on success; so for all error cases we end up here!
309  // write element content
311 }
312 
314  Reference<XPropertySet> & xMaster)
315 {
316  // currently: delegate to XMLVariableDeclImportContext;
317  // should eventually go here
319  GetImport(),
320  GetImportHelper(),
321  GetName(),
322  eFieldType);
323 }
324 
325 
326 // sequence field
327 
328 
330  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
333  // formula
334  true, true,
335  false, false, false, false,
336  false,
337  false, false, false, true),
338 
339  sNumFormat(OUString('1')),
340  sNumFormatSync(GetXMLToken(XML_FALSE)),
341  bRefNameOK(false)
342 {
343 }
344 
346  sal_Int32 nAttrToken, std::string_view sAttrValue )
347 {
348  switch (nAttrToken)
349  {
351  sNumFormat = OUString::fromUtf8(sAttrValue);
352  break;
354  sNumFormatSync = OUString::fromUtf8(sAttrValue);
355  break;
357  sRefName = OUString::fromUtf8(sAttrValue);
358  bRefNameOK = true;
359  break;
360  default:
361  // delegate to super class (name, formula)
363  sAttrValue);
364  break;
365  } // switch
366 }
367 
369  const Reference<XPropertySet> & xPropertySet)
370 {
371  // delegate to super class (formula)
373 
374  // set format
375  sal_Int16 nNumType = NumberingType::ARABIC;
377  xPropertySet->setPropertyValue(sAPI_number_format, Any(nNumType));
378 
379  // handle reference name
380  if (bRefNameOK)
381  {
382  Any aAny = xPropertySet->getPropertyValue("SequenceValue");
383  sal_Int16 nValue = 0;
384  aAny >>= nValue;
386  }
387 }
388 
389 
390 // variable set field
391 
392 
394  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
397  // formula, value&type, style,
398  // display none
399  true, true,
400  false, false, false,
401  true, false,
402  true, true, true,
403  true)
404 {
405 }
406 
408  const Reference<XPropertySet> & xPropertySet)
409 {
410  // set type
411  Any aAny;
412  aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
413  xPropertySet->setPropertyValue(sAPI_sub_type, aAny);
414 
415  // the remainder is handled by super class
417 }
418 
419 
420 // variable input field
421 
422 
424  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
427  // description, display none/formula,
428  // value&type, style, formula
429  true, true,
430  true, true, true,
431  true, false,
432  true, true, true,
433  true)
434 {
435 }
436 
438  const Reference<XPropertySet> & xPropertySet)
439 {
440  // set type (input field)
441  Any aAny;
442  xPropertySet->setPropertyValue("Input", Any(true));
443 
444  // set type
445  aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
446  xPropertySet->setPropertyValue(sAPI_sub_type, aAny);
447 
448  // the remainder is handled by super class
450 }
451 
452 
453 // user field
454 
455 
457  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
458  XMLSetVarFieldImportContext(rImport, rHlp, sAPI_user,
460  // display none/formula, style
461  false, false,
462  false, false, false, true,
463  true,
464  false, true, false,
465  false)
466 {
467 }
468 
469 
470 // user input field
471 
472 
473 // bug: doesn't work (SO API lacking)
475  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
476  XMLVarFieldImportContext(rImport, rHlp, "InputUser",
477  // description, style
478  false, false,
479  true, false, false,
480  false, false,
481  false /*???*/, true, false,
482  false)
483 {
484 }
485 
487  const Reference<XPropertySet> & xPropertySet)
488 {
489  xPropertySet->setPropertyValue(sAPI_content, Any(GetName()));
490 
491  // delegate to super class
493 }
494 
495 
496 // variable get field
497 
498 
500  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
502  // style, display formula
503  false, false,
504  false, false, false,
505  false, true,
506  true, true, false,
507  true)
508 {
509 }
510 
512  const Reference<XPropertySet> & xPropertySet)
513 {
514  // set name
515  xPropertySet->setPropertyValue(sAPI_content, Any(GetName()));
516 
517  // the remainder is handled by super class
519 }
520 
521 
522 // expression field
523 
524 
526  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
528  // formula, type, style, display formula
529  true, true,
530  false, false, false,
531  false, true,
532  true, true, false,
533  true)
534 {
535  bValid = true; // always valid
536 }
537 
538 
540  const Reference<XPropertySet> & xPropertySet)
541 {
542  xPropertySet->setPropertyValue(sAPI_sub_type, Any(sal_Int16(SetVariableType::FORMULA)));
543 
544  // delegate to super class
546 }
547 
548 
549 // text input field
550 
551 
553  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
554  XMLVarFieldImportContext(rImport, rHlp, "Input",
555  // description
556  false, false,
557  true, true, true,
558  false, false,
559  false, false, false,
560  false)
561 {
562  bValid = true; // always valid
563 }
564 
566  const Reference<XPropertySet> & xPropertySet)
567 {
569 
570  xPropertySet->setPropertyValue(sAPI_content, Any(GetContent()));
571 }
572 
573 
574 // table formula field
575 
576 
578  SvXMLImport& rImport,
579  XMLTextImportHelper& rHlp) :
580  XMLTextFieldImportContext(rImport, rHlp, "TableFormula"),
581  aValueHelper(rImport, rHlp, false, true, false, true),
582  bIsShowFormula(false)
583 {
584 }
585 
587  sal_Int32 nAttrToken,
588  std::string_view sAttrValue )
589 {
590  switch (nAttrToken)
591  {
593  aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
594  bValid = true; // we need a formula!
595  break;
596 
598  aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
599  break;
601  if ( sAttrValue == "formula" )
602  bIsShowFormula = true;
603  break;
604  default:
605  // unknown attribute -> ignore
606  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
607  break;
608  }
609 }
610 
612  const Reference<XPropertySet> & xPropertySet)
613 {
614  // set format and formula
615  aValueHelper.PrepareField( xPropertySet );
616 
617  Any aAny;
618 
619  // set 'show formula' and presentation
620  xPropertySet->setPropertyValue( "IsShowFormula", Any(bIsShowFormula) );
621 
622  aAny <<= GetContent();
623  xPropertySet->setPropertyValue( "CurrentPresentation", aAny );
624 }
625 
626 
627 // variable declarations
628 
629 // Should be adapted to XMLVarField-/XMLSetVarFieldImportContext scheme!
630 
631 
632 // declaration container import (<variable/user-field/sequence-decls>)
633 
634 
636  SvXMLImport& rImport, XMLTextImportHelper& rHlp, enum VarType eVarType) :
637  SvXMLImportContext(rImport),
638  eVarDeclsContextType(eVarType),
639  rImportHelper(rHlp)
640 {
641 }
642 
643 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLVariableDeclsImportContext::createFastChildContext(
644  sal_Int32 nElement,
645  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
646 {
647  SvXMLImportContextRef xImportContext;
648 
649  if( IsTokenInNamespace(nElement, XML_NAMESPACE_TEXT) )
650  {
651  enum XMLTokenEnum eElementName;
652  switch (eVarDeclsContextType)
653  {
654  case VarTypeSequence:
655  eElementName = XML_SEQUENCE_DECL;
656  break;
657  case VarTypeSimple:
658  eElementName = XML_VARIABLE_DECL;
659  break;
660  case VarTypeUserField:
661  eElementName = XML_USER_FIELD_DECL;
662  break;
663  default:
664  OSL_FAIL("unknown field type!");
665  eElementName = XML_SEQUENCE_DECL;
666  break;
667  }
668 
669  if( nElement == XML_ELEMENT(TEXT, eElementName) )
670  {
671  return new XMLVariableDeclImportContext(
672  GetImport(), rImportHelper, nElement, xAttrList,
674  }
675  }
676 
677  // if no context was created, use default context
678  return nullptr;
679 }
680 
681 
682 // declaration import (<variable/user-field/sequence-decl> elements)
683 
684 
686  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
687  sal_Int32 nElement,
688  const Reference<xml::sax::XFastAttributeList> & xAttrList,
689  enum VarType eVarType) :
690  SvXMLImportContext(rImport)
691 {
692  // bug?? which properties for userfield/userfieldmaster
693  XMLValueImportHelper aValueHelper(rImport, rHlp, true, false, true, false);
694  sal_Unicode cSeparationChar('.');
695 
696  sal_Int8 nNumLevel(-1);
697  OUString sName;
698 
699  if (nElement != XML_ELEMENT(TEXT, XML_SEQUENCE_DECL) &&
700  nElement != XML_ELEMENT(TEXT, XML_VARIABLE_DECL) &&
701  nElement != XML_ELEMENT(TEXT, XML_USER_FIELD_DECL) )
702  return;
703 
704  // TODO: check validity (need name!)
705 
706  // parse attributes
707  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
708  {
709  switch (aIter.getToken())
710  {
711  case XML_ELEMENT(TEXT, XML_NAME):
712  sName = aIter.toString();
713  break;
715  {
716  sal_Int32 nLevel;
717  bool const bRet = ::sax::Converter::convertNumber(
718  nLevel, aIter.toView(), 0,
719  GetImport().GetTextImport()->GetChapterNumbering()->
720  getCount());
721  if (bRet)
722  {
723  nNumLevel = static_cast< sal_Int8 >( nLevel-1 ); // API numbers -1..9
724  }
725  break;
726  }
728  cSeparationChar =
729  static_cast<char>(aIter.toString().toChar());
730  break;
731 
732  default:
733  // delegate to value helper
734  aValueHelper.ProcessAttribute(aIter.getToken(), aIter.toView());
735  break;
736  }
737  }
738 
739  Reference<XPropertySet> xFieldMaster;
740  if (!FindFieldMaster(xFieldMaster, GetImport(), rHlp,
741  sName, eVarType))
742  return;
743 
744  // now we have a field master: process attributes!
745  Any aAny;
746 
747  switch (eVarType)
748  {
749  case VarTypeSequence:
750  xFieldMaster->setPropertyValue("ChapterNumberingLevel", Any(nNumLevel));
751 
752  if (nNumLevel >= 0)
753  {
754  OUString sStr(&cSeparationChar, 1);
755  xFieldMaster->setPropertyValue(
756  "NumberingSeparator", Any(sStr));
757  }
758  break;
759  case VarTypeSimple:
760  {
761  // set string or non-string SubType (#93192#)
762  // The SubType was already set in the FindFieldMaster
763  // method, but it needs to be adjusted if it's a string.
764  aAny <<= aValueHelper.IsStringValue()
765  ? SetVariableType::STRING : SetVariableType::VAR;
766  xFieldMaster->setPropertyValue(sAPI_sub_type, aAny);
767  }
768  break;
769  case VarTypeUserField:
770  {
771  bool bTmp = !aValueHelper.IsStringValue();
772  xFieldMaster->setPropertyValue("IsExpression", Any(bTmp));
773  aValueHelper.PrepareField(xFieldMaster);
774  break;
775  }
776  default:
777  OSL_FAIL("unknown varfield type");
778  } // switch
779 }
780 
781 
783  Reference<XPropertySet> & xMaster, SvXMLImport& rImport,
784  XMLTextImportHelper& rImportHelper,
785  const OUString& sVarName, enum VarType eVarType)
786 {
787  static sal_Int32 nCollisionCount = 0;
788 
789  // rename field
790  // currently: no family in use! Use 0.
791  OUString sName = rImportHelper.GetRenameMap().Get(
792  sal::static_int_cast< sal_uInt16 >(eVarType), sVarName);
793 
794  // get text fields supplier and field masters
795  Reference<XTextFieldsSupplier> xTextFieldsSupp(rImport.GetModel(),
796  UNO_QUERY);
797  Reference<container::XNameAccess> xFieldMasterNameAccess =
798  xTextFieldsSupp->getTextFieldMasters();
799 
800  OUString sVarServiceName =
801  OUString::Concat(sAPI_fieldmaster_prefix) +
803  "." +
804  sName;
805 
806  OUString sUserServiceName =
807  OUString::Concat(sAPI_fieldmaster_prefix) +
808  sAPI_user +
809  "." +
810  sName;
811 
812  if (xFieldMasterNameAccess->hasByName(sVarServiceName)) {
813  // variable field master already in document
814 
815  Any aAny = xFieldMasterNameAccess->getByName(sVarServiceName);
816  aAny >>= xMaster;
817 
818  aAny = xMaster->getPropertyValue(sAPI_sub_type);
819  sal_Int16 nType = 0;
820  aAny >>= nType;
821 
822  enum VarType eFMVarType =
823  (SetVariableType::SEQUENCE == nType) ?
825 
826  if (eFMVarType != eVarType)
827  {
828  ++nCollisionCount;
829  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
830 
831  // FIXME! can't find if name is taken already!!!!
832 
833  rImportHelper.GetRenameMap().Add(
834  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
835 
836  // call FindFieldMaster recursively to create new master
837  return FindFieldMaster(xMaster, rImport, rImportHelper,
838  sNew, eVarType);
839  }
840  } else if (xFieldMasterNameAccess->hasByName(sUserServiceName)) {
841  // user field: get field master
842  Any aAny = xFieldMasterNameAccess->getByName(sUserServiceName);
843  aAny >>= xMaster;
844 
845  if (VarTypeUserField != eVarType) {
846  ++nCollisionCount;
847  // find new name that is not taken
848  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
849 
850  // FIXME! can't find if name is taken already!!!!
851 
852  rImportHelper.GetRenameMap().Add(
853  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
854 
855  // call FindFieldMaster recursively to create new master
856  return FindFieldMaster(xMaster, rImport, rImportHelper,
857  sNew, eVarType);
858  }
859  } else {
860  // field name not used: create field master
861 
862  // import -> model is MultiServiceFactory -> createInstance
863  Reference<lang::XMultiServiceFactory>
864  xFactory(rImport.GetModel(),UNO_QUERY);
865  if( xFactory.is() ) {
866 
867  OUStringBuffer sService;
868  sService.append(sAPI_fieldmaster_prefix);
869  sService.append((eVarType==VarTypeUserField) ?
870  OUString(sAPI_user) : OUString(sAPI_set_expression));
871  Reference<XInterface> xIfc =
872  xFactory->createInstance( sService.makeStringAndClear() );
873  if (xIfc.is()) {
874  Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
875  xMaster = xTmp;
876 
877  // set name
878  xMaster->setPropertyValue("Name", Any(sName));
879 
880  if (eVarType != VarTypeUserField) {
881  // set subtype for setexp field
882  Any aAny;
883  aAny <<= ((eVarType == VarTypeSimple) ?
884  SetVariableType::VAR :
885  SetVariableType::SEQUENCE);
886  xMaster->setPropertyValue(sAPI_sub_type, aAny);
887  } // else : user field: no subtype
888 
889  } else {
890  return false;
891  }
892  } else {
893  return false;
894  }
895  }
896 
897  DBG_ASSERT(xMaster.is(), "no field master found!?!");
898  return true;
899 }
900 
901 
902 // Database Display field import
903 
904 
906  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
907  XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database, false),
908  aValueHelper(rImport, rHlp, false, true, false, false),
909  bColumnOK(false),
910  bDisplay( true ),
911  bDisplayOK( false )
912 {
913 }
914 
916  sal_Int32 nAttrToken, std::string_view sAttrValue )
917 {
918  switch (nAttrToken)
919  {
921  sColumnName = OUString::fromUtf8(sAttrValue);
922  bColumnOK = true;
923  break;
925  {
926  bool bNone = IsXMLToken( sAttrValue, XML_NONE );
927  bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
928  bDisplay = bValue;
929  bDisplayOK = bNone || bValue;
930  }
931  break;
935  // handled by super class
937  sAttrValue);
938  break;
939  default:
940  // remainder handled by value helper
941  aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
942  break;
943  }
944 
946 }
947 
949 {
950  // we have an EndElement of our own, because database fields need
951  // to be attached to a field master before they can be inserted into
952  // the document. Database stuff (database, table, column) all goes
953  // to the field master, value & style go to the field.
954 
955  if (bValid)
956  {
957 
958  // so here goes: we start with the master
959  Reference<XPropertySet> xMaster;
960 
961  // create and prepare field master first
962  if (CreateField(xMaster,
963  "com.sun.star.text.FieldMaster.Database"))
964  {
965  Any aAny;
966  xMaster->setPropertyValue("DataColumnName", Any(sColumnName));
967 
968  // fieldmaster takes database, table and column name
970 
971  // create field
973  if (CreateField(xField,
974  sAPI_database))
975  {
976  // attach field master
977  Reference<XDependentTextField> xDepField(xField, UNO_QUERY);
978  if (xDepField.is())
979  {
980  // attach field to field master
981  xDepField->attachTextFieldMaster(xMaster);
982 
983  // attach field to document
984  Reference<XTextContent> xTextContent(xField, UNO_QUERY);
985  if (xTextContent.is())
986  {
987  // insert, set field properties and exit!
988  try
989  {
990  GetImportHelper().InsertTextContent(xTextContent);
991 
992  // prepare field: format from database?
993  bool bTmp = !aValueHelper.IsFormatOK();
994  xField->setPropertyValue("DataBaseFormat", Any(bTmp));
995 
996  // value, value-type and format done by value helper
997  aValueHelper.PrepareField(xField);
998 
999  // visibility
1000  if( bDisplayOK )
1001  {
1002  xField->setPropertyValue(sAPI_is_visible, Any(bDisplay));
1003  }
1004 
1005  // set presentation
1006  aAny <<= GetContent();
1007  xField->setPropertyValue(sAPI_current_presentation, aAny);
1008 
1009  // success!
1010  return;
1011  }
1012  catch (const lang::IllegalArgumentException&)
1013  {
1014  TOOLS_WARN_EXCEPTION("xmloff.text", "Failed to insert text content");
1015  }
1016  }
1017  }
1018  }
1019  }
1020  }
1021 
1022  // above: exit on success; so for all error cases we end up here!
1023  // write element content
1025 }
1026 
1027 
1028 // value import helper
1029 
1030 namespace {
1031 
1033 {
1034  XML_VALUE_TYPE_STRING,
1035  XML_VALUE_TYPE_FLOAT,
1036  XML_VALUE_TYPE_CURRENCY,
1037  XML_VALUE_TYPE_PERCENTAGE,
1038  XML_VALUE_TYPE_DATE,
1039  XML_VALUE_TYPE_TIME,
1040  XML_VALUE_TYPE_BOOLEAN
1041 };
1042 
1043 }
1044 
1046 {
1047  { XML_FLOAT, XML_VALUE_TYPE_FLOAT },
1048  { XML_CURRENCY, XML_VALUE_TYPE_CURRENCY },
1049  { XML_PERCENTAGE, XML_VALUE_TYPE_PERCENTAGE },
1050  { XML_DATE, XML_VALUE_TYPE_DATE },
1051  { XML_TIME, XML_VALUE_TYPE_TIME },
1052  { XML_BOOLEAN, XML_VALUE_TYPE_BOOLEAN },
1053  { XML_STRING, XML_VALUE_TYPE_STRING },
1055 };
1056 
1058  SvXMLImport& rImprt,
1059  XMLTextImportHelper& rHlp,
1060  bool bType, bool bStyle, bool bValue, bool bFormula) :
1061 
1062  rImport(rImprt),
1063  rHelper(rHlp),
1064 
1065  fValue(0.0),
1066  nFormatKey(0),
1067  bIsDefaultLanguage(true),
1068 
1069  bStringType(false),
1070  bFormatOK(false),
1071  bStringValueOK(false),
1072  bFormulaOK(false),
1073 
1074  bSetType(bType),
1075  bSetValue(bValue),
1076  bSetStyle(bStyle),
1077  bSetFormula(bFormula)
1078 {
1079 }
1080 
1082  sal_Int32 nAttrToken, std::string_view sAttrValue )
1083 {
1084  switch (nAttrToken)
1085  {
1086  case XML_ELEMENT(TEXT, XML_VALUE_TYPE): // #i32362#: src680m48++ saves text:value-type
1088  {
1089  // convert enum
1090  ValueType eValueType = XML_VALUE_TYPE_STRING;
1091  bool bRet = SvXMLUnitConverter::convertEnum(
1092  eValueType, sAttrValue, aValueTypeMap);
1093 
1094  if (bRet) {
1095  switch (eValueType)
1096  {
1097  case XML_VALUE_TYPE_STRING:
1098  bStringType = true;
1099  break;
1100  case XML_VALUE_TYPE_FLOAT:
1101  case XML_VALUE_TYPE_CURRENCY:
1102  case XML_VALUE_TYPE_PERCENTAGE:
1103  case XML_VALUE_TYPE_DATE:
1104  case XML_VALUE_TYPE_TIME:
1105  case XML_VALUE_TYPE_BOOLEAN:
1106  bStringType = false;
1107  break;
1108 
1109  default:
1110  OSL_FAIL("unknown value type");
1111  }
1112  }
1113  break;
1114  }
1115 
1116  case XML_ELEMENT(TEXT, XML_VALUE):
1117  case XML_ELEMENT(OFFICE, XML_VALUE):
1118  {
1119  double fTmp;
1120  bool const bRet = ::sax::Converter::convertDouble(fTmp,sAttrValue);
1121  if (bRet) {
1122  fValue = fTmp;
1123  }
1124  break;
1125  }
1126 
1129  {
1130  double fTmp;
1131  bool const bRet =
1132  ::sax::Converter::convertDuration(fTmp, sAttrValue);
1133  if (bRet) {
1134  fValue = fTmp;
1135  }
1136  break;
1137  }
1138 
1141  {
1142  double fTmp;
1143  bool bRet = rImport.GetMM100UnitConverter().
1144  convertDateTime(fTmp,sAttrValue);
1145  if (bRet) {
1146  fValue = fTmp;
1147  }
1148  break;
1149  }
1150 
1152  {
1153  bool bTmp(false);
1154  bool bRet = ::sax::Converter::convertBool(bTmp, sAttrValue);
1155  if (bRet) {
1156  fValue = (bTmp ? 1.0 : 0.0);
1157  }
1158  else
1159  {
1160  double fTmp;
1161  bRet = ::sax::Converter::convertDouble(fTmp, sAttrValue);
1162  if (bRet) {
1163  fValue = fTmp;
1164  }
1165  }
1166  break;
1167  }
1168 
1171  sValue = OUString::fromUtf8(sAttrValue);
1172  bStringValueOK = true;
1173  break;
1174 
1175  case XML_ELEMENT(TEXT, XML_FORMULA):
1176  {
1177  OUString sTmp;
1178  sal_uInt16 nPrefix = rImport.GetNamespaceMap().
1179  GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1180  if( XML_NAMESPACE_OOOW == nPrefix )
1181  {
1182  sFormula = sTmp;
1183  bFormulaOK = true;
1184  }
1185  else
1186  sFormula = OUString::fromUtf8(sAttrValue);
1187  }
1188  break;
1189 
1191  {
1192  sal_Int32 nKey = rHelper.GetDataStyleKey(
1193  OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1194  if (-1 != nKey)
1195  {
1196  nFormatKey = nKey;
1197  bFormatOK = true;
1198  }
1199  break;
1200  }
1201  default:
1202  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1203  } // switch
1204 }
1205 
1207  const Reference<XPropertySet> & xPropertySet)
1208 {
1209  Any aAny;
1210 
1211  if (bSetType)
1212  {
1213  // ??? how to set type?
1214  }
1215 
1216  if (bSetFormula)
1217  {
1218  aAny <<= !bFormulaOK ? sDefault : sFormula;
1219  xPropertySet->setPropertyValue(sAPI_content, aAny);
1220  }
1221 
1222  // format/style
1223  if (bSetStyle && bFormatOK)
1224  {
1225  xPropertySet->setPropertyValue(sAPI_number_format, Any(nFormatKey));
1226 
1227  if( xPropertySet->getPropertySetInfo()->
1228  hasPropertyByName( "IsFixedLanguage" ) )
1229  {
1230  bool bIsFixedLanguage = ! bIsDefaultLanguage;
1231  xPropertySet->setPropertyValue( "IsFixedLanguage", Any(bIsFixedLanguage) );
1232  }
1233  }
1234 
1235  // value: string or float
1236  if (bSetValue)
1237  {
1238  if (bStringType)
1239  {
1240  aAny <<= !bStringValueOK ? sDefault : sValue;
1241  xPropertySet->setPropertyValue(sAPI_content, aAny);
1242  }
1243  else
1244  {
1245  xPropertySet->setPropertyValue("Value", Any(fValue));
1246  }
1247  }
1248 }
1249 
1250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool FindFieldMaster(css::uno::Reference< css::beans::XPropertySet > &xMaster)
find appropriate field master
Definition: txtvfldi.cxx:313
double fValue
string value (only valid if bStringValueOK)
Definition: txtvfldi.hxx:38
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:402
XMLValueImportHelper aValueHelper
hint
Definition: txtvfldi.hxx:113
void SetDefault(const OUString &sStr)
Definition: txtvfldi.hxx:77
XMLVariableDeclsImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, enum VarType eVarType)
Definition: txtvfldi.cxx:635
bool bSetDisplayFormula
set IsVisible
Definition: txtvfldi.hxx:129
const bool bSetType
have we read the formula attribute?
Definition: txtvfldi.hxx:49
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:539
enum VarType eVarDeclsContextType
Definition: txtvfldi.hxx:359
const bool bSetFormula
should PrepareField set NumberFormat?
Definition: txtvfldi.hxx:52
superclass for database fields: handle database and table names
Definition: txtfldi.hxx:307
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:565
constexpr OUStringLiteral sAPI_is_visible
Definition: txtvfldi.cxx:66
signed char sal_Int8
XMLVariableInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:423
const OUString & Get(sal_uInt16 nKind, const OUString &rName) const
Definition: i18nmap.cxx:32
sal_Int32 nFormatKey
double value (only valid if bFloatValueOK)
Definition: txtvfldi.hxx:39
constexpr char16_t sAPI_fieldmaster_prefix[]
#file
Definition: txtvfldi.cxx:56
XMLTextInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:552
constexpr OUStringLiteral sAPI_current_presentation
Definition: txtvfldi.cxx:67
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
XMLUserFieldInputImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:474
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
set presentation from elem. content
Definition: txtvfldi.cxx:109
#define XMLOFF_WARN_UNKNOWN_ATTR(area, token, value)
Definition: xmlictxt.hxx:116
bool bDescriptionOK
sFormula was set
Definition: txtvfldi.hxx:118
abstract class for text field import
Definition: txtfldi.hxx:49
OUString sHint
help text
Definition: txtvfldi.hxx:112
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
create, prepare and insert database field master and database field
Definition: txtvfldi.cxx:948
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:397
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3481
XMLVariableSetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:393
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
SvI18NMap & GetRenameMap()
Definition: txtimp.cxx:2056
bool bSetPresentation
set DisplayFormula (sub type???)
Definition: txtvfldi.hxx:130
upperclass for variable/user-set, var/user-input, and sequence fields inds field master of appropriat...
Definition: txtvfldi.hxx:223
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: txtvfldi.cxx:368
VarType
variable type (for XMLSetVarFieldImportContext)
Definition: txtimp.hxx:81
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:486
const OUString & GetServiceName() const
Definition: txtfldi.hxx:92
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1115
OUString sDescription
formula attribute
Definition: txtvfldi.hxx:110
bool CreateField(css::uno::Reference< css::beans::XPropertySet > &xField, const OUString &sServiceName)
create field from ServiceName
Definition: txtfldi.cxx:191
abstract parent class for all variable related fields
Definition: txtvfldi.hxx:105
XMLTextImportHelper & rHelper
Definition: txtvfldi.hxx:35
constexpr OUStringLiteral sAPI_set_expression
Definition: txtvfldi.cxx:58
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
sal_uInt16 sal_Unicode
constexpr OUStringLiteral sAPI_number_format
Definition: txtvfldi.cxx:65
bool IsFormatOK() const
has format been read?
Definition: txtvfldi.hxx:75
void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue)
process formula (Prep.F.)
Definition: txtvfldi.cxx:1081
OUString sFormula
format key (only valid of bFormatOK)
Definition: txtvfldi.hxx:40
void InsertString(const OUString &rChars)
Definition: txtimp.cxx:701
constexpr OUStringLiteral sAPI_get_expression
Definition: txtvfldi.cxx:57
bool bSetFormulaDefault
set Formula property
Definition: txtvfldi.hxx:124
bool bDisplayFormula
value, value-type, and style
Definition: txtvfldi.hxx:114
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:511
XMLSequenceFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:329
constexpr OUStringLiteral sAPI_user
Definition: txtvfldi.cxx:59
void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet)
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:1206
sal_Int16 nNumType
bool IsStringValue() const
Definition: txtvfldi.hxx:165
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtvfldi.cxx:345
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
text import helper
Definition: txtvfldi.cxx:915
const char * sName
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
bool convertNumFormat(sal_Int16 &rType, const OUString &rNumFormat, std::u16string_view rNumLetterSync, bool bNumberNone=false) const
convert num-format and num-letter-sync values to NumberingType
Definition: xmluconv.cxx:686
constexpr OUStringLiteral sAPI_database
Definition: txtvfldi.cxx:60
OUString sHelp
description
Definition: txtvfldi.hxx:111
XMLTextImportHelper & rImportHelper
Definition: txtvfldi.hxx:360
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
text import helper
Definition: txtvfldi.cxx:586
bool bDisplayNone
display formula?(rather than value)
Definition: txtvfldi.hxx:115
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:427
#define TOOLS_WARN_EXCEPTION(area, stream)
bool bSetFormula
sDisplayFormula/-None were set
Definition: txtvfldi.hxx:123
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:174
#define DBG_ASSERT(sCon, aError)
bool bDisplayOK
sHint was set
Definition: txtvfldi.hxx:121
constexpr sal_uInt16 XML_NAMESPACE_TEXT
void Add(sal_uInt16 nKind, const OUString &rName, const OUString &rNewName)
Definition: i18nmap.cxx:24
XMLTextImportHelper & GetImportHelper()
get helper
Definition: txtfldi.hxx:90
OUString sFormula
name attribute
Definition: txtvfldi.hxx:109
bool bSetDescription
use content as default for formula
Definition: txtvfldi.hxx:125
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:407
float u
bool bFormatOK
is this a string (or a float) type?
Definition: txtvfldi.hxx:45
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
const bool bSetValue
should PrepareField set the SetExp subtype?
Definition: txtvfldi.hxx:50
const OUString & GetName() const
Definition: txtvfldi.hxx:164
static bool convertBool(bool &rBool, std::u16string_view rString)
bool bHelpOK
sDescription was set
Definition: txtvfldi.hxx:119
constexpr OUStringLiteral sAPI_sub_type
Definition: txtvfldi.cxx:64
bool bIsDefaultLanguage
default (see bStringDefault/bFormulaDef.)
Definition: txtvfldi.hxx:42
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
bool bStringType
format (of nFormatKey) has system language?
Definition: txtvfldi.hxx:44
void InsertTextContent(css::uno::Reference< css::text::XTextContent > const &xContent)
Definition: txtimp.cxx:757
bool bSetHelp
set sDescription with Hint-property
Definition: txtvfldi.hxx:126
Map an XMLTokenEnum to an enum value.
Definition: ximpshap.hxx:39
ValueType
OUString const & GetContent()
Definition: txtfldi.cxx:144
XMLUserFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:456
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:103
static bool FindFieldMaster(css::uno::Reference< css::beans::XPropertySet > &xMaster, SvXMLImport &rImport, XMLTextImportHelper &rHelper, const OUString &sVarName, enum VarType eVarType)
variable type
Definition: txtvfldi.cxx:782
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3425
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:437
void InsertSequenceID(const OUString &sXMLId, const OUString &sName, sal_Int16 nAPIId)
insert new sequence ID Also fixup open references from backpatch list to this ID. ...
Handling of tokens in XML:
const bool bSetStyle
should PrepareField set content/value?
Definition: txtvfldi.hxx:51
XMLExpressionFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:525
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:96
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:138
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:399
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:403
QPRO_FUNC_TYPE nType
XMLVariableDeclImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, enum VarType eVarType)
Definition: txtvfldi.cxx:685
variable field declarations (variable-decl, user-field-decl, sequence-decl)
Definition: txtvfldi.hxx:378
bool bHintOK
sHelp was set
Definition: txtvfldi.hxx:120
bool bFormulaOK
have we read a string-value attr.?
Definition: txtvfldi.hxx:47
constexpr OUStringLiteral sAPI_content
Definition: txtvfldi.cxx:63
ValueType
Definition: txtvfldi.cxx:1032
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
variable type
Definition: txtvfldi.cxx:643
Reference< XSingleServiceFactory > xFactory
OUString sDefault
formula string
Definition: txtvfldi.hxx:41
SvXMLImport & rImport
Definition: txtvfldi.hxx:34
XMLSetVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName, VarType eVarType, bool bFormula, bool bFormulaDefault, bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bDisplayFormula, bool bType, bool bStyle, bool bValue, bool bPresentation)
Definition: txtvfldi.cxx:247
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
see XMLTextFieldImportContext
Definition: txtvfldi.cxx:261
bool bStringValueOK
have we read a style:data-style-name attr.?
Definition: txtvfldi.hxx:46
XMLTableFormulaImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:577
XMLDatabaseDisplayImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:905
SvXMLEnumMapEntry< ValueType > const aValueTypeMap[]
Definition: txtvfldi.cxx:1045
bool bFormulaOK
hide field?
Definition: txtvfldi.hxx:117
constexpr sal_uInt16 XML_NAMESPACE_OOOW
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtfldi.cxx:1194
XMLVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName, bool bFormula, bool bFormulaDefault, bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bDisplayFormula, bool bType, bool bStyle, bool bValue, bool bPresentation)
set presentation frm elem. content?
Definition: txtvfldi.cxx:81
TEXT
bool IsStringValue() const
is value a string (rather than double)?
Definition: txtvfldi.hxx:72
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:611
sal_Int16 nValue
XMLValueImportHelper(SvXMLImport &rImprt, XMLTextImportHelper &rHlp, bool bType, bool bStyle, bool bValue, bool bFormula)
should PrepareField set Formula?
Definition: txtvfldi.cxx:1057
XMLVariableGetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:499
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
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:1936