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 
53 
54 // service names
55 constexpr char16_t sAPI_fieldmaster_prefix[] = u"com.sun.star.text.FieldMaster.";
56 const char sAPI_get_expression[] = "GetExpression";
57 const char sAPI_set_expression[] = "SetExpression";
58 const char sAPI_user[] = "User";
59 const char sAPI_database[] = "com.sun.star.text.TextField.Database";
60 
61 // property names
62 const char sAPI_content[] = "Content";
63 const char sAPI_sub_type[] = "SubType";
64 const char sAPI_number_format[] = "NumberFormat";
65 const char sAPI_is_visible[] = "IsVisible";
66 const char sAPI_current_presentation[] = "CurrentPresentation";
67 
68 
69 using namespace ::com::sun::star;
70 using namespace ::com::sun::star::uno;
71 using namespace ::com::sun::star::beans;
72 using namespace ::com::sun::star::text;
73 using namespace ::com::sun::star::style;
74 using namespace ::xmloff::token;
75 
76 
77 // XMLVarFieldImportContext: superclass for all variable related fields
78 
79 
81  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
82  const char* pServiceName, sal_uInt16 nPrfx,
83  const OUString& rLocalName,
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, nPrfx, rLocalName),
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_uInt16 nAttrToken,
111  const OUString& sAttrValue )
112 {
113  switch (nAttrToken)
114  {
116  sName = sAttrValue;
117  bValid = true; // we assume: field with name is valid!
118  break;
120  sDescription = sAttrValue;
121  bDescriptionOK = true;
122  break;
124  sHelp = sAttrValue;
125  bHelpOK = true;
126  break;
128  sHint = sAttrValue;
129  bHintOK = true;
130  break;
132  {
133  OUString sTmp;
134  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
135  GetKeyByAttrValueQName(sAttrValue, &sTmp);
136  if( XML_NAMESPACE_OOOW == nPrefix )
137  {
138  sFormula = sTmp;
139  bFormulaOK = true;
140  }
141  else
142  sFormula = 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 curren 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 char* pServiceName, sal_uInt16 nPrfx,
250  const OUString& rLocalName, VarType eVarType,
251  bool bFormula, bool bFormulaDefault,
252  bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bIsDisplayFormula,
253  bool bType, bool bStyle, bool bValue, bool bPresentation) :
254  XMLVarFieldImportContext(rImport, rHlp, pServiceName,
255  nPrfx, rLocalName,
256  bFormula, bFormulaDefault,
257  bDescription, bHelp, bHint, bVisible, bIsDisplayFormula,
258  bType, bStyle, bValue, bPresentation),
259  eFieldType(eVarType)
260 {
261 }
262 
264 {
265  // should we call PrepareField on the field, or rather on it's master?
266  // currently: call on field (just like superclass)
267  // possible alternatives: call on master
268  // call field or master depending on variable
269  // PrepareMaster() in addition to PrepareField()
270 
271  DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
272 
273  if (bValid)
274  {
275  DBG_ASSERT(!GetName().isEmpty(), "variable name needed!");
276 
277  // find field master
278  Reference<XPropertySet> xMaster;
279  if (FindFieldMaster(xMaster))
280  {
281  // create field/Service
282  Reference<XPropertySet> xPropSet;
283  if (CreateField(xPropSet, "com.sun.star.text.TextField." + GetServiceName()))
284  {
285  Reference<XDependentTextField> xDepTextField(xPropSet, UNO_QUERY);
286  if (xDepTextField.is())
287  {
288  // attach field to field master
289  xDepTextField->attachTextFieldMaster(xMaster);
290 
291  // attach field to document
292  Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
293  if (xTextContent.is())
294  {
295  try {
296  // insert, set field properties and exit!
297  GetImportHelper().InsertTextContent(xTextContent);
298  PrepareField(xPropSet);
299  } catch (lang::IllegalArgumentException & /*e*/)
300  {
301  // ignore e: #i54023#
302  };
303  return;
304  }
305  }
306  }
307  }
308  }
309 
310  // above: exit on success; so for all error cases we end up here!
311  // write element content
313 }
314 
316  Reference<XPropertySet> & xMaster)
317 {
318  // currently: delegate to XMLVariableDeclImportContext;
319  // should eventually go here
321  GetImport(),
322  GetImportHelper(),
323  GetName(),
324  eFieldType);
325 }
326 
327 
328 // sequence field
329 
330 
332  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
333  sal_uInt16 nPrfx, const OUString& rLocalName) :
335  nPrfx, rLocalName, VarTypeSequence,
336  // formula
337  true, true,
338  false, false, false, false,
339  false,
340  false, false, false, true),
341 
342  sNumFormat(OUString('1')),
343  sNumFormatSync(GetXMLToken(XML_FALSE)),
344  bRefNameOK(false)
345 {
346 }
347 
349  sal_uInt16 nAttrToken, const OUString& sAttrValue )
350 {
351  switch (nAttrToken)
352  {
354  sNumFormat = sAttrValue;
355  break;
357  sNumFormatSync = sAttrValue;
358  break;
360  sRefName = sAttrValue;
361  bRefNameOK = true;
362  break;
363  default:
364  // delegate to super class (name, formula)
366  sAttrValue);
367  break;
368  } // switch
369 }
370 
372  const Reference<XPropertySet> & xPropertySet)
373 {
374  // delegate to super class (formula)
376 
377  // set format
378  sal_Int16 nNumType = NumberingType::ARABIC;
380  xPropertySet->setPropertyValue(sAPI_number_format, Any(nNumType));
381 
382  // handle reference name
383  if (bRefNameOK)
384  {
385  Any aAny = xPropertySet->getPropertyValue("SequenceValue");
386  sal_Int16 nValue = 0;
387  aAny >>= nValue;
389  }
390 }
391 
392 
393 // variable set field
394 
395 
397  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
398  sal_uInt16 nPrfx, const OUString& rLocalName) :
400  nPrfx, rLocalName, VarTypeSimple,
401  // formula, value&type, style,
402  // display none
403  true, true,
404  false, false, false,
405  true, false,
406  true, true, true,
407  true)
408 {
409 }
410 
412  const Reference<XPropertySet> & xPropertySet)
413 {
414  // set type
415  Any aAny;
416  aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
417  xPropertySet->setPropertyValue(sAPI_sub_type, aAny);
418 
419  // the remainder is handled by super class
421 }
422 
423 
424 // variable input field
425 
426 
428  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
429  const OUString& rLocalName) :
431  nPrfx, rLocalName, VarTypeSimple,
432  // description, display none/formula,
433  // value&type, style, formula
434  true, true,
435  true, true, true,
436  true, false,
437  true, true, true,
438  true)
439 {
440 }
441 
443  const Reference<XPropertySet> & xPropertySet)
444 {
445  // set type (input field)
446  Any aAny;
447  xPropertySet->setPropertyValue("Input", Any(true));
448 
449  // set type
450  aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
451  xPropertySet->setPropertyValue(sAPI_sub_type, aAny);
452 
453  // the remainder is handled by super class
455 }
456 
457 
458 // user field
459 
460 
462  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
463  sal_uInt16 nPrfx, const OUString& rLocalName) :
464  XMLSetVarFieldImportContext(rImport, rHlp, sAPI_user, nPrfx,
465  rLocalName, VarTypeUserField,
466  // display none/formula, style
467  false, false,
468  false, false, false, true,
469  true,
470  false, true, false,
471  false)
472 {
473 }
474 
475 
476 // user input field
477 
478 
479 // bug: doesn't work (SO API lacking)
481  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
482  const OUString& rLocalName) :
483  XMLVarFieldImportContext(rImport, rHlp, "InputUser",
484  nPrfx, rLocalName,
485  // description, style
486  false, false,
487  true, false, false,
488  false, false,
489  false /*???*/, true, false,
490  false)
491 {
492 }
493 
495  const Reference<XPropertySet> & xPropertySet)
496 {
497  xPropertySet->setPropertyValue(sAPI_content, Any(GetName()));
498 
499  // delegate to super class
501 }
502 
503 
504 // variable get field
505 
506 
508  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
509  sal_uInt16 nPrfx, const OUString& rLocalName) :
511  nPrfx, rLocalName,
512  // style, display formula
513  false, false,
514  false, false, false,
515  false, true,
516  true, true, false,
517  true)
518 {
519 }
520 
522  const Reference<XPropertySet> & xPropertySet)
523 {
524  // set name
525  xPropertySet->setPropertyValue(sAPI_content, Any(GetName()));
526 
527  // the remainder is handled by super class
529 }
530 
531 
532 // expression field
533 
534 
536  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
537  sal_uInt16 nPrfx, const OUString& rLocalName) :
539  nPrfx, rLocalName,
540  // formula, type, style, display formula
541  true, true,
542  false, false, false,
543  false, true,
544  true, true, false,
545  true)
546 {
547  bValid = true; // always valid
548 }
549 
550 
552  const Reference<XPropertySet> & xPropertySet)
553 {
554  xPropertySet->setPropertyValue(sAPI_sub_type, Any(sal_Int16(SetVariableType::FORMULA)));
555 
556  // delegate to super class
558 }
559 
560 
561 // text input field
562 
563 
565  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
566  sal_uInt16 nPrfx, const OUString& sLocalName) :
567  XMLVarFieldImportContext(rImport, rHlp, "Input",
568  nPrfx, sLocalName,
569  // description
570  false, false,
571  true, true, true,
572  false, false,
573  false, false, false,
574  false)
575 {
576  bValid = true; // always valid
577 }
578 
580  const Reference<XPropertySet> & xPropertySet)
581 {
583 
584  xPropertySet->setPropertyValue(sAPI_content, Any(GetContent()));
585 }
586 
587 
588 // table formula field
589 
590 
592  SvXMLImport& rImport,
593  XMLTextImportHelper& rHlp,
594  sal_uInt16 nPrfx,
595  const OUString& rLocalName) :
596  XMLTextFieldImportContext(rImport, rHlp, "TableFormula",
597  nPrfx, rLocalName),
598  aValueHelper(rImport, rHlp, false, true, false, true),
599  bIsShowFormula(false)
600 {
601 }
602 
604  sal_uInt16 nAttrToken,
605  const OUString& sAttrValue )
606 {
607  switch (nAttrToken)
608  {
610  aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
611  bValid = true; // we need a formula!
612  break;
613 
615  aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
616  break;
618  if ( sAttrValue == "formula" )
619  bIsShowFormula = true;
620  break;
621  default:
622  // unknown attribute -> ignore
623  break;
624  }
625 }
626 
628  const Reference<XPropertySet> & xPropertySet)
629 {
630  // set format and formula
631  aValueHelper.PrepareField( xPropertySet );
632 
633  Any aAny;
634 
635  // set 'show formula' and presentation
636  xPropertySet->setPropertyValue( "IsShowFormula", Any(bIsShowFormula) );
637 
638  aAny <<= GetContent();
639  xPropertySet->setPropertyValue( "CurrentPresentation", aAny );
640 }
641 
642 
643 // variable declarations
644 
645 // Should be adapted to XMLVarField-/XMLSetVarFieldImportContext scheme!
646 
647 
648 // declaration container import (<variable/user-field/sequence-decls>)
649 
650 
652  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
653  const OUString& rLocalName, enum VarType eVarType) :
654  SvXMLImportContext(rImport, nPrfx, rLocalName),
655  eVarDeclsContextType(eVarType),
656  rImportHelper(rHlp)
657 {
658 }
659 
661  sal_uInt16 nPrefix, const OUString& rLocalName,
662  const Reference<xml::sax::XAttributeList> & xAttrList )
663 {
664  enum XMLTokenEnum eElementName;
665  SvXMLImportContextRef xImportContext;
666 
667  if( XML_NAMESPACE_TEXT == nPrefix )
668  {
669  switch (eVarDeclsContextType)
670  {
671  case VarTypeSequence:
672  eElementName = XML_SEQUENCE_DECL;
673  break;
674  case VarTypeSimple:
675  eElementName = XML_VARIABLE_DECL;
676  break;
677  case VarTypeUserField:
678  eElementName = XML_USER_FIELD_DECL;
679  break;
680  default:
681  OSL_FAIL("unknown field type!");
682  eElementName = XML_SEQUENCE_DECL;
683  break;
684  }
685 
686  if( IsXMLToken( rLocalName, eElementName ) )
687  {
688  xImportContext = new XMLVariableDeclImportContext(
689  GetImport(), rImportHelper, nPrefix, rLocalName, xAttrList,
691  }
692  }
693 
694  // if no context was created, use default context
695  return xImportContext;
696 }
697 
698 
699 // declaration import (<variable/user-field/sequence-decl> elements)
700 
701 
703  SvXMLImport& rImport, XMLTextImportHelper& rHlp,
704  sal_uInt16 nPrfx, const OUString& rLocalName,
705  const Reference<xml::sax::XAttributeList> & xAttrList,
706  enum VarType eVarType) :
707  SvXMLImportContext(rImport, nPrfx, rLocalName)
708 {
709  // bug?? which properties for userfield/userfieldmaster
710  XMLValueImportHelper aValueHelper(rImport, rHlp, true, false, true, false);
711  sal_Unicode cSeparationChar('.');
712 
713  sal_Int8 nNumLevel(-1);
714  OUString sName;
715 
716  if ( (XML_NAMESPACE_TEXT != nPrfx) ||
717  !( ( IsXMLToken( rLocalName, XML_SEQUENCE_DECL )) ||
718  ( IsXMLToken( rLocalName, XML_VARIABLE_DECL)) ||
719  ( IsXMLToken( rLocalName, XML_USER_FIELD_DECL)) ) )
720  return;
721 
722 
723  // TODO: check validity (need name!)
724 
725  // parse attributes
726  sal_Int16 nLength = xAttrList->getLength();
727  for(sal_Int16 i=0; i<nLength; i++) {
728 
729  OUString sLocalName;
730  sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
731  GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
732 
733  sal_uInt16 nToken = rHlp.
734  GetTextFieldAttrTokenMap().Get(nPrefix, sLocalName);
735 
736  switch (nToken)
737  {
739  sName = xAttrList->getValueByIndex(i);
740  break;
742  {
743  sal_Int32 nLevel;
744  bool const bRet = ::sax::Converter::convertNumber(
745  nLevel, xAttrList->getValueByIndex(i), 0,
746  GetImport().GetTextImport()->GetChapterNumbering()->
747  getCount());
748  if (bRet)
749  {
750  nNumLevel = static_cast< sal_Int8 >( nLevel-1 ); // API numbers -1..9
751  }
752  break;
753  }
755  cSeparationChar =
756  static_cast<char>(xAttrList->getValueByIndex(i).toChar());
757  break;
758 
759  default:
760  // delegate to value helper
761  aValueHelper.ProcessAttribute(nToken,
762  xAttrList->getValueByIndex(i));
763  break;
764  }
765  }
766 
767  Reference<XPropertySet> xFieldMaster;
768  if (!FindFieldMaster(xFieldMaster, GetImport(), rHlp,
769  sName, eVarType))
770  return;
771 
772  // now we have a field master: process attributes!
773  Any aAny;
774 
775  switch (eVarType)
776  {
777  case VarTypeSequence:
778  xFieldMaster->setPropertyValue("ChapterNumberingLevel", Any(nNumLevel));
779 
780  if (nNumLevel >= 0)
781  {
782  OUString sStr(&cSeparationChar, 1);
783  xFieldMaster->setPropertyValue(
784  "NumberingSeparator", Any(sStr));
785  }
786  break;
787  case VarTypeSimple:
788  {
789  // set string or non-string SubType (#93192#)
790  // The SubType was already set in the FindFieldMaster
791  // method, but it needs to be adjusted if it's a string.
792  aAny <<= aValueHelper.IsStringValue()
793  ? SetVariableType::STRING : SetVariableType::VAR;
794  xFieldMaster->setPropertyValue(sAPI_sub_type, aAny);
795  }
796  break;
797  case VarTypeUserField:
798  {
799  bool bTmp = !aValueHelper.IsStringValue();
800  xFieldMaster->setPropertyValue("IsExpression", Any(bTmp));
801  aValueHelper.PrepareField(xFieldMaster);
802  break;
803  }
804  default:
805  OSL_FAIL("unknown varfield type");
806  } // switch
807 }
808 
809 
811  Reference<XPropertySet> & xMaster, SvXMLImport& rImport,
812  XMLTextImportHelper& rImportHelper,
813  const OUString& sVarName, enum VarType eVarType)
814 {
815  static sal_Int32 nCollisionCount = 0;
816 
817  // rename field
818  // currently: no family in use! Use 0.
819  OUString sName = rImportHelper.GetRenameMap().Get(
820  sal::static_int_cast< sal_uInt16 >(eVarType), sVarName);
821 
822  // get text fields supplier and field masters
823  Reference<XTextFieldsSupplier> xTextFieldsSupp(rImport.GetModel(),
824  UNO_QUERY);
825  Reference<container::XNameAccess> xFieldMasterNameAccess =
826  xTextFieldsSupp->getTextFieldMasters();
827 
828  OUString sVarServiceName =
829  OUStringLiteral(sAPI_fieldmaster_prefix) +
831  "." +
832  sName;
833 
834  OUString sUserServiceName =
835  OUStringLiteral(sAPI_fieldmaster_prefix) +
836  sAPI_user +
837  "." +
838  sName;
839 
840  if (xFieldMasterNameAccess->hasByName(sVarServiceName)) {
841  // variable field master already in document
842 
843  Any aAny = xFieldMasterNameAccess->getByName(sVarServiceName);
844  aAny >>= xMaster;
845 
846  aAny = xMaster->getPropertyValue(sAPI_sub_type);
847  sal_Int16 nType = 0;
848  aAny >>= nType;
849 
850  enum VarType eFMVarType =
851  (SetVariableType::SEQUENCE == nType) ?
853 
854  if (eFMVarType != eVarType)
855  {
856  ++nCollisionCount;
857  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
858 
859  // FIXME! can't find if name is taken already!!!!
860 
861  rImportHelper.GetRenameMap().Add(
862  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
863 
864  // call FindFieldMaster recursively to create new master
865  return FindFieldMaster(xMaster, rImport, rImportHelper,
866  sNew, eVarType);
867  }
868  } else if (xFieldMasterNameAccess->hasByName(sUserServiceName)) {
869  // user field: get field master
870  Any aAny = xFieldMasterNameAccess->getByName(sUserServiceName);
871  aAny >>= xMaster;
872 
873  if (VarTypeUserField != eVarType) {
874  ++nCollisionCount;
875  // find new name that is not taken
876  OUString sNew(sName + "_renamed_" + OUString::number(nCollisionCount));
877 
878  // FIXME! can't find if name is taken already!!!!
879 
880  rImportHelper.GetRenameMap().Add(
881  sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
882 
883  // call FindFieldMaster recursively to create new master
884  return FindFieldMaster(xMaster, rImport, rImportHelper,
885  sNew, eVarType);
886  }
887  } else {
888  // field name not used: create field master
889 
890  // import -> model is MultiServiceFactory -> createInstance
891  Reference<lang::XMultiServiceFactory>
892  xFactory(rImport.GetModel(),UNO_QUERY);
893  if( xFactory.is() ) {
894 
895  OUStringBuffer sService;
896  sService.append(sAPI_fieldmaster_prefix);
897  sService.appendAscii((eVarType==VarTypeUserField) ?
899  Reference<XInterface> xIfc =
900  xFactory->createInstance( sService.makeStringAndClear() );
901  if (xIfc.is()) {
902  Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
903  xMaster = xTmp;
904 
905  // set name
906  xMaster->setPropertyValue("Name", Any(sName));
907 
908  if (eVarType != VarTypeUserField) {
909  // set subtype for setexp field
910  Any aAny;
911  aAny <<= ((eVarType == VarTypeSimple) ?
912  SetVariableType::VAR :
913  SetVariableType::SEQUENCE);
914  xMaster->setPropertyValue(sAPI_sub_type, aAny);
915  } // else : user field: no subtype
916 
917  } else {
918  return false;
919  }
920  } else {
921  return false;
922  }
923  }
924 
925  DBG_ASSERT(xMaster.is(), "no field master found!?!");
926  return true;
927 }
928 
929 
930 // Database Display field import
931 
932 
934  SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
935  const OUString& rLocalName) :
937  nPrfx, rLocalName, false),
938  aValueHelper(rImport, rHlp, false, true, false, false),
939  bColumnOK(false),
940  bDisplay( true ),
941  bDisplayOK( false )
942 {
943 }
944 
946  sal_uInt16 nAttrToken, const OUString& sAttrValue )
947 {
948  switch (nAttrToken)
949  {
951  sColumnName = sAttrValue;
952  bColumnOK = true;
953  break;
955  {
956  bool bNone = IsXMLToken( sAttrValue, XML_NONE );
957  bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
958  bDisplay = bValue;
959  bDisplayOK = bNone || bValue;
960  }
961  break;
965  // handled by super class
967  sAttrValue);
968  break;
969  default:
970  // remainder handled by value helper
971  aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
972  break;
973  }
974 
976 }
977 
979 {
980  // we have an EndElement of our own, because database fields need
981  // to be attached to a field master before they can be inserted into
982  // the document. Database stuff (database, table, column) all goes
983  // to the field master, value & style go to the field.
984 
985  if (bValid)
986  {
987 
988  // so here goes: we start with the master
989  Reference<XPropertySet> xMaster;
990 
991  // create and prepare field master first
992  if (CreateField(xMaster,
993  "com.sun.star.text.FieldMaster.Database"))
994  {
995  Any aAny;
996  xMaster->setPropertyValue("DataColumnName", Any(sColumnName));
997 
998  // fieldmaster takes database, table and column name
1000 
1001  // create field
1002  Reference<XPropertySet> xField;
1003  if (CreateField(xField,
1004  sAPI_database))
1005  {
1006  // attach field master
1007  Reference<XDependentTextField> xDepField(xField, UNO_QUERY);
1008  if (xDepField.is())
1009  {
1010  // attach field to field master
1011  xDepField->attachTextFieldMaster(xMaster);
1012 
1013  // attach field to document
1014  Reference<XTextContent> xTextContent(xField, UNO_QUERY);
1015  if (xTextContent.is())
1016  {
1017  // insert, set field properties and exit!
1018  try
1019  {
1020  GetImportHelper().InsertTextContent(xTextContent);
1021 
1022  // prepare field: format from database?
1023  bool bTmp = !aValueHelper.IsFormatOK();
1024  xField->setPropertyValue("DataBaseFormat", Any(bTmp));
1025 
1026  // value, value-type and format done by value helper
1027  aValueHelper.PrepareField(xField);
1028 
1029  // visibility
1030  if( bDisplayOK )
1031  {
1032  xField->setPropertyValue(sAPI_is_visible, Any(bDisplay));
1033  }
1034 
1035  // set presentation
1036  aAny <<= GetContent();
1037  xField->setPropertyValue(sAPI_current_presentation, aAny);
1038 
1039  // success!
1040  return;
1041  }
1042  catch (const lang::IllegalArgumentException& rException)
1043  {
1044  SAL_WARN("xmloff.text", "Failed to insert text content: " << rException.Message);
1045  }
1046  }
1047  }
1048  }
1049  }
1050  }
1051 
1052  // above: exit on success; so for all error cases we end up here!
1053  // write element content
1055 }
1056 
1057 
1058 // value import helper
1059 
1060 namespace {
1061 
1063 {
1064  XML_VALUE_TYPE_STRING,
1065  XML_VALUE_TYPE_FLOAT,
1066  XML_VALUE_TYPE_CURRENCY,
1067  XML_VALUE_TYPE_PERCENTAGE,
1068  XML_VALUE_TYPE_DATE,
1069  XML_VALUE_TYPE_TIME,
1070  XML_VALUE_TYPE_BOOLEAN
1071 };
1072 
1073 }
1074 
1076 {
1077  { XML_FLOAT, XML_VALUE_TYPE_FLOAT },
1078  { XML_CURRENCY, XML_VALUE_TYPE_CURRENCY },
1079  { XML_PERCENTAGE, XML_VALUE_TYPE_PERCENTAGE },
1080  { XML_DATE, XML_VALUE_TYPE_DATE },
1081  { XML_TIME, XML_VALUE_TYPE_TIME },
1082  { XML_BOOLEAN, XML_VALUE_TYPE_BOOLEAN },
1083  { XML_STRING, XML_VALUE_TYPE_STRING },
1085 };
1086 
1088  SvXMLImport& rImprt,
1089  XMLTextImportHelper& rHlp,
1090  bool bType, bool bStyle, bool bValue, bool bFormula) :
1091 
1092  rImport(rImprt),
1093  rHelper(rHlp),
1094 
1095  fValue(0.0),
1096  nFormatKey(0),
1097  bIsDefaultLanguage(true),
1098 
1099  bStringType(false),
1100  bFormatOK(false),
1101  bStringValueOK(false),
1102  bFormulaOK(false),
1103 
1104  bSetType(bType),
1105  bSetValue(bValue),
1106  bSetStyle(bStyle),
1107  bSetFormula(bFormula)
1108 {
1109 }
1110 
1112  sal_uInt16 nAttrToken, const OUString& sAttrValue )
1113 {
1114  switch (nAttrToken)
1115  {
1117  {
1118  // convert enum
1119  ValueType eValueType = XML_VALUE_TYPE_STRING;
1120  bool bRet = SvXMLUnitConverter::convertEnum(
1121  eValueType, sAttrValue, aValueTypeMap);
1122 
1123  if (bRet) {
1124  switch (eValueType)
1125  {
1126  case XML_VALUE_TYPE_STRING:
1127  bStringType = true;
1128  break;
1129  case XML_VALUE_TYPE_FLOAT:
1130  case XML_VALUE_TYPE_CURRENCY:
1131  case XML_VALUE_TYPE_PERCENTAGE:
1132  case XML_VALUE_TYPE_DATE:
1133  case XML_VALUE_TYPE_TIME:
1134  case XML_VALUE_TYPE_BOOLEAN:
1135  bStringType = false;
1136  break;
1137 
1138  default:
1139  OSL_FAIL("unknown value type");
1140  }
1141  }
1142  break;
1143  }
1144 
1146  {
1147  double fTmp;
1148  bool const bRet = ::sax::Converter::convertDouble(fTmp,sAttrValue);
1149  if (bRet) {
1150  fValue = fTmp;
1151  }
1152  break;
1153  }
1154 
1156  {
1157  double fTmp;
1158  bool const bRet =
1159  ::sax::Converter::convertDuration(fTmp, sAttrValue);
1160  if (bRet) {
1161  fValue = fTmp;
1162  }
1163  break;
1164  }
1165 
1167  {
1168  double fTmp;
1169  bool bRet = rImport.GetMM100UnitConverter().
1170  convertDateTime(fTmp,sAttrValue);
1171  if (bRet) {
1172  fValue = fTmp;
1173  }
1174  break;
1175  }
1176 
1178  {
1179  bool bTmp(false);
1180  bool bRet = ::sax::Converter::convertBool(bTmp, sAttrValue);
1181  if (bRet) {
1182  fValue = (bTmp ? 1.0 : 0.0);
1183  }
1184  else
1185  {
1186  double fTmp;
1187  bRet = ::sax::Converter::convertDouble(fTmp, sAttrValue);
1188  if (bRet) {
1189  fValue = fTmp;
1190  }
1191  }
1192  break;
1193  }
1194 
1196  sValue = sAttrValue;
1197  bStringValueOK = true;
1198  break;
1199 
1201  {
1202  OUString sTmp;
1203  sal_uInt16 nPrefix = rImport.GetNamespaceMap().
1204  GetKeyByAttrValueQName(sAttrValue, &sTmp);
1205  if( XML_NAMESPACE_OOOW == nPrefix )
1206  {
1207  sFormula = sTmp;
1208  bFormulaOK = true;
1209  }
1210  else
1211  sFormula = sAttrValue;
1212  }
1213  break;
1214 
1216  {
1217  sal_Int32 nKey = rHelper.GetDataStyleKey(
1218  sAttrValue, &bIsDefaultLanguage);
1219  if (-1 != nKey)
1220  {
1221  nFormatKey = nKey;
1222  bFormatOK = true;
1223  }
1224  break;
1225  }
1226  } // switch
1227 }
1228 
1230  const Reference<XPropertySet> & xPropertySet)
1231 {
1232  Any aAny;
1233 
1234  if (bSetType)
1235  {
1236  // ??? how to set type?
1237  }
1238 
1239  if (bSetFormula)
1240  {
1241  aAny <<= !bFormulaOK ? sDefault : sFormula;
1242  xPropertySet->setPropertyValue(sAPI_content, aAny);
1243  }
1244 
1245  // format/style
1246  if (bSetStyle && bFormatOK)
1247  {
1248  xPropertySet->setPropertyValue(sAPI_number_format, Any(nFormatKey));
1249 
1250  if( xPropertySet->getPropertySetInfo()->
1251  hasPropertyByName( "IsFixedLanguage" ) )
1252  {
1253  bool bIsFixedLanguage = ! bIsDefaultLanguage;
1254  xPropertySet->setPropertyValue( "IsFixedLanguage", Any(bIsFixedLanguage) );
1255  }
1256  }
1257 
1258  // value: string or float
1259  if (bSetValue)
1260  {
1261  if (bStringType)
1262  {
1263  aAny <<= !bStringValueOK ? sDefault : sValue;
1264  xPropertySet->setPropertyValue(sAPI_content, aAny);
1265  }
1266  else
1267  {
1268  xPropertySet->setPropertyValue("Value", Any(fValue));
1269  }
1270  }
1271 }
1272 
1273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool FindFieldMaster(css::uno::Reference< css::beans::XPropertySet > &xMaster)
find appropriate field master
Definition: txtvfldi.cxx:315
double fValue
string value (only valid if bStringValueOK)
Definition: txtvfldi.hxx:39
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:428
XMLValueImportHelper aValueHelper
hint
Definition: txtvfldi.hxx:114
void SetDefault(const OUString &sStr)
Definition: txtvfldi.hxx:78
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3434
bool bSetDisplayFormula
set IsVisible
Definition: txtvfldi.hxx:130
const char sAPI_set_expression[]
Definition: txtvfldi.cxx:57
XMLSequenceFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:331
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 bool bSetType
have we read the formula attribute?
Definition: txtvfldi.hxx:50
XMLVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const char *pServiceName, sal_uInt16 nPrfx, const OUString &rLocalName, 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:80
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:551
enum VarType eVarDeclsContextType
Definition: txtvfldi.hxx:380
static bool convertBool(bool &rBool, const OUString &rString)
virtual void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue) override
set presentation from elem. content
Definition: txtvfldi.cxx:109
const bool bSetFormula
should PrepareField set NumberFormat?
Definition: txtvfldi.hxx:53
superclass for database fields: handle database and table names
Definition: txtfldi.hxx:386
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:579
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
const char sAPI_content[]
Definition: txtvfldi.cxx:62
const char sAPI_sub_type[]
Definition: txtvfldi.cxx:63
signed char sal_Int8
virtual void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue) override
element name w/o prefix
Definition: txtvfldi.cxx:603
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:40
constexpr char16_t sAPI_fieldmaster_prefix[]
#file
Definition: txtvfldi.cxx:55
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
variable type
Definition: txtvfldi.cxx:660
bool bDescriptionOK
sFormula was set
Definition: txtvfldi.hxx:119
abstract class for text field import
Definition: txtfldi.hxx:110
OUString sHint
help text
Definition: txtvfldi.hxx:113
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:402
XMLVariableInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:427
virtual void EndElement() override
see XMLTextFieldImportContext
Definition: txtvfldi.cxx:263
SvI18NMap & GetRenameMap()
Definition: txtimp.cxx:2580
bool bSetPresentation
set DisplayFormula (sub type???)
Definition: txtvfldi.hxx:131
upperclass for variable/user-set, var/user-input, and sequence fields inds field master of appropriat...
Definition: txtvfldi.hxx:232
const char sAPI_is_visible[]
Definition: txtvfldi.cxx:65
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:600
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:371
VarType
variable type (for XMLSetVarFieldImportContext)
Definition: txtimp.hxx:351
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:494
const OUString & GetServiceName() const
Definition: txtfldi.hxx:156
OUString sDescription
formula attribute
Definition: txtvfldi.hxx:111
bool CreateField(css::uno::Reference< css::beans::XPropertySet > &xField, const OUString &sServiceName)
create field from ServiceName
Definition: txtfldi.cxx:197
abstract parent class for all variable related fields
Definition: txtvfldi.hxx:106
XMLTextImportHelper & rHelper
Definition: txtvfldi.hxx:36
const char sAPI_get_expression[]
Definition: txtvfldi.cxx:56
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue)
process formula (Prep.F.)
Definition: txtvfldi.cxx:1111
const char sAPI_number_format[]
Definition: txtvfldi.cxx:64
sal_uInt16 sal_Unicode
bool IsFormatOK() const
has format been read?
Definition: txtvfldi.hxx:76
OUString sFormula
format key (only valid of bFormatOK)
Definition: txtvfldi.hxx:41
void InsertString(const OUString &rChars)
Definition: txtimp.cxx:1180
bool bSetFormulaDefault
set Formula property
Definition: txtvfldi.hxx:125
bool bDisplayFormula
value, value-type, and style
Definition: txtvfldi.hxx:115
XMLUserFieldInputImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:480
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:521
void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet)
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:1229
sal_Int16 nNumType
const char sAPI_current_presentation[]
Definition: txtvfldi.cxx:66
bool IsStringValue() const
Definition: txtvfldi.hxx:168
const char * sName
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
const char sAPI_user[]
Definition: txtvfldi.cxx:58
XMLTextInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &sLocalName)
Definition: txtvfldi.cxx:564
OUString sHelp
description
Definition: txtvfldi.hxx:112
XMLTextImportHelper & rImportHelper
Definition: txtvfldi.hxx:381
bool bDisplayNone
display formula?(rather than value)
Definition: txtvfldi.hxx:116
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:455
bool bSetFormula
sDisplayFormula/-None were set
Definition: txtvfldi.hxx:124
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)
int i
virtual void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue) override
element name w/o prefix
Definition: txtvfldi.cxx:945
bool bDisplayOK
sHint was set
Definition: txtvfldi.hxx:122
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:154
OUString sFormula
name attribute
Definition: txtvfldi.hxx:110
bool bSetDescription
use content as default for formula
Definition: txtvfldi.hxx:126
virtual void EndElement() override
create, prepare and insert database field master and database field
Definition: txtvfldi.cxx:978
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:411
float u
bool bFormatOK
is this a string (or a float) type?
Definition: txtvfldi.hxx:46
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
XMLSetVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const char *pServiceName, sal_uInt16 nPrfx, const OUString &rLocalName, 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
const bool bSetValue
should PrepareField set the SetExp subtype?
Definition: txtvfldi.hxx:51
const OUString & GetName() const
Definition: txtvfldi.hxx:167
bool bHelpOK
sDescription was set
Definition: txtvfldi.hxx:120
bool bIsDefaultLanguage
default (see bStringDefault/bFormulaDef.)
Definition: txtvfldi.hxx:43
XMLVariableGetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:507
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:45
void InsertTextContent(css::uno::Reference< css::text::XTextContent > const &xContent)
Definition: txtimp.cxx:1236
virtual void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue) override
element name w/o prefix
Definition: txtvfldi.cxx:348
bool bSetHelp
set sDescription with Hint-property
Definition: txtvfldi.hxx:127
Map an XMLTokenEnum to an enum value.
Definition: ximpshap.hxx:40
DefTokenId nToken
XMLVariableSetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:396
ValueType
OUString const & GetContent()
Definition: txtfldi.cxx:149
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:810
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3378
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
element name w/o prefix
Definition: txtvfldi.cxx:442
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. ...
const char sAPI_database[]
Definition: txtvfldi.cxx:59
Handling of tokens in XML:
const bool bSetStyle
should PrepareField set content/value?
Definition: txtvfldi.hxx:52
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:404
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:408
XMLUserFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:461
QPRO_FUNC_TYPE nType
XMLTableFormulaImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:591
XMLExpressionFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &sLocalName)
Definition: txtvfldi.cxx:535
variable field declarations (variable-decl, user-field-decl, sequence-decl)
Definition: txtvfldi.hxx:403
bool bHintOK
sHelp was set
Definition: txtvfldi.hxx:121
bool bFormulaOK
have we read a string-value attr.?
Definition: txtvfldi.hxx:48
virtual void ProcessAttribute(sal_uInt16 nAttrToken, const OUString &sAttrValue) override
process attribute values
Definition: txtfldi.cxx:1162
ValueType
Definition: txtvfldi.cxx:1062
XMLVariableDeclsImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName, enum VarType eVarType)
Definition: txtvfldi.cxx:651
#define SAL_WARN(area, stream)
Reference< XSingleServiceFactory > xFactory
OUString sDefault
formula string
Definition: txtvfldi.hxx:42
SvXMLImport & rImport
Definition: txtvfldi.hxx:35
XMLDatabaseDisplayImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName)
Definition: txtvfldi.cxx:933
sal_Int32 nLength
Definition: xmltoken.cxx:36
XMLVariableDeclImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_uInt16 nPrfx, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, enum VarType eVarType)
Definition: txtvfldi.cxx:702
bool bStringValueOK
have we read a style:data-style-name attr.?
Definition: txtvfldi.hxx:47
SvXMLEnumMapEntry< ValueType > const aValueTypeMap[]
Definition: txtvfldi.cxx:1075
bool bFormulaOK
hide field?
Definition: txtvfldi.hxx:118
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:1242
bool IsStringValue() const
is value a string (rather than double)?
Definition: txtvfldi.hxx:73
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:627
sal_Int16 nValue
XMLValueImportHelper(SvXMLImport &rImprt, XMLTextImportHelper &rHlp, bool bType, bool bStyle, bool bValue, bool bFormula)
should PrepareField set Formula?
Definition: txtvfldi.cxx:1087
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:2430