dbaccess/source/filter/xml/xmlStyleImport.cxx                   |   21 ++-
 dbaccess/source/filter/xml/xmlStyleImport.hxx                   |    3 
 include/xmloff/XMLShapeStyleContext.hxx                         |    4 
 include/xmloff/XMLTextShapeStyleContext.hxx                     |    3 
 include/xmloff/prstylei.hxx                                     |    4 
 include/xmloff/txtstyli.hxx                                     |    3 
 include/xmloff/xmlnumi.hxx                                      |    3 
 include/xmloff/xmlstyle.hxx                                     |    4 
 reportdesign/source/filter/xml/xmlStyleImport.cxx               |   20 +--
 reportdesign/source/filter/xml/xmlStyleImport.hxx               |    3 
 sc/source/filter/xml/xmlstyli.cxx                               |   21 ++-
 sc/source/filter/xml/xmlstyli.hxx                               |    3 
 sw/source/filter/xml/xmlfmt.cxx                                 |   32 ++---
 xmloff/inc/PageMasterImportContext.hxx                          |    3 
 xmloff/inc/XMLChartStyleContext.hxx                             |    4 
 xmloff/inc/XMLFootnoteConfigurationImportContext.hxx            |   10 -
 xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx         |    3 
 xmloff/inc/XMLLineNumberingImportContext.hxx                    |    3 
 xmloff/source/chart/XMLChartStyleContext.cxx                    |   22 +--
 xmloff/source/draw/XMLShapeStyleContext.cxx                     |   16 +-
 xmloff/source/style/PageMasterImportContext.cxx                 |    8 -
 xmloff/source/style/XMLFontStylesContext.cxx                    |   31 ++---
 xmloff/source/style/XMLFontStylesContext_impl.hxx               |    6 -
 xmloff/source/style/prstylei.cxx                                |    7 -
 xmloff/source/style/xmlnumfi.cxx                                |    2 
 xmloff/source/style/xmlnumi.cxx                                 |    8 -
 xmloff/source/style/xmlstyle.cxx                                |   55 
+++------
 xmloff/source/table/XMLTableImport.cxx                          |   10 -
 xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx    |   41 ++-----
 xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx |   52 
+++------
 xmloff/source/text/XMLLineNumberingImportContext.cxx            |   56 
++--------
 xmloff/source/text/XMLTextShapeStyleContext.cxx                 |    8 -
 xmloff/source/text/txtstyli.cxx                                 |   38 ++----
 33 files changed, 195 insertions(+), 312 deletions(-)

New commits:
commit 7896173f7ff017e338721b8079f00634a8879dab
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Dec 7 22:04:40 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Dec 8 07:50:58 2020 +0100

    fastparser in styles
    
    Change-Id: I39d285f1dd7dd18c396db96863f77f511741951c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107364
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx 
b/dbaccess/source/filter/xml/xmlStyleImport.cxx
index 91ccd77c462a..e5a5970c2e00 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.cxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx
@@ -107,17 +107,20 @@ void OTableStyleContext::AddProperty(const sal_Int16 
nContextID, const uno::Any&
     GetProperties().push_back(aPropState); // has to be inserted in a sort 
order later
 }
 
-void OTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void OTableStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    // TODO: use a map here
-    if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
-        m_sDataStyleName = rValue;
-    else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
-        sPageStyle = rValue;
-    else
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+    switch(nElement & TOKEN_MASK)
+    {
+        case XML_DATA_STYLE_NAME:
+            m_sDataStyleName = rValue;
+            break;
+        case XML_MASTER_PAGE_NAME:
+            sPageStyle = rValue;
+            break;
+        default:
+            XMLPropStyleContext::SetAttribute( nElement, rValue );
+    }
 }
 
 ODBFilter& OTableStyleContext::GetOwnImport()
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx 
b/dbaccess/source/filter/xml/xmlStyleImport.hxx
index 27e3fa5549a1..d3fc001b03d5 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.hxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx
@@ -39,8 +39,7 @@ namespace dbaxml
 
     protected:
 
-        virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                                const OUString& rLocalName,
+        virtual void SetAttribute( sal_Int32 nElement,
                                 const OUString& rValue ) override;
 
     public:
diff --git a/include/xmloff/XMLShapeStyleContext.hxx 
b/include/xmloff/XMLShapeStyleContext.hxx
index 556cfec7cdfc..59b7c91e6b5e 100644
--- a/include/xmloff/XMLShapeStyleContext.hxx
+++ b/include/xmloff/XMLShapeStyleContext.hxx
@@ -37,9 +37,7 @@ class XMLOFF_DLLPUBLIC XMLShapeStyleContext: public 
XMLPropStyleContext
 protected:
     OUString     m_sListStyleName;
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
-                               const OUString& rValue ) override;
+    virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) 
override;
 public:
 
     XMLShapeStyleContext(
diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx 
b/include/xmloff/XMLTextShapeStyleContext.hxx
index 77e2bcbe58b1..bff4781526bc 100644
--- a/include/xmloff/XMLTextShapeStyleContext.hxx
+++ b/include/xmloff/XMLTextShapeStyleContext.hxx
@@ -29,8 +29,7 @@ class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext final : 
public XMLShapeStyleCont
 
     rtl::Reference<XMLEventsImportContext> xEventContext;
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
 public:
diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
index b79ae267f9b1..c2766f76fa0c 100644
--- a/include/xmloff/prstylei.hxx
+++ b/include/xmloff/prstylei.hxx
@@ -74,9 +74,7 @@ protected:
     static const OldFillStyleDefinitionSet& getHeaderSet();
     static const OldFillStyleDefinitionSet& getFooterSet();
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
-                               const OUString& rValue ) override;
+    virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) 
override;
     SvXMLStylesContext *GetStyles() { return mxStyles.get(); }
     ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; 
}
 
diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx
index bb570ac9095c..27e9f6dd5b15 100644
--- a/include/xmloff/txtstyli.hxx
+++ b/include/xmloff/txtstyli.hxx
@@ -47,8 +47,7 @@ class XMLOFF_DLLPUBLIC XMLTextStyleContext : public 
XMLPropStyleContext
 
 protected:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
 public:
diff --git a/include/xmloff/xmlnumi.hxx b/include/xmloff/xmlnumi.hxx
index e8d0b1def920..4adfd437b95d 100644
--- a/include/xmloff/xmlnumi.hxx
+++ b/include/xmloff/xmlnumi.hxx
@@ -43,8 +43,7 @@ class XMLOFF_DLLPUBLIC SvxXMLListStyleContext final
     bool                        bConsecutive : 1;
     bool                        bOutline : 1;
 
-    SAL_DLLPRIVATE virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    SAL_DLLPRIVATE virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
 public:
diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
index a657f31393b6..d0b820258ba4 100644
--- a/include/xmloff/xmlstyle.hxx
+++ b/include/xmloff/xmlstyle.hxx
@@ -57,9 +57,7 @@ class XMLOFF_DLLPUBLIC SvXMLStyleContext : public 
SvXMLImportContext
 
 protected:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
-                               const OUString& rValue );
+    virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue );
 
     void SetFamily( XmlStyleFamily nSet ) { mnFamily = nSet; }
     void SetAutoName( const OUString& rName ) { maAutoName = rName; }
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx 
b/reportdesign/source/filter/xml/xmlStyleImport.cxx
index 5b269a5d7e9d..e6b103abc586 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.cxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx
@@ -127,17 +127,19 @@ void OControlStyleContext::AddProperty(const sal_Int16 
nContextID, const uno::An
     GetProperties().push_back(aPropState); // has to be inserted in a sort 
order later
 }
 
-void OControlStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void OControlStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    // TODO: use a map here
-    if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
-        m_sDataStyleName = rValue;
-    else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
-        ;
-    else
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+    switch(nElement & TOKEN_MASK)
+    {
+        case XML_DATA_STYLE_NAME:
+            m_sDataStyleName = rValue;
+            break;
+        case XML_MASTER_PAGE_NAME:
+            break;
+        default:
+        XMLPropStyleContext::SetAttribute( nElement, rValue );
+    }
 }
 
 
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx 
b/reportdesign/source/filter/xml/xmlStyleImport.hxx
index fac89edc67bf..b51108fd5244 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.hxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx
@@ -40,8 +40,7 @@ namespace rptxml
         void operator =(const OControlStyleContext&) = delete;
     protected:
 
-        virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                                const OUString& rLocalName,
+        virtual void SetAttribute( sal_Int32 nElement,
                                 const OUString& rValue ) override;
 
     public:
diff --git a/sc/source/filter/xml/xmlstyli.cxx 
b/sc/source/filter/xml/xmlstyli.cxx
index 3a0fd7ecf2ba..a3db1cff5f0f 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -396,17 +396,20 @@ ScCondFormatEntry* ScXMLMapContext::CreateConditionEntry()
     return pEntry;
 }
 
-void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void XMLTableStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    // TODO: use a map here
-    if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
-        sDataStyleName = rValue;
-    else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
-        sPageStyle = rValue;
-    else
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+    switch(nElement & TOKEN_MASK)
+    {
+        case XML_DATA_STYLE_NAME:
+            sDataStyleName = rValue;
+            break;
+        case XML_MASTER_PAGE_NAME:
+            sPageStyle = rValue;
+            break;
+        default:
+            XMLPropStyleContext::SetAttribute( nElement, rValue );
+    }
 }
 
 
diff --git a/sc/source/filter/xml/xmlstyli.hxx 
b/sc/source/filter/xml/xmlstyli.hxx
index e867b4969ae1..9a2b00d0b6db 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -79,8 +79,7 @@ class XMLTableStyleContext : public XMLPropStyleContext
 
 protected:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
 public:
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index fa0b31a5e78d..eb2707ac8013 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -380,7 +380,7 @@ class SwXMLCellStyleContext : public XMLPropStyleContext
 public:
     using XMLPropStyleContext::XMLPropStyleContext;
     virtual void FillPropertySet(const 
css::uno::Reference<css::beans::XPropertySet>& rPropSet) override;
-    virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString& 
rLocalName, const OUString& rValue) override;
+    virtual void SetAttribute(sal_Int32 nElement, const OUString& rValue) 
override;
 };
 
 class SwXMLItemSetStyleContext_Impl : public SvXMLStyleContext
@@ -402,8 +402,7 @@ class SwXMLItemSetStyleContext_Impl : public 
SvXMLStyleContext
 
 protected:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
     SwXMLImport& GetSwImport() { return 
static_cast<SwXMLImport&>(GetImport()); }
@@ -484,26 +483,26 @@ void SwXMLCellStyleContext::FillPropertySet(const 
css::uno::Reference<css::beans
     XMLPropStyleContext::FillPropertySet(rPropSet);
 }
 
-void SwXMLCellStyleContext::SetAttribute(sal_uInt16 nPrefixKey, const 
OUString& rLocalName, const OUString& rValue)
+void SwXMLCellStyleContext::SetAttribute(sal_Int32 nElement, const OUString& 
rValue)
 {
-    if (IsXMLToken(rLocalName, XML_DATA_STYLE_NAME))
+    if ((nElement & TOKEN_MASK) == XML_DATA_STYLE_NAME)
         m_sDataStyleName = rValue;
     else
-        XMLPropStyleContext::SetAttribute(nPrefixKey, rLocalName, rValue);
+        XMLPropStyleContext::SetAttribute(nElement, rValue);
 }
 
