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  if( IsTokenInNamespace(nElement, XML_NAMESPACE_TEXT) )
648  {
649  enum XMLTokenEnum eElementName;
650  switch (eVarDeclsContextType)
651  {
652  case VarTypeSequence:
653  eElementName = XML_SEQUENCE_DECL;
654  break;
655  case VarTypeSimple:
656  eElementName = XML_VARIABLE_DECL;
657  break;
658  case VarTypeUserField:
659  eElementName = XML_USER_FIELD_DECL;
660  break;
661  default:
662  OSL_FAIL("unknown field type!");
663  eElementName = XML_SEQUENCE_DECL;
664  break;
665  }
666 
667  if( nElement == XML_ELEMENT(TEXT, eElementName) )
668  {
669  return new XMLVariableDeclImportContext(
670  GetImport(), rImportHelper, nElement, xAttrList,
672  }
673  }
674 
675  // if no context was created, use default context
676  return nullptr;
677 }
678 
679 
680 // declaration import (<variable/user-field/sequence-decl> elements)
681 
682 
684  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
685  sal_Int32 nElement,
686  const Reference<xml::sax::XFastAttributeList> & xAttrList,
687  enum VarType eVarType) :
688  SvXMLImportContext(rImport)
689 {
690  // bug?? which properties for userfield/userfieldmaster
691  XMLValueImportHelper aValueHelper(rImport, rHlp, true, false, true, false);
692  sal_Unicode cSeparationChar('.');
693 
694  sal_Int8 nNumLevel(-1);
695  OUString sName;
696 
697  if (nElement != XML_ELEMENT(TEXT, XML_SEQUENCE_DECL) &&
698  nElement != XML_ELEMENT(TEXT, XML_VARIABLE_DECL) &&
699  nElement != XML_ELEMENT(TEXT, XML_USER_FIELD_DECL) )
700  return;
701 
702  // TODO: check validity (need name!)
703 
704  // parse attributes
705  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
706  {
707  switch (aIter.getToken())
708  {
709  case XML_ELEMENT(TEXT, XML_NAME):
710  sName = aIter.toString();
711  break;
713  {
714  sal_Int32 nLevel;
715  bool const bRet = ::sax::Converter::convertNumber(
716  nLevel, aIter.toView(), 0,
717  GetImport().GetTextImport()->GetChapterNumbering()->
718  getCount());
719  if (bRet)
720  {
721  nNumLevel = static_cast< sal_Int8 >( nLevel-1 ); // API numbers -1..9
722  }
723  break;
724  }
726  cSeparationChar =
727  static_cast<char>(aIter.toString().toChar());
728  break;
729 
730  default:
731  // delegate to value helper
732  aValueHelper.ProcessAttribute(aIter.getToken(), aIter.toView());
733  break;
734  }
735  }
736 
737  Reference<XPropertySet> xFieldMaster;
738  if (!FindFieldMaster(xFieldMaster, GetImport(), rHlp,
739  sName, eVarType))
740  return;
741 
742  // now we have a field master: process attributes!
743  Any aAny;
744 
745  switch (eVarType)
746  {
747  case VarTypeSequence:
748  xFieldMaster->setPropertyValue("ChapterNumberingLevel", Any(nNumLevel));
749 
750  if (nNumLevel >= 0)
751  {
752  OUString sStr(&cSeparationChar, 1);
753  xFieldMaster->setPropertyValue(
754  "NumberingSeparator", Any(sStr));
755  }
756  break;
757  case VarTypeSimple:
758  {
759  // set string or non-string SubType (#93192#)
760  // The SubType was already set in the FindFieldMaster
761  // method, but it needs to be adjusted if it's a string.
762  aAny <<= aValueHelper.IsStringValue()
763  ? SetVariableType::STRING : SetVariableType::VAR;
764  xFieldMaster->setPropertyValue(sAPI_sub_type, aAny);
765  }
766  break;
767  case VarTypeUserField:
768  {
769  bool bTmp = !aValueHelper.IsStringValue();
770  xFieldMaster->setPropertyValue("IsExpression", Any(bTmp));
771  aValueHelper.PrepareField(xFieldMaster);
772  break;
773  }
774  default:
775  OSL_FAIL("unknown varfield type");
776  } // switch
777 }
778 
779 
781  Reference<XPropertySet> & xMaster, SvXMLImport& rImport,
782  XMLTextImportHelper& rImportHelper,
783  const OUString& sVarName, enum VarType eVarType)
784 {
785  static sal_Int32 nCollisionCount = 0;
786 
787  // rename field
788  // currently: no family in use! Use 0.
789  OUString sName = rImportHelper.GetRenameMap().Get(
790  sal::static_int_cast< sal_uInt16 >(eVarType), sVarName);
791 
792  // get text fields supplier and field masters
793  Reference<XTextFieldsSupplier> xTextFieldsSupp(rImport.GetModel(),
794  UNO_QUERY);
795  Reference<container::XNameAccess> xFieldMasterNameAccess =
796  xTextFieldsSupp->getTextFieldMasters();
797 
798  OUString sVarServiceName =
799  OUString::Concat(sAPI_fieldmaster_prefix) +
801  "." +
802  sName;
803 
804  OUString sUserServiceName =
805  OUString::Concat(sAPI_fieldmaster_prefix) +
806  sAPI_user +
807  "." +
808  sName;
809 
810  if (xFieldMasterNameAccess->hasByName(sVarServiceName)) {
811  // variable field master already in document
812 
813  Any aAny = xFieldMasterNameAccess->getByName(sVarServiceName);
814  aAny >>= xMaster;
815 
816  aAny = xMaster->getPropertyValue(sAPI_sub_type);
817  sal_Int16 nType = 0;
818  aAny >>= nType;
819 
820  enum VarType eFMVarType =
821  (SetVariableType::SEQUENCE == nType) ?
823 
824  if (eFMVarType != eVarType)
825  {
826  ++nCollisionCount;
827  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
828 
829  // FIXME! can't find if name is taken already!!!!
830 
831  rImportHelper.GetRenameMap().Add(
832  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
833 
834  // call FindFieldMaster recursively to create new master
835  return FindFieldMaster(xMaster, rImport, rImportHelper,
836  sNew, eVarType);
837  }
838  } else if (xFieldMasterNameAccess->hasByName(sUserServiceName)) {
839  // user field: get field master
840  Any aAny = xFieldMasterNameAccess->getByName(sUserServiceName);
841  aAny >>= xMaster;
842 
843  if (VarTypeUserField != eVarType) {
844  ++nCollisionCount;
845  // find new name that is not taken
846  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
847 
848  // FIXME! can't find if name is taken already!!!!
849 
850  rImportHelper.GetRenameMap().Add(
851  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
852 
853  // call FindFieldMaster recursively to create new master
854  return FindFieldMaster(xMaster, rImport, rImportHelper,
855  sNew, eVarType);
856  }
857  } else {
858  // field name not used: create field master
859 
860  // import -> model is MultiServiceFactory -> createInstance
861  Reference<lang::XMultiServiceFactory>
862  xFactory(rImport.GetModel(),UNO_QUERY);
863  if( xFactory.is() ) {
864 
865  OUString sService = sAPI_fieldmaster_prefix
866  + ((eVarType==VarTypeUserField) ?
867  OUString(sAPI_user) : OUString(sAPI_set_expression));
868  Reference<XInterface> xIfc =
869  xFactory->createInstance( sService );
870  if (xIfc.is()) {
871  Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
872  xMaster = xTmp;
873 
874  // set name
875  xMaster->setPropertyValue("Name", Any(sName));
876 
877  if (eVarType != VarTypeUserField) {
878  // set subtype for setexp field
879  Any aAny;
880  aAny <<= ((eVarType == VarTypeSimple) ?
881  SetVariableType::VAR :
882  SetVariableType::SEQUENCE);
883  xMaster->setPropertyValue(sAPI_sub_type, aAny);
884  } // else : user field: no subtype
885 
886  } else {
887  return false;
888  }
889  } else {
890  return false;
891  }
892  }
893 
894  DBG_ASSERT(xMaster.is(), "no field master found!?!");
895  return true;
896 }
897 
898 
899 // Database Display field import
900 
901 
903  SvXMLImport& rImport, XMLTextImportHelper& rHlp) :
904  XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database, false),
905  aValueHelper(rImport, rHlp, false, true, false, false),
906  bColumnOK(false),
907  bDisplay( true ),
908  bDisplayOK( false )
909 {
910 }
911 
913  sal_Int32 nAttrToken, std::string_view sAttrValue )
914 {
915  switch (nAttrToken)
916  {
918  sColumnName = OUString::fromUtf8(sAttrValue);
919  bColumnOK = true;
920  break;
922  {
923  bool bNone = IsXMLToken( sAttrValue, XML_NONE );
924  bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
925  bDisplay = bValue;
926  bDisplayOK = bNone || bValue;
927  }
928  break;
932  // handled by super class
934  sAttrValue);
935  break;
936  default:
937  // remainder handled by value helper
938  aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
939  break;
940  }
941 
943 }
944 
946 {
947  // we have an EndElement of our own, because database fields need
948  // to be attached to a field master before they can be inserted into
949  // the document. Database stuff (database, table, column) all goes
950  // to the field master, value & style go to the field.
951 
952  if (bValid)
953  {
954 
955  // so here goes: we start with the master
956  Reference<XPropertySet> xMaster;
957 
958  // create and prepare field master first
959  if (CreateField(xMaster,
960  "com.sun.star.text.FieldMaster.Database"))
961  {
962  Any aAny;
963  xMaster->setPropertyValue("DataColumnName", Any(sColumnName));
964 
965  // fieldmaster takes database, table and column name
967 
968  // create field
970  if (CreateField(xField,
971  sAPI_database))
972  {
973  // attach field master
974  Reference<XDependentTextField> xDepField(xField, UNO_QUERY);
975  if (xDepField.is())
976  {
977  // attach field to field master
978  xDepField->attachTextFieldMaster(xMaster);
979 
980  // attach field to document
981  Reference<XTextContent> xTextContent(xField, UNO_QUERY);
982  if (xTextContent.is())
983  {
984  // insert, set field properties and exit!
985  try
986  {
987  GetImportHelper().InsertTextContent(xTextContent);
988 
989  // prepare field: format from database?
990  bool bTmp = !aValueHelper.IsFormatOK();
991  xField->setPropertyValue("DataBaseFormat", Any(bTmp));
992 
993  // value, value-type and format done by value helper
994  aValueHelper.PrepareField(xField);
995 
996  // visibility
997  if( bDisplayOK )
998  {
999  xField->setPropertyValue(sAPI_is_visible, Any(bDisplay));
1000  }
1001 
1002  // set presentation
1003  aAny <<= GetContent();
1004  xField->setPropertyValue(sAPI_current_presentation, aAny);
1005 
1006  // success!
1007  return;
1008  }
1009  catch (const lang::IllegalArgumentException&)
1010  {
1011  TOOLS_WARN_EXCEPTION("xmloff.text", "Failed to insert text content");
1012  }
1013  }
1014  }
1015  }
1016  }
1017  }
1018 
1019  // above: exit on success; so for all error cases we end up here!
1020  // write element content
1022 }
1023 
1024 
1025 // value import helper
1026 
1027 namespace {
1028 
1030 {
1031  XML_VALUE_TYPE_STRING,
1032  XML_VALUE_TYPE_FLOAT,
1033  XML_VALUE_TYPE_CURRENCY,
1034  XML_VALUE_TYPE_PERCENTAGE,
1035  XML_VALUE_TYPE_DATE,
1036  XML_VALUE_TYPE_TIME,
1037  XML_VALUE_TYPE_BOOLEAN
1038 };
1039 
1040 }
1041 
1043 {
1044  { XML_FLOAT, XML_VALUE_TYPE_FLOAT },
1045  { XML_CURRENCY, XML_VALUE_TYPE_CURRENCY },
1046  { XML_PERCENTAGE, XML_VALUE_TYPE_PERCENTAGE },
1047  { XML_DATE, XML_VALUE_TYPE_DATE },
1048  { XML_TIME, XML_VALUE_TYPE_TIME },
1049  { XML_BOOLEAN, XML_VALUE_TYPE_BOOLEAN },
1050  { XML_STRING, XML_VALUE_TYPE_STRING },
1052 };
1053 
1055  SvXMLImport& rImprt,
1056  XMLTextImportHelper& rHlp,
1057  bool bType, bool bStyle, bool bValue, bool bFormula) :
1058 
1059  rImport(rImprt),
1060  rHelper(rHlp),
1061 
1062  fValue(0.0),
1063  nFormatKey(0),
1064  bIsDefaultLanguage(true),
1065 
1066  bStringType(false),
1067  bFormatOK(false),
1068  bStringValueOK(false),
1069  bFormulaOK(false),
1070 
1071  bSetType(bType),
1072  bSetValue(bValue),
1073  bSetStyle(bStyle),
1074  bSetFormula(bFormula)
1075 {
1076 }
1077 
1079  sal_Int32 nAttrToken, std::string_view sAttrValue )
1080 {
1081  switch (nAttrToken)
1082  {
1083  case XML_ELEMENT(TEXT, XML_VALUE_TYPE): // #i32362#: src680m48++ saves text:value-type
1085  {
1086  // convert enum
1087  ValueType eValueType = XML_VALUE_TYPE_STRING;
1088  bool bRet = SvXMLUnitConverter::convertEnum(
1089  eValueType, sAttrValue, aValueTypeMap);
1090 
1091  if (bRet) {
1092  switch (eValueType)
1093  {
1094  case XML_VALUE_TYPE_STRING:
1095  bStringType = true;
1096  break;
1097  case XML_VALUE_TYPE_FLOAT:
1098  case XML_VALUE_TYPE_CURRENCY:
1099  case XML_VALUE_TYPE_PERCENTAGE:
1100  case XML_VALUE_TYPE_DATE:
1101  case XML_VALUE_TYPE_TIME:
1102  case XML_VALUE_TYPE_BOOLEAN:
1103  bStringType = false;
1104  break;
1105 
1106  default:
1107  OSL_FAIL("unknown value type");
1108  }
1109  }
1110  break;
1111  }
1112 
1113  case XML_ELEMENT(TEXT, XML_VALUE):
1114  case XML_ELEMENT(OFFICE, XML_VALUE):
1115  {
1116  double fTmp;
1117  bool const bRet = ::sax::Converter::convertDouble(fTmp,sAttrValue);
1118  if (bRet) {
1119  fValue = fTmp;
1120  }
1121  break;
1122  }
1123 
1126  {
1127  double fTmp;
1128  bool const bRet =
1129  ::sax::Converter::convertDuration(fTmp, sAttrValue);
1130  if (bRet) {
1131  fValue = fTmp;
1132  }
1133  break;
1134  }
1135 
1138  {
1139  double fTmp;
1140  bool bRet = rImport.GetMM100UnitConverter().
1141  convertDateTime(fTmp,sAttrValue);
1142  if (bRet) {
1143  fValue = fTmp;
1144  }
1145  break;
1146  }
1147 
1149  {
1150  bool bTmp(false);
1151  bool bRet = ::sax::Converter::convertBool(bTmp, sAttrValue);
1152  if (bRet) {
1153  fValue = (bTmp ? 1.0 : 0.0);
1154  }
1155  else
1156  {
1157  double fTmp;
1158  bRet = ::sax::Converter::convertDouble(fTmp, sAttrValue);
1159  if (bRet) {
1160  fValue = fTmp;
1161  }
1162  }
1163  break;
1164  }
1165 
1168  sValue = OUString::fromUtf8(sAttrValue);
1169  bStringValueOK = true;
1170  break;
1171 
1172  case XML_ELEMENT(TEXT, XML_FORMULA):
1173  {
1174  OUString sTmp;
1175  sal_uInt16 nPrefix = rImport.GetNamespaceMap().
1176  GetKeyByAttrValueQName(OUString::fromUtf8(sAttrValue), &sTmp);
1177  if( XML_NAMESPACE_OOOW == nPrefix )
1178  {
1179  sFormula = sTmp;
1180  bFormulaOK = true;
1181  }
1182  else
1183  sFormula = OUString::fromUtf8(sAttrValue);
1184  }
1185  break;
1186 
1188  {
1189  sal_Int32 nKey = rHelper.GetDataStyleKey(
1190  OUString::fromUtf8(sAttrValue), &bIsDefaultLanguage);
1191  if (-1 != nKey)
1192  {
1193  nFormatKey = nKey;
1194  bFormatOK = true;
1195  }
1196  break;
1197  }
1198  default:
1199  XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
1200  } // switch
1201 }
1202 
1204  const Reference<XPropertySet> & xPropertySet)
1205 {
1206  Any aAny;
1207 
1208  if (bSetType)
1209  {
1210  // ??? how to set type?
1211  }
1212 
1213  if (bSetFormula)
1214  {
1215  aAny <<= !bFormulaOK ? sDefault : sFormula;
1216  xPropertySet->setPropertyValue(sAPI_content, aAny);
1217  }
1218 
1219  // format/style
1220  if (bSetStyle && bFormatOK)
1221  {
1222  xPropertySet->setPropertyValue(sAPI_number_format, Any(nFormatKey));
1223 
1224  if( xPropertySet->getPropertySetInfo()->
1225  hasPropertyByName( "IsFixedLanguage" ) )
1226  {
1227  bool bIsFixedLanguage = ! bIsDefaultLanguage;
1228  xPropertySet->setPropertyValue( "IsFixedLanguage", Any(bIsFixedLanguage) );
1229  }
1230  }
1231 
1232  // value: string or float
1233  if (bSetValue)
1234  {
1235  if (bStringType)
1236  {
1237  aAny <<= !bStringValueOK ? sDefault : sValue;
1238  xPropertySet->setPropertyValue(sAPI_content, aAny);
1239  }
1240  else
1241  {
1242  xPropertySet->setPropertyValue("Value", Any(fValue));
1243  }
1244  }
1245 }
1246 
1247 /* 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:60
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:117
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:945
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:398
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3528
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:2058
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:1078
OUString sFormula
format key (only valid of bFormatOK)
Definition: txtvfldi.hxx:40
void InsertString(const OUString &rChars)
Definition: txtimp.cxx:702
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:1203
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:912
const char * sName
bool convertNumFormat(sal_Int16 &rType, const OUString &rNumFormat, std::u16string_view rNumLetterSync, bool bNumberNone=false) const
convert num-format and num-letter-sync values to NumberingType
Definition: xmluconv.cxx:701
constexpr OUStringLiteral sAPI_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:45
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:758
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:104
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:780
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3472
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:97
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Definition: xmluconv.hxx:145
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:400
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:404
QPRO_FUNC_TYPE nType
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
XMLVariableDeclImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, enum VarType eVarType)
Definition: txtvfldi.cxx:683
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:1029
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:902
SvXMLEnumMapEntry< ValueType > const aValueTypeMap[]
Definition: txtvfldi.cxx:1042
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:1054
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:1938