fastparser in TokenContext
Change-Id: I12c2af505d4bf19d94fb127cda2403f0b6618b07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106159 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -35,10 +35,6 @@ namespace com::sun::star {
|
||||
}
|
||||
|
||||
/** create import context for xforms:model element. */
|
||||
XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName );
|
||||
XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext(
|
||||
SvXMLImport& rImport );
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext(
|
||||
switch( rTokenMap.Get( nPrefix, rLocalName ) )
|
||||
{
|
||||
case XML_TOK_DOC_XFORMS:
|
||||
pContext = createXFormsModelContext(GetImport(), nPrefix, rLocalName);
|
||||
pContext = createXFormsModelContext(GetImport());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
#include <xmloff/xmltoken.hxx>
|
||||
#include <xmloff/xmlnamespace.hxx>
|
||||
#include <xmloff/xmltkmap.hxx>
|
||||
#include <xmloff/xmlimp.hxx>
|
||||
|
||||
#include <com/sun/star/xforms/XDataTypeRepository.hpp>
|
||||
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XFastAttributeList;
|
||||
using com::sun::star::xforms::XDataTypeRepository;
|
||||
using namespace xmloff::token;
|
||||
|
||||
@@ -39,18 +40,10 @@ const SvXMLTokenMapEntry aAttributes[] =
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
const SvXMLTokenMapEntry aChildren[] =
|
||||
{
|
||||
TOKEN_MAP_ENTRY( XSD, SIMPLETYPE ),
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
SchemaContext::SchemaContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XDataTypeRepository>& rRepository ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
|
||||
TokenContext( rImport, aAttributes ),
|
||||
mxRepository( rRepository )
|
||||
{
|
||||
}
|
||||
@@ -62,14 +55,11 @@ void SchemaContext::HandleAttribute(
|
||||
}
|
||||
|
||||
SvXMLImportContext* SchemaContext::HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32 nElementToken,
|
||||
const Reference<XFastAttributeList>& )
|
||||
{
|
||||
if ( nToken == XML_SIMPLETYPE )
|
||||
return new SchemaSimpleTypeContext( GetImport(), nPrefix, rLocalName,
|
||||
mxRepository );
|
||||
if ( nElementToken == XML_ELEMENT(XSD, XML_SIMPLETYPE) )
|
||||
return new SchemaSimpleTypeContext( GetImport(), mxRepository );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@ class SchemaContext : public TokenContext
|
||||
|
||||
public:
|
||||
SchemaContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrfx,
|
||||
const OUString& rLName,
|
||||
const css::uno::Reference<css::xforms::XDataTypeRepository>& rRepository );
|
||||
|
||||
// implement TokenContext methods:
|
||||
@@ -51,10 +49,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::makeAny;
|
||||
using namespace com::sun::star;
|
||||
using com::sun::star::util::Duration;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XFastAttributeList;
|
||||
using com::sun::star::xforms::XDataTypeRepository;
|
||||
using namespace xmloff::token;
|
||||
|
||||
@@ -59,31 +59,11 @@ const SvXMLTokenMapEntry aAttributes[] =
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
const SvXMLTokenMapEntry aChildren[] =
|
||||
{
|
||||
TOKEN_MAP_ENTRY( XSD, LENGTH ),
|
||||
TOKEN_MAP_ENTRY( XSD, MINLENGTH ),
|
||||
TOKEN_MAP_ENTRY( XSD, MAXLENGTH ),
|
||||
TOKEN_MAP_ENTRY( XSD, MININCLUSIVE ),
|
||||
TOKEN_MAP_ENTRY( XSD, MINEXCLUSIVE ),
|
||||
TOKEN_MAP_ENTRY( XSD, MAXINCLUSIVE ),
|
||||
TOKEN_MAP_ENTRY( XSD, MAXEXCLUSIVE ),
|
||||
TOKEN_MAP_ENTRY( XSD, PATTERN ),
|
||||
// ??? XML_ENUMERATION
|
||||
TOKEN_MAP_ENTRY( XSD, WHITESPACE ),
|
||||
TOKEN_MAP_ENTRY( XSD, TOTALDIGITS ),
|
||||
TOKEN_MAP_ENTRY( XSD, FRACTIONDIGITS ),
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
|
||||
SchemaRestrictionContext::SchemaRestrictionContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
Reference<css::xforms::XDataTypeRepository> const & rRepository,
|
||||
const OUString& sTypeName ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
|
||||
TokenContext( rImport, aAttributes ),
|
||||
mxRepository( rRepository ),
|
||||
msTypeName( sTypeName ),
|
||||
msBaseName()
|
||||
@@ -212,24 +192,24 @@ static Any xforms_time( const OUString& rValue )
|
||||
|
||||
|
||||
SvXMLImportContext* SchemaRestrictionContext::HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XAttributeList>& xAttrList )
|
||||
sal_Int32 nElementToken,
|
||||
const Reference<XFastAttributeList>& xAttrList )
|
||||
{
|
||||
// find value
|
||||
OUString sValue;
|
||||
sal_Int16 nLength = xAttrList->getLength();
|
||||
for( sal_Int16 n = 0; n < nLength; n++ )
|
||||
for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
|
||||
{
|
||||
if( IsXMLToken( xAttrList->getNameByIndex( n ), XML_VALUE ) )
|
||||
sValue = xAttrList->getValueByIndex( n );
|
||||
if( ( aIter.getToken() & TOKEN_MASK) == XML_VALUE )
|
||||
{
|
||||
sValue = aIter.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// determine property name + suitable converter
|
||||
OUString sPropertyName;
|
||||
convert_t pConvert = nullptr;
|
||||
switch( nToken )
|
||||
switch( nElementToken & TOKEN_MASK )
|
||||
{
|
||||
case XML_LENGTH:
|
||||
sPropertyName = "Length";
|
||||
@@ -270,7 +250,7 @@ SvXMLImportContext* SchemaRestrictionContext::HandleChild(
|
||||
// converter is only type dependent.
|
||||
|
||||
// first, attribute-dependent prefix
|
||||
switch( nToken )
|
||||
switch( nElementToken )
|
||||
{
|
||||
case XML_MININCLUSIVE:
|
||||
sPropertyName = "MinInclusive";
|
||||
@@ -356,7 +336,7 @@ SvXMLImportContext* SchemaRestrictionContext::HandleChild(
|
||||
}
|
||||
}
|
||||
|
||||
return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
|
||||
return new SvXMLImportContext( GetImport() );
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -42,8 +42,6 @@ class SchemaRestrictionContext : public TokenContext
|
||||
|
||||
public:
|
||||
SchemaRestrictionContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrfx,
|
||||
const OUString& rLName,
|
||||
css::uno::Reference<css::xforms::XDataTypeRepository> const & rRepository,
|
||||
const OUString& sTypeName );
|
||||
|
||||
@@ -58,10 +56,8 @@ private:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
#include <xmloff/namespacemap.hxx>
|
||||
#include <xmloff/xmlnamespace.hxx>
|
||||
#include <xmloff/xmltkmap.hxx>
|
||||
#include <xmloff/xmlimp.hxx>
|
||||
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XFastAttributeList;
|
||||
using com::sun::star::xforms::XDataTypeRepository;
|
||||
using namespace xmloff::token;
|
||||
|
||||
@@ -40,18 +41,10 @@ const SvXMLTokenMapEntry aAttributes[] =
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
const SvXMLTokenMapEntry aChildren[] =
|
||||
{
|
||||
TOKEN_MAP_ENTRY( XSD, RESTRICTION ),
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
SchemaSimpleTypeContext::SchemaSimpleTypeContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XDataTypeRepository>& rRepository ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
|
||||
TokenContext( rImport, aAttributes ),
|
||||
mxRepository( rRepository )
|
||||
{
|
||||
}
|
||||
@@ -67,16 +60,13 @@ void SchemaSimpleTypeContext::HandleAttribute(
|
||||
}
|
||||
|
||||
SvXMLImportContext* SchemaSimpleTypeContext::HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32 nElementToken,
|
||||
const Reference<XFastAttributeList>& )
|
||||
{
|
||||
switch( nToken )
|
||||
switch( nElementToken )
|
||||
{
|
||||
case XML_RESTRICTION:
|
||||
case XML_ELEMENT(XSD, XML_RESTRICTION):
|
||||
return new SchemaRestrictionContext( GetImport(),
|
||||
nPrefix, rLocalName,
|
||||
mxRepository, msTypeName );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,6 @@ class SchemaSimpleTypeContext : public TokenContext
|
||||
|
||||
public:
|
||||
SchemaSimpleTypeContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrfx,
|
||||
const OUString& rLName,
|
||||
const css::uno::Reference<css::xforms::XDataTypeRepository>& rRepository );
|
||||
|
||||
// implement TokenContext methods:
|
||||
@@ -52,10 +50,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,22 +37,9 @@ const SvXMLTokenMapEntry aEmptyMap[1] =
|
||||
};
|
||||
|
||||
TokenContext::TokenContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const SvXMLTokenMapEntry* pAttributes,
|
||||
const SvXMLTokenMapEntry* pChildren )
|
||||
: SvXMLImportContext( rImport, nPrefix, rLocalName ),
|
||||
mpAttributes( pAttributes ),
|
||||
mpChildren( pChildren )
|
||||
{
|
||||
}
|
||||
|
||||
TokenContext::TokenContext( SvXMLImport& rImport,
|
||||
const SvXMLTokenMapEntry* pAttributes,
|
||||
const SvXMLTokenMapEntry* pChildren )
|
||||
const SvXMLTokenMapEntry* pAttributes )
|
||||
: SvXMLImportContext( rImport ),
|
||||
mpAttributes( pAttributes ),
|
||||
mpChildren( pChildren )
|
||||
mpAttributes( pAttributes )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -94,28 +81,15 @@ void TokenContext::StartElement(
|
||||
}
|
||||
}
|
||||
|
||||
SvXMLImportContextRef TokenContext::CreateChildContext(
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XAttributeList>& xAttrList )
|
||||
css::uno::Reference< css::xml::sax::XFastContextHandler > TokenContext::createFastChildContext(
|
||||
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
|
||||
{
|
||||
// call HandleChild for elements in token map. Ignore other content.
|
||||
|
||||
SvXMLImportContext* pContext = nullptr;
|
||||
|
||||
SAL_WARN_IF( mpChildren == nullptr, "xmloff", "no token map for child elements" );
|
||||
SvXMLTokenMap aMap( mpChildren );
|
||||
sal_uInt16 nToken = aMap.Get( nPrefix, rLocalName );
|
||||
if( nToken != XML_TOK_UNKNOWN )
|
||||
{
|
||||
// call handle child, and pass down arguments
|
||||
pContext = HandleChild( nToken, nPrefix, rLocalName, xAttrList );
|
||||
}
|
||||
|
||||
// call handle child, and pass down arguments
|
||||
SvXMLImportContext* pContext = HandleChild( nElement, xAttrList );
|
||||
// error handling: create default context and generate warning
|
||||
if( pContext == nullptr )
|
||||
{
|
||||
GetImport().SetError( XMLERROR_UNKNOWN_ELEMENT, rLocalName );
|
||||
GetImport().SetError( XMLERROR_UNKNOWN_ELEMENT, SvXMLImport::getNameFromToken( nElement ) );
|
||||
}
|
||||
return pContext;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace com::sun::star {
|
||||
namespace xml::sax { class XAttributeList; }
|
||||
namespace xml::sax { class XFastAttributeList; }
|
||||
namespace uno { template<typename T> class Reference; }
|
||||
}
|
||||
|
||||
@@ -39,17 +40,10 @@ class TokenContext : public SvXMLImportContext
|
||||
{
|
||||
protected:
|
||||
const SvXMLTokenMapEntry* mpAttributes; /// static token map
|
||||
const SvXMLTokenMapEntry* mpChildren; /// static token map
|
||||
|
||||
public:
|
||||
TokenContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const SvXMLTokenMapEntry* pAttributes,
|
||||
const SvXMLTokenMapEntry* pChildren );
|
||||
TokenContext( SvXMLImport& rImport,
|
||||
const SvXMLTokenMapEntry* pAttributes,
|
||||
const SvXMLTokenMapEntry* pChildren );
|
||||
const SvXMLTokenMapEntry* pAttributes );
|
||||
|
||||
// implement SvXMLImportContext methods:
|
||||
|
||||
@@ -63,10 +57,8 @@ public:
|
||||
* create a warning for all others. Classes that wish to override
|
||||
* CreateChildContext may want to call the parent method for
|
||||
* handling of defaults. */
|
||||
virtual SvXMLImportContextRef CreateChildContext(
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
|
||||
sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
|
||||
|
||||
/** Create a warning for all non-namespace character
|
||||
* content. Classes that wish to deal with character content have
|
||||
@@ -82,13 +74,8 @@ protected:
|
||||
|
||||
/** will be called for each child element */
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
|
||||
// the following attributes are mainly to be used for child
|
||||
// context creation
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) = 0;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,7 @@ using com::sun::star::uno::makeAny;
|
||||
using com::sun::star::uno::UNO_QUERY;
|
||||
using com::sun::star::container::XNameContainer;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XFastAttributeList;
|
||||
using com::sun::star::xforms::XModel2;
|
||||
using namespace xmloff::token;
|
||||
|
||||
@@ -63,10 +64,8 @@ static void lcl_fillNamespaceContainer( const SvXMLNamespaceMap&,
|
||||
|
||||
XFormsBindContext::XFormsBindContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XModel2>& xModel ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
|
||||
TokenContext( rImport, aAttributeMap ),
|
||||
mxModel( xModel )
|
||||
{
|
||||
// attach binding to model
|
||||
@@ -131,10 +130,8 @@ void XFormsBindContext::StartElement(
|
||||
|
||||
/** will be called for each child element */
|
||||
SvXMLImportContext* XFormsBindContext::HandleChild(
|
||||
sal_uInt16,
|
||||
sal_uInt16,
|
||||
const OUString&,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32,
|
||||
const Reference<XFastAttributeList>& )
|
||||
{
|
||||
OSL_FAIL( "no children supported" );
|
||||
return nullptr;
|
||||
|
||||
@@ -40,8 +40,6 @@ class XFormsBindContext : public TokenContext
|
||||
|
||||
public:
|
||||
XFormsBindContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xforms::XModel2>& xModel );
|
||||
|
||||
// implement SvXMLImportContext & TokenContext methods:
|
||||
@@ -54,10 +52,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nNamespace,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -55,10 +55,8 @@ const SvXMLTokenMapEntry aAttributes[] =
|
||||
|
||||
XFormsInstanceContext::XFormsInstanceContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XModel2> & xModel ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ),
|
||||
TokenContext( rImport, aAttributes ),
|
||||
mxModel( xModel )
|
||||
{
|
||||
SAL_WARN_IF( !mxModel.is(), "xmloff", "need model" );
|
||||
@@ -124,10 +122,8 @@ void XFormsInstanceContext::HandleAttribute(
|
||||
}
|
||||
|
||||
SvXMLImportContext* XFormsInstanceContext::HandleChild(
|
||||
sal_uInt16,
|
||||
sal_uInt16,
|
||||
const OUString&,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32,
|
||||
const Reference<css::xml::sax::XFastAttributeList>& )
|
||||
{
|
||||
OSL_FAIL( "to be handled by CreateChildContext" );
|
||||
return nullptr;
|
||||
|
||||
@@ -43,8 +43,6 @@ class XFormsInstanceContext : public TokenContext
|
||||
|
||||
public:
|
||||
XFormsInstanceContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrfx,
|
||||
const OUString& rLName,
|
||||
const css::uno::Reference<css::xforms::XModel2> & xModel );
|
||||
|
||||
// implement SvXMLImportContext & TokenContext methods:
|
||||
@@ -63,10 +61,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nNamespace,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,26 +51,8 @@ const SvXMLTokenMapEntry aAttributes[] =
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
const SvXMLTokenMapEntry aChildren[] =
|
||||
{
|
||||
TOKEN_MAP_ENTRY( XFORMS, INSTANCE ),
|
||||
TOKEN_MAP_ENTRY( XFORMS, BIND ),
|
||||
TOKEN_MAP_ENTRY( XFORMS, SUBMISSION ),
|
||||
TOKEN_MAP_ENTRY( XSD, SCHEMA ),
|
||||
XML_TOKEN_MAP_END
|
||||
};
|
||||
|
||||
|
||||
XFormsModelContext::XFormsModelContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aChildren ),
|
||||
mxModel( xforms_createXFormsModel() )
|
||||
{
|
||||
}
|
||||
|
||||
XFormsModelContext::XFormsModelContext( SvXMLImport& rImport ) :
|
||||
TokenContext( rImport, aAttributes, aChildren ),
|
||||
TokenContext( rImport, aAttributes ),
|
||||
mxModel( xforms_createXFormsModel() )
|
||||
{
|
||||
}
|
||||
@@ -94,30 +76,24 @@ void XFormsModelContext::HandleAttribute(
|
||||
}
|
||||
|
||||
SvXMLImportContext* XFormsModelContext::HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32 nElementToken,
|
||||
const Reference<css::xml::sax::XFastAttributeList>& )
|
||||
{
|
||||
SvXMLImportContext* pContext = nullptr;
|
||||
|
||||
switch( nToken )
|
||||
switch( nElementToken )
|
||||
{
|
||||
case XML_INSTANCE:
|
||||
pContext = new XFormsInstanceContext( GetImport(), nPrefix, rLocalName,
|
||||
mxModel );
|
||||
case XML_ELEMENT(XFORMS, XML_INSTANCE):
|
||||
pContext = new XFormsInstanceContext( GetImport(), mxModel );
|
||||
break;
|
||||
case XML_BIND:
|
||||
pContext = new XFormsBindContext( GetImport(), nPrefix, rLocalName,
|
||||
mxModel );
|
||||
case XML_ELEMENT(XFORMS, XML_BIND):
|
||||
pContext = new XFormsBindContext( GetImport(), mxModel );
|
||||
break;
|
||||
case XML_SUBMISSION:
|
||||
pContext = new XFormsSubmissionContext( GetImport(), nPrefix,
|
||||
rLocalName, mxModel );
|
||||
case XML_ELEMENT(XFORMS, XML_SUBMISSION):
|
||||
pContext = new XFormsSubmissionContext( GetImport(), mxModel );
|
||||
break;
|
||||
case XML_SCHEMA:
|
||||
pContext = new SchemaContext(
|
||||
GetImport(), nPrefix, rLocalName, mxModel->getDataTypeRepository() );
|
||||
case XML_ELEMENT(XSD, XML_SCHEMA):
|
||||
pContext = new SchemaContext( GetImport(), mxModel->getDataTypeRepository() );
|
||||
break;
|
||||
default:
|
||||
OSL_FAIL( "Boooo!" );
|
||||
|
||||
@@ -38,9 +38,6 @@ class XFormsModelContext : public TokenContext
|
||||
css::uno::Reference<css::xforms::XModel2> mxModel;
|
||||
|
||||
public:
|
||||
XFormsModelContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrfx,
|
||||
const OUString& rLName );
|
||||
XFormsModelContext( SvXMLImport& rImport );
|
||||
|
||||
// implement SvXMLImportContext & TokenContext methods:
|
||||
@@ -53,10 +50,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,10 +63,8 @@ const struct SvXMLTokenMapEntry aAttributeMap[] =
|
||||
|
||||
XFormsSubmissionContext::XFormsSubmissionContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const Reference<XModel2>& xModel ) :
|
||||
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
|
||||
TokenContext( rImport, aAttributeMap ),
|
||||
mxSubmission()
|
||||
{
|
||||
// register submission with model
|
||||
@@ -150,10 +148,8 @@ void XFormsSubmissionContext::HandleAttribute( sal_uInt16 nToken,
|
||||
|
||||
/** will be called for each child element */
|
||||
SvXMLImportContext* XFormsSubmissionContext::HandleChild(
|
||||
sal_uInt16,
|
||||
sal_uInt16,
|
||||
const OUString&,
|
||||
const Reference<XAttributeList>& )
|
||||
sal_Int32,
|
||||
const Reference<css::xml::sax::XFastAttributeList>& )
|
||||
{
|
||||
OSL_FAIL( "no children supported" );
|
||||
return nullptr;
|
||||
|
||||
@@ -39,8 +39,6 @@ class XFormsSubmissionContext : public TokenContext
|
||||
|
||||
public:
|
||||
XFormsSubmissionContext( SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xforms::XModel2>& xModel );
|
||||
|
||||
// implement TokenContext methods:
|
||||
@@ -50,10 +48,8 @@ protected:
|
||||
const OUString& rValue ) override;
|
||||
|
||||
virtual SvXMLImportContext* HandleChild(
|
||||
sal_uInt16 nToken,
|
||||
sal_uInt16 nNamespace,
|
||||
const OUString& rLocalName,
|
||||
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
|
||||
sal_Int32 nElementToken,
|
||||
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -54,14 +54,6 @@ using com::sun::star::form::binding::XListEntrySink;
|
||||
using com::sun::star::form::submission::XSubmission;
|
||||
using com::sun::star::form::submission::XSubmissionSupplier;
|
||||
|
||||
SvXMLImportContext* createXFormsModelContext(
|
||||
SvXMLImport& rImport,
|
||||
sal_uInt16 nPrefix,
|
||||
const OUString& rLocalName )
|
||||
{
|
||||
return new XFormsModelContext( rImport, nPrefix, rLocalName );
|
||||
}
|
||||
|
||||
SvXMLImportContext* createXFormsModelContext(
|
||||
SvXMLImport& rImport )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user