LibreOffice Module xmloff (master) 1
xformsexport.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
22
23#include "XFormsModelExport.hxx"
24
25#include <xmloff/xmlexp.hxx>
26#include <xmloff/xmltoken.hxx>
29#include <DomExport.hxx>
30
32
35
37#include <sal/log.hxx>
38#include <com/sun/star/container/XIndexAccess.hpp>
39#include <com/sun/star/container/XNameAccess.hpp>
40#include <com/sun/star/document/NamedPropertyValues.hpp>
41#include <com/sun/star/frame/XModel.hpp>
42#include <com/sun/star/xml/dom/XDocument.hpp>
43#include <com/sun/star/form/binding/XBindableValue.hpp>
44#include <com/sun/star/form/binding/XListEntrySink.hpp>
45#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
46#include <com/sun/star/xforms/XModel.hpp>
47#include <com/sun/star/xforms/XDataTypeRepository.hpp>
48#include <com/sun/star/xforms/XFormsSupplier.hpp>
49#include <com/sun/star/beans/PropertyValue.hpp>
50#include <com/sun/star/container/XEnumerationAccess.hpp>
51#include <com/sun/star/container/XEnumeration.hpp>
52#include <com/sun/star/container/XNameContainer.hpp>
53#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
54#include <com/sun/star/xsd/DataTypeClass.hpp>
55#include <com/sun/star/util/Date.hpp>
56#include <com/sun/star/util/Time.hpp>
57#include <com/sun/star/util/DateTime.hpp>
58#include <com/sun/star/util/Duration.hpp>
59
60using namespace com::sun::star;
61using namespace com::sun::star::uno;
62using namespace xmloff::token;
63
65using com::sun::star::beans::XPropertySetInfo;
66using com::sun::star::container::XIndexAccess;
67using com::sun::star::container::XNameAccess;
68using com::sun::star::container::XNameContainer;
69using com::sun::star::container::XEnumerationAccess;
70using com::sun::star::container::XEnumeration;
71using com::sun::star::xml::dom::XDocument;
72using com::sun::star::form::binding::XBindableValue;
73using com::sun::star::form::binding::XListEntrySink;
74using com::sun::star::form::submission::XSubmissionSupplier;
75using com::sun::star::beans::PropertyValue;
76using com::sun::star::xforms::XDataTypeRepository;
77using com::sun::star::xforms::XFormsSupplier;
78using com::sun::star::util::Duration;
79
80void exportXForms( SvXMLExport& rExport )
81{
82 Reference<XFormsSupplier> xSupplier( rExport.GetModel(), UNO_QUERY );
83 if( !xSupplier.is() )
84 return;
85
86 Reference<XNameContainer> xForms = xSupplier->getXForms();
87 if( xForms.is() )
88 {
89 const Sequence<OUString> aNames = xForms->getElementNames();
90
91 for( const auto& rName : aNames )
92 {
93 Reference<XPropertySet> xModel( xForms->getByName( rName ),
94 UNO_QUERY );
95 exportXFormsModel( rExport, xModel );
96 }
97 }
98}
99
100
105
106
107typedef OUString (*convert_t)( const Any& );
108
109namespace {
110
111struct ExportTable
112{
113 const char* pPropertyName;
114 sal_uInt16 const nNamespace;
115 sal_uInt16 nToken;
116 convert_t const aConverter;
117};
118
119}
120
121static void lcl_export( const Reference<XPropertySet>& rPropertySet,
122 SvXMLExport& rExport,
123 const ExportTable* pTable );
124
125#define TABLE_END { nullptr, 0, 0, nullptr }
126
127// any conversion functions
128static OUString xforms_string( const Any& );
129static OUString xforms_bool( const Any& );
130static OUString xforms_whitespace( const Any& );
131template<typename T, void (*FUNC)( OUStringBuffer&, T )> static OUString xforms_convert( const Any& );
132template<typename T, void (*FUNC)( OUStringBuffer&, const T& )> static OUString xforms_convertRef( const Any& );
133
134static void xforms_formatDate( OUStringBuffer& aBuffer, const util::Date& aDate );
135static void xforms_formatTime( OUStringBuffer& aBuffer, const css::util::Time& aTime );
136static void xforms_formatDateTime( OUStringBuffer& aBuffer, const util::DateTime& aDateTime );
137
138static void convertNumber(OUStringBuffer & b, sal_Int32 n) {
139 b.append(n);
140}
141
142convert_t const xforms_int32 = &xforms_convert<sal_Int32,&convertNumber>;
143convert_t const xforms_double = &xforms_convert<double,&::sax::Converter::convertDouble>;
144convert_t const xforms_dateTime = &xforms_convertRef<util::DateTime,&xforms_formatDateTime>;
145convert_t const xforms_date = &xforms_convertRef<util::Date,&xforms_formatDate>;
146convert_t const xforms_time = &xforms_convertRef<css::util::Time,&xforms_formatTime>;
147
148// other functions
149static OUString lcl_getXSDType( SvXMLExport const & rExport,
150 const Reference<XPropertySet>& xType );
151
152
153// the model
154
155
156const ExportTable aXFormsModelTable[] =
157{
161};
162
164 const Reference<XPropertySet>& xModelPropSet )
165{
166 // no model -> don't do anything!
167 Reference<css::xforms::XModel> xModel( xModelPropSet, UNO_QUERY );
168 if( ! xModel.is() || ! xModelPropSet.is() )
169 return;
170
171 lcl_export( xModelPropSet, rExport, aXFormsModelTable );
172 SvXMLElementExport aModelElement( rExport, XML_NAMESPACE_XFORMS, XML_MODEL,
173 true, true );
174
175 // instances
176 Reference<XIndexAccess> xInstances( xModel->getInstances(),
177 UNO_QUERY_THROW);
178 sal_Int32 nCount = xInstances->getCount();
179 sal_Int32 i = 0;
180 for( i = 0; i < nCount; i++ )
181 {
182 Sequence<PropertyValue> aInstance;
183 xInstances->getByIndex( i ) >>= aInstance;
184 exportXFormsInstance( rExport, aInstance );
185 }
186
187
188 // bindings
189 Reference<XIndexAccess> xBindings( xModel->getBindings(), UNO_QUERY_THROW);
190 nCount = xBindings->getCount();
191 for( i = 0; i < nCount; i++ )
192 {
193 Reference<XPropertySet> aBinding( xBindings->getByIndex( i ),
194 UNO_QUERY_THROW );
195 exportXFormsBinding( rExport, aBinding );
196 }
197
198 // submissions
199 Reference<XIndexAccess> xSubmissions( xModel->getSubmissions(),
200 UNO_QUERY_THROW );
201 nCount = xSubmissions->getCount();
202 for( i = 0; i < nCount; i++ )
203 {
204 Reference<XPropertySet> xSubmission( xSubmissions->getByIndex( i ),
205 UNO_QUERY_THROW );
206 exportXFormsSubmission( rExport, xSubmission );
207 }
208
209 // schemas
210 exportXFormsSchemas( rExport, xModel );
211}
212
213
214// the instance
215
216
218 const Sequence<PropertyValue>& xInstance )
219{
220 OUString sId;
221 OUString sURL;
223
224 for( const auto& rProp : xInstance )
225 {
226 OUString sName = rProp.Name;
227 const Any& rAny = rProp.Value;
228 if ( sName == "ID" )
229 rAny >>= sId;
230 else if ( sName == "URL" )
231 rAny >>= sURL;
232 else if ( sName == "Instance" )
233 rAny >>= xDoc;
234 }
235
236 if( !sId.isEmpty() )
238
239 if( !sURL.isEmpty() )
240 rExport.AddAttribute( XML_NAMESPACE_NONE, XML_SRC, sURL );
241
243 true, true );
244 rExport.IgnorableWhitespace();
245 if( xDoc.is() )
246 {
247 exportDom( rExport, xDoc );
248 }
249}
250
251
252// the binding
253
254
255const ExportTable aXFormsBindingTable[] =
256{
264 // type handled separately, for type name <-> XSD type conversion
265 // { "Type", XML_NAMESPACE_NONE, xmloff::token::XML_TYPE, xforms_string },
267};
268
270 const Reference<XPropertySet>& xBinding )
271{
272 // name check; generate binding ID if necessary
273 {
274 OUString sName;
275 xBinding->getPropertyValue( "BindingID" ) >>= sName;
276 if( sName.isEmpty() )
277 {
278 // if we don't have a name yet, generate one on the fly
279 sal_Int64 nId = reinterpret_cast<sal_uInt64>( xBinding.get() );
280 sName = "bind_" + OUString::number( nId , 16 );
281 xBinding->setPropertyValue( "BindingID", Any(sName));
282 }
283 }
284
285 lcl_export( xBinding, rExport, aXFormsBindingTable );
286
287 // handle type attribute
288 {
289 OUString sTypeName;
290 xBinding->getPropertyValue( "Type" ) >>= sTypeName;
291
292 try
293 {
294 // now get type, and determine whether it's a standard type. If
295 // so, export the XSD name
297 xBinding->getPropertyValue( "Model" ),
298 UNO_QUERY );
300 xModel.is() ? xModel->getDataTypeRepository() : Reference<XDataTypeRepository>() );
301 if( xRepository.is() )
302 {
303 Reference<XPropertySet> xDataType =
304 xRepository->getDataType( sTypeName );
305
306 // if it's a basic data type, write out the XSD name
307 // for the XSD type class
308 bool bIsBasic = false;
309 xDataType->getPropertyValue( "IsBasic" ) >>= bIsBasic;
310 if( bIsBasic )
311 sTypeName = lcl_getXSDType( rExport, xDataType );
312 }
313 }
314 catch( Exception& )
315 {
316 ; // ignore; just use typename
317 }
318
319 // now that we have the proper type name, write out the attribute
320 if( !sTypeName.isEmpty() )
321 {
323 sTypeName );
324 }
325 }
326
327 // we need to ensure all the namespaces in the binding will work correctly.
328 // to do so, we will write out all missing namespace declaractions.
329 const SvXMLNamespaceMap& rMap = rExport.GetNamespaceMap();
330 Reference<XNameAccess> xNamespaces(
331 xBinding->getPropertyValue( "ModelNamespaces" ), UNO_QUERY);
332 if( xNamespaces.is() )
333 {
334 // iterate over Prefixes for this binding
335 const Sequence<OUString> aPrefixes = xNamespaces->getElementNames();
336 for( const OUString& rPrefix : aPrefixes )
337 {
338 OUString sURI;
339 xNamespaces->getByName( rPrefix ) >>= sURI;
340
341 // check whether prefix/URI pair is in map; else write declaration
342 // (we don't need to change the map, since this element has no
343 // other content)
344 sal_uInt16 nKey = rMap.GetKeyByPrefix( rPrefix );
345 if( nKey == XML_NAMESPACE_UNKNOWN ||
346 rMap.GetNameByKey( nKey ) != sURI )
347 {
348 // add declaration if it doesn't already exist
349 comphelper::AttributeList& rAttrList = rExport.GetAttrList();
350 OUString sName = "xmlns:" + rPrefix;
351 sal_Int16 nFound = rAttrList.GetIndexByName(sName);
352 // duplicate xmlns:script, http://openoffice.org/2000/script seen
353 assert(nFound == -1 || rAttrList.getValueByIndex(nFound) == sURI);
354 if (nFound != -1)
355 continue;
356 rAttrList.AddAttribute(sName, sURI);
357 }
358 }
359 }
360
362 true, true );
363}
364
365
366// the submission
367
368
369const ExportTable aXFormsSubmissionTable[] =
370{
387};
388
390 const Reference<XPropertySet>& xSubmission )
391{
392 lcl_export( xSubmission, rExport, aXFormsSubmissionTable );
394 true, true );
395}
396
397
398// export data types as XSD schema
399
400
401const ExportTable aDataTypeFacetTable[] =
402{
427 // ??? XML_ENUMERATION,
432};
433
434// export facets through table; use the same table as lcl_export does
436 const Reference<XPropertySet>& rPropertySet,
437 const ExportTable* pTable )
438{
439 Reference<XPropertySetInfo> xInfo = rPropertySet->getPropertySetInfo();
440 for( const ExportTable* pCurrent = pTable;
441 pCurrent->pPropertyName != nullptr;
442 pCurrent++ )
443 {
444 OUString sName( OUString::createFromAscii( pCurrent->pPropertyName ) );
445 if( xInfo->hasPropertyByName( sName ) )
446 {
447 OUString sValue = (*pCurrent->aConverter)(
448 rPropertySet->getPropertyValue( sName ) );
449
450 if( !sValue.isEmpty() )
451 {
452 rExport.AddAttribute( XML_NAMESPACE_NONE, XML_VALUE, sValue );
453 SvXMLElementExport aFacet(
454 rExport,
455 pCurrent->nNamespace,
456 static_cast<XMLTokenEnum>( pCurrent->nToken ),
457 true, true );
458 }
459 }
460 }
461}
462
463static OUString lcl_getXSDType( SvXMLExport const & rExport,
464 const Reference<XPropertySet>& xType )
465{
466 // we use string as default...
468
469 sal_uInt16 nDataTypeClass = 0;
470 xType->getPropertyValue( "TypeClass" ) >>= nDataTypeClass;
471 switch( nDataTypeClass )
472 {
473 case css::xsd::DataTypeClass::STRING:
475 break;
476 case css::xsd::DataTypeClass::anyURI:
478 break;
479 case css::xsd::DataTypeClass::DECIMAL:
481 break;
482 case css::xsd::DataTypeClass::DOUBLE:
484 break;
485 case css::xsd::DataTypeClass::FLOAT:
487 break;
488 case css::xsd::DataTypeClass::BOOLEAN:
490 break;
491 case css::xsd::DataTypeClass::DATETIME:
493 break;
494 case css::xsd::DataTypeClass::TIME:
496 break;
497 case css::xsd::DataTypeClass::DATE:
499 break;
500 case css::xsd::DataTypeClass::gYear:
502 break;
503 case css::xsd::DataTypeClass::gDay:
504 eToken = XML_DAY;
505 break;
506 case css::xsd::DataTypeClass::gMonth:
508 break;
509 case css::xsd::DataTypeClass::DURATION:
510 case css::xsd::DataTypeClass::gYearMonth:
511 case css::xsd::DataTypeClass::gMonthDay:
512 case css::xsd::DataTypeClass::hexBinary:
513 case css::xsd::DataTypeClass::base64Binary:
514 case css::xsd::DataTypeClass::QName:
515 case css::xsd::DataTypeClass::NOTATION:
516 default:
517 OSL_FAIL( "unknown data type" );
518 }
519
521 GetXMLToken( eToken ) );
522}
523
524static void lcl_exportDataType( SvXMLExport& rExport,
525 const Reference<XPropertySet>& xType )
526{
527 // we do not need to export basic types; exit if we have one
528 bool bIsBasic = false;
529 xType->getPropertyValue( "IsBasic" ) >>= bIsBasic;
530 if( bIsBasic )
531 return;
532
533 // no basic type -> export
534
535 // <xsd:simpleType name="...">
536 OUString sName;
537 xType->getPropertyValue( "Name" ) >>= sName;
539 SvXMLElementExport aSimpleType( rExport,
541 true, true );
542
543 // <xsd:restriction base="xsd:...">
545 lcl_getXSDType( rExport, xType ) );
546 SvXMLElementExport aRestriction( rExport,
549 true, true );
550
551 // export facets
553 xType,
555}
556
558 const Reference<css::xforms::XModel>& xModel )
559{
560 // TODO: for now, we'll fake this...
561 {
562 SvXMLElementExport aSchemaElem( rExport, XML_NAMESPACE_XSD, XML_SCHEMA,
563 true, true );
564
565 // now get data type repository, and export
566 Reference<XEnumerationAccess> xTypes = xModel->getDataTypeRepository();
567 if( xTypes.is() )
568 {
569 Reference<XEnumeration> xEnum = xTypes->createEnumeration();
570 SAL_WARN_IF( !xEnum.is(), "xmloff", "no enum?" );
571 while( xEnum->hasMoreElements() )
572 {
573 Reference<XPropertySet> xType( xEnum->nextElement(), UNO_QUERY );
574 lcl_exportDataType( rExport, xType );
575 }
576 }
577 }
578
579 // export other, 'foreign' schemas
580 Reference<XPropertySet> xPropSet( xModel, UNO_QUERY );
581 if( xPropSet.is() )
582 {
583 Reference<XDocument> xDocument(
584 xPropSet->getPropertyValue( "ForeignSchema" ),
585 UNO_QUERY );
586
587 if( xDocument.is() )
588 exportDom( rExport, xDocument );
589 }
590}
591
592
593// helper functions
594
595
596static void lcl_export( const Reference<XPropertySet>& rPropertySet,
597 SvXMLExport& rExport,
598 const ExportTable* pTable )
599{
600 for( const ExportTable* pCurrent = pTable;
601 pCurrent->pPropertyName != nullptr;
602 pCurrent++ )
603 {
604 Any aAny = rPropertySet->getPropertyValue(
605 OUString::createFromAscii( pCurrent->pPropertyName ) );
606 OUString sValue = (*pCurrent->aConverter)( aAny );
607
608 if( !sValue.isEmpty() )
609 rExport.AddAttribute(
610 pCurrent->nNamespace,
611 static_cast<XMLTokenEnum>( pCurrent->nToken ),
612 sValue );
613 }
614}
615
616
617// any conversion functions
618
619
620template<typename T, void (*FUNC)( OUStringBuffer&, T )>
621OUString xforms_convert( const Any& rAny )
622{
623 OUStringBuffer aBuffer;
624 T aData = T();
625 if( rAny >>= aData )
626 {
627 FUNC( aBuffer, aData );
628 }
629 return aBuffer.makeStringAndClear();
630}
631
632template<typename T, void (*FUNC)( OUStringBuffer&, const T& )>
633OUString xforms_convertRef( const Any& rAny )
634{
635 OUStringBuffer aBuffer;
636 T aData;
637 if( rAny >>= aData )
638 {
639 FUNC( aBuffer, aData );
640 }
641 return aBuffer.makeStringAndClear();
642}
643
644OUString xforms_string( const Any& rAny )
645{
646 OUString aResult;
647 rAny >>= aResult;
648 return aResult;
649}
650
651OUString xforms_bool( const Any& rAny )
652{
653 bool bResult = bool();
654 if( rAny >>= bResult )
655 return GetXMLToken( bResult ? XML_TRUE : XML_FALSE );
656 OSL_FAIL( "expected boolean value" );
657 return OUString();
658}
659
660void xforms_formatDate( OUStringBuffer& aBuffer, const util::Date& rDate )
661{
662 aBuffer.append( OUString::number( rDate.Year ) +
663 "-" + OUString::number( rDate.Month ) +
664 "-" + OUString::number( rDate.Day ) );
665}
666
667void xforms_formatTime( OUStringBuffer& aBuffer, const css::util::Time& rTime )
668{
669 Duration aDuration;
670 aDuration.Hours = rTime.Hours;
671 aDuration.Minutes = rTime.Minutes;
672 aDuration.Seconds = rTime.Seconds;
673 aDuration.NanoSeconds = rTime.NanoSeconds;
675}
676
677void xforms_formatDateTime( OUStringBuffer& aBuffer, const util::DateTime& aDateTime )
678{
679 ::sax::Converter::convertDateTime(aBuffer, aDateTime, nullptr);
680}
681
682OUString xforms_whitespace( const Any& rAny )
683{
684 OUString sResult;
685 sal_uInt16 n = sal_uInt16();
686 if( rAny >>= n )
687 {
688 switch( n )
689 {
690 case css::xsd::WhiteSpaceTreatment::Preserve:
691 sResult = GetXMLToken( XML_PRESERVE );
692 break;
693 case css::xsd::WhiteSpaceTreatment::Replace:
694 sResult = GetXMLToken( XML_REPLACE );
695 break;
696 case css::xsd::WhiteSpaceTreatment::Collapse:
697 sResult = GetXMLToken( XML_COLLAPSE );
698 break;
699 }
700 }
701 return sResult;
702}
703
704
706static OUString lcl_getXFormsBindName( const Reference<XPropertySet>& xBinding )
707{
708 OUString sProp( "BindingID" );
709
710 OUString sReturn;
711 if( xBinding.is() &&
712 xBinding->getPropertySetInfo()->hasPropertyByName( sProp ) )
713 {
714 xBinding->getPropertyValue( sProp ) >>= sReturn;
715 }
716 return sReturn;
717}
718
719// return name of binding
721{
722 Reference<XBindableValue> xBindable( xControl, UNO_QUERY );
723 return xBindable.is()
725 Reference<XPropertySet>( xBindable->getValueBinding(), UNO_QUERY ))
726 : OUString();
727}
728
729// return name of list binding
731{
732 Reference<XListEntrySink> xListEntrySink( xControl, UNO_QUERY );
733 return xListEntrySink.is()
735 Reference<XPropertySet>( xListEntrySink->getListEntrySource(),
736 UNO_QUERY ) )
737 : OUString();
738}
739
741{
742 OUString sReturn;
743
744 Reference<XSubmissionSupplier> xSubmissionSupplier( xBinding, UNO_QUERY );
745 if( xSubmissionSupplier.is() )
746 {
747 Reference<XPropertySet> xPropertySet(
748 xSubmissionSupplier->getSubmission(), UNO_QUERY );
749 OUString sProp( "ID" );
750 if( xPropertySet.is() &&
751 xPropertySet->getPropertySetInfo()->hasPropertyByName( sProp ) )
752 {
753 xPropertySet->getPropertyValue( sProp ) >>= sReturn;
754 }
755 }
756
757 return sReturn;
758}
759
761{
762 _out_rSettings = Sequence< PropertyValue >();
763
764 OSL_PRECOND( _rXForms.is(), "getXFormsSettings: invalid XForms container!" );
765 if ( !_rXForms.is() )
766 return;
767
768 try
769 {
770 // we want to export some special properties of our XForms models as config-item-map-named,
771 // which implies we need a PropertyValue whose value is an XNameAccess, whose keys
772 // are the names of the XForm models, and which in turn provides named sequences of
773 // PropertyValues - which denote the actual property values of the given named model.
774
775 const Sequence< OUString > aModelNames( _rXForms->getElementNames() );
776
777 Reference< XNameContainer > xModelSettings = document::NamedPropertyValues::create( comphelper::getProcessComponentContext() );
778
779 for ( auto const & modelName : aModelNames )
780 {
781 Reference< XPropertySet > xModelProps( _rXForms->getByName( modelName ), UNO_QUERY_THROW );
782
783 static constexpr OUStringLiteral sExternalData = u"ExternalData";
785 sExternalData, xModelProps->getPropertyValue(sExternalData)) };
786
787 xModelSettings->insertByName( modelName, Any( aModelSettings ) );
788 }
789
790 if ( xModelSettings->hasElements() )
791 {
792 _out_rSettings = { comphelper::makePropertyValue("XFormModels", xModelSettings) };
793 }
794 }
795 catch( const Exception& )
796 {
797 DBG_UNHANDLED_EXCEPTION("xmloff");
798 }
799}
800
801/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void exportDom(SvXMLExport &rExport, const Reference< XDocument > &xDocument)
Definition: DomExport.cxx:241
const char * pPropertyName
const SvXMLNamespaceMap & GetNamespaceMap() const
Definition: xmlexp.hxx:385
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlexp.hxx:411
void IgnorableWhitespace()
Definition: xmlexp.cxx:2187
comphelper::AttributeList & GetAttrList()
Definition: xmlexp.hxx:374
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
const OUString & GetNameByKey(sal_uInt16 nKey) const
sal_uInt16 GetKeyByPrefix(const OUString &rPrefix) const
virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
sal_Int16 GetIndexByName(const OUString &rName) const
void AddAttribute(const OUString &sName, const OUString &sValue)
static void convertDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime, sal_Int16 const *pTimeZoneOffset, bool bAddTimeIf0AM=false)
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
int nCount
#define DBG_UNHANDLED_EXCEPTION(...)
float u
OUString sName
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
constexpr OUStringLiteral aData
@ Exception
class SAL_NO_VTABLE XPropertySet
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
const sal_uInt16 XML_NAMESPACE_NONE
const sal_uInt16 XML_NAMESPACE_UNKNOWN
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
@ XML_INCLUDENAMESPACEPREFIXES
Definition: xmltoken.hxx:2835
@ XML_OMIT_XML_DECLARATION
Definition: xmltoken.hxx:2824
@ XML_CDATA_SECTION_ELEMENTS
Definition: xmltoken.hxx:2826
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
sal_Int16 nId
DefTokenId nToken
OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
Reference< XModel > xModel
OUString sId
std::unique_ptr< char[]> aBuffer
static void xforms_formatDateTime(OUStringBuffer &aBuffer, const util::DateTime &aDateTime)
static OUString lcl_getXFormsBindName(const Reference< XPropertySet > &xBinding)
return name of Binding
static void exportXFormsInstance(SvXMLExport &, const Sequence< PropertyValue > &)
static OUString xforms_whitespace(const Any &)
#define TABLE_END
void getXFormsSettings(const Reference< XNameAccess > &_rXForms, Sequence< PropertyValue > &_out_rSettings)
static OUString lcl_getXSDType(SvXMLExport const &rExport, const Reference< XPropertySet > &xType)
static void exportXFormsBinding(SvXMLExport &, const Reference< XPropertySet > &)
static OUString xforms_convert(const Any &)
static void lcl_export(const Reference< XPropertySet > &rPropertySet, SvXMLExport &rExport, const ExportTable *pTable)
OUString getXFormsSubmissionName(const Reference< XPropertySet > &xBinding)
OUString getXFormsBindName(const Reference< XPropertySet > &xControl)
convert_t const xforms_dateTime
const ExportTable aXFormsModelTable[]
static void xforms_formatTime(OUStringBuffer &aBuffer, const css::util::Time &aTime)
static void exportXFormsSubmission(SvXMLExport &, const Reference< XPropertySet > &)
convert_t const xforms_time
const ExportTable aXFormsBindingTable[]
static void lcl_exportDataType(SvXMLExport &rExport, const Reference< XPropertySet > &xType)
static OUString xforms_bool(const Any &)
convert_t const xforms_int32
const ExportTable aDataTypeFacetTable[]
static OUString xforms_string(const Any &)
const ExportTable aXFormsSubmissionTable[]
static OUString xforms_convertRef(const Any &)
static void xforms_formatDate(OUStringBuffer &aBuffer, const util::Date &aDate)
static void exportXFormsSchemas(SvXMLExport &, const Reference< css::xforms::XModel > &)
OUString getXFormsListBindName(const Reference< XPropertySet > &xControl)
static void lcl_exportDataTypeFacets(SvXMLExport &rExport, const Reference< XPropertySet > &rPropertySet, const ExportTable *pTable)
convert_t const xforms_double
void exportXForms(SvXMLExport &rExport)
export an XForms model.
OUString(* convert_t)(const Any &)
static void convertNumber(OUStringBuffer &b, sal_Int32 n)
void exportXFormsModel(SvXMLExport &rExport, const Reference< XPropertySet > &xModelPropSet)
convert_t const xforms_date
constexpr sal_uInt16 XML_NAMESPACE_XSD
constexpr sal_uInt16 XML_NAMESPACE_XFORMS
XMLTokenEnum eToken
Definition: xmltoken.cxx:40