fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmloff / source / text / txtvfldi.cxx
blobf837a561ffffea2409b845e457c24476f970d866
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 /** @#file
23 * export of all variable related text fields (and database display field)
25 #include "txtvfldi.hxx"
26 #include <xmloff/xmltoken.hxx>
27 #include <xmloff/txtimp.hxx>
28 #include <xmloff/xmlnumi.hxx>
29 #include "xmloff/xmlnmspe.hxx"
30 #include <xmloff/nmspmap.hxx>
31 #include "xmloff/i18nmap.hxx"
32 #include <xmloff/xmlimp.hxx>
33 #include <xmloff/xmluconv.hxx>
34 #include <xmloff/xmlement.hxx>
35 #include <com/sun/star/text/SetVariableType.hpp>
36 #include <com/sun/star/text/XTextField.hpp>
37 #include <com/sun/star/text/XDependentTextField.hpp>
38 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/beans/XPropertySetInfo.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/xml/sax/XAttributeList.hpp>
44 #include <sax/tools/converter.hxx>
46 #include <rtl/ustring.hxx>
48 #include <tools/debug.hxx>
51 // service names
52 static const sal_Char sAPI_textfield_prefix[] = "com.sun.star.text.TextField.";
53 static const sal_Char sAPI_fieldmaster_prefix[] = "com.sun.star.text.FieldMaster.";
54 static const sal_Char sAPI_input[] = "Input";
55 static const sal_Char sAPI_input_user[] = "InputUser";
56 static const sal_Char sAPI_get_expression[] = "GetExpression";
57 static const sal_Char sAPI_set_expression[] = "SetExpression";
58 static const sal_Char sAPI_user[] = "User";
59 static const sal_Char sAPI_table_formula[] = "TableFormula";
60 static const sal_Char sAPI_database[] = "com.sun.star.text.TextField.Database";
61 static const sal_Char sAPI_fieldmaster_database[] = "com.sun.star.text.FieldMaster.Database";
63 // property names
64 static const sal_Char sAPI_hint[] = "Hint";
65 static const sal_Char sAPI_help[] = "Help";
66 static const sal_Char sAPI_tooltip[] = "Tooltip";
67 static const sal_Char sAPI_content[] = "Content";
68 static const sal_Char sAPI_sub_type[] = "SubType";
69 static const sal_Char sAPI_is_expression[] = "IsExpression";
70 static const sal_Char sAPI_is_input[] = "Input";
71 static const sal_Char sAPI_is_show_formula[] = "IsShowFormula";
72 static const sal_Char sAPI_numbering_type[] = "NumberingType";
73 static const sal_Char sAPI_number_format[] = "NumberFormat";
74 static const sal_Char sAPI_name[] = "Name";
75 static const sal_Char sAPI_numbering_separator[] = "NumberingSeparator";
76 static const sal_Char sAPI_chapter_numbering_level[]= "ChapterNumberingLevel";
77 static const sal_Char sAPI_value[] = "Value";
78 static const sal_Char sAPI_is_visible[] = "IsVisible";
79 static const sal_Char sAPI_variable_subtype[] = "VariableSubtype";
80 static const sal_Char sAPI_data_column_name[] = "DataColumnName";
81 static const sal_Char sAPI_is_data_base_format[] = "DataBaseFormat";
82 static const sal_Char sAPI_current_presentation[] = "CurrentPresentation";
83 static const sal_Char sAPI_sequence_value[] = "SequenceValue";
84 static const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
88 using namespace ::com::sun::star;
89 using namespace ::com::sun::star::uno;
90 using namespace ::com::sun::star::beans;
91 using namespace ::com::sun::star::text;
92 using namespace ::com::sun::star::style;
93 using namespace ::xmloff::token;
98 // XMLVarFieldImportContext: superclass for all variable related fields
101 TYPEINIT1( XMLVarFieldImportContext, XMLTextFieldImportContext );
103 XMLVarFieldImportContext::XMLVarFieldImportContext(
104 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
105 const sal_Char* pServiceName, sal_uInt16 nPrfx,
106 const OUString& rLocalName,
107 sal_Bool bFormula, sal_Bool bFormulaDefault,
108 sal_Bool bDescription, sal_Bool bHelp, sal_Bool bHint, sal_Bool bVisible,
109 sal_Bool bIsDisplayFormula,
110 sal_Bool bType, sal_Bool bStyle, sal_Bool bValue,
111 sal_Bool bPresentation) :
112 XMLTextFieldImportContext(rImport, rHlp, pServiceName, nPrfx, rLocalName),
113 sPropertyContent(sAPI_content),
114 sPropertyHint(sAPI_hint),
115 sPropertyHelp(sAPI_help),
116 sPropertyTooltip(sAPI_tooltip),
117 sPropertyIsVisible(sAPI_is_visible),
118 sPropertyIsDisplayFormula(sAPI_is_show_formula),
119 sPropertyCurrentPresentation(sAPI_current_presentation),
120 aValueHelper(rImport, rHlp, bType, bStyle, bValue, sal_False),
121 bDisplayFormula(sal_False),
122 bDisplayNone(sal_False),
123 bNameOK(sal_False),
124 bFormulaOK(sal_False),
125 bDescriptionOK(sal_False),
126 bHelpOK(sal_False),
127 bHintOK(sal_False),
128 bDisplayOK(sal_False),
129 bSetFormula(bFormula),
130 bSetFormulaDefault(bFormulaDefault),
131 bSetDescription(bDescription),
132 bSetHelp(bHelp),
133 bSetHint(bHint),
134 bSetVisible(bVisible),
135 bSetDisplayFormula(bIsDisplayFormula),
136 bSetPresentation(bPresentation)
140 void XMLVarFieldImportContext::ProcessAttribute(
141 sal_uInt16 nAttrToken,
142 const OUString& sAttrValue )
144 switch (nAttrToken)
146 case XML_TOK_TEXTFIELD_NAME:
147 sName = sAttrValue;
148 bNameOK = sal_True;
149 bValid = sal_True; // we assume: field with name is valid!
150 break;
151 case XML_TOK_TEXTFIELD_DESCRIPTION:
152 sDescription = sAttrValue;
153 bDescriptionOK = sal_True;
154 break;
155 case XML_TOK_TEXTFIELD_HELP:
156 sHelp = sAttrValue;
157 bHelpOK = true;
158 break;
159 case XML_TOK_TEXTFIELD_HINT:
160 sHint = sAttrValue;
161 bHintOK = true;
162 break;
163 case XML_TOK_TEXTFIELD_FORMULA:
165 OUString sTmp;
166 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
167 _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
168 if( XML_NAMESPACE_OOOW == nPrefix )
170 sFormula = sTmp;
171 bFormulaOK = sal_True;
173 else
174 sFormula = sAttrValue;
176 break;
177 case XML_TOK_TEXTFIELD_DISPLAY:
178 if (IsXMLToken(sAttrValue, XML_FORMULA))
180 bDisplayFormula = sal_True;
181 bDisplayNone = sal_False;
182 bDisplayOK = sal_True;
184 else if (IsXMLToken(sAttrValue, XML_VALUE))
186 bDisplayFormula = sal_False;
187 bDisplayNone = sal_False;
188 bDisplayOK = sal_True;
190 else if (IsXMLToken(sAttrValue, XML_NONE))
192 bDisplayFormula = sal_False;
193 bDisplayNone = sal_True;
194 bDisplayOK = sal_True;
195 } // else: no change
196 DBG_ASSERT(!(bDisplayFormula && bDisplayNone),
197 "illegal display values");
198 break;
199 default:
200 // delegate all others to value helper
201 aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
202 break;
206 void XMLVarFieldImportContext::PrepareField(
207 const Reference<XPropertySet> & xPropertySet)
209 // bSetName: not implemented
211 if (bSetFormula)
213 if (!bFormulaOK && bSetFormulaDefault)
215 sFormula = GetContent();
216 bFormulaOK = sal_True;
219 if (bFormulaOK)
221 Any aAny;
222 aAny <<= sFormula;
223 xPropertySet->setPropertyValue(sPropertyContent, aAny);
227 if (bSetDescription && bDescriptionOK)
229 Any aAny;
230 aAny <<= sDescription;
231 xPropertySet->setPropertyValue(sPropertyHint, aAny);
234 if (bSetHelp && bHelpOK)
236 Any aAny;
237 aAny <<= sHelp;
238 xPropertySet->setPropertyValue(sPropertyHelp, aAny);
241 if (bSetHint && bHintOK)
243 Any aAny;
244 aAny <<= sHint;
245 xPropertySet->setPropertyValue(sPropertyTooltip, aAny);
248 if (bSetVisible && bDisplayOK)
250 Any aAny;
251 sal_Bool bTmp = ! (bDisplayNone && bDisplayOK);
252 aAny.setValue( &bTmp, ::getBooleanCppuType());
253 xPropertySet->setPropertyValue(sPropertyIsVisible, aAny);
256 // workaround for #no-bug#: display formula by default
257 if (xPropertySet->getPropertySetInfo()->
258 hasPropertyByName(sPropertyIsDisplayFormula) &&
259 !bSetDisplayFormula)
261 bDisplayFormula = sal_False;
262 bSetDisplayFormula = sal_True;
266 if (bSetDisplayFormula)
268 Any aAny;
269 sal_Bool bTmp = bDisplayFormula && bDisplayOK;
270 aAny.setValue( &bTmp, ::getBooleanCppuType());
271 xPropertySet->setPropertyValue(sPropertyIsDisplayFormula, aAny);
274 // delegate to value helper
275 aValueHelper.SetDefault(GetContent());
276 aValueHelper.PrepareField(xPropertySet);
278 // finally, set the curren presentation
279 if (bSetPresentation)
281 Any aAny;
282 aAny <<= GetContent();
283 xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
292 // variable set fields
295 TYPEINIT1( XMLSetVarFieldImportContext, XMLVarFieldImportContext );
297 XMLSetVarFieldImportContext::XMLSetVarFieldImportContext(
298 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
299 const sal_Char* pServiceName, sal_uInt16 nPrfx,
300 const OUString& rLocalName, VarType eVarType,
301 sal_Bool bFormula, sal_Bool bFormulaDefault,
302 sal_Bool bDescription, sal_Bool bHelp, sal_Bool bHint, sal_Bool bVisible, sal_Bool bIsDisplayFormula,
303 sal_Bool bType, sal_Bool bStyle, sal_Bool bValue, sal_Bool bPresentation) :
304 XMLVarFieldImportContext(rImport, rHlp, pServiceName,
305 nPrfx, rLocalName,
306 bFormula, bFormulaDefault,
307 bDescription, bHelp, bHint, bVisible, bIsDisplayFormula,
308 bType, bStyle, bValue, bPresentation),
309 eFieldType(eVarType)
313 void XMLSetVarFieldImportContext::EndElement()
315 // should we call PrepareField on the field, or rather on it's master?
316 // currently: call on field (just like superclass)
317 // possible alternatives: call on master
318 // call field or master depending on variable
319 // PrepareMaster() in addition to PrepareField()
321 DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
323 if (bValid)
325 DBG_ASSERT(!GetName().isEmpty(), "variable name needed!");
327 // find field master
328 Reference<XPropertySet> xMaster;
329 if (FindFieldMaster(xMaster))
331 // create field/Service
332 Reference<XPropertySet> xPropSet;
333 if (CreateField(xPropSet, OUString(sAPI_textfield_prefix) + GetServiceName()))
335 Reference<XDependentTextField> xDepTextField(xPropSet, UNO_QUERY);
336 if (xDepTextField.is())
338 // attach field to field master
339 xDepTextField->attachTextFieldMaster(xMaster);
341 // attach field to document
342 Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
343 if (xTextContent.is())
345 try {
346 // insert, set field properties and exit!
347 GetImportHelper().InsertTextContent(xTextContent);
348 PrepareField(xPropSet);
349 } catch (lang::IllegalArgumentException & /*e*/)
351 // ignore e: #i54023#
353 return;
360 // above: exit on success; so for all error cases we end up here!
361 // write element content
362 GetImportHelper().InsertString(GetContent());
365 sal_Bool XMLSetVarFieldImportContext::FindFieldMaster(
366 Reference<XPropertySet> & xMaster)
368 // currently: delegate to XMLVariableDeclImportContext;
369 // shoud eventually go here
370 return XMLVariableDeclImportContext::FindFieldMaster(xMaster,
371 GetImport(),
372 GetImportHelper(),
373 GetName(),
374 eFieldType);
380 // sequence field
383 TYPEINIT1( XMLSequenceFieldImportContext, XMLSetVarFieldImportContext );
385 XMLSequenceFieldImportContext::XMLSequenceFieldImportContext(
386 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
387 sal_uInt16 nPrfx, const OUString& rLocalName) :
388 XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
389 nPrfx, rLocalName, VarTypeSequence,
390 // formula
391 sal_True, sal_True,
392 sal_False, sal_False, sal_False, sal_False,
393 sal_False,
394 sal_False, sal_False, sal_False, sal_True),
396 sPropertyNumberFormat(sAPI_number_format),
397 sPropertySequenceValue(sAPI_sequence_value),
398 sNumFormat(OUString::valueOf(sal_Unicode('1'))),
399 sNumFormatSync(GetXMLToken(XML_FALSE)),
400 bRefNameOK(sal_False)
404 void XMLSequenceFieldImportContext::ProcessAttribute(
405 sal_uInt16 nAttrToken, const OUString& sAttrValue )
407 switch (nAttrToken)
409 case XML_TOK_TEXTFIELD_NUM_FORMAT:
410 sNumFormat = sAttrValue;
411 break;
412 case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
413 sNumFormatSync = sAttrValue;
414 break;
415 case XML_TOK_TEXTFIELD_REF_NAME:
416 sRefName = sAttrValue;
417 bRefNameOK = sal_True;
418 break;
419 default:
420 // delegate to super class (name, formula)
421 XMLSetVarFieldImportContext::ProcessAttribute(nAttrToken,
422 sAttrValue);
423 break;
424 } // switch
427 void XMLSequenceFieldImportContext::PrepareField(
428 const Reference<XPropertySet> & xPropertySet)
430 // delegate to super class (formula)
431 XMLSetVarFieldImportContext::PrepareField(xPropertySet);
433 // set format
434 sal_Int16 nNumType = NumberingType::ARABIC;
435 GetImport().GetMM100UnitConverter().convertNumFormat( nNumType, sNumFormat, sNumFormatSync );
436 Any aAny;
437 aAny <<= nNumType;
438 xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
440 // handle reference name
441 if (bRefNameOK)
443 aAny = xPropertySet->getPropertyValue(sPropertySequenceValue);
444 sal_Int16 nValue = 0;
445 aAny >>= nValue;
446 GetImportHelper().InsertSequenceID(sRefName, GetName(), nValue);
453 // variable set field
456 TYPEINIT1( XMLVariableSetFieldImportContext, XMLSetVarFieldImportContext );
458 XMLVariableSetFieldImportContext::XMLVariableSetFieldImportContext(
459 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
460 sal_uInt16 nPrfx, const OUString& rLocalName) :
461 XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
462 nPrfx, rLocalName, VarTypeSimple,
463 // formula, value&type, style,
464 // display none
465 sal_True, sal_True,
466 sal_False, sal_False, sal_False,
467 sal_True, sal_False,
468 sal_True, sal_True, sal_True,
469 sal_True),
470 sPropertySubType(sAPI_sub_type)
474 void XMLVariableSetFieldImportContext::PrepareField(
475 const Reference<XPropertySet> & xPropertySet)
477 // set type
478 Any aAny;
479 aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
480 xPropertySet->setPropertyValue(sPropertySubType, aAny);
482 // the remainder is handled by super class
483 XMLSetVarFieldImportContext::PrepareField(xPropertySet);
489 // variable input field
492 TYPEINIT1( XMLVariableInputFieldImportContext, XMLSetVarFieldImportContext );
494 XMLVariableInputFieldImportContext::XMLVariableInputFieldImportContext(
495 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
496 const OUString& rLocalName) :
497 XMLSetVarFieldImportContext(rImport, rHlp, sAPI_set_expression,
498 nPrfx, rLocalName, VarTypeSimple,
499 // description, display none/formula,
500 // value&type, style, formula
501 sal_True, sal_True,
502 sal_True, sal_True, sal_True,
503 sal_True, sal_False,
504 sal_True, sal_True, sal_True,
505 sal_True),
506 sPropertySubType(sAPI_sub_type),
507 sPropertyIsInput(sAPI_is_input)
511 void XMLVariableInputFieldImportContext::PrepareField(
512 const Reference<XPropertySet> & xPropertySet)
514 // set type (input field)
515 Any aAny;
516 sal_Bool bTrue = sal_True;
517 aAny.setValue( &bTrue, ::getBooleanCppuType() );
518 xPropertySet->setPropertyValue(sPropertyIsInput, aAny);
520 // set type
521 aAny <<= (IsStringValue()? SetVariableType::STRING : SetVariableType::VAR);
522 xPropertySet->setPropertyValue(sPropertySubType, aAny);
524 // the remainder is handled by super class
525 XMLSetVarFieldImportContext::PrepareField(xPropertySet);
531 // user field
534 TYPEINIT1( XMLUserFieldImportContext, XMLSetVarFieldImportContext );
536 XMLUserFieldImportContext::XMLUserFieldImportContext(
537 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
538 sal_uInt16 nPrfx, const OUString& rLocalName) :
539 XMLSetVarFieldImportContext(rImport, rHlp, sAPI_user, nPrfx,
540 rLocalName, VarTypeUserField,
541 // display none/formula, style
542 sal_False, sal_False,
543 sal_False, sal_False, sal_False, sal_True,
544 sal_True,
545 sal_False, sal_True, sal_False,
546 sal_False)
553 // user input field
556 TYPEINIT1( XMLUserFieldInputImportContext, XMLVarFieldImportContext );
558 // bug: doesn't work (SO API lacking)
559 XMLUserFieldInputImportContext::XMLUserFieldInputImportContext(
560 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
561 const OUString& rLocalName) :
562 XMLVarFieldImportContext(rImport, rHlp, sAPI_input_user,
563 nPrfx, rLocalName,
564 // description, style
565 sal_False, sal_False,
566 sal_True, sal_False, sal_False,
567 sal_False, sal_False,
568 sal_False /*???*/, sal_True, sal_False,
569 sal_False)
573 void XMLUserFieldInputImportContext::PrepareField(
574 const Reference<XPropertySet> & xPropertySet)
576 Any aAny;
577 aAny <<= GetName();
578 xPropertySet->setPropertyValue(sPropertyContent, aAny);
580 // delegate to super class
581 XMLVarFieldImportContext::PrepareField(xPropertySet);
586 // variable get field
589 TYPEINIT1( XMLVariableGetFieldImportContext, XMLVarFieldImportContext );
591 XMLVariableGetFieldImportContext::XMLVariableGetFieldImportContext(
592 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
593 sal_uInt16 nPrfx, const OUString& rLocalName) :
594 XMLVarFieldImportContext(rImport, rHlp, sAPI_get_expression,
595 nPrfx, rLocalName,
596 // style, display formula
597 sal_False, sal_False,
598 sal_False, sal_False, sal_False,
599 sal_False, sal_True,
600 sal_True, sal_True, sal_False,
601 sal_True),
602 sPropertySubType(sAPI_sub_type)
606 void XMLVariableGetFieldImportContext::PrepareField(
607 const Reference<XPropertySet> & xPropertySet)
609 // set name
610 Any aAny;
611 aAny <<= GetName();
612 xPropertySet->setPropertyValue(sPropertyContent, aAny);
614 // the remainder is handled by super class
615 XMLVarFieldImportContext::PrepareField(xPropertySet);
621 // expression field
624 TYPEINIT1( XMLExpressionFieldImportContext, XMLVarFieldImportContext );
626 XMLExpressionFieldImportContext::XMLExpressionFieldImportContext(
627 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
628 sal_uInt16 nPrfx, const OUString& rLocalName) :
629 XMLVarFieldImportContext(rImport, rHlp, sAPI_get_expression,
630 nPrfx, rLocalName,
631 // formula, type, style, display formula
632 sal_True, sal_True,
633 sal_False, sal_False, sal_False,
634 sal_False, sal_True,
635 sal_True, sal_True, sal_False,
636 sal_True),
637 sPropertySubType(sAPI_sub_type)
639 bValid = sal_True; // always valid
643 void XMLExpressionFieldImportContext::PrepareField(
644 const Reference<XPropertySet> & xPropertySet)
646 sal_Int16 nSubType = SetVariableType::FORMULA;
647 Any aAny;
648 aAny <<= nSubType;
649 xPropertySet->setPropertyValue(sPropertySubType, aAny);
651 // delegate to super class
652 XMLVarFieldImportContext::PrepareField(xPropertySet);
658 // text input field
661 TYPEINIT1( XMLTextInputFieldImportContext, XMLVarFieldImportContext );
663 XMLTextInputFieldImportContext::XMLTextInputFieldImportContext(
664 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
665 sal_uInt16 nPrfx, const OUString& sLocalName) :
666 XMLVarFieldImportContext(rImport, rHlp, sAPI_input,
667 nPrfx, sLocalName,
668 // description
669 sal_False, sal_False,
670 sal_True, sal_True, sal_True,
671 sal_False, sal_False,
672 sal_False, sal_False, sal_False,
673 sal_False),
674 sPropertyContent(sAPI_content)
676 bValid = sal_True; // always valid
679 void XMLTextInputFieldImportContext::PrepareField(
680 const Reference<XPropertySet> & xPropertySet)
682 XMLVarFieldImportContext::PrepareField(xPropertySet);
684 Any aAny;
685 aAny <<= GetContent();
686 xPropertySet->setPropertyValue(sPropertyContent, aAny);
691 // table formula field
694 TYPEINIT1( XMLTableFormulaImportContext, XMLTextFieldImportContext );
696 XMLTableFormulaImportContext::XMLTableFormulaImportContext(
697 SvXMLImport& rImport,
698 XMLTextImportHelper& rHlp,
699 sal_uInt16 nPrfx,
700 const OUString& rLocalName) :
701 XMLTextFieldImportContext(rImport, rHlp, sAPI_table_formula,
702 nPrfx, rLocalName),
703 sPropertyIsShowFormula("IsShowFormula"),
704 sPropertyCurrentPresentation(
705 "CurrentPresentation"),
706 aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_True),
707 sFormula(),
708 bIsShowFormula(sal_False)
712 XMLTableFormulaImportContext::~XMLTableFormulaImportContext()
716 void XMLTableFormulaImportContext::ProcessAttribute(
717 sal_uInt16 nAttrToken,
718 const OUString& sAttrValue )
720 switch (nAttrToken)
722 case XML_TOK_TEXTFIELD_FORMULA:
723 aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
724 bValid = sal_True; // we need a formula!
725 break;
727 case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
728 aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
729 break;
730 case XML_TOK_TEXTFIELD_DISPLAY:
731 if ( sAttrValue == "formula" )
732 bIsShowFormula = sal_True;
733 break;
734 default:
735 // unknown attribute -> ignore
736 break;
740 void XMLTableFormulaImportContext::PrepareField(
741 const Reference<XPropertySet> & xPropertySet)
743 // set format and formula
744 aValueHelper.PrepareField( xPropertySet );
746 Any aAny;
748 // set 'show formula' and presentation
749 aAny.setValue( &bIsShowFormula, ::getBooleanCppuType() );
750 xPropertySet->setPropertyValue( sPropertyIsShowFormula, aAny );
752 aAny <<= GetContent();
753 xPropertySet->setPropertyValue( sPropertyCurrentPresentation, aAny );
759 // variable declarations
761 // Should be adapted to XMLVarField-/XMLSetVarFieldImportContext scheme!
767 // declaration containter import (<variable/user-field/sequence-decls>)
770 TYPEINIT1( XMLVariableDeclsImportContext, SvXMLImportContext );
772 XMLVariableDeclsImportContext::XMLVariableDeclsImportContext(
773 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
774 const OUString& rLocalName, enum VarType eVarType) :
775 SvXMLImportContext(rImport, nPrfx, rLocalName),
776 eVarDeclsContextType(eVarType),
777 rImportHelper(rHlp)
781 SvXMLImportContext* XMLVariableDeclsImportContext::CreateChildContext(
782 sal_uInt16 nPrefix, const OUString& rLocalName,
783 const Reference<xml::sax::XAttributeList> & xAttrList )
785 enum XMLTokenEnum eElementName;
786 SvXMLImportContext* pImportContext = NULL;
788 if( XML_NAMESPACE_TEXT == nPrefix )
790 switch (eVarDeclsContextType)
792 case VarTypeSequence:
793 eElementName = XML_SEQUENCE_DECL;
794 break;
795 case VarTypeSimple:
796 eElementName = XML_VARIABLE_DECL;
797 break;
798 case VarTypeUserField:
799 eElementName = XML_USER_FIELD_DECL;
800 break;
801 default:
802 OSL_FAIL("unknown field type!");
803 eElementName = XML_SEQUENCE_DECL;
804 break;
807 if( IsXMLToken( rLocalName, eElementName ) )
809 pImportContext = new XMLVariableDeclImportContext(
810 GetImport(), rImportHelper, nPrefix, rLocalName, xAttrList,
811 eVarDeclsContextType);
815 // if no context was created, use default context
816 if (NULL == pImportContext) {
817 pImportContext = SvXMLImportContext::CreateChildContext(nPrefix,
818 rLocalName,
819 xAttrList);
822 return pImportContext;
828 // declaration import (<variable/user-field/sequence-decl> elements)
831 TYPEINIT1( XMLVariableDeclImportContext, SvXMLImportContext );
833 XMLVariableDeclImportContext::XMLVariableDeclImportContext(
834 SvXMLImport& rImport, XMLTextImportHelper& rHlp,
835 sal_uInt16 nPrfx, const OUString& rLocalName,
836 const Reference<xml::sax::XAttributeList> & xAttrList,
837 enum VarType eVarType) :
838 SvXMLImportContext(rImport, nPrfx, rLocalName),
839 // bug?? which properties for userfield/userfieldmaster
840 sPropertyName(sAPI_name),
841 sPropertySubType(sAPI_sub_type),
842 sPropertyNumberingLevel(sAPI_chapter_numbering_level),
843 sPropertyNumberingSeparator(sAPI_numbering_separator),
844 sPropertyIsExpression(sAPI_is_expression),
845 aValueHelper(rImport, rHlp, sal_True, sal_False, sal_True, sal_False),
846 nNumLevel(-1), cSeparationChar('.')
848 if ( (XML_NAMESPACE_TEXT == nPrfx) &&
849 ( ( IsXMLToken( rLocalName, XML_SEQUENCE_DECL )) ||
850 ( IsXMLToken( rLocalName, XML_VARIABLE_DECL)) ||
851 ( IsXMLToken( rLocalName, XML_USER_FIELD_DECL)) )) {
853 // TODO: check validity (need name!)
855 // parse attributes
856 sal_Int16 nLength = xAttrList->getLength();
857 for(sal_Int16 i=0; i<nLength; i++) {
859 OUString sLocalName;
860 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
861 GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
863 sal_uInt16 nToken = rHlp.
864 GetTextFieldAttrTokenMap().Get(nPrefix, sLocalName);
866 switch (nToken)
868 case XML_TOK_TEXTFIELD_NAME:
869 sName = xAttrList->getValueByIndex(i);
870 break;
871 case XML_TOK_TEXTFIELD_NUMBERING_LEVEL:
873 sal_Int32 nLevel;
874 bool const bRet = ::sax::Converter::convertNumber(
875 nLevel, xAttrList->getValueByIndex(i), 0,
876 GetImport().GetTextImport()->GetChapterNumbering()->
877 getCount());
878 if (bRet)
880 nNumLevel = static_cast< sal_Int8 >( nLevel-1 ); // API numbers -1..9
882 break;
884 case XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR:
885 cSeparationChar =
886 (sal_Char)xAttrList->getValueByIndex(i).toChar();
887 break;
889 default:
890 // delegate to value helper
891 aValueHelper.ProcessAttribute(nToken,
892 xAttrList->getValueByIndex(i));
893 break;
897 Reference<XPropertySet> xFieldMaster;
898 if (FindFieldMaster(xFieldMaster, GetImport(), rHlp,
899 sName, eVarType))
901 // now we have a field master: process attributes!
902 Any aAny;
904 switch (eVarType)
906 case VarTypeSequence:
907 aAny <<= nNumLevel;
908 xFieldMaster->setPropertyValue(sPropertyNumberingLevel, aAny);
910 if (nNumLevel >= 0)
912 OUString sStr(&cSeparationChar, 1);
913 aAny <<= sStr;
914 xFieldMaster->setPropertyValue(
915 sPropertyNumberingSeparator, aAny);
917 break;
918 case VarTypeSimple:
920 // set string or non-string SubType (#93192#)
921 // The SubType was already set in the FindFieldMaster
922 // method, but it needs to be adjusted if it's a string.
923 aAny <<= aValueHelper.IsStringValue()
924 ? SetVariableType::STRING : SetVariableType::VAR;
925 xFieldMaster->setPropertyValue(sPropertySubType, aAny);
927 break;
928 case VarTypeUserField:
930 sal_Bool bTmp = !aValueHelper.IsStringValue();
931 aAny.setValue(&bTmp, ::getBooleanCppuType());
932 xFieldMaster->setPropertyValue(sPropertyIsExpression, aAny);
933 aValueHelper.PrepareField(xFieldMaster);
934 break;
936 default:
937 OSL_FAIL("unknown varfield type");
938 } // switch
939 } // else: no field master found/constructed
940 } // else: no sequence-decl
945 sal_Bool XMLVariableDeclImportContext::FindFieldMaster(
946 Reference<XPropertySet> & xMaster, SvXMLImport& rImport,
947 XMLTextImportHelper& rImportHelper,
948 const OUString& sVarName, enum VarType eVarType)
950 static sal_Int32 nCollisionCount = 0;
952 // rename field
953 // currently: no family in use! Use 0.
954 OUString sName = rImportHelper.GetRenameMap().Get(
955 sal::static_int_cast< sal_uInt16 >(eVarType), sVarName);
957 // get text fields supplier and field masters
958 Reference<XTextFieldsSupplier> xTextFieldsSupp(rImport.GetModel(),
959 UNO_QUERY);
960 Reference<container::XNameAccess> xFieldMasterNameAccess(
961 xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
963 OUStringBuffer sBuffer;
964 sBuffer.appendAscii(sAPI_fieldmaster_prefix);
965 sBuffer.appendAscii(sAPI_set_expression);
966 sBuffer.appendAscii(".");
967 sBuffer.append(sName);
968 OUString sVarServiceName = sBuffer.makeStringAndClear();
970 sBuffer.appendAscii(sAPI_fieldmaster_prefix);
971 sBuffer.appendAscii(sAPI_user);
972 sBuffer.appendAscii(".");
973 sBuffer.append(sName);
974 OUString sUserServiceName = sBuffer.makeStringAndClear();
976 if (xFieldMasterNameAccess->hasByName(sVarServiceName)) {
977 // variable field master already in document
979 Any aAny = xFieldMasterNameAccess->getByName(sVarServiceName);
980 aAny >>= xMaster;
982 aAny = xMaster->getPropertyValue(
983 // sPropertySubType
984 OUString(sAPI_sub_type)
986 sal_Int16 nType = 0;
987 aAny >>= nType;
989 enum VarType eFMVarType =
990 (SetVariableType::SEQUENCE == nType) ?
991 VarTypeSequence : VarTypeSimple;
993 if (eFMVarType != eVarType)
995 OUString sNew;
997 // FIXME! cant find if name is taken already!!!!
999 nCollisionCount++;
1000 OUStringBuffer aBuf;
1001 aBuf.append(sName);
1002 aBuf.appendAscii("_renamed_");
1003 aBuf.append(nCollisionCount);
1004 sNew = aBuf.makeStringAndClear();
1006 rImportHelper.GetRenameMap().Add(
1007 sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
1009 // call FindFieldMaster recursively to create new master
1010 return FindFieldMaster(xMaster, rImport, rImportHelper,
1011 sNew, eVarType);
1013 } else if (xFieldMasterNameAccess->hasByName(sUserServiceName)) {
1014 // user field: get field master
1015 Any aAny = xFieldMasterNameAccess->getByName(sUserServiceName);
1016 aAny >>= xMaster;
1018 if (VarTypeUserField != eVarType) {
1019 // find new name that is not taken
1020 OUString sNew;
1022 // FIXME! cant find if name is taken already!!!!
1024 nCollisionCount++;
1025 OUStringBuffer aBuf;
1026 aBuf.append(sName);
1027 aBuf.appendAscii("_renamed_");
1028 aBuf.append(nCollisionCount);
1029 sNew = aBuf.makeStringAndClear();
1031 rImportHelper.GetRenameMap().Add(
1032 sal::static_int_cast< sal_uInt16 >(eVarType), sName, sNew);
1034 // call FindFieldMaster recursively to create new master
1035 return FindFieldMaster(xMaster, rImport, rImportHelper,
1036 sNew, eVarType);
1038 } else {
1039 // field name not used: create field master
1041 // import -> model is MultiServiceFactory -> createInstance
1042 Reference<lang::XMultiServiceFactory>
1043 xFactory(rImport.GetModel(),UNO_QUERY);
1044 if( xFactory.is() ) {
1046 OUStringBuffer sService;
1047 sService.appendAscii(sAPI_fieldmaster_prefix);
1048 sService.appendAscii((eVarType==VarTypeUserField) ?
1049 sAPI_user : sAPI_set_expression);
1050 Reference<XInterface> xIfc =
1051 xFactory->createInstance( sService.makeStringAndClear() );
1052 if (xIfc.is()) {
1053 Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
1054 xMaster = xTmp;
1056 // set name
1057 Any aAny;
1058 aAny <<= sName;
1059 xMaster->setPropertyValue(
1060 // sPropertyName
1061 OUString(sAPI_name)
1062 , aAny);
1064 if (eVarType != VarTypeUserField) {
1065 // set subtype for setexp field
1067 aAny <<= ((eVarType == VarTypeSimple) ?
1068 SetVariableType::VAR :
1069 SetVariableType::SEQUENCE);
1070 xMaster->setPropertyValue(
1071 // sPropertySubType
1072 OUString(sAPI_sub_type)
1073 , aAny);
1074 } // else : user field: no subtype
1076 } else {
1077 return sal_False;
1079 } else {
1080 return sal_False;
1084 DBG_ASSERT(xMaster.is(), "no field master found!?!");
1085 return sal_True;
1090 // Database Display field import
1094 TYPEINIT1( XMLDatabaseDisplayImportContext, XMLDatabaseFieldImportContext );
1096 XMLDatabaseDisplayImportContext::XMLDatabaseDisplayImportContext(
1097 SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
1098 const OUString& rLocalName) :
1099 XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database,
1100 nPrfx, rLocalName, false),
1101 sPropertyColumnName(sAPI_data_column_name),
1102 sPropertyDatabaseFormat(sAPI_is_data_base_format),
1103 sPropertyCurrentPresentation(sAPI_current_presentation),
1104 sPropertyIsVisible(sAPI_is_visible),
1105 aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_False),
1106 bColumnOK(sal_False),
1107 bDisplay( sal_True ),
1108 bDisplayOK( sal_False )
1112 void XMLDatabaseDisplayImportContext::ProcessAttribute(
1113 sal_uInt16 nAttrToken, const OUString& sAttrValue )
1115 switch (nAttrToken)
1117 case XML_TOK_TEXTFIELD_COLUMN_NAME:
1118 sColumnName = sAttrValue;
1119 bColumnOK = sal_True;
1120 break;
1121 case XML_TOK_TEXTFIELD_DISPLAY:
1123 sal_Bool bNone = IsXMLToken( sAttrValue, XML_NONE );
1124 sal_Bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
1125 bDisplay = bValue;
1126 bDisplayOK = bNone || bValue;
1128 break;
1129 case XML_TOK_TEXTFIELD_DATABASE_NAME:
1130 case XML_TOK_TEXTFIELD_TABLE_NAME:
1131 case XML_TOK_TEXTFIELD_TABLE_TYPE:
1132 // handled by super class
1133 XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
1134 sAttrValue);
1135 break;
1136 default:
1137 // remainder handled by value helper
1138 aValueHelper.ProcessAttribute(nAttrToken, sAttrValue);
1139 break;
1142 bValid = bTableOK && bDatabaseOK && bColumnOK;
1145 void XMLDatabaseDisplayImportContext::EndElement()
1147 // we have an EndElement of our own, because database fields need
1148 // to be attached to a field master before they can be inserted into
1149 // the document. Database stuff (database, table, column) all goes
1150 // to the field master, value & style go to the field.
1152 if (bValid)
1155 // so here goes: we start with the master
1156 Reference<XPropertySet> xMaster;
1158 // create and prepare field master first
1159 if (CreateField(xMaster,
1160 OUString(
1161 sAPI_fieldmaster_database)))
1163 Any aAny;
1164 aAny <<= sColumnName;
1165 xMaster->setPropertyValue(sPropertyColumnName, aAny);
1167 // fieldmaster takes database, table and column name
1168 XMLDatabaseFieldImportContext::PrepareField(xMaster);
1170 // create field
1171 Reference<XPropertySet> xField;
1172 if (CreateField(xField,
1173 OUString(
1174 sAPI_database)))
1176 // attach field master
1177 Reference<XDependentTextField> xDepField(xField, UNO_QUERY);
1178 if (xDepField.is())
1180 // attach field to field master
1181 xDepField->attachTextFieldMaster(xMaster);
1183 // attach field to document
1184 Reference<XTextContent> xTextContent(xField, UNO_QUERY);
1185 if (xTextContent.is())
1187 // insert, set field properties and exit!
1188 GetImportHelper().InsertTextContent(xTextContent);
1190 // prepare field: format from database?
1191 sal_Bool bTmp = !aValueHelper.IsFormatOK();
1192 aAny.setValue( &bTmp, ::getBooleanCppuType() );
1193 xField->setPropertyValue(sPropertyDatabaseFormat,aAny);
1195 // value, value-type and format done by value helper
1196 aValueHelper.PrepareField(xField);
1198 // visibility
1199 if( bDisplayOK )
1201 aAny.setValue( &bDisplay, ::getBooleanCppuType() );
1202 xField->setPropertyValue(sPropertyIsVisible, aAny);
1205 // set presentation
1206 aAny <<= GetContent();
1207 xField->setPropertyValue(sPropertyCurrentPresentation,
1208 aAny);
1210 // success!
1211 return;
1218 // above: exit on success; so for all error cases we end up here!
1219 // write element content
1220 GetImportHelper().InsertString(GetContent());
1225 // value import helper
1228 enum ValueType
1230 XML_VALUE_TYPE_STRING,
1231 XML_VALUE_TYPE_FLOAT,
1232 XML_VALUE_TYPE_CURRENCY,
1233 XML_VALUE_TYPE_PERCENTAGE,
1234 XML_VALUE_TYPE_DATE,
1235 XML_VALUE_TYPE_TIME,
1236 XML_VALUE_TYPE_BOOLEAN
1239 static SvXMLEnumMapEntry const aValueTypeMap[] =
1241 { XML_FLOAT, XML_VALUE_TYPE_FLOAT },
1242 { XML_CURRENCY, XML_VALUE_TYPE_CURRENCY },
1243 { XML_PERCENTAGE, XML_VALUE_TYPE_PERCENTAGE },
1244 { XML_DATE, XML_VALUE_TYPE_DATE },
1245 { XML_TIME, XML_VALUE_TYPE_TIME },
1246 { XML_BOOLEAN, XML_VALUE_TYPE_BOOLEAN },
1247 { XML_STRING, XML_VALUE_TYPE_STRING },
1248 { XML_TOKEN_INVALID, 0 }
1251 XMLValueImportHelper::XMLValueImportHelper(
1252 SvXMLImport& rImprt,
1253 XMLTextImportHelper& rHlp,
1254 sal_Bool bType, sal_Bool bStyle, sal_Bool bValue, sal_Bool bFormula) :
1255 sPropertyContent(sAPI_content),
1256 sPropertyValue(sAPI_value),
1257 sPropertyNumberFormat(sAPI_number_format),
1258 sPropertyIsFixedLanguage(sAPI_is_fixed_language),
1260 rImport(rImprt),
1261 rHelper(rHlp),
1263 fValue(0.0),
1264 nFormatKey(0),
1265 bIsDefaultLanguage(sal_True),
1267 bStringType(sal_False),
1268 bFormatOK(sal_False),
1269 bTypeOK(sal_False),
1270 bStringValueOK(sal_False),
1271 bFloatValueOK(sal_False),
1272 bFormulaOK(sal_False),
1274 bSetType(bType),
1275 bSetValue(bValue),
1276 bSetStyle(bStyle),
1277 bSetFormula(bFormula),
1279 bStringDefault(sal_True),
1280 bFormulaDefault(sal_True)
1284 XMLValueImportHelper::~XMLValueImportHelper()
1288 void XMLValueImportHelper::ProcessAttribute(
1289 sal_uInt16 nAttrToken, const OUString& sAttrValue )
1291 switch (nAttrToken)
1293 case XML_TOK_TEXTFIELD_VALUE_TYPE:
1295 // convert enum
1296 sal_uInt16 nTmp = 0;
1297 sal_Bool bRet = SvXMLUnitConverter::convertEnum(
1298 nTmp, sAttrValue, aValueTypeMap);
1300 if (bRet) {
1301 ValueType eValueType = (ValueType)nTmp;
1303 bTypeOK = sal_True;
1305 switch (eValueType)
1307 case XML_VALUE_TYPE_STRING:
1308 bStringType = sal_True;
1309 break;
1310 case XML_VALUE_TYPE_FLOAT:
1311 case XML_VALUE_TYPE_CURRENCY:
1312 case XML_VALUE_TYPE_PERCENTAGE:
1313 case XML_VALUE_TYPE_DATE:
1314 case XML_VALUE_TYPE_TIME:
1315 case XML_VALUE_TYPE_BOOLEAN:
1316 bStringType = sal_False;
1317 break;
1319 default:
1320 OSL_FAIL("unknown value type");
1321 bTypeOK = sal_False;
1324 break;
1327 case XML_TOK_TEXTFIELD_VALUE:
1329 double fTmp;
1330 bool const bRet = ::sax::Converter::convertDouble(fTmp,sAttrValue);
1331 if (bRet) {
1332 bFloatValueOK = sal_True;
1333 fValue = fTmp;
1335 break;
1338 case XML_TOK_TEXTFIELD_TIME_VALUE:
1340 double fTmp;
1341 bool const bRet =
1342 ::sax::Converter::convertDuration(fTmp, sAttrValue);
1343 if (bRet) {
1344 bFloatValueOK = sal_True;
1345 fValue = fTmp;
1347 break;
1350 case XML_TOK_TEXTFIELD_DATE_VALUE:
1352 double fTmp;
1353 sal_Bool bRet = rImport.GetMM100UnitConverter().
1354 convertDateTime(fTmp,sAttrValue);
1355 if (bRet) {
1356 bFloatValueOK = sal_True;
1357 fValue = fTmp;
1359 break;
1362 case XML_TOK_TEXTFIELD_BOOL_VALUE:
1364 bool bTmp(false);
1365 bool bRet = ::sax::Converter::convertBool(bTmp, sAttrValue);
1366 if (bRet) {
1367 bFloatValueOK = sal_True;
1368 fValue = (bTmp ? 1.0 : 0.0);
1370 else
1372 double fTmp;
1373 bRet = ::sax::Converter::convertDouble(fTmp, sAttrValue);
1374 if (bRet) {
1375 bFloatValueOK = sal_True;
1376 fValue = fTmp;
1379 break;
1382 case XML_TOK_TEXTFIELD_STRING_VALUE:
1383 sValue = sAttrValue;
1384 bStringValueOK = sal_True;
1385 break;
1387 case XML_TOK_TEXTFIELD_FORMULA:
1389 OUString sTmp;
1390 sal_uInt16 nPrefix = rImport.GetNamespaceMap().
1391 _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
1392 if( XML_NAMESPACE_OOOW == nPrefix )
1394 sFormula = sTmp;
1395 bFormulaOK = sal_True;
1397 else
1398 sFormula = sAttrValue;
1400 break;
1402 case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
1404 sal_Int32 nKey = rHelper.GetDataStyleKey(
1405 sAttrValue, &bIsDefaultLanguage);
1406 if (-1 != nKey)
1408 nFormatKey = nKey;
1409 bFormatOK = sal_True;
1411 break;
1413 } // switch
1416 void XMLValueImportHelper::PrepareField(
1417 const Reference<XPropertySet> & xPropertySet)
1419 Any aAny;
1421 if (bSetType)
1423 // ??? how to set type?
1426 if (bSetFormula)
1428 aAny <<= (!bFormulaOK && bFormulaDefault) ? sDefault : sFormula;
1429 xPropertySet->setPropertyValue(sPropertyContent, aAny);
1432 // format/style
1433 if (bSetStyle && bFormatOK)
1435 aAny <<= nFormatKey;
1436 xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
1438 if( xPropertySet->getPropertySetInfo()->
1439 hasPropertyByName( sPropertyIsFixedLanguage ) )
1441 sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
1442 aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
1443 xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
1447 // value: string or float
1448 if (bSetValue)
1450 if (bStringType)
1452 aAny <<= (!bStringValueOK && bStringDefault) ? sDefault : sValue;
1453 xPropertySet->setPropertyValue(sPropertyContent, aAny);
1455 else
1457 aAny <<= fValue;
1458 xPropertySet->setPropertyValue(sPropertyValue, aAny);
1463 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */