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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 9 10:24:04 UTC 2020


 xmloff/inc/txtfldi.hxx          |  122 +++++-----
 xmloff/inc/txtvfldi.hxx         |   24 --
 xmloff/source/text/txtfldi.cxx  |  452 +++++++++++++++++++++-------------------
 xmloff/source/text/txtvfldi.cxx |  129 +++++------
 4 files changed, 380 insertions(+), 347 deletions(-)

New commits:
commit 75b55ec26586b80aa851a9491e93a9e13eb012fc
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 5 15:16:55 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Nov 9 11:23:26 2020 +0100

    StartElement->startFastElement in text fields
    
    Change-Id: I455599516814866ecd076d5d56e8682956f93004
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105370
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 34d1a863d4c0..f19a34480c04 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -134,8 +134,9 @@ public:
     virtual void SAL_CALL characters( const OUString& sContent ) override;
 
     /// parses attributes and calls ProcessAttribute
-    virtual void StartElement(
-        const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 
     /// create XTextField and insert into document; calls PrepareTextField
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
@@ -159,7 +160,7 @@ protected:
     OUString const & GetContent();
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) = 0;
 
     /// prepare XTextField for insertion into document
@@ -187,7 +188,6 @@ class XMLSenderFieldImportContext : public XMLTextFieldImportContext
 protected:
     // variables for access in subclass
     bool bFixed;
-    sal_uInt16 nElementToken;   /// token for this element field
 
 public:
 
@@ -195,16 +195,16 @@ public:
         SvXMLImport& rImport,                   /// XML Import
         XMLTextImportHelper& rHlp,              /// Text import helper
         sal_uInt16 nPrfx,                       /// namespace prefix
-        const OUString& sLocalName,      /// element name w/o prefix
-        sal_uInt16 nToken);                     /// element token
+        const OUString& sLocalName);      /// element name w/o prefix
 
 protected:
     /// start element
-    virtual void StartElement(
-        const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -225,16 +225,16 @@ public:
         SvXMLImport& rImport,                   /// XML Import
         XMLTextImportHelper& rHlp,              /// Text import helper
         sal_uInt16 nPrfx,                       /// namespace prefix
-        const OUString& sLocalName,      /// element name w/o prefix
-        sal_uInt16 nToken);                     /// element token
+        const OUString& sLocalName);      /// element name w/o prefix
 
 private:
     /// start element
-    virtual void StartElement(
-        const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -260,7 +260,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -297,7 +297,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -318,7 +318,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 };
 
@@ -342,7 +342,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -374,7 +374,7 @@ public:
 
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -413,7 +413,7 @@ protected:
 public:
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -438,7 +438,7 @@ public:
                                  const OUString& sLocalName);
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 };
 
@@ -466,7 +466,7 @@ public:
                                  const OUString& sLocalName);
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -489,7 +489,7 @@ public:
                                    const OUString& sLocalName);
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -516,7 +516,7 @@ public:
                                    const OUString& sLocalName);
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -549,7 +549,7 @@ public:
 
 protected:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -582,7 +582,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -628,7 +628,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
     virtual void PrepareField(
         const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
@@ -652,7 +652,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -684,7 +684,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -715,7 +715,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -742,7 +742,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -766,7 +766,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -789,7 +789,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -817,7 +817,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -844,7 +844,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -867,7 +867,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -900,7 +900,7 @@ private:
         const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList ) override;
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -930,11 +930,12 @@ public:
 
 private:
     /// start element
-    virtual void StartElement(
-        const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -960,18 +961,16 @@ public:
 /** import dde field declaration (<text:dde-connection-decl>) */
 class XMLDdeFieldDeclImportContext final : public SvXMLImportContext
 {
-    const SvXMLTokenMap& rTokenMap;
-
 public:
 
     XMLDdeFieldDeclImportContext(SvXMLImport& rImport,
                                  sal_uInt16 nPrfx,
-                                 const OUString& sLocalName,
-                                 const SvXMLTokenMap& rMap);
+                                 const OUString& sLocalName);
 
     // create fieldmaster
-    virtual void StartElement(
-        const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 };
 
 /** import dde fields (<text:dde-connection>) */
@@ -989,7 +988,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// create textfield, attach master, and insert into document
@@ -1013,7 +1012,7 @@ public:
 
 private:
     /// no attributes -> empty method
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// no attributes -> empty method
@@ -1033,7 +1032,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -1057,7 +1056,7 @@ public:
 
 private:
     /// no attributes -> empty method
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// no attributes -> empty method
@@ -1079,11 +1078,12 @@ public:
 
 private:
     /// process attributes (fill aValues)
-    virtual void StartElement(
-        const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+    virtual void SAL_CALL startFastElement(
+        sal_Int32 nElement,
+        const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
 
-    /// empty method; all attributes are handled in StartElement
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    /// empty method; all attributes are handled in startFastElement
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// convert aValues into sequence and set property
@@ -1119,7 +1119,7 @@ public:
 
 private:
     /// process attributes
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// set properties
@@ -1150,7 +1150,7 @@ public:
 
 private:
     /// process attributes
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// set properties
@@ -1172,7 +1172,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -1206,7 +1206,7 @@ public:
 
 private:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -1226,7 +1226,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -1246,7 +1246,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -1266,7 +1266,7 @@ public:
         const OUString& sLocalName);     /// element name w/o prefix
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx
index 2ad378a9e670..5cfca16c312b 100644
--- a/xmloff/inc/txtvfldi.hxx
+++ b/xmloff/inc/txtvfldi.hxx
@@ -62,8 +62,8 @@ public:
         bool bFormula);                     /// process formula (Prep.F.)
 
     /// process attribute values
-    void ProcessAttribute( sal_uInt16 nAttrToken,
-                                   const OUString& sAttrValue );
+    void ProcessAttribute( sal_Int32 nAttrToken,
+                           const OUString& sAttrValue );
 
     /// prepare XTextField for insertion into document
     void PrepareField(
@@ -155,7 +155,7 @@ public:
 
 protected:
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -362,7 +362,7 @@ public:
 private:
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -390,10 +390,9 @@ public:
         const OUString& rLocalName,      /// element name w/o prefix
         enum VarType eVarType);                 /// variable type
 
-    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;
 };
 
 /**
@@ -408,9 +407,8 @@ public:
     XMLVariableDeclImportContext(
         SvXMLImport& rImport,                   /// XML Import
         XMLTextImportHelper& rHlp,              /// text import helper
-        sal_uInt16 nPrfx,                       /// namespace prefix
-        const OUString& rLocalName,      /// element name w/o prefix
-        const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList,/// list of element attributes
+        sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList,/// list of element attributes
         enum VarType eVarType);                 /// variable type
 
     /// get field master for name and rename if appropriate
@@ -440,7 +438,7 @@ public:
 private:
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// prepare XTextField for insertion into document
@@ -472,7 +470,7 @@ public:
 private:
 
     /// process attribute values
-    virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+    virtual void ProcessAttribute( sal_Int32 nAttrToken,
                                    const OUString& sAttrValue ) override;
 
     /// create, prepare and insert database field master and database field
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 0caa7d9551cc..6612f86dbe92 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -129,21 +129,13 @@ XMLTextFieldImportContext::XMLTextFieldImportContext(
     sServiceName = OUString::createFromAscii(pService);
 }
 
-void XMLTextFieldImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLTextFieldImportContext::startFastElement(
+        sal_Int32 /*nElement*/,
+        const Reference<XFastAttributeList> & xAttrList)
 {
     // process attributes
-    sal_Int16 nLength = xAttrList->getLength();
-    for(sal_Int16 i=0; i<nLength; i++) {
-
-        OUString sLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-            GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
-        ProcessAttribute(rTextImportHelper.GetTextFieldAttrTokenMap().
-                             Get(nPrefix, sLocalName),
-                         xAttrList->getValueByIndex(i) );
-    }
+    for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
+        ProcessAttribute(aIter.getToken(), aIter.toString() );
 }
 
 OUString const & XMLTextFieldImportContext::GetContent()