-void SwXMLItemSetStyleContext_Impl::SetAttribute( sal_uInt16 nPrefixKey,
-                                           const OUString& rLocalName,
+void SwXMLItemSetStyleContext_Impl::SetAttribute( sal_Int32 nElement,
                                            const OUString& rValue )
 {
-    if( XML_NAMESPACE_STYLE == nPrefixKey )
+    switch(nElement)
     {
-        if ( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
+        case XML_ELEMENT(STYLE, XML_MASTER_PAGE_NAME):
         {
             sMasterPageName = rValue;
             bHasMasterPageName = true;
+            break;
         }
-        else if ( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
         {
             // if we have a valid data style name
             if (!rValue.isEmpty())
@@ -511,15 +510,10 @@ void SwXMLItemSetStyleContext_Impl::SetAttribute( 
sal_uInt16 nPrefixKey,
                 sDataStyleName = rValue;
                 bDataStyleIsResolved = false;   // needs to be resolved
             }
+            break;
         }
-        else
-        {
-            SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
-        }
-    }
-    else
-    {
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        default:
+            SvXMLStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/inc/PageMasterImportContext.hxx 
b/xmloff/inc/PageMasterImportContext.hxx
index 08b361fbb84c..44cf86bc99e0 100644
--- a/xmloff/inc/PageMasterImportContext.hxx
+++ b/xmloff/inc/PageMasterImportContext.hxx
@@ -29,8 +29,7 @@ private:
     OUString sPageUsage;
     bool                m_bIsFillStyleAlreadyConverted : 1;
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
 public:
diff --git a/xmloff/inc/XMLChartStyleContext.hxx 
b/xmloff/inc/XMLChartStyleContext.hxx
index c22df28ffa75..f88be429b8a5 100644
--- a/xmloff/inc/XMLChartStyleContext.hxx
+++ b/xmloff/inc/XMLChartStyleContext.hxx
@@ -29,9 +29,7 @@ private:
     SvXMLStylesContext& mrStyles;
 
     /// is called when an attribute at the (auto)style element is found
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
-                               const OUString& rValue ) override;
+    virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) 
override;
 
 public:
 
diff --git a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx 
b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
index 04cc2c8bc17a..aaccbd4f3da2 100644
--- a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
+++ b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx
@@ -44,17 +44,14 @@ class XMLFootnoteConfigurationImportContext final : public 
SvXMLStyleContext
     OUString sBeginNotice;
     OUString sEndNotice;
 
-    std::unique_ptr<SvXMLTokenMap> pAttrTokenMap;
-
     sal_Int16 nOffset;
     sal_Int16 nNumbering;
     bool bPosition;
     bool bIsEndnote;
 
     /// parse attributes
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
-                               const OUString& rValue ) override;
+    virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) 
override;
+
 public:
 
 
@@ -69,9 +66,6 @@ public:
     virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
         sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& AttrList ) override;
 
