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