[Libreoffice-commits] core.git: include/xmloff sw/source xmloff/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 19 18:31:20 UTC 2020


 include/xmloff/xformsimport.hxx                   |    4 -
 sw/source/filter/xml/xmlimp.cxx                   |    2 
 xmloff/source/xforms/SchemaContext.cxx            |   24 +++--------
 xmloff/source/xforms/SchemaContext.hxx            |    8 ---
 xmloff/source/xforms/SchemaRestrictionContext.cxx |   46 +++++----------------
 xmloff/source/xforms/SchemaRestrictionContext.hxx |    8 ---
 xmloff/source/xforms/SchemaSimpleTypeContext.cxx  |   24 +++--------
 xmloff/source/xforms/SchemaSimpleTypeContext.hxx  |    8 ---
 xmloff/source/xforms/TokenContext.cxx             |   40 +++---------------
 xmloff/source/xforms/TokenContext.hxx             |   25 ++---------
 xmloff/source/xforms/XFormsBindContext.cxx        |   11 +----
 xmloff/source/xforms/XFormsBindContext.hxx        |    8 ---
 xmloff/source/xforms/XFormsInstanceContext.cxx    |   10 +---
 xmloff/source/xforms/XFormsInstanceContext.hxx    |    8 ---
 xmloff/source/xforms/XFormsModelContext.cxx       |   48 +++++-----------------
 xmloff/source/xforms/XFormsModelContext.hxx       |    9 ----
 xmloff/source/xforms/XFormsSubmissionContext.cxx  |   10 +---
 xmloff/source/xforms/XFormsSubmissionContext.hxx  |    8 ---
 xmloff/source/xforms/xformsimport.cxx             |    8 ---
 19 files changed, 77 insertions(+), 232 deletions(-)

New commits:
commit 39d8ee8f91f4c571030b53febdcba07ea55ca7de
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 19 13:51:21 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 19 19:30:34 2020 +0100

    fastparser in TokenContext
    
    Change-Id: I12c2af505d4bf19d94fb127cda2403f0b6618b07
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106159
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xformsimport.hxx b/include/xmloff/xformsimport.hxx
index b6b86044ce1b..8a7ef2f6724d 100644
--- a/include/xmloff/xformsimport.hxx
+++ b/include/xmloff/xformsimport.hxx
@@ -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 );
 
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 15c71e820fe1..0a7934c8b303 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -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;
     }
 
diff --git a/xmloff/source/xforms/SchemaContext.cxx b/xmloff/source/xforms/SchemaContext.cxx
index 6b779fe77837..0ab3fdeefde6 100644
--- a/xmloff/source/xforms/SchemaContext.cxx
+++ b/xmloff/source/xforms/SchemaContext.cxx
@@ -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;
 }
 
diff --git a/xmloff/source/xforms/SchemaContext.hxx b/xmloff/source/xforms/SchemaContext.hxx
index e679d2855940..b92ec292e9e6 100644
--- a/xmloff/source/xforms/SchemaContext.hxx
+++ b/xmloff/source/xforms/SchemaContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx
index f62223dd8f2f..935ae043ce85 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.cxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx
@@ -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: */
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.hxx b/xmloff/source/xforms/SchemaRestrictionContext.hxx
index d5c86a3fb3b2..4c338034184a 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.hxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.cxx b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
index 0ae42e5fb1c9..7a2c79bf1b84 100644
--- a/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.cxx
@@ -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;
     }
diff --git a/xmloff/source/xforms/SchemaSimpleTypeContext.hxx b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
index da0e4f365866..891a7ff594e9 100644
--- a/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
+++ b/xmloff/source/xforms/SchemaSimpleTypeContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/TokenContext.cxx b/xmloff/source/xforms/TokenContext.cxx
index f6cf9201d0f9..c4549b97bea5 100644
--- a/xmloff/source/xforms/TokenContext.cxx
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -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;
 }
diff --git a/xmloff/source/xforms/TokenContext.hxx b/xmloff/source/xforms/TokenContext.hxx
index 9821a3c8f386..390812a689a9 100644
--- a/xmloff/source/xforms/TokenContext.hxx
+++ b/xmloff/source/xforms/TokenContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx b/xmloff/source/xforms/XFormsBindContext.cxx
index 546faf138d3e..9348fea46b02 100644
--- a/xmloff/source/xforms/XFormsBindContext.cxx
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -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;
diff --git a/xmloff/source/xforms/XFormsBindContext.hxx b/xmloff/source/xforms/XFormsBindContext.hxx
index 86a11f5ffb1c..46fc38df4d43 100644
--- a/xmloff/source/xforms/XFormsBindContext.hxx
+++ b/xmloff/source/xforms/XFormsBindContext.hxx
@@ -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;
 
 };
 
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx b/xmloff/source/xforms/XFormsInstanceContext.cxx
index 80dcc3739999..86e11cff4132 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.cxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -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;
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx b/xmloff/source/xforms/XFormsInstanceContext.hxx
index 651bbf2466c3..337a6934e039 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.hxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx b/xmloff/source/xforms/XFormsModelContext.cxx
index 0ccb9be98461..966b93837edc 100644
--- a/xmloff/source/xforms/XFormsModelContext.cxx
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -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!" );
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx b/xmloff/source/xforms/XFormsModelContext.hxx
index a93a88a3041a..1a23659317f5 100644
--- a/xmloff/source/xforms/XFormsModelContext.hxx
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -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
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.cxx b/xmloff/source/xforms/XFormsSubmissionContext.cxx
index f7e81ecf4c90..e25a8bc2dafa 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.cxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.cxx
@@ -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;
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.hxx b/xmloff/source/xforms/XFormsSubmissionContext.hxx
index f1b1a9019dbb..23d248574e90 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.hxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.hxx
@@ -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;
 
 };
 
diff --git a/xmloff/source/xforms/xformsimport.cxx b/xmloff/source/xforms/xformsimport.cxx
index a82d8a41da8b..1e4b05295e71 100644
--- a/xmloff/source/xforms/xformsimport.cxx
+++ b/xmloff/source/xforms/xformsimport.cxx
@@ -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 )
 {


More information about the Libreoffice-commits mailing list