-    /// get token map for attributes
-    const SvXMLTokenMap& GetFtnConfigAttrTokenMap();
-
     /// set configuration at document; calls ProcessSettings
     /* Move code from <CreateAndInsertLate(..)> to <Finish(..)>, because
        at this time all styles it references have been set. (#i40579#)
diff --git a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx 
b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx
index d02e799200c3..d3f689b90349 100644
--- a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx
+++ b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx
@@ -60,8 +60,7 @@ public:
 
 private:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
     virtual void CreateAndInsert( bool bOverwrite ) override;
diff --git a/xmloff/inc/XMLLineNumberingImportContext.hxx 
b/xmloff/inc/XMLLineNumberingImportContext.hxx
index 4baeb35048a4..fd0f4597f934 100644
--- a/xmloff/inc/XMLLineNumberingImportContext.hxx
+++ b/xmloff/inc/XMLLineNumberingImportContext.hxx
@@ -75,8 +75,7 @@ public:
 
 private:
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 
     virtual void CreateAndInsert(bool bOverwrite) override;
diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx 
b/xmloff/source/chart/XMLChartStyleContext.cxx
index b000a36b2f03..1f8fa14eee27 100644
--- a/xmloff/source/chart/XMLChartStyleContext.cxx
+++ b/xmloff/source/chart/XMLChartStyleContext.cxx
@@ -42,21 +42,19 @@ using ::xmloff::token::XML_CHART_PROPERTIES;
 
 
 void XMLChartStyleContext::SetAttribute(
-    sal_uInt16 nPrefixKey,
-    const OUString& rLocalName,
+    sal_Int32 nElement,
     const OUString& rValue )
 {
-    if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
-    {
-        msDataStyleName =rValue;
-    }
-    else if( IsXMLToken( rLocalName, XML_PERCENTAGE_DATA_STYLE_NAME ) )
-    {
-        msPercentageDataStyleName =rValue;
-    }
-    else
+    switch (nElement & TOKEN_MASK)
     {
-        XMLShapeStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        case XML_DATA_STYLE_NAME:
+            msDataStyleName = rValue;
+            break;
+        case XML_PERCENTAGE_DATA_STYLE_NAME:
+            msPercentageDataStyleName = rValue;
+            break;
+        default:
+            XMLShapeStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx 
b/xmloff/source/draw/XMLShapeStyleContext.cxx
index 5dd1da864f05..1da9e11cf074 100644
--- a/xmloff/source/draw/XMLShapeStyleContext.cxx
+++ b/xmloff/source/draw/XMLShapeStyleContext.cxx
@@ -42,10 +42,7 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::drawing;
-using ::xmloff::token::IsXMLToken;
-using ::xmloff::token::XML_TEXT_PROPERTIES;
-using ::xmloff::token::XML_GRAPHIC_PROPERTIES;
-using ::xmloff::token::XML_PARAGRAPH_PROPERTIES;
+using namespace ::xmloff::token;
 
 
 XMLShapeStyleContext::XMLShapeStyleContext(
@@ -61,22 +58,21 @@ XMLShapeStyleContext::~XMLShapeStyleContext()
 {
 }
 
-void XMLShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const 
OUString& rLocalName, const OUString& rValue )
+void XMLShapeStyleContext::SetAttribute( sal_Int32 nElement, const OUString& 
rValue )
 {
-    if (m_sControlDataStyleName.isEmpty() && 
(::xmloff::token::GetXMLToken(::xmloff::token::XML_DATA_STYLE_NAME) == 
rLocalName))
+    if (m_sControlDataStyleName.isEmpty() && (nElement & TOKEN_MASK) == 
XML_DATA_STYLE_NAME)
     {
         m_sControlDataStyleName = rValue;
     }
-    else if( (XML_NAMESPACE_STYLE == nPrefixKey) && IsXMLToken( rLocalName, 
::xmloff::token::XML_LIST_STYLE_NAME ) )
+    else if( nElement == XML_ELEMENT(STYLE, XML_LIST_STYLE_NAME) )
     {
         m_sListStyleName = rValue;
     }
     else
     {
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        XMLPropStyleContext::SetAttribute( nElement, rValue );
 
-        if( (XML_NAMESPACE_STYLE == nPrefixKey) &&
-            ( IsXMLToken( rLocalName, ::xmloff::token::XML_NAME ) || 
IsXMLToken( rLocalName, ::xmloff::token::XML_DISPLAY_NAME ) ) )
+        if( nElement == XML_ELEMENT(STYLE, XML_NAME) || nElement == 
XML_ELEMENT(STYLE, XML_DISPLAY_NAME) )
         {
             if( !GetName().isEmpty() && !GetDisplayName().isEmpty() && 
GetName() != GetDisplayName() )
             {
diff --git a/xmloff/source/style/PageMasterImportContext.cxx 
b/xmloff/source/style/PageMasterImportContext.cxx
index 7d70190cec89..17d9bf7986da 100644
--- a/xmloff/source/style/PageMasterImportContext.cxx
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -44,18 +44,16 @@ using namespace ::com::sun::star::lang;
 //
 using namespace ::com::sun::star::beans;
 
-void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void PageStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    // TODO: use a map here
-    if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, 
XML_PAGE_USAGE ) )
+    if( nElement == XML_ELEMENT(STYLE, XML_PAGE_USAGE) )
     {
         sPageUsage = rValue;
     }
     else
     {
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        XMLPropStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx 
b/xmloff/source/style/XMLFontStylesContext.cxx
index bdd86c93bd73..db22711e039c 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -95,41 +95,40 @@ XMLFontStyleContextFontFace::XMLFontStyleContextFontFace( 
SvXMLImport& rImport,
     aEnc <<= static_cast<sal_Int16>(rStyles.GetDfltCharset());
 }
 
-void XMLFontStyleContextFontFace::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void XMLFontStyleContextFontFace::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
     SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
-    const SvXMLTokenMap& rTokenMap = GetStyles()->GetFontStyleAttrTokenMap();
     Any aAny;
 
-    switch( rTokenMap.Get( nPrefixKey, rLocalName ) )
+    switch(nElement)
     {
-    case XML_TOK_FONT_STYLE_ATTR_FAMILY:
+    case XML_ELEMENT(SVG, XML_FONT_FAMILY):
+    case XML_ELEMENT(SVG_COMPAT, XML_FONT_FAMILY):
         if( GetStyles()->GetFamilyNameHdl().importXML( rValue, aAny,
                                                           rUnitConv ) )
             aFamilyName = aAny;
         break;
-    case XML_TOK_FONT_STYLE_ATTR_STYLENAME:
+    case XML_ELEMENT(STYLE, XML_FONT_ADORNMENTS):
         aStyleName <<= rValue;
         break;
-    case XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC:
+    case XML_ELEMENT(STYLE, XML_FONT_FAMILY_GENERIC):
         if( GetStyles()->GetFamilyHdl().importXML( rValue, aAny,
                                                       rUnitConv ) )
             aFamily = aAny;
         break;
-    case XML_TOK_FONT_STYLE_ATTR_PITCH:
+    case XML_ELEMENT(STYLE, XML_FONT_PITCH):
         if( GetStyles()->GetPitchHdl().importXML( rValue, aAny,
                                                       rUnitConv ) )
             aPitch = aAny;
         break;
-    case XML_TOK_FONT_STYLE_ATTR_CHARSET:
+    case XML_ELEMENT(STYLE, XML_FONT_CHARSET):
         if( GetStyles()->GetEncodingHdl().importXML( rValue, aAny,
                                                       rUnitConv ) )
             aEnc = aAny;
         break;
     default:
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        SvXMLStyleContext::SetAttribute( nElement, rValue );
         break;
     }
 }
@@ -200,13 +199,13 @@ 
XMLFontStyleContextFontFaceFormat::XMLFontStyleContextFontFaceFormat( SvXMLImpor
 {
 }
 
-void XMLFontStyleContextFontFaceFormat::SetAttribute( sal_uInt16 nPrefixKey, 
const OUString& rLocalName,
+void XMLFontStyleContextFontFaceFormat::SetAttribute( sal_Int32 nElement,
     const OUString& rValue )
 {
-    if( nPrefixKey == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, XML_STRING 
))
+    if( nElement == XML_ELEMENT(SVG, XML_STRING) || nElement == 
XML_ELEMENT(SVG_COMPAT, XML_STRING))
         uri.SetFormat(rValue);
     else
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        SvXMLStyleContext::SetAttribute( nElement, rValue );
 }
 
 
@@ -257,13 +256,13 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLFontStyleContextFon
     return nullptr;
 }
 
-void XMLFontStyleContextFontFaceUri::SetAttribute( sal_uInt16 nPrefixKey, 
const OUString& rLocalName,
+void XMLFontStyleContextFontFaceUri::SetAttribute( sal_Int32 nElement,
     const OUString& rValue )
 {
-    if( nPrefixKey == XML_NAMESPACE_XLINK && IsXMLToken( rLocalName, XML_HREF 
))
+    if( nElement == XML_ELEMENT(XLINK, XML_HREF) )
         linkPath = rValue;
     else
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        SvXMLStyleContext::SetAttribute( nElement, rValue );
 }
 
 void XMLFontStyleContextFontFaceUri::SetFormat( const OUString& rFormat )
diff --git a/xmloff/source/style/XMLFontStylesContext_impl.hxx 
b/xmloff/source/style/XMLFontStylesContext_impl.hxx
index 72f5af7e2347..2c76ecc6955b 100644
--- a/xmloff/source/style/XMLFontStylesContext_impl.hxx
+++ b/xmloff/source/style/XMLFontStylesContext_impl.hxx
@@ -49,7 +49,7 @@ public:
             XMLFontStylesContext& rStyles );
     virtual ~XMLFontStyleContextFontFace() override;
 
-    void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
+    void SetAttribute( sal_Int32 nElement,
                        const OUString& rValue ) override;
 
     void FillProperties( ::std::vector< XMLPropertyState > &rProps,
@@ -98,7 +98,7 @@ public:
     XMLFontStyleContextFontFaceUri( SvXMLImport& rImport,
             const XMLFontStyleContextFontFace& font );
 
-    virtual void SetAttribute( sal_uInt16 nPrefixKey, const OUString& 
rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
         const OUString& rValue ) override;
     void SetFormat( const OUString& rFormat );
     void SAL_CALL endFastElement(sal_Int32 nElement) override;
@@ -116,7 +116,7 @@ public:
     XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport,
             XMLFontStyleContextFontFaceUri& uri );
 
-    void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
+    void SetAttribute( sal_Int32 nElement,
         const OUString& rValue ) override;
 };
 
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 5ed852e98e48..3bf2c8ad8af6 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -54,17 +54,16 @@ using namespace ::com::sun::star::lang;
 using namespace ::xmloff::token;
 using namespace com::sun::star::drawing;
 
-void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void XMLPropStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    if( XML_NAMESPACE_STYLE == nPrefixKey && IsXMLToken( rLocalName, 
XML_FAMILY ) )
+    if( nElement == XML_ELEMENT(STYLE, XML_FAMILY) )
     {
         SAL_WARN_IF( GetFamily() != SvXMLStylesContext::GetFamily( rValue ), 
"xmloff", "unexpected style family" );
     }
     else
     {
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        SvXMLStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 85c967eea110..1910950e9662 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1276,7 +1276,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( 
SvXMLImport& rImport,
     eDateSecs( XML_DEA_NONE ),
     bDateNoDefault( false )
 {
-    SetAttribute(XML_NAMESPACE_STYLE, GetXMLToken(XML_NAME), rName);
+    SetAttribute(XML_ELEMENT(STYLE, XML_NAME), rName);
 }
 
 SvXMLNumFormatContext::~SvXMLNumFormatContext()
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 16eff2be6aff..dae61e273821 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -845,18 +845,16 @@ 
SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAli
     rLLevel.SetLabelFollowedBy( eLabelFollowedBy );
 }
 
-void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                           const OUString& rLocalName,
+void SvxXMLListStyleContext::SetAttribute( sal_Int32 nElement,
                                            const OUString& rValue )
 {
-    if( XML_NAMESPACE_TEXT == nPrefixKey &&
-        IsXMLToken( rLocalName, XML_CONSECUTIVE_NUMBERING ) )
+    if( nElement == XML_ELEMENT(TEXT, XML_CONSECUTIVE_NUMBERING) )
     {
         bConsecutive = IsXMLToken( rValue, XML_TRUE );
     }
     else
     {
-        SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        SvXMLStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index fdaf07f47b4d..264a57282a8e 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -62,47 +62,37 @@ using namespace ::xmloff::token;
 constexpr OUStringLiteral gsParaStyleServiceName( 
u"com.sun.star.style.ParagraphStyle" );
 constexpr OUStringLiteral gsTextStyleServiceName( 
u"com.sun.star.style.CharacterStyle" );
 
-void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                      const OUString& rLocalName,
+void SvXMLStyleContext::SetAttribute( sal_Int32 nElement,
                                       const OUString& rValue )
 {
-    // TODO: use a map here
-    if( XML_NAMESPACE_STYLE == nPrefixKey )
+    switch (nElement)
     {
-        if( IsXMLToken( rLocalName, XML_FAMILY ) )
+        case XML_ELEMENT(STYLE, XML_FAMILY):
         {
             if( IsXMLToken( rValue, XML_PARAGRAPH ) )
                 mnFamily = XmlStyleFamily(SfxStyleFamily::Para);
             else if( IsXMLToken( rValue, XML_TEXT ) )
                 mnFamily = XmlStyleFamily(SfxStyleFamily::Char);
+            break;
         }
-        else if( IsXMLToken( rLocalName, XML_NAME ) )
-        {
+        case XML_ELEMENT(STYLE, XML_NAME):
             maName = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_DISPLAY_NAME ) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_DISPLAY_NAME):
             maDisplayName = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_PARENT_STYLE_NAME ) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_PARENT_STYLE_NAME):
             maParentName = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_NEXT_STYLE_NAME ) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_NEXT_STYLE_NAME):
             maFollow = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_HIDDEN ) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_HIDDEN):
             mbHidden = rValue.toBoolean();
-        }
-    }
-    else if (XML_NAMESPACE_LO_EXT == nPrefixKey)
-    {
-        if (IsXMLToken(rLocalName, XML_HIDDEN))
-        {
+            break;
+        case XML_ELEMENT(LO_EXT, XML_HIDDEN):
             mbHidden = rValue.toBoolean();
-        }
+            break;
     }
 }
 
@@ -127,19 +117,8 @@ void SvXMLStyleContext::startFastElement(
     sal_Int32 /*nElement*/,
     const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    // Fall back from fastparser to slowparser code
     for( auto &it : sax_fastparser::castToFastAttributeList( xAttrList ) )
