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>
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;
91 for(
const auto& rName : aNames )
123 const ExportTable* pTable );
125#define TABLE_END { nullptr, 0, 0, nullptr }
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& );
134static void xforms_formatDate( OUStringBuffer& aBuffer,
const util::Date& aDate );
135static void xforms_formatTime( OUStringBuffer& aBuffer,
const css::util::Time& aTime );
168 if( !
xModel.is() || ! xModelPropSet.is() )
178 sal_Int32
nCount = xInstances->getCount();
183 xInstances->getByIndex(
i ) >>= aInstance;
190 nCount = xBindings->getCount();
201 nCount = xSubmissions->getCount();
224 for(
const auto& rProp : xInstance )
226 OUString
sName = rProp.Name;
227 const Any& rAny = rProp.Value;
230 else if (
sName ==
"URL" )
232 else if (
sName ==
"Instance" )
239 if( !sURL.isEmpty() )
275 xBinding->getPropertyValue(
"BindingID" ) >>=
sName;
276 if(
sName.isEmpty() )
279 sal_Int64
nId =
reinterpret_cast<sal_uInt64
>( xBinding.get() );
280 sName =
"bind_" + OUString::number(
nId , 16 );
281 xBinding->setPropertyValue(
"BindingID",
Any(
sName));
290 xBinding->getPropertyValue(
"Type" ) >>= sTypeName;
297 xBinding->getPropertyValue(
"Model" ),
301 if( xRepository.is() )
304 xRepository->getDataType( sTypeName );
308 bool bIsBasic =
false;
309 xDataType->getPropertyValue(
"IsBasic" ) >>= bIsBasic;
320 if( !sTypeName.isEmpty() )
331 xBinding->getPropertyValue(
"ModelNamespaces" ), UNO_QUERY);
332 if( xNamespaces.is() )
336 for(
const OUString& rPrefix : aPrefixes )
339 xNamespaces->getByName( rPrefix ) >>= sURI;
350 OUString
sName =
"xmlns:" + rPrefix;
437 const ExportTable* pTable )
440 for(
const ExportTable* pCurrent = pTable;
441 pCurrent->pPropertyName !=
nullptr;
444 OUString
sName( OUString::createFromAscii( pCurrent->pPropertyName ) );
445 if( xInfo->hasPropertyByName(
sName ) )
447 OUString sValue = (*pCurrent->aConverter)(
448 rPropertySet->getPropertyValue(
sName ) );
450 if( !sValue.isEmpty() )
455 pCurrent->nNamespace,
469 sal_uInt16 nDataTypeClass = 0;
470 xType->getPropertyValue(
"TypeClass" ) >>= nDataTypeClass;
471 switch( nDataTypeClass )
473 case css::xsd::DataTypeClass::STRING:
476 case css::xsd::DataTypeClass::anyURI:
479 case css::xsd::DataTypeClass::DECIMAL:
482 case css::xsd::DataTypeClass::DOUBLE:
485 case css::xsd::DataTypeClass::FLOAT:
488 case css::xsd::DataTypeClass::BOOLEAN:
491 case css::xsd::DataTypeClass::DATETIME:
494 case css::xsd::DataTypeClass::TIME:
497 case css::xsd::DataTypeClass::DATE:
500 case css::xsd::DataTypeClass::gYear:
503 case css::xsd::DataTypeClass::gDay:
506 case css::xsd::DataTypeClass::gMonth:
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:
517 OSL_FAIL(
"unknown data type" );
528 bool bIsBasic =
false;
529 xType->getPropertyValue(
"IsBasic" ) >>= bIsBasic;
537 xType->getPropertyValue(
"Name" ) >>=
sName;
571 while( xEnum->hasMoreElements() )
584 xPropSet->getPropertyValue(
"ForeignSchema" ),
598 const ExportTable* pTable )
600 for(
const ExportTable* pCurrent = pTable;
601 pCurrent->pPropertyName !=
nullptr;
604 Any aAny = rPropertySet->getPropertyValue(
605 OUString::createFromAscii( pCurrent->pPropertyName ) );
606 OUString sValue = (*pCurrent->aConverter)( aAny );
608 if( !sValue.isEmpty() )
610 pCurrent->nNamespace,
620template<
typename T,
void (*FUNC)( OUStringBuffer&, T )>
629 return aBuffer.makeStringAndClear();
632template<
typename T,
void (*FUNC)( OUStringBuffer&, const T& )>
641 return aBuffer.makeStringAndClear();
653 bool bResult = bool();
654 if( rAny >>= bResult )
656 OSL_FAIL(
"expected boolean value" );
662 aBuffer.append( OUString::number( rDate.Year ) +
663 "-" + OUString::number( rDate.Month ) +
664 "-" + OUString::number( rDate.Day ) );
670 aDuration.Hours = rTime.Hours;
671 aDuration.Minutes = rTime.Minutes;
672 aDuration.Seconds = rTime.Seconds;
673 aDuration.NanoSeconds = rTime.NanoSeconds;
685 sal_uInt16
n = sal_uInt16();
690 case css::xsd::WhiteSpaceTreatment::Preserve:
693 case css::xsd::WhiteSpaceTreatment::Replace:
696 case css::xsd::WhiteSpaceTreatment::Collapse:
708 OUString sProp(
"BindingID" );
712 xBinding->getPropertySetInfo()->hasPropertyByName( sProp ) )
714 xBinding->getPropertyValue( sProp ) >>= sReturn;
723 return xBindable.is()
733 return xListEntrySink.is()
745 if( xSubmissionSupplier.is() )
748 xSubmissionSupplier->getSubmission(), UNO_QUERY );
749 OUString sProp(
"ID" );
750 if( xPropertySet.is() &&
751 xPropertySet->getPropertySetInfo()->hasPropertyByName( sProp ) )
753 xPropertySet->getPropertyValue( sProp ) >>= sReturn;
764 OSL_PRECOND( _rXForms.is(),
"getXFormsSettings: invalid XForms container!" );
765 if ( !_rXForms.is() )
779 for (
auto const & modelName : aModelNames )
783 static constexpr OUStringLiteral sExternalData =
u"ExternalData";
785 sExternalData, xModelProps->getPropertyValue(sExternalData)) };
787 xModelSettings->insertByName( modelName,
Any( aModelSettings ) );
790 if ( xModelSettings->hasElements() )
void exportDom(SvXMLExport &rExport, const Reference< XDocument > &xDocument)
const char * pPropertyName
const SvXMLNamespaceMap & GetNamespaceMap() const
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
const css::uno::Reference< css::frame::XModel > & GetModel() const
void IgnorableWhitespace()
comphelper::AttributeList & GetAttrList()
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)
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN_IF(condition, area, stream)
constexpr OUStringLiteral aData
class SAL_NO_VTABLE XPropertySet
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
const sal_uInt16 XML_NAMESPACE_NONE
const sal_uInt16 XML_NAMESPACE_UNKNOWN
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
@ XML_INCLUDENAMESPACEPREFIXES
@ XML_OMIT_XML_DECLARATION
@ XML_CDATA_SECTION_ELEMENTS
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
Reference< XModel > xModel
std::unique_ptr< char[]> aBuffer
constexpr sal_uInt16 XML_NAMESPACE_XSD
constexpr sal_uInt16 XML_NAMESPACE_XFORMS