@@ -250,14 +242,14 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
         case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
             pContext =
                 new XMLSenderFieldImportContext( rImport, rHlp,
-                                                 nPrefix, rName, nToken );
+                                                 nPrefix, rName );
             break;
 
         case XML_TOK_TEXT_AUTHOR_NAME:
         case XML_TOK_TEXT_AUTHOR_INITIALS:
             pContext =
                 new XMLAuthorFieldImportContext( rImport, rHlp,
-                                                 nPrefix, rName, nToken );
+                                                 nPrefix, rName );
             break;
 
         case XML_TOK_TEXT_PLACEHOLDER:
@@ -539,65 +531,65 @@ constexpr OUStringLiteral gsPropertyFieldSubType(u"UserDataType");
 
 XMLSenderFieldImportContext::XMLSenderFieldImportContext(
     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
-    sal_uInt16 nPrfx, const OUString& sLocalName,
-    sal_uInt16 nToken)
+    sal_uInt16 nPrfx, const OUString& sLocalName)
     : XMLTextFieldImportContext(rImport, rHlp, "ExtendedUser", nPrfx, sLocalName)
     , nSubType(0)
     , sPropertyFixed(sAPI_is_fixed)
     , sPropertyContent(sAPI_content)
     , bFixed(true)
-    , nElementToken(nToken)
 {
 }
 