-    {
-        sal_Int32 nToken = it.getToken();
-        const OUString& rAttrNamespacePrefix = 
SvXMLImport::getNamespacePrefixFromToken(nToken, 
&GetImport().GetNamespaceMap());
-        OUString sAttrName = SvXMLImport::getNameFromToken( nToken );
-        if ( !rAttrNamespacePrefix.isEmpty() )
-            sAttrName = rAttrNamespacePrefix + 
SvXMLImport::aNamespaceSeparator + sAttrName;
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( 
sAttrName, &aLocalName );
-
-        SetAttribute( nPrefix, aLocalName, it.toString() );
-    }
+        SetAttribute( it.getToken(), it.toString() );
 }
 
 void SvXMLStyleContext::SetDefaults()
diff --git a/xmloff/source/table/XMLTableImport.cxx 
b/xmloff/source/table/XMLTableImport.cxx
index a03fa8445524..6d8b30f474ce 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -169,8 +169,7 @@ public:
 
     virtual void CreateAndInsert( bool bOverwrite ) override;
 protected:
-    virtual void SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+    virtual void SetAttribute( sal_Int32 nElement,
                                const OUString& rValue ) override;
 private:
     XMLTableTemplate maTableTemplate;
@@ -732,13 +731,12 @@ XMLTableTemplateContext::XMLTableTemplateContext( 
SvXMLImport& rImport )
 {
 }
 
-void XMLTableTemplateContext::SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+void XMLTableTemplateContext::SetAttribute( sal_Int32 nElement,
                                const OUString& rValue )
 {
-    if( (nPrefixKey == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, 
XML_STYLE_NAME ))
+    if( nElement == XML_ELEMENT(TEXT, XML_STYLE_NAME)
         // Writer specific: according to oasis odf 1.2 prefix should be 
"table" and element name should be "name"
-        || (nPrefixKey == XML_NAMESPACE_TABLE && IsXMLToken( rLocalName, 
XML_NAME )))
+        || nElement == XML_ELEMENT(TABLE, XML_NAME) )
     {
         msTemplateStyleName = rValue;
     }
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx 
b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index d4415ff29c04..a7d4b93349d5 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -190,17 +190,6 @@ const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
     XML_TOKEN_MAP_END
 };
 
-const SvXMLTokenMap&
-    XMLFootnoteConfigurationImportContext::GetFtnConfigAttrTokenMap()
-{
-    if (!pAttrTokenMap)
-    {
-        pAttrTokenMap.reset( new SvXMLTokenMap(aTextFieldAttrTokenMap) );
-    }
-
-    return *pAttrTokenMap;
-}
-
 SvXMLEnumMapEntry<sal_Int16> const aFootnoteNumberingMap[] =
 {
     { XML_PAGE,             FootnoteNumbering::PER_PAGE },
@@ -209,25 +198,25 @@ SvXMLEnumMapEntry<sal_Int16> const 
aFootnoteNumberingMap[] =
     { XML_TOKEN_INVALID,    0 },
 };
 
-void XMLFootnoteConfigurationImportContext::SetAttribute( sal_uInt16 
nPrefixKey,
-                               const OUString& rLocalName,
+void XMLFootnoteConfigurationImportContext::SetAttribute( sal_Int32 nElement,
                                const OUString& rValue )
 {
-    switch (GetFtnConfigAttrTokenMap().Get(nPrefixKey, rLocalName))
+    switch (nElement)
     {
-        case XML_TOK_FTNCONFIG_CITATION_STYLENAME:
+        case XML_ELEMENT(TEXT, XML_CITATION_STYLE_NAME):
             sCitationStyle = rValue;
             break;
-        case XML_TOK_FTNCONFIG_ANCHOR_STYLENAME:
+        case XML_ELEMENT(TEXT, XML_CITATION_BODY_STYLE_NAME):
             sAnchorStyle = rValue;
             break;
-        case XML_TOK_FTNCONFIG_DEFAULT_STYLENAME:
+        case XML_ELEMENT(TEXT, XML_DEFAULT_STYLE_NAME):
             sDefaultStyle = rValue;
             break;
-        case XML_TOK_FTNCONFIG_PAGE_STYLENAME:
+        case XML_ELEMENT(TEXT, XML_MASTER_PAGE_NAME):
             sPageStyle = rValue;
             break;
-        case XML_TOK_FTNCONFIG_OFFSET:
+        case XML_ELEMENT(TEXT, XML_START_VALUE):
+        case XML_ELEMENT(TEXT, XML_OFFSET): // for backwards compatibility 
with SRC630 & earlier
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber(nTmp, rValue))
@@ -236,25 +225,27 @@ void XMLFootnoteConfigurationImportContext::SetAttribute( 
sal_uInt16 nPrefixKey,
             }
             break;
         }
-        case XML_TOK_FTNCONFIG_NUM_PREFIX:
+        case XML_ELEMENT(STYLE, XML_NUM_PREFIX):
+        case XML_ELEMENT(TEXT, XML_NUM_PREFIX): // for backwards compatibility 
with SRC630 & earlier
             sPrefix = rValue;
             break;
-        case XML_TOK_FTNCONFIG_NUM_SUFFIX:
+        case XML_ELEMENT(STYLE, XML_NUM_SUFFIX):
+        case XML_ELEMENT(TEXT, XML_NUM_SUFFIX): // for backwards compatibility 
with SRC630 & earlier
             sSuffix = rValue;
             break;
-        case XML_TOK_FTNCONFIG_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumFormat = rValue;
             break;
-        case XML_TOK_FTNCONFIG_NUM_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sNumSync = rValue;
             break;
-        case XML_TOK_FTNCONFIG_START_AT:
+        case XML_ELEMENT(TEXT, XML_START_NUMBERING_AT):
         {
             (void)SvXMLUnitConverter::convertEnum(nNumbering, rValue,
                                                   aFootnoteNumberingMap);
             break;
         }
-        case XML_TOK_FTNCONFIG_POSITION:
+        case XML_ELEMENT(TEXT, XML_FOOTNOTES_POSITION):
             bPosition = IsXMLToken( rValue, XML_DOCUMENT );
             break;
         default:
diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx 
b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
index 6b1b7e5d37bf..759c786f8aa8 100644
--- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
+++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx
@@ -73,62 +73,50 @@ 
XMLIndexBibliographyConfigurationContext::~XMLIndexBibliographyConfigurationCont
 }
 
 void XMLIndexBibliographyConfigurationContext::SetAttribute(
-    sal_uInt16 nPrefix,
-    const OUString& sLocalName,
+    sal_Int32 nElement,
     const OUString& sValue)
 {
-    if( XML_NAMESPACE_TEXT == nPrefix )
+    switch (nElement)
     {
-        if( IsXMLToken(sLocalName, XML_PREFIX) )
-        {
+        case XML_ELEMENT(TEXT, XML_PREFIX):
             sPrefix = sValue;
-        }
-        else if( IsXMLToken(sLocalName, XML_SUFFIX) )
-        {
+            break;
+        case XML_ELEMENT(TEXT, XML_SUFFIX):
             sSuffix = sValue;
-        }
-        else if( IsXMLToken(sLocalName, XML_NUMBERED_ENTRIES) )
+            break;
+        case XML_ELEMENT(TEXT, XML_NUMBERED_ENTRIES):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sValue))
             {
                 bNumberedEntries = bTmp;
             }
+            break;
         }
-        else if( IsXMLToken(sLocalName, XML_SORT_BY_POSITION) )
+        case XML_ELEMENT(TEXT, XML_SORT_BY_POSITION):
         {
             bool bTmp(false);
             if (::sax::Converter::convertBool(bTmp, sValue))
             {
                 bSortByPosition = bTmp;
             }
+            break;
         }
-        else if( IsXMLToken(sLocalName, XML_SORT_ALGORITHM) )
-        {
+        case XML_ELEMENT(TEXT, XML_SORT_ALGORITHM):
             sAlgorithm = sValue;
-        }
-    }
-    else if( XML_NAMESPACE_FO == nPrefix )
-    {
-        if( IsXMLToken(sLocalName, XML_LANGUAGE) )
-        {
+            break;
+        case XML_ELEMENT(FO, XML_LANGUAGE):
             maLanguageTagODF.maLanguage = sValue;
-        }
-        else if( IsXMLToken(sLocalName, XML_SCRIPT) )
-        {
+            break;
+        case XML_ELEMENT(FO, XML_SCRIPT):
             maLanguageTagODF.maScript = sValue;
-        }
-        else if( IsXMLToken(sLocalName, XML_COUNTRY) )
-        {
+            break;
+        case XML_ELEMENT(FO, XML_COUNTRY):
             maLanguageTagODF.maCountry = sValue;
-        }
-    }
-    else if( XML_NAMESPACE_STYLE == nPrefix )
-    {
-        if( IsXMLToken(sLocalName, XML_RFC_LANGUAGE_TAG) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_RFC_LANGUAGE_TAG):
             maLanguageTagODF.maRfcLanguageTag = sValue;
-        }
+            break;
     }
 }
 
diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx 
b/xmloff/source/text/XMLLineNumberingImportContext.cxx
index fde276850f9c..ad0f162013c0 100644
--- a/xmloff/source/text/XMLLineNumberingImportContext.cxx
+++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx
@@ -76,79 +76,47 @@ 
XMLLineNumberingImportContext::~XMLLineNumberingImportContext()
 {
 }
 
-void XMLLineNumberingImportContext::SetAttribute( sal_uInt16 nPrefixKey,
-                               const OUString& rLocalName,
+void XMLLineNumberingImportContext::SetAttribute( sal_Int32 nElement,
                                const OUString& rValue )
 {
-    static const SvXMLTokenMapEntry aLineNumberingTokenMap[] =
-    {
-        { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_LINENUMBERING_STYLE_NAME 
},
-        { XML_NAMESPACE_TEXT, XML_NUMBER_LINES,
-              XML_TOK_LINENUMBERING_NUMBER_LINES },
-        { XML_NAMESPACE_TEXT, XML_COUNT_EMPTY_LINES,
-              XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES },
-        { XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES,
-              XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES },
-        { XML_NAMESPACE_TEXT, XML_RESTART_ON_PAGE,
-              XML_TOK_LINENUMBERING_RESTART_NUMBERING },
-        { XML_NAMESPACE_TEXT, XML_OFFSET, XML_TOK_LINENUMBERING_OFFSET },
-        { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, 
XML_TOK_LINENUMBERING_NUM_FORMAT },
-        { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
-              XML_TOK_LINENUMBERING_NUM_LETTER_SYNC },
-        { XML_NAMESPACE_TEXT, XML_NUMBER_POSITION,
-              XML_TOK_LINENUMBERING_NUMBER_POSITION },
-        { XML_NAMESPACE_TEXT, XML_INCREMENT, XML_TOK_LINENUMBERING_INCREMENT },
-    //  { XML_NAMESPACE_TEXT, XML_LINENUMBERING_CONFIGURATION,
-    //        XML_TOK_LINENUMBERING_LINENUMBERING_CONFIGURATION },
-    //  { XML_NAMESPACE_TEXT, XML_INCREMENT, XML_TOK_LINENUMBERING_INCREMENT },
-    //  { XML_NAMESPACE_TEXT, XML_LINENUMBERING_SEPARATOR,
-    //        XML_TOK_LINENUMBERING_LINENUMBERING_SEPARATOR },
-
-        XML_TOKEN_MAP_END
-    };
-
-    static const SvXMLTokenMap aTokenMap(aLineNumberingTokenMap);
-
-    auto eToken = aTokenMap.Get(nPrefixKey, rLocalName);
-
     bool bTmp(false);
     sal_Int32 nTmp;
 
-    switch (eToken)
+    switch (nElement)
     {
-        case XML_TOK_LINENUMBERING_STYLE_NAME:
+        case XML_ELEMENT(TEXT, XML_STYLE_NAME):
             sStyleName = rValue;
             break;
 
-        case XML_TOK_LINENUMBERING_NUMBER_LINES:
+        case XML_ELEMENT(TEXT, XML_NUMBER_LINES):
             if (::sax::Converter::convertBool(bTmp, rValue))
             {
                 bNumberLines = bTmp;
             }
             break;
 
-        case XML_TOK_LINENUMBERING_COUNT_EMPTY_LINES:
+        case XML_ELEMENT(TEXT, XML_COUNT_EMPTY_LINES):
             if (::sax::Converter::convertBool(bTmp, rValue))
             {
                 bCountEmptyLines = bTmp;
             }
             break;
 
-        case XML_TOK_LINENUMBERING_COUNT_IN_TEXT_BOXES:
+        case XML_ELEMENT(TEXT, XML_COUNT_IN_TEXT_BOXES):
             if (::sax::Converter::convertBool(bTmp, rValue))
             {
                 bCountInFloatingFrames = bTmp;
             }
             break;
 
-        case XML_TOK_LINENUMBERING_RESTART_NUMBERING:
+        case XML_ELEMENT(TEXT, XML_RESTART_ON_PAGE):
             if (::sax::Converter::convertBool(bTmp, rValue))
             {
                 bRestartNumbering = bTmp;
             }
             break;
 
-        case XML_TOK_LINENUMBERING_OFFSET:
+        case XML_ELEMENT(TEXT, XML_OFFSET):
             if (GetImport().GetMM100UnitConverter().
                     convertMeasureToCore(nTmp, rValue))
             {
@@ -156,15 +124,15 @@ void XMLLineNumberingImportContext::SetAttribute( 
sal_uInt16 nPrefixKey,
             }
             break;
 
-        case XML_TOK_LINENUMBERING_NUM_FORMAT:
+        case XML_ELEMENT(STYLE, XML_NUM_FORMAT):
             sNumFormat = rValue;
             break;
 
-        case XML_TOK_LINENUMBERING_NUM_LETTER_SYNC:
+        case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             sNumLetterSync = rValue;
             break;
 
-        case XML_TOK_LINENUMBERING_NUMBER_POSITION:
+        case XML_ELEMENT(TEXT, XML_NUMBER_POSITION):
         {
             static const SvXMLEnumMapEntry<sal_Int16> aLineNumberPositionMap[] 
=
             {
@@ -180,7 +148,7 @@ void XMLLineNumberingImportContext::SetAttribute( 
sal_uInt16 nPrefixKey,
             break;
         }
 
-        case XML_TOK_LINENUMBERING_INCREMENT:
+        case XML_ELEMENT(TEXT, XML_INCREMENT):
             if (::sax::Converter::convertNumber(nTmp, rValue, 0))
             {
                 nIncrement = static_cast<sal_Int16>(nTmp);
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx 
b/xmloff/source/text/XMLTextShapeStyleContext.cxx
index 27accc1ed1c2..70736d80d6c9 100644
--- a/xmloff/source/text/XMLTextShapeStyleContext.cxx
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -117,19 +117,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLTextShapePropertySe
                         nElement, xAttrList, rProperties, rProp );
 }
 
-void XMLTextShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void XMLTextShapeStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    if( XML_NAMESPACE_STYLE == nPrefixKey &&
-        IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
+    if( nElement == XML_ELEMENT(STYLE, XML_AUTO_UPDATE) )
     {
           if( IsXMLToken( rValue, XML_TRUE ) )
             bAutoUpdate = true;
     }
     else
     {
-        XMLShapeStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        XMLShapeStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 350c0e584830..e765f53417f2 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -74,38 +74,37 @@ const SvXMLEnumMapEntry<sal_uInt16> aCategoryMap[] =
     { XML_TOKEN_INVALID, 0 }
 };
 
-void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
-                                        const OUString& rLocalName,
+void XMLTextStyleContext::SetAttribute( sal_Int32 nElement,
                                         const OUString& rValue )
 {
-    if( XML_NAMESPACE_STYLE == nPrefixKey )
+    switch (nElement)
     {
-        // TODO: use a map here
-        if( IsXMLToken( rLocalName, XML_AUTO_UPDATE ) )
+        case XML_ELEMENT(STYLE, XML_AUTO_UPDATE):
         {
             if( IsXMLToken( rValue, XML_TRUE ) )
                 m_isAutoUpdate = true;
+            break;
         }
-        else if( IsXMLToken( rLocalName, XML_LIST_STYLE_NAME ) )
+        case XML_ELEMENT(STYLE, XML_LIST_STYLE_NAME):
         {
             m_sListStyleName = rValue;
             // Inherited paragraph style lost information about unset 
numbering (#i69523#)
             m_bListStyleSet = true;
+            break;
         }
-        else if( IsXMLToken( rLocalName, XML_MASTER_PAGE_NAME ) )
+        case XML_ELEMENT(STYLE, XML_MASTER_PAGE_NAME):
         {
             m_sMasterPageName = rValue;
             m_bHasMasterPageName = true;
+            break;
         }
-        else if( IsXMLToken( rLocalName, XML_DATA_STYLE_NAME ) )
-        {
+        case XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME):
             m_sDataStyleName = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_CLASS ) )
-        {
+            break;
+        case XML_ELEMENT(STYLE, XML_CLASS):
             m_sCategoryVal = rValue;
-        }
-        else if( IsXMLToken( rLocalName, XML_DEFAULT_OUTLINE_LEVEL ) )
+            break;
+        case XML_ELEMENT(STYLE, XML_DEFAULT_OUTLINE_LEVEL):
         {
             sal_Int32 nTmp;
             if (::sax::Converter::convertNumber( nTmp, rValue ) &&
@@ -113,15 +112,10 @@ void XMLTextStyleContext::SetAttribute( sal_uInt16 
nPrefixKey,
             {
                 m_nOutlineLevel = static_cast<sal_Int8>(nTmp);
             }
+            break;
         }
-        else
-        {
-            XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue 
);
-        }
-    }
-    else
-    {
-        XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+        default:
+            XMLPropStyleContext::SetAttribute( nElement, rValue );
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to