-void XMLSenderFieldImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLSenderFieldImportContext::startFastElement(
+        sal_Int32 nElement,
+        const Reference<XFastAttributeList> & xAttrList)
 {
     bValid = true;
-    switch (nElementToken) {
-    case XML_TOK_TEXT_SENDER_FIRSTNAME:
+    switch (nElement) {
+    case XML_ELEMENT(TEXT, XML_SENDER_FIRSTNAME):
         nSubType = UserDataPart::FIRSTNAME;
         break;
-    case XML_TOK_TEXT_SENDER_LASTNAME:
+    case  XML_ELEMENT(TEXT, XML_SENDER_LASTNAME):
         nSubType = UserDataPart::NAME;
         break;
-    case XML_TOK_TEXT_SENDER_INITIALS:
+    case XML_ELEMENT(LO_EXT, XML_SENDER_INITIALS):
+    case XML_ELEMENT(TEXT,   XML_SENDER_INITIALS):
         nSubType = UserDataPart::SHORTCUT;
         break;
-    case XML_TOK_TEXT_SENDER_TITLE:
+    case XML_ELEMENT(TEXT, XML_SENDER_TITLE):
         nSubType = UserDataPart::TITLE;
         break;
-    case XML_TOK_TEXT_SENDER_POSITION:
+    case XML_ELEMENT(TEXT, XML_SENDER_POSITION):
         nSubType = UserDataPart::POSITION;
         break;
-    case XML_TOK_TEXT_SENDER_EMAIL:
+    case XML_ELEMENT(TEXT, XML_SENDER_EMAIL):
         nSubType = UserDataPart::EMAIL;
         break;
-    case XML_TOK_TEXT_SENDER_PHONE_PRIVATE:
+    case XML_ELEMENT(TEXT, XML_SENDER_PHONE_PRIVATE):
         nSubType = UserDataPart::PHONE_PRIVATE;
         break;
-    case XML_TOK_TEXT_SENDER_FAX:
+    case XML_ELEMENT(TEXT, XML_SENDER_FAX):
         nSubType = UserDataPart::FAX;
         break;
-    case XML_TOK_TEXT_SENDER_COMPANY:
+    case XML_ELEMENT(TEXT, XML_SENDER_COMPANY):
         nSubType = UserDataPart::COMPANY;
         break;
-    case XML_TOK_TEXT_SENDER_PHONE_WORK:
+    case  XML_ELEMENT(TEXT, XML_SENDER_PHONE_WORK):
         nSubType = UserDataPart::PHONE_COMPANY;
         break;
-    case XML_TOK_TEXT_SENDER_STREET:
+    case  XML_ELEMENT(TEXT, XML_SENDER_STREET):
         nSubType = UserDataPart::STREET;
         break;
-    case XML_TOK_TEXT_SENDER_CITY:
+    case XML_ELEMENT(TEXT, XML_SENDER_CITY):
         nSubType = UserDataPart::CITY;
         break;
-    case XML_TOK_TEXT_SENDER_POSTAL_CODE:
+    case XML_ELEMENT(TEXT, XML_SENDER_POSTAL_CODE):
         nSubType = UserDataPart::ZIP;
         break;
-    case XML_TOK_TEXT_SENDER_COUNTRY:
+    case XML_ELEMENT(TEXT, XML_SENDER_COUNTRY):
         nSubType = UserDataPart::COUNTRY;
         break;
-    case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
+    case  XML_ELEMENT(TEXT, XML_SENDER_STATE_OR_PROVINCE):
         nSubType = UserDataPart::STATE;
         break;
     default:
@@ -606,14 +598,14 @@ void XMLSenderFieldImportContext::StartElement(
     }
 
     // process Attributes
-    XMLTextFieldImportContext::StartElement(xAttrList);
+    XMLTextFieldImportContext::startFastElement(nElement, xAttrList);
 }
 
 void XMLSenderFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue)
 {
-    if (XML_TOK_TEXTFIELD_FIXED == nAttrToken) {
+    if (XML_ELEMENT(TEXT, XML_FIXED) == nAttrToken) {
 
         // set bVal
         bool bVal(false);
@@ -624,6 +616,8 @@ void XMLSenderFieldImportContext::ProcessAttribute(
             bFixed = bVal;
         }
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLSenderFieldImportContext::PrepareField(
@@ -658,9 +652,8 @@ constexpr OUStringLiteral gsPropertyAuthorFullName(u"FullName");
 
 XMLAuthorFieldImportContext::XMLAuthorFieldImportContext(
     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
-    sal_uInt16 nPrfx, const OUString& sLocalName,
-    sal_uInt16 nToken)
-:   XMLSenderFieldImportContext(rImport, rHlp, nPrfx, sLocalName, nToken)
+    sal_uInt16 nPrfx, const OUString& sLocalName)
+:   XMLSenderFieldImportContext(rImport, rHlp, nPrfx, sLocalName)
 ,   bAuthorFullName(true)
 ,   sPropertyFixed(sAPI_is_fixed)
 ,   sPropertyContent(sAPI_content)
@@ -669,24 +662,27 @@ XMLAuthorFieldImportContext::XMLAuthorFieldImportContext(
     SetServiceName(sAPI_author);
 }
 
-void XMLAuthorFieldImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList) {
-
-    bAuthorFullName = (XML_TOK_TEXT_AUTHOR_INITIALS != nElementToken);
+void XMLAuthorFieldImportContext::startFastElement(
+        sal_Int32 nElement,
+        const Reference<XFastAttributeList> & xAttrList)
+{
+    bAuthorFullName = ( XML_ELEMENT(TEXT, XML_AUTHOR_INITIALS) != nElement);
     bValid = true;
 
     // process Attributes
-    XMLTextFieldImportContext::StartElement(xAttrList);
+    XMLTextFieldImportContext::startFastElement(nElement, xAttrList);
 }
 
-void XMLAuthorFieldImportContext::ProcessAttribute(sal_uInt16 nAttrToken, const OUString& sAttrValue)
+void XMLAuthorFieldImportContext::ProcessAttribute(sal_Int32 nAttrToken, const OUString& sAttrValue)
 {
-    if(nAttrToken == XML_TOK_TEXTFIELD_FIXED)
+    if(nAttrToken == XML_ELEMENT(TEXT, XML_FIXED))
     {
         bool bTmp(false);
         if (::sax::Converter::convertBool(bTmp, sAttrValue))
             bFixed = bTmp;
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLAuthorFieldImportContext::PrepareField(
@@ -742,11 +738,11 @@ XMLPageContinuationImportContext::XMLPageContinuationImportContext(
 }
 
 void XMLPageContinuationImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch(nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_SELECT_PAGE:
+        case XML_ELEMENT(TEXT, XML_SELECT_PAGE):
         {
             PageNumberType nTmp;
             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
@@ -757,10 +753,13 @@ void XMLPageContinuationImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_STRING_VALUE:
+        case XML_ELEMENT(TEXT, XML_STRING_VALUE):
+        case XML_ELEMENT(OFFICE, XML_STRING_VALUE):
             sString = sAttrValue;
             sStringOK = true;
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -798,23 +797,23 @@ XMLPageNumberImportContext::XMLPageNumberImportContext(
 }
 
 void XMLPageNumberImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumberFormat = sAttrValue;
             sNumberFormatOK = true;
             break;
-        case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sNumberSync = sAttrValue;
             break;
-        case XML_TOK_TEXTFIELD_SELECT_PAGE:
+        case XML_ELEMENT(TEXT, XML_SELECT_PAGE):
             SvXMLUnitConverter::convertEnum(eSelectPage, sAttrValue,
                                                 lcl_aSelectPageAttrMap);
             break;
-        case XML_TOK_TEXTFIELD_PAGE_ADJUST:
+        case XML_ELEMENT(TEXT, XML_PAGE_ADJUST):
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber(nTmp, sAttrValue))
@@ -823,6 +822,8 @@ void XMLPageNumberImportContext::ProcessAttribute(
             }
             break;
         }
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -892,14 +893,14 @@ XMLPlaceholderFieldImportContext::XMLPlaceholderFieldImportContext(
 
 /// process attribute values
 void XMLPlaceholderFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken) {
-    case XML_TOK_TEXTFIELD_DESCRIPTION:
+    case XML_ELEMENT(TEXT, XML_DESCRIPTION):
         sDescription = sAttrValue;
         break;
 
-    case XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE:
+    case XML_ELEMENT(TEXT, XML_PLACEHOLDER_TYPE):
         bValid = true;
         if (IsXMLToken(sAttrValue, XML_TABLE))
         {
@@ -928,7 +929,8 @@ void XMLPlaceholderFieldImportContext::ProcessAttribute(
         break;
 
     default:
-        ; // ignore
+        // ignore
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -984,11 +986,12 @@ XMLTimeFieldImportContext::XMLTimeFieldImportContext(
 }
 
 void XMLTimeFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_TIME_VALUE:
+        case XML_ELEMENT(TEXT, XML_TIME_VALUE):
+        case XML_ELEMENT(OFFICE, XML_TIME_VALUE):
         {
             if (::sax::Converter::parseTimeOrDateTime(aDateTimeValue, sAttrValue))
             {
@@ -996,7 +999,7 @@ void XMLTimeFieldImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_FIXED:
+        case XML_ELEMENT(TEXT, XML_FIXED):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -1005,7 +1008,7 @@ void XMLTimeFieldImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
         {
             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
                                                sAttrValue, &bIsDefaultLanguage);
@@ -1016,7 +1019,7 @@ void XMLTimeFieldImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_TIME_ADJUST:
+        case XML_ELEMENT(TEXT, XML_TIME_ADJUST):
         {
             double fTmp;
 
@@ -1027,6 +1030,8 @@ void XMLTimeFieldImportContext::ProcessAttribute(
             }
             break;
         }
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -1101,12 +1106,13 @@ XMLDateFieldImportContext::XMLDateFieldImportContext(
 }
 
 void XMLDateFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DATE_VALUE:
+        case XML_ELEMENT(TEXT, XML_DATE_VALUE):
+        case XML_ELEMENT(OFFICE, XML_DATE_VALUE):
         {
             if (::sax::Converter::parseDateTime(aDateTimeValue, sAttrValue))
             {
@@ -1114,14 +1120,15 @@ void XMLDateFieldImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_DATE_ADJUST:
+        case XML_ELEMENT(TEXT, XML_DATE_ADJUST):
             // delegate to superclass, pretending it was a time-adjust attr.
             XMLTimeFieldImportContext::ProcessAttribute(
                 XML_TOK_TEXTFIELD_TIME_ADJUST,
                 sAttrValue);
             break;
-        case XML_TOK_TEXTFIELD_TIME_VALUE:
-        case XML_TOK_TEXTFIELD_TIME_ADJUST:
+        case XML_ELEMENT(TEXT, XML_TIME_VALUE):
+        case XML_ELEMENT(OFFICE, XML_TIME_VALUE):
+        case XML_ELEMENT(TEXT, XML_TIME_ADJUST):
             ; // ignore time-adjust and time-value attributes
             break;
         default:
@@ -1160,20 +1167,20 @@ XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext(
 }
 
 void XMLDatabaseFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DATABASE_NAME:
+        case XML_ELEMENT(TEXT, XML_DATABASE_NAME):
             m_sDatabaseName = sAttrValue;
             m_bDatabaseOK = true;
             m_bDatabaseNameOK = true;
             break;
-        case XML_TOK_TEXTFIELD_TABLE_NAME:
+        case XML_ELEMENT(TEXT, XML_TABLE_NAME):
             m_sTableName = sAttrValue;
             m_bTableOK = true;
             break;
-        case XML_TOK_TEXTFIELD_TABLE_TYPE:
+        case  XML_ELEMENT(TEXT, XML_TABLE_TYPE):
             if( IsXMLToken( sAttrValue, XML_TABLE ) )
             {
                 m_nCommandType = sdb::CommandType::TABLE;
@@ -1190,7 +1197,7 @@ void XMLDatabaseFieldImportContext::ProcessAttribute(
                 m_bCommandTypeOK = true;
             }
             break;
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
             if( IsXMLToken( sAttrValue, XML_NONE ) )
             {
                 m_bDisplay = false;
@@ -1202,6 +1209,8 @@ void XMLDatabaseFieldImportContext::ProcessAttribute(
                 m_bDisplayOK = true;
             }
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -1278,7 +1287,7 @@ XMLDatabaseNameImportContext::XMLDatabaseNameImportContext(
 }
 
 void XMLDatabaseNameImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     // delegate to superclass and check for success
     XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken, sAttrValue);
@@ -1313,9 +1322,9 @@ XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
 }
 
 void XMLDatabaseNextImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
-    if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
+    if (XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
     {
         OUString sTmp;
         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
@@ -1364,10 +1373,10 @@ XMLDatabaseSelectImportContext::XMLDatabaseSelectImportContext(
 }
 
 void XMLDatabaseSelectImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
-    if (XML_TOK_TEXTFIELD_ROW_NUMBER == nAttrToken)
+    if (XML_ELEMENT(TEXT, XML_ROW_NUMBER) == nAttrToken)
     {
         sal_Int32 nTmp;
         if (::sax::Converter::convertNumber( nTmp, sAttrValue
@@ -1413,18 +1422,19 @@ XMLDatabaseNumberImportContext::XMLDatabaseNumberImportContext(
 }
 
 void XMLDatabaseNumberImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumberFormat = sAttrValue;
             break;
-        case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sNumberSync = sAttrValue;
             break;
-        case XML_TOK_TEXTFIELD_VALUE:
+        case XML_ELEMENT(TEXT, XML_VALUE_TYPE):
+        case XML_ELEMENT(OFFICE, XML_VALUE_TYPE):
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber( nTmp, sAttrValue ))
@@ -1481,10 +1491,10 @@ XMLSimpleDocInfoImportContext::XMLSimpleDocInfoImportContext(
 }
 
 void XMLSimpleDocInfoImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
-    if (XML_TOK_TEXTFIELD_FIXED == nAttrToken)
+    if (XML_ELEMENT(TEXT, XML_FIXED) == nAttrToken)
     {
         bool bTmp(false);
         if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -1492,6 +1502,8 @@ void XMLSimpleDocInfoImportContext::ProcessAttribute(
             bFixed = bTmp;
         }
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLSimpleDocInfoImportContext::PrepareField(
@@ -1688,12 +1700,12 @@ XMLDateTimeDocInfoImportContext::XMLDateTimeDocInfoImportContext(
 }
 
 void XMLDateTimeDocInfoImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
         {
             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
                                                sAttrValue, &bIsDefaultLanguage);
@@ -1704,7 +1716,7 @@ void XMLDateTimeDocInfoImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_FIXED:
+        case XML_ELEMENT(TEXT, XML_FIXED):
             XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken,
                                                             sAttrValue);
             break;
@@ -1761,12 +1773,12 @@ XMLUserDocInfoImportContext::XMLUserDocInfoImportContext(
 }
 
 void XMLUserDocInfoImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
         {
             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
                                                sAttrValue, &bIsDefaultLanguage);
@@ -1777,7 +1789,7 @@ void XMLUserDocInfoImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_NAME:
+        case XML_ELEMENT(TEXT, XML_NAME):
         {
             if (!bValid)
             {
@@ -1837,10 +1849,10 @@ XMLHiddenParagraphImportContext::XMLHiddenParagraphImportContext(
 }
 
 void XMLHiddenParagraphImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
-    if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
+    if ( XML_ELEMENT(TEXT, XML_CONDITION) == nAttrToken)
     {
         OUString sTmp;
         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
@@ -1853,7 +1865,7 @@ void XMLHiddenParagraphImportContext::ProcessAttribute(
         else
             sCondition = sAttrValue;
     }
-    else if (XML_TOK_TEXTFIELD_IS_HIDDEN == nAttrToken)
+    else if ( XML_ELEMENT(TEXT, XML_IS_HIDDEN) == nAttrToken)
     {
         bool bTmp(false);
         if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -1861,6 +1873,8 @@ void XMLHiddenParagraphImportContext::ProcessAttribute(
             bIsHidden = bTmp;
         }
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLHiddenParagraphImportContext::PrepareField(
@@ -1892,12 +1906,12 @@ XMLConditionalTextImportContext::XMLConditionalTextImportContext(
 }
 
 void XMLConditionalTextImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_CONDITION:
+        case XML_ELEMENT(TEXT, XML_CONDITION):
             {
                 OUString sTmp;
                 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
@@ -1911,15 +1925,15 @@ void XMLConditionalTextImportContext::ProcessAttribute(
                     sCondition = sAttrValue;
             }
             break;
-        case XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE:
+        case XML_ELEMENT(TEXT, XML_STRING_VALUE_IF_FALSE):
             sFalseContent = sAttrValue;
             bFalseOK = true;
             break;
-        case XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE:
+        case XML_ELEMENT(TEXT, XML_STRING_VALUE_IF_TRUE):
             sTrueContent = sAttrValue;
             bTrueOK = true;
             break;
-        case XML_TOK_TEXTFIELD_CURRENT_VALUE:
+        case XML_ELEMENT(TEXT, XML_CURRENT_VALUE):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -1928,6 +1942,8 @@ void XMLConditionalTextImportContext::ProcessAttribute(
             }
             break;
         }
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 
     bValid = bConditionOK && bFalseOK && bTrueOK;
@@ -1962,12 +1978,12 @@ XMLHiddenTextImportContext::XMLHiddenTextImportContext(
 }
 
 void XMLHiddenTextImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_CONDITION:
+        case XML_ELEMENT(TEXT, XML_CONDITION):
             {
                 OUString sTmp;
                 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
@@ -1981,11 +1997,12 @@ void XMLHiddenTextImportContext::ProcessAttribute(
                     sCondition = sAttrValue;
             }
             break;
-        case XML_TOK_TEXTFIELD_STRING_VALUE:
+        case XML_ELEMENT(TEXT, XML_STRING_VALUE):
+        case XML_ELEMENT(OFFICE, XML_STRING_VALUE):
             sString = sAttrValue;
             bStringOK = true;
             break;
-        case XML_TOK_TEXTFIELD_IS_HIDDEN:
+        case XML_ELEMENT(TEXT, XML_IS_HIDDEN):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -1994,6 +2011,8 @@ void XMLHiddenTextImportContext::ProcessAttribute(
             }
             break;
         }
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 
     bValid = bConditionOK && bStringOK;
@@ -2036,12 +2055,12 @@ XMLFileNameImportContext::XMLFileNameImportContext(
 }
 
 void XMLFileNameImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_FIXED:
+        case XML_ELEMENT(TEXT, XML_FIXED):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -2050,7 +2069,7 @@ void XMLFileNameImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
         {
             sal_uInt16 nTmp;
             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
@@ -2061,7 +2080,8 @@ void XMLFileNameImportContext::ProcessAttribute(
             break;
         }
         default:
-            ; // unknown attribute: ignore
+            // unknown attribute: ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 }
@@ -2117,12 +2137,12 @@ XMLTemplateNameImportContext::XMLTemplateNameImportContext(
 }
 
 void XMLTemplateNameImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
         {
             sal_uInt16 nTmp;
             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
@@ -2133,7 +2153,8 @@ void XMLTemplateNameImportContext::ProcessAttribute(
             break;
         }
         default:
-            ; // unknown attribute: ignore
+            // unknown attribute: ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 }
@@ -2173,12 +2194,12 @@ XMLChapterImportContext::XMLChapterImportContext(
 }
 
 void XMLChapterImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
         {
             sal_uInt16 nTmp;
             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
@@ -2188,7 +2209,7 @@ void XMLChapterImportContext::ProcessAttribute(
             }
             break;
         }
-        case XML_TOK_TEXTFIELD_OUTLINE_LEVEL:
+        case XML_ELEMENT(TEXT, XML_OUTLINE_LEVEL):
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber(
@@ -2203,7 +2224,8 @@ void XMLChapterImportContext::ProcessAttribute(
             break;
         }
         default:
-            ; // unknown attribute: ignore
+            // unknown attribute: ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 }
@@ -2234,18 +2256,20 @@ XMLCountFieldImportContext::XMLCountFieldImportContext(
 }
 
 void XMLCountFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumberFormat = sAttrValue;
             bNumberFormatOK = true;
             break;
-        case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sLetterSync = sAttrValue;
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -2326,18 +2350,20 @@ XMLPageVarGetFieldImportContext::XMLPageVarGetFieldImportContext(
 }
 
 void XMLPageVarGetFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumberFormat = sAttrValue;
             bNumberFormatOK = true;
             break;
-        case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sLetterSync = sAttrValue;
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -2376,12 +2402,12 @@ XMLPageVarSetFieldImportContext::XMLPageVarSetFieldImportContext(
 }
 
 void XMLPageVarSetFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-    case XML_TOK_TEXTFIELD_ACTIVE:
+    case XML_ELEMENT(TEXT, XML_ACTIVE):
     {
         bool bTmp(false);
         if (::sax::Converter::convertBool(bTmp, sAttrValue))
@@ -2390,7 +2416,7 @@ void XMLPageVarSetFieldImportContext::ProcessAttribute(
         }
         break;
     }
-    case XML_TOK_TEXTFIELD_PAGE_ADJUST:
+    case XML_ELEMENT(TEXT, XML_PAGE_ADJUST):
     {
         sal_Int32 nTmp(0);
         if (::sax::Converter::convertNumber(nTmp, sAttrValue))
@@ -2400,6 +2426,7 @@ void XMLPageVarSetFieldImportContext::ProcessAttribute(
         break;
     }
     default:
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
         break;
     }
 }
@@ -2445,19 +2472,21 @@ SvXMLImportContextRef XMLMacroFieldImportContext::CreateChildContext(
 }
 
 void XMLMacroFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_DESCRIPTION:
+        case XML_ELEMENT(TEXT, XML_DESCRIPTION):
             sDescription = sAttrValue;
             bDescriptionOK = true;
             break;
-        case XML_TOK_TEXTFIELD_NAME:
+        case XML_ELEMENT(TEXT, XML_NAME):
             sMacro = sAttrValue;
             bValid = true;
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -2561,13 +2590,14 @@ SvXMLEnumMapEntry<sal_uInt16> const lcl_aReferenceTypeTokenMap[] =
     { XML_TOKEN_INVALID, 0 }
 };
 
-void XMLReferenceFieldImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLReferenceFieldImportContext::startFastElement(
+        sal_Int32 nElement,
+        const Reference<XFastAttributeList> & xAttrList)
 {
     bTypeOK = true;
     switch (nElementToken)
     {
-        case XML_TOK_TEXT_REFERENCE_REF:
+       case XML_TOK_TEXT_REFERENCE_REF:
             nSource = ReferenceFieldSource::REFERENCE_MARK;
             break;
         case XML_TOK_TEXT_BOOKMARK_REF:
@@ -2585,25 +2615,25 @@ void XMLReferenceFieldImportContext::StartElement(
             break;
     }
 
-    XMLTextFieldImportContext::StartElement(xAttrList);
+    XMLTextFieldImportContext::startFastElement(nElement, xAttrList);
 }
 
 
 void XMLReferenceFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NOTE_CLASS:
+        case XML_ELEMENT(TEXT, XML_NOTE_CLASS):
             if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
                 nSource = ReferenceFieldSource::ENDNOTE;
             break;
-        case XML_TOK_TEXTFIELD_REF_NAME:
+        case XML_ELEMENT(TEXT, XML_REF_NAME):
             sName = sAttrValue;
             bNameOK = true;
             break;
-        case XML_TOK_TEXTFIELD_REFERENCE_FORMAT:
+        case  XML_ELEMENT(TEXT, XML_REFERENCE_FORMAT):
         {
             sal_uInt16 nToken;
             if (SvXMLUnitConverter::convertEnum(nToken, sAttrValue,
@@ -2623,9 +2653,12 @@ void XMLReferenceFieldImportContext::ProcessAttribute(
 
             break;
         }
-        case XML_TOK_TEXTFIELD_REFERENCE_LANGUAGE:
+        case XML_ELEMENT(LO_EXT, XML_REFERENCE_LANGUAGE):
+        case XML_ELEMENT(TEXT, XML_REFERENCE_LANGUAGE):
             sLanguage = sAttrValue;
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 
     // bValid: we need proper element type and name
@@ -2700,9 +2733,7 @@ SvXMLImportContextRef XMLDdeFieldDeclsImportContext::CreateChildContext(
     if ( (XML_NAMESPACE_TEXT == nPrefix) &&
          (IsXMLToken(rLocalName, XML_DDE_CONNECTION_DECL)) )
     {
-        static const SvXMLTokenMap aTokenMap(aDdeDeclAttrTokenMap);
-        return new XMLDdeFieldDeclImportContext(GetImport(), nPrefix,
-                                                rLocalName, aTokenMap);
+        return new XMLDdeFieldDeclImportContext(GetImport(), nPrefix, rLocalName);
     }
     return nullptr;
 }
@@ -2713,16 +2744,16 @@ SvXMLImportContextRef XMLDdeFieldDeclsImportContext::CreateChildContext(
 
 XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext(
     SvXMLImport& rImport, sal_uInt16 nPrfx,
-    const OUString& sLocalName, const SvXMLTokenMap& rMap)
+    const OUString& sLocalName)
 :   SvXMLImportContext(rImport, nPrfx, sLocalName)
-,   rTokenMap(rMap)
 {
     DBG_ASSERT(XML_NAMESPACE_TEXT == nPrfx, "wrong prefix");
     DBG_ASSERT(IsXMLToken(sLocalName, XML_DDE_CONNECTION_DECL), "wrong name");
 }
 
-void XMLDdeFieldDeclImportContext::StartElement(
-    const Reference<XAttributeList> & xAttrList)
+void XMLDdeFieldDeclImportContext::startFastElement(
+        sal_Int32 /*nElement*/,
+        const Reference<XFastAttributeList> & xAttrList)
 {
     OUString sName;
     OUString sCommandApplication;
@@ -2736,42 +2767,37 @@ void XMLDdeFieldDeclImportContext::StartElement(
     bool bCommandItemOK = false;
 
     // process attributes
-    sal_Int16 nLength = xAttrList->getLength();
-    for(sal_Int16 i=0; i<nLength; i++)
+    for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
     {
-
-        OUString sLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-            GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
-        switch (rTokenMap.Get(nPrefix, sLocalName))
+        switch (aIter.getToken())
         {
-            case XML_TOK_DDEFIELD_NAME:
-                sName = xAttrList->getValueByIndex(i);
+            case XML_ELEMENT(OFFICE, XML_NAME):
+                sName = aIter.toString();
                 bNameOK = true;
                 break;
-            case XML_TOK_DDEFIELD_APPLICATION:
-                sCommandApplication = xAttrList->getValueByIndex(i);
+            case XML_ELEMENT(OFFICE, XML_DDE_APPLICATION):
+                sCommandApplication = aIter.toString();
                 bCommandApplicationOK = true;
                 break;
-            case XML_TOK_DDEFIELD_TOPIC:
-                sCommandTopic = xAttrList->getValueByIndex(i);
+            case XML_ELEMENT(OFFICE, XML_DDE_TOPIC):
+                sCommandTopic = aIter.toString();
                 bCommandTopicOK = true;
                 break;
-            case XML_TOK_DDEFIELD_ITEM:
-                sCommandItem = xAttrList->getValueByIndex(i);
+            case XML_ELEMENT(OFFICE, XML_DDE_ITEM):
+                sCommandItem = aIter.toString();
                 bCommandItemOK = true;
                 break;
-            case XML_TOK_DDEFIELD_UPDATE:
+            case XML_ELEMENT(OFFICE, XML_AUTOMATIC_UPDATE):
             {
                 bool bTmp(false);
-                if (::sax::Converter::convertBool(
-                    bTmp, xAttrList->getValueByIndex(i)) )
+                if (::sax::Converter::convertBool(bTmp, aIter.toString()) )
                 {
                     bUpdate = bTmp;
                 }
                 break;
             }
+            default:
+                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         }
     }
 
@@ -2842,16 +2868,19 @@ XMLDdeFieldImportContext::XMLDdeFieldImportContext(
 }
 
 void XMLDdeFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
-    if (XML_TOK_TEXTFIELD_CONNECTION_NAME == nAttrToken)
+    if ( XML_ELEMENT(TEXT, XML_CONNECTION_NAME) == nAttrToken)
     {
         sName = sAttrValue;
         bValid = true;
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
+
 void XMLDdeFieldImportContext::endFastElement(sal_Int32 )
 {
     if (!bValid)
@@ -2918,10 +2947,11 @@ XMLSheetNameImportContext::XMLSheetNameImportContext(
 }
 
 void XMLSheetNameImportContext::ProcessAttribute(
-    sal_uInt16,
-    const OUString& )
+    sal_Int32 nAttrToken,
+    const OUString& sAttrValue)
 {
     // no attributes -> nothing to be done
+    XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLSheetNameImportContext::PrepareField(
@@ -2943,9 +2973,10 @@ XMLPageNameFieldImportContext::XMLPageNameFieldImportContext(
 }
 
 /// process attribute values
-void XMLPageNameFieldImportContext::ProcessAttribute( sal_uInt16,
-                                   const OUString& )
+void XMLPageNameFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken,
+                                   const OUString& sAttrValue )
 {
+    XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 /// prepare XTextField for insertion into document
@@ -2970,21 +3001,22 @@ XMLUrlFieldImportContext::XMLUrlFieldImportContext(
 }
 
 void XMLUrlFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_HREF:
+        case XML_ELEMENT(XLINK, XML_HREF):
             sURL = GetImport().GetAbsoluteReference( sAttrValue );
             bValid = true;
             break;
-        case XML_TOK_TEXTFIELD_TARGET_FRAME:
+        case XML_ELEMENT(OFFICE, XML_TARGET_FRAME_NAME):
             sFrame = sAttrValue;
             bFrameOK = true;
             break;
         default:
             // ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 }
@@ -3047,32 +3079,28 @@ SvXMLEnumMapEntry<sal_uInt16> const aBibliographyDataTypeMap[] =
 // we'll process attributes on our own and for fit the standard
 // textfield mechanism, because our attributes have zero overlap with
 // all the other textfields.
-void XMLBibliographyFieldImportContext::StartElement(
-        const Reference<XAttributeList> & xAttrList)
+void XMLBibliographyFieldImportContext::startFastElement(
+        sal_Int32 /*nElement*/,
+        const Reference<XFastAttributeList> & xAttrList)
 {
     // iterate over attributes
-    sal_Int16 nLength = xAttrList->getLength();
-    for(sal_Int16 i=0; i<nLength; i++) {
-
-        OUString sLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-            GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
-        if (nPrefix == XML_NAMESPACE_TEXT)
+    for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
+    {
+        if (IsTokenInNamespace(aIter.getToken(), XML_NAMESPACE_TEXT))
         {
             PropertyValue aValue;
             aValue.Name = OUString::createFromAscii(
-                MapBibliographyFieldName(sLocalName));
+                MapBibliographyFieldName(SvXMLImport::getNameFromToken(aIter.getToken())));
             Any aAny;
 
             // special treatment for bibliography type
             // biblio vs bibilio: #96658#; also read old documents
-            if (IsXMLToken(sLocalName, XML_BIBILIOGRAPHIC_TYPE) ||
-                IsXMLToken(sLocalName, XML_BIBLIOGRAPHY_TYPE)    )
+            if ((aIter.getToken() & TOKEN_MASK) == XML_BIBILIOGRAPHIC_TYPE ||
+                (aIter.getToken() & TOKEN_MASK) == XML_BIBLIOGRAPHY_TYPE   )
             {
                 sal_uInt16 nTmp;
                 if (SvXMLUnitConverter::convertEnum(
-                    nTmp, xAttrList->getValueByIndex(i),
+                    nTmp, aIter.toString(),
                     aBibliographyDataTypeMap))
                 {
                     aAny <<= static_cast<sal_Int16>(nTmp);
@@ -3083,7 +3111,7 @@ void XMLBibliographyFieldImportContext::StartElement(
             }
             else
             {
-                aAny <<= xAttrList->getValueByIndex(i);
+                aAny <<= aIter.toString();
                 aValue.Value = aAny;
 
                 aValues.push_back(aValue);
@@ -3094,11 +3122,11 @@ void XMLBibliographyFieldImportContext::StartElement(
 }
 
 void XMLBibliographyFieldImportContext::ProcessAttribute(
-    sal_uInt16,
+    sal_Int32 ,
     const OUString& )
 {
     // attributes are handled in StartElement
-    OSL_FAIL("This should not have happened.");
+    assert(false && "This should not have happened.");
 }
 
 
@@ -3280,13 +3308,15 @@ XMLAnnotationImportContext::XMLAnnotationImportContext(
 }
 
 void XMLAnnotationImportContext::ProcessAttribute(
-    sal_uInt16 nToken,
-    const OUString& rValue )
+    sal_Int32 nAttrToken,
+    const OUString& sAttrValue )
 {
-    if (nToken == XML_TOK_TEXT_NAME)
-        aName = rValue;
-    if (nToken == XML_TOK_TEXT_RESOLVED)
-        aResolved = rValue;
+    if (nAttrToken == XML_ELEMENT(OFFICE, XML_NAME))
+        aName = sAttrValue;
+    else if (nAttrToken == XML_ELEMENT(LO_EXT, XML_RESOLVED))
+        aResolved = sAttrValue;
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 SvXMLImportContextRef XMLAnnotationImportContext::CreateChildContext(
@@ -3497,22 +3527,23 @@ XMLScriptImportContext::XMLScriptImportContext(
 }
 
 void XMLScriptImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_HREF:
+        case XML_ELEMENT(XLINK, XML_HREF):
             sContent = GetImport().GetAbsoluteReference( sAttrValue );
             bContentOK = true;
             break;
 
-        case XML_TOK_TEXTFIELD_LANGUAGE:
+        case XML_ELEMENT(SCRIPT, XML_LANGUAGE):
             sScriptType = sAttrValue;
             break;
 
         default:
             // ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 
@@ -3552,12 +3583,12 @@ XMLMeasureFieldImportContext::XMLMeasureFieldImportContext(
 }
 
 void XMLMeasureFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_MEASURE_KIND:
+        case XML_ELEMENT(TEXT, XML_KIND):
             if( IsXMLToken( sAttrValue, XML_VALUE ) )
             {
                 mnKind = 0; bValid = true;
@@ -3571,6 +3602,8 @@ void XMLMeasureFieldImportContext::ProcessAttribute(
                 mnKind = 2; bValid = true;
             }
             break;
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     }
 }
 
@@ -3654,15 +3687,15 @@ SvXMLImportContextRef XMLDropDownFieldImportContext::CreateChildContext(
 }
 
 void XMLDropDownFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
-    if( nAttrToken == XML_TOK_TEXTFIELD_NAME )
+    if( nAttrToken == XML_ELEMENT(TEXT, XML_NAME))
     {
         sName = sAttrValue;
         bNameOK = true;
     }
-    else if (nAttrToken == XML_TOK_TEXTFIELD_HELP)
+    else if (nAttrToken ==  XML_ELEMENT(TEXT, XML_HELP))
     {
         sHelp = sAttrValue;
         bHelpOK = true;
@@ -3672,6 +3705,8 @@ void XMLDropDownFieldImportContext::ProcessAttribute(
         sHint = sAttrValue;
         bHintOK = true;
     }
+    else
+        XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 void XMLDropDownFieldImportContext::PrepareField(
@@ -3725,8 +3760,9 @@ XMLHeaderFieldImportContext::XMLHeaderFieldImportContext(
 }
 
 /// process attribute values
-void XMLHeaderFieldImportContext::ProcessAttribute( sal_uInt16, const OUString& )
+void XMLHeaderFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
+    XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 /// prepare XTextField for insertion into document
@@ -3748,8 +3784,9 @@ XMLFooterFieldImportContext::XMLFooterFieldImportContext(
 }
 
 /// process attribute values
-void XMLFooterFieldImportContext::ProcessAttribute( sal_uInt16, const OUString& )
+void XMLFooterFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken, const OUString& sAttrValue)
 {
+    XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 /// prepare XTextField for insertion into document
@@ -3772,9 +3809,10 @@ XMLDateTimeFieldImportContext::XMLDateTimeFieldImportContext(
 }
 
 /// process attribute values
-void XMLDateTimeFieldImportContext::ProcessAttribute( sal_uInt16,
-                                   const OUString& )
+void XMLDateTimeFieldImportContext::ProcessAttribute( sal_Int32 nAttrToken,
+                                   const OUString& sAttrValue )
 {
+    XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
 }
 
 /// prepare XTextField for insertion into document
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index cc7313515786..abcbb51622fe 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -108,28 +108,28 @@ XMLVarFieldImportContext::XMLVarFieldImportContext(
 }
 
 void XMLVarFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
         {
-        case XML_TOK_TEXTFIELD_NAME:
+        case XML_ELEMENT(TEXT, XML_NAME):
             sName = sAttrValue;
             bValid = true;      // we assume: field with name is valid!
             break;
-        case XML_TOK_TEXTFIELD_DESCRIPTION:
+        case XML_ELEMENT(TEXT, XML_DESCRIPTION):
             sDescription = sAttrValue;
             bDescriptionOK = true;
             break;
-        case XML_TOK_TEXTFIELD_HELP:
+        case XML_ELEMENT(TEXT, XML_HELP):
             sHelp = sAttrValue;
             bHelpOK = true;
             break;
-        case XML_TOK_TEXTFIELD_HINT:
+        case XML_ELEMENT(TEXT, XML_HINT):
             sHint = sAttrValue;
             bHintOK = true;
             break;
-        case XML_TOK_TEXTFIELD_FORMULA:
+        case XML_ELEMENT(TEXT, XML_FORMULA):
             {
                 OUString sTmp;
                 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
@@ -143,7 +143,7 @@ void XMLVarFieldImportContext::ProcessAttribute(
                     sFormula = sAttrValue;
             }
             break;
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
             if (IsXMLToken(sAttrValue, XML_FORMULA))
             {
                 bDisplayFormula = true;
@@ -347,17 +347,17 @@ XMLSequenceFieldImportContext::XMLSequenceFieldImportContext(
 }
 
 void XMLSequenceFieldImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumFormat = sAttrValue;
             break;
-        case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sNumFormatSync = sAttrValue;
             break;
-        case XML_TOK_TEXTFIELD_REF_NAME:
+        case XML_ELEMENT(TEXT, XML_REF_NAME):
             sRefName = sAttrValue;
             bRefNameOK = true;
             break;
@@ -602,25 +602,26 @@ XMLTableFormulaImportContext::XMLTableFormulaImportContext(
 }
 
 void XMLTableFormulaImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken,
+    sal_Int32 nAttrToken,
     const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_FORMULA:
+        case XML_ELEMENT(TEXT, XML_FORMULA):
             aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
             bValid = true;  // we need a formula!
             break;
 
-        case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
             aValueHelper.ProcessAttribute( nAttrToken, sAttrValue );
             break;
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
             if ( sAttrValue == "formula" )
                  bIsShowFormula = true;
             break;
         default:
             // unknown attribute -> ignore
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
             break;
     }
 }
@@ -658,15 +659,15 @@ XMLVariableDeclsImportContext::XMLVariableDeclsImportContext(
 {
 }
 
-SvXMLImportContextRef XMLVariableDeclsImportContext::CreateChildContext(
-    sal_uInt16 nPrefix, const OUString& rLocalName,
-    const Reference<xml::sax::XAttributeList> & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > XMLVariableDeclsImportContext::createFastChildContext(
+        sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    enum XMLTokenEnum eElementName;
     SvXMLImportContextRef xImportContext;
 
-    if( XML_NAMESPACE_TEXT == nPrefix )
+    if( IsTokenInNamespace(nElement, XML_NAMESPACE_TEXT) )
     {
+        enum XMLTokenEnum eElementName;
         switch (eVarDeclsContextType)
         {
             case VarTypeSequence:
@@ -684,16 +685,16 @@ SvXMLImportContextRef XMLVariableDeclsImportContext::CreateChildContext(
                 break;
         }
 
-        if( IsXMLToken( rLocalName, eElementName ) )
+        if( nElement == XML_ELEMENT(TEXT, eElementName) )
         {
-            xImportContext = new XMLVariableDeclImportContext(
-                GetImport(), rImportHelper, nPrefix, rLocalName, xAttrList,
+            return new XMLVariableDeclImportContext(
+                GetImport(), rImportHelper, nElement, xAttrList,
                 eVarDeclsContextType);
         }
     }
 
     // if no context was created, use default context
-    return xImportContext;
+    return nullptr;
 }
 
 
@@ -702,10 +703,10 @@ SvXMLImportContextRef XMLVariableDeclsImportContext::CreateChildContext(
 
 XMLVariableDeclImportContext::XMLVariableDeclImportContext(
     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
-    sal_uInt16 nPrfx, const OUString& rLocalName,
-    const Reference<xml::sax::XAttributeList> & xAttrList,
+    sal_Int32 nElement,
+    const Reference<xml::sax::XFastAttributeList> & xAttrList,
     enum VarType eVarType) :
-        SvXMLImportContext(rImport, nPrfx, rLocalName)
+        SvXMLImportContext(rImport)
 {
     // bug?? which properties for userfield/userfieldmaster
     XMLValueImportHelper aValueHelper(rImport, rHlp, true, false, true, false);
@@ -714,36 +715,26 @@ XMLVariableDeclImportContext::XMLVariableDeclImportContext(
     sal_Int8 nNumLevel(-1);
     OUString sName;
 
-    if ( (XML_NAMESPACE_TEXT != nPrfx) ||
-         !( ( IsXMLToken( rLocalName, XML_SEQUENCE_DECL )) ||
-            ( IsXMLToken( rLocalName, XML_VARIABLE_DECL)) ||
-            ( IsXMLToken( rLocalName, XML_USER_FIELD_DECL)) ) )
+    if (nElement != XML_ELEMENT(TEXT, XML_SEQUENCE_DECL) &&
+        nElement != XML_ELEMENT(TEXT, XML_VARIABLE_DECL) &&
+        nElement != XML_ELEMENT(TEXT, XML_USER_FIELD_DECL) )
         return;
 
-
     // TODO: check validity (need name!)
 
     // parse attributes
-    sal_Int16 nLength = xAttrList->getLength();
-    for(sal_Int16 i=0; i<nLength; i++) {
-
-        OUString sLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
-            GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
-
-        sal_uInt16 nToken = rHlp.
-            GetTextFieldAttrTokenMap().Get(nPrefix, sLocalName);
-
-        switch (nToken)
+    for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
+    {
+        switch (aIter.getToken())
         {
-            case XML_TOK_TEXTFIELD_NAME:
-                sName = xAttrList->getValueByIndex(i);
+            case XML_ELEMENT(TEXT, XML_NAME):
+                sName = aIter.toString();
                 break;
-            case XML_TOK_TEXTFIELD_NUMBERING_LEVEL:
+            case XML_ELEMENT(TEXT, XML_DISPLAY_OUTLINE_LEVEL):
             {
                 sal_Int32 nLevel;
                 bool const bRet = ::sax::Converter::convertNumber(
-                    nLevel, xAttrList->getValueByIndex(i), 0,
+                    nLevel, aIter.toString(), 0,
                     GetImport().GetTextImport()->GetChapterNumbering()->
                                                                getCount());
                 if (bRet)
@@ -752,15 +743,14 @@ XMLVariableDeclImportContext::XMLVariableDeclImportContext(
                 }
                 break;
             }
-            case XML_TOK_TEXTFIELD_NUMBERING_SEPARATOR:
+            case XML_ELEMENT(TEXT, XML_SEPARATION_CHARACTER):
                 cSeparationChar =
-                    static_cast<char>(xAttrList->getValueByIndex(i).toChar());
+                    static_cast<char>(aIter.toString().toChar());
                 break;
 
             default:
                 // delegate to value helper
-                aValueHelper.ProcessAttribute(nToken,
-                                              xAttrList->getValueByIndex(i));
+                aValueHelper.ProcessAttribute(aIter.getToken(), aIter.toString());
                 break;
         }
     }
@@ -944,15 +934,15 @@ XMLDatabaseDisplayImportContext::XMLDatabaseDisplayImportContext(
 }
 
 void XMLDatabaseDisplayImportContext::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_COLUMN_NAME:
+        case XML_ELEMENT(TEXT, XML_COLUMN_NAME):
             sColumnName = sAttrValue;
             bColumnOK = true;
             break;
-        case XML_TOK_TEXTFIELD_DISPLAY:
+        case XML_ELEMENT(TEXT, XML_DISPLAY):
             {
                 bool bNone = IsXMLToken( sAttrValue, XML_NONE );
                 bool bValue = IsXMLToken( sAttrValue, XML_VALUE );
@@ -960,9 +950,9 @@ void XMLDatabaseDisplayImportContext::ProcessAttribute(
                 bDisplayOK = bNone || bValue;
             }
             break;
-        case XML_TOK_TEXTFIELD_DATABASE_NAME:
-        case XML_TOK_TEXTFIELD_TABLE_NAME:
-        case XML_TOK_TEXTFIELD_TABLE_TYPE:
+        case XML_ELEMENT(TEXT, XML_DATABASE_NAME):
+        case XML_ELEMENT(TEXT, XML_TABLE_NAME):
+        case XML_ELEMENT(TEXT, XML_TABLE_TYPE):
             // handled by super class
             XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
                                                             sAttrValue);
@@ -1110,11 +1100,12 @@ XMLValueImportHelper::XMLValueImportHelper(
 }
 
 void XMLValueImportHelper::ProcessAttribute(
-    sal_uInt16 nAttrToken, const OUString& sAttrValue )
+    sal_Int32 nAttrToken, const OUString& sAttrValue )
 {
     switch (nAttrToken)
     {
-        case XML_TOK_TEXTFIELD_VALUE_TYPE:
+        case XML_ELEMENT(TEXT, XML_VALUE_TYPE):
+        case XML_ELEMENT(OFFICE, XML_VALUE_TYPE):
         {
             // convert enum
             ValueType eValueType = XML_VALUE_TYPE_STRING;
@@ -1143,7 +1134,8 @@ void XMLValueImportHelper::ProcessAttribute(
             break;
         }
 
-        case XML_TOK_TEXTFIELD_VALUE:
+        case XML_ELEMENT(TEXT, XML_VALUE):
+        case XML_ELEMENT(OFFICE, XML_VALUE):
         {
             double fTmp;
             bool const bRet = ::sax::Converter::convertDouble(fTmp,sAttrValue);
@@ -1153,7 +1145,8 @@ void XMLValueImportHelper::ProcessAttribute(
             break;
         }
 
-        case XML_TOK_TEXTFIELD_TIME_VALUE:
+        case XML_ELEMENT(TEXT, XML_TIME_VALUE):
+        case XML_ELEMENT(OFFICE, XML_TIME_VALUE):
         {
             double fTmp;
             bool const bRet =
@@ -1164,7 +1157,8 @@ void XMLValueImportHelper::ProcessAttribute(
             break;
         }
 
-        case XML_TOK_TEXTFIELD_DATE_VALUE:
+        case XML_ELEMENT(TEXT, XML_DATE_VALUE):
+        case XML_ELEMENT(OFFICE, XML_DATE_VALUE):
         {
             double fTmp;
             bool bRet = rImport.GetMM100UnitConverter().
@@ -1175,7 +1169,7 @@ void XMLValueImportHelper::ProcessAttribute(
             break;
         }
 
-        case XML_TOK_TEXTFIELD_BOOL_VALUE:
+        case XML_ELEMENT(OFFICE, XML_BOOLEAN_VALUE):
         {
             bool bTmp(false);
             bool bRet = ::sax::Converter::convertBool(bTmp, sAttrValue);
@@ -1193,12 +1187,13 @@ void XMLValueImportHelper::ProcessAttribute(
             break;
         }
 
-        case XML_TOK_TEXTFIELD_STRING_VALUE:
+        case XML_ELEMENT(TEXT, XML_STRING_VALUE):
+        case XML_ELEMENT(OFFICE, XML_STRING_VALUE):
             sValue = sAttrValue;
             bStringValueOK = true;
             break;
 
-        case XML_TOK_TEXTFIELD_FORMULA:
+        case  XML_ELEMENT(TEXT, XML_FORMULA):
             {
                 OUString sTmp;
                 sal_uInt16 nPrefix = rImport.GetNamespaceMap().
@@ -1213,7 +1208,7 @@ void XMLValueImportHelper::ProcessAttribute(
             }
             break;
 
-        case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
         {
             sal_Int32 nKey = rHelper.GetDataStyleKey(
                                           sAttrValue, &bIsDefaultLanguage);
@@ -1224,6 +1219,8 @@ void XMLValueImportHelper::ProcessAttribute(
             }
             break;
         }
+        default:
+            XMLOFF_WARN_UNKNOWN_ATTR("xmloff", nAttrToken, sAttrValue);
     } // switch
 }
 


More information about the Libreoffice-commits mailing list