[Libreoffice-commits] core.git: 2 commits - include/sax sc/source

Mohammed Abdul Azeem azeemmysore at gmail.com
Tue Aug 8 05:18:35 UTC 2017


 include/sax/fastattribs.hxx                            |    5 
 sc/source/filter/xml/XMLCalculationSettingsContext.cxx |    4 
 sc/source/filter/xml/XMLDDELinksContext.cxx            |    2 
 sc/source/filter/xml/XMLTrackedChangesContext.cxx      |    2 
 sc/source/filter/xml/xmlcelli.cxx                      |    4 
 sc/source/filter/xml/xmldpimp.cxx                      |    6 
 sc/source/filter/xml/xmlexternaltabi.cxx               |    2 
 sc/source/filter/xml/xmlfilti.cxx                      |  366 +++++++----------
 sc/source/filter/xml/xmlfilti.hxx                      |   93 +---
 sc/source/filter/xml/xmlsorti.cxx                      |   73 +--
 sc/source/filter/xml/xmlsorti.hxx                      |   16 
 11 files changed, 241 insertions(+), 332 deletions(-)

New commits:
commit 855af7f3260705faf7c33be36efc1610354336f0
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Sun Aug 6 16:40:55 2017 +0530

    Avoiding unnecessary memory allocation:
    
    Added a method to directly convert fast attribute values
    to double.
    
    Change-Id: Ia0c415530d6d7c7f767a2e0c88983429bc966210
    Reviewed-on: https://gerrit.libreoffice.org/40846
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 9c1db656e36c..8b669fe26a17 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -150,6 +150,11 @@ public:
             assert(mnIdx < mrList.maAttributeTokens.size());
             return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
         }
+        double toDouble() const
+        {
+            assert(mnIdx < mrList.maAttributeTokens.size());
+            return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
+        }
         OUString toString() const
         {
             assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 0617d2654b14..81fc1744ab4c 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -200,9 +200,7 @@ ScXMLIterationContext::ScXMLIterationContext( ScXMLImport& rImport,
                 pCalcSet->SetIterationCount(aIter.toInt32());
                 break;
             case XML_ELEMENT( TABLE, XML_MAXIMUM_DIFFERENCE ):
-                double fDif;
-                ::sax::Converter::convertDouble(fDif, aIter.toString());
-                pCalcSet->SetIterationEpsilon(fDif);
+                pCalcSet->SetIterationEpsilon( aIter.toDouble() );
                 break;
             }
         }
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 59b9fbb5df66..faaab9888728 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -370,7 +370,7 @@ ScXMLDDECellContext::ScXMLDDECellContext( ScXMLImport& rImport,
                     bString2 = true;
                 break;
                 case XML_ELEMENT( OFFICE, XML_VALUE ):
-                    ::sax::Converter::convertDouble(fValue, aIter.toString());
+                    fValue = aIter.toDouble();
                     bEmpty = false;
                     bString2 = false;
                 break;
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 1657ea40687f..ff843fa7df51 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -887,7 +887,7 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
                 }
                 break;
             case XML_ELEMENT( OFFICE, XML_VALUE ):
-                ::sax::Converter::convertDouble(fValue, aIter.toString());
+                fValue = aIter.toDouble();
                 bEmpty = false;
                 break;
             case XML_ELEMENT( OFFICE, XML_DATE_VALUE ):
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 043190f41bbf..c3edfdbeac03 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -211,7 +211,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                 {
                     if (!it.isEmpty())
                     {
-                        ::sax::Converter::convertDouble(fValue, it.toString());
+                        fValue = it.toDouble();
                         bIsEmpty = false;
 
                         //if office:value="0", let's get the text:p in case this is
@@ -259,7 +259,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                         else if ( IsXMLToken( it, XML_FALSE ) )
                             fValue = 0.0;
                         else
-                            ::sax::Converter::convertDouble(fValue, it.toString() );
+                            fValue = it.toDouble();
                         bIsEmpty = false;
                     }
                 }
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 27dfb894a7dd..9f431889385c 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -1504,7 +1504,7 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport,
                         bAutoStart = true;
                     else
                     {
-                        ::sax::Converter::convertDouble(fStart, aIter.toString());
+                        fStart = aIter.toDouble();
                         bAutoStart = false;
                     }
                 }
@@ -1515,14 +1515,14 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport,
                         bAutoEnd = true;
                     else
                     {
-                        ::sax::Converter::convertDouble(fEnd, aIter.toString());
+                        fEnd = aIter.toDouble();
                         bAutoEnd = false;
                     }
                 }
                 break;
                 case XML_STEP :
                 {
-                    ::sax::Converter::convertDouble(fStep, aIter.toString());
+                    fStep = aIter.toDouble();
                 }
                 break;
                 case XML_GROUPED_BY :
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 1b0f1775eb0a..70fc010667f2 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -278,7 +278,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
                 {
                     if ( !it.isEmpty() )
                     {
-                        ::sax::Converter::convertDouble( mfCellValue, it.toString() );
+                        mfCellValue = it.toDouble();
                         mbIsNumeric = true;
                         mbIsEmpty = false;
                     }
commit 5b25fec2159e1e5207141bc4268170aec3ac6c7d
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Sat Aug 5 22:47:00 2017 +0530

    Moving legacy contexts to FastContexts:
    
    ScXMLAndContext
    ScXMLOrContext
    ScXMLConditionContext
    ScXMLSetItemContext
    ScXMLDPAndContext
    ScXMLDPOrContext
    ScXMLDPConditionContext
    ScXMLSortByContext
    
    Change-Id: I559ae11ade78a262f6890875d8972d0c2eb4480f
    Reviewed-on: https://gerrit.libreoffice.org/40791
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/xml/xmlfilti.cxx b/sc/source/filter/xml/xmlfilti.cxx
index 944b64834a3d..b3c6349a8c9b 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -100,37 +100,35 @@ ScXMLFilterContext::~ScXMLFilterContext()
 {
 }
 
-SvXMLImportContext *ScXMLFilterContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLFilterContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_AND:
+        case XML_ELEMENT( TABLE, XML_FILTER_AND ):
         {
             pContext = new ScXMLAndContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, this);
+                GetScImport(), nElement, xAttrList, mrQueryParam, this);
         }
         break;
-        case XML_TOK_FILTER_OR:
+        case XML_ELEMENT( TABLE, XML_FILTER_OR ):
         {
             pContext = new ScXMLOrContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, this);
+                GetScImport(), nElement, xAttrList, mrQueryParam, this);
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
             pContext = new ScXMLConditionContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, this);
+                GetScImport(), nElement, xAttrList, mrQueryParam, this);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
@@ -194,12 +192,11 @@ bool ScXMLFilterContext::GetConnection()
 }
 
 ScXMLAndContext::ScXMLAndContext( ScXMLImport& rImport,
-                                  sal_uInt16 nPrfx,
-                                  const OUString& rLName,
-                                  const Reference<XAttributeList>& /* xAttrList */,
+                                  sal_Int32 /*nElement*/,
+                                  const uno::Reference<xml::sax::XFastAttributeList>& /* xAttrList */,
                                   ScQueryParam& rParam,
                                   ScXMLFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mrQueryParam(rParam),
     pFilterContext(pTempFilterContext)
 {
@@ -210,46 +207,43 @@ ScXMLAndContext::~ScXMLAndContext()
 {
 }
 
-SvXMLImportContext *ScXMLAndContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLAndContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_OR:
+        case XML_ELEMENT( TABLE, XML_FILTER_OR ):
         {
             // not supported in StarOffice
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
             pContext = new ScXMLConditionContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, pFilterContext);
+                GetScImport(), nElement, xAttrList, mrQueryParam, pFilterContext);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLAndContext::EndElement()
+void SAL_CALL ScXMLAndContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     pFilterContext->CloseConnection();
 }
 
 ScXMLOrContext::ScXMLOrContext( ScXMLImport& rImport,
-                                sal_uInt16 nPrfx,
-                                const OUString& rLName,
-                                const Reference<css::xml::sax::XAttributeList>& /* xAttrList */,
+                                sal_Int32 /*nElement*/,
+                                const Reference<css::xml::sax::XFastAttributeList>& /* xAttrList */,
                                 ScQueryParam& rParam,
                                 ScXMLFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mrQueryParam(rParam),
     pFilterContext(pTempFilterContext)
 {
@@ -260,46 +254,44 @@ ScXMLOrContext::~ScXMLOrContext()
 {
 }
 
-SvXMLImportContext *ScXMLOrContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLOrContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_AND:
+        case XML_ELEMENT( TABLE, XML_FILTER_AND ):
         {
             pContext = new ScXMLAndContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, pFilterContext);
+                GetScImport(), nElement, xAttrList, mrQueryParam, pFilterContext);
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
             pContext = new ScXMLConditionContext(
-                GetScImport(), nPrefix, rLName, xAttrList, mrQueryParam, pFilterContext);
+                GetScImport(), nElement, xAttrList, mrQueryParam, pFilterContext);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLOrContext::EndElement()
+void SAL_CALL ScXMLOrContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     pFilterContext->CloseConnection();
 }
 
 ScXMLConditionContext::ScXMLConditionContext(
-    ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
-    const Reference<XAttributeList>& xAttrList,
+    ScXMLImport& rImport, sal_Int32 /*nElement*/,
+    const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
     ScQueryParam& rParam,
     ScXMLFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     mrQueryParam(rParam),
     pFilterContext(pTempFilterContext),
     nField(0),
@@ -307,43 +299,41 @@ ScXMLConditionContext::ScXMLConditionContext(
 {
     sDataType = GetXMLToken(XML_TEXT);
 
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetFilterConditionAttrTokenMap());
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix = GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName );
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_CONDITION_ATTR_FIELD_NUMBER :
-            {
-                nField = sValue.toInt32();
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_CASE_SENSITIVE :
-            {
-                bIsCaseSensitive = IsXMLToken(sValue, XML_TRUE);
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_DATA_TYPE :
-            {
-                sDataType = sValue;
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_VALUE :
-            {
-                sConditionValue = sValue;
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_OPERATOR :
+            switch (aIter.getToken())
             {
-                sOperator = sValue;
+                case XML_ELEMENT( TABLE, XML_FIELD_NUMBER ):
+                {
+                    nField = aIter.toInt32();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+                {
+                    bIsCaseSensitive = IsXMLToken(aIter, XML_TRUE);
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_DATA_TYPE ):
+                {
+                    sDataType = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_VALUE ):
+                {
+                    sConditionValue = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_OPERATOR ):
+                {
+                    sOperator = aIter.toString();
+                }
+                break;
             }
-            break;
         }
     }
 }
@@ -352,25 +342,23 @@ ScXMLConditionContext::~ScXMLConditionContext()
 {
 }
 
-SvXMLImportContext *ScXMLConditionContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const Reference<XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLConditionContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext = nullptr;
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterConditionElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_CONDITION_FILTER_SET_ITEM:
+        case XML_ELEMENT( TABLE, XML_FILTER_SET_ITEM ):
         {
             pContext = new ScXMLSetItemContext(
-                GetScImport(), nPrefix, rLName, xAttrList, *this);
+                GetScImport(), nElement, xAttrList, *this);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
@@ -432,7 +420,7 @@ void ScXMLConditionContext::AddSetItem(const ScQueryEntry::Item& rItem)
     maQueryItems.push_back(rItem);
 }
 
-void ScXMLConditionContext::EndElement()
+void SAL_CALL ScXMLConditionContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     ScQueryEntry& rEntry = mrQueryParam.AppendEntry();
 
@@ -466,52 +454,38 @@ void ScXMLConditionContext::EndElement()
 }
 
 ScXMLSetItemContext::ScXMLSetItemContext(
-    ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
-    const Reference<XAttributeList>& xAttrList, ScXMLConditionContext& rParent) :
-    ScXMLImportContext(rImport, nPrfx, rLName)
+    ScXMLImport& rImport, sal_Int32 /*nElement*/,
+    const Reference<xml::sax::XFastAttributeList>& xAttrList, ScXMLConditionContext& rParent) :
+    ScXMLImportContext(rImport)
 {
-    sal_Int32 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetFilterSetItemAttrTokenMap();
-    for (sal_Int32 i = 0; i < nAttrCount; ++i)
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName = xAttrList->getNameByIndex(i);
-        OUString aLocalName;
-        sal_uInt16 nPrefix =
-            GetScImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
-
-        const OUString& sValue = xAttrList->getValueByIndex(i);
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch (rAttrTokenMap.Get(nPrefix, aLocalName))
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_FILTER_SET_ITEM_ATTR_VALUE:
+            switch (aIter.getToken())
             {
-                svl::SharedStringPool& rPool = GetScImport().GetDocument()->GetSharedStringPool();
-                ScQueryEntry::Item aItem;
-                aItem.maString = rPool.intern(sValue);
-                aItem.meType = ScQueryEntry::ByString;
-                aItem.mfVal = 0.0;
-                rParent.AddSetItem(aItem);
+                case XML_ELEMENT( TABLE, XML_VALUE ):
+                {
+                    svl::SharedStringPool& rPool = GetScImport().GetDocument()->GetSharedStringPool();
+                    ScQueryEntry::Item aItem;
+                    aItem.maString = rPool.intern(aIter.toString());
+                    aItem.meType = ScQueryEntry::ByString;
+                    aItem.mfVal = 0.0;
+                    rParent.AddSetItem(aItem);
+                }
+                break;
             }
-            break;
         }
     }
 }
 
-SvXMLImportContext* ScXMLSetItemContext::CreateChildContext(
-    sal_uInt16 nPrefix, const OUString& rLName,
-    const Reference<XAttributeList>& /*xAttrList*/ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
 ScXMLSetItemContext::~ScXMLSetItemContext()
 {
 }
 
-void ScXMLSetItemContext::EndElement()
-{
-}
-
 ScXMLDPFilterContext::ScXMLDPFilterContext( ScXMLImport& rImport,
                                       sal_Int32 /*nElement*/,
                                       const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
@@ -576,37 +550,32 @@ ScXMLDPFilterContext::~ScXMLDPFilterContext()
 {
 }
 
-SvXMLImportContext *ScXMLDPFilterContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDPFilterContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_AND:
+        case XML_ELEMENT( TABLE, XML_FILTER_AND ):
         {
-            pContext = new ScXMLDPAndContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLDPAndContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_FILTER_OR:
+        case XML_ELEMENT( TABLE, XML_FILTER_OR ):
         {
-            pContext = new ScXMLDPOrContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLDPOrContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
-            pContext = new ScXMLDPConditionContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLDPConditionContext( GetScImport(), nElement, xAttrList, this);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
@@ -634,11 +603,10 @@ void ScXMLDPFilterContext::AddFilterField (const ScQueryEntry& aFilterField)
 }
 
 ScXMLDPAndContext::ScXMLDPAndContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& /* xAttrList */,
                                       ScXMLDPFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName )
+    ScXMLImportContext( rImport )
 {
     pFilterContext = pTempFilterContext;
     pFilterContext->OpenConnection(false);
@@ -648,45 +616,41 @@ ScXMLDPAndContext::~ScXMLDPAndContext()
 {
 }
 
-SvXMLImportContext *ScXMLDPAndContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDPAndContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_OR:
+        case XML_ELEMENT( TABLE, XML_FILTER_OR ):
         {
             // not supported in StarOffice
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
-            pContext = new ScXMLDPConditionContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pFilterContext);
+            pContext = new ScXMLDPConditionContext( GetScImport(), nElement, xAttrList, pFilterContext);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLDPAndContext::EndElement()
+void SAL_CALL ScXMLDPAndContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     pFilterContext->CloseConnection();
 }
 
 ScXMLDPOrContext::ScXMLDPOrContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& /* xAttrList */,
                                       ScXMLDPFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pFilterContext(pTempFilterContext)
 {
     pFilterContext->OpenConnection(true);
@@ -696,89 +660,82 @@ ScXMLDPOrContext::~ScXMLDPOrContext()
 {
 }
 
-SvXMLImportContext *ScXMLDPOrContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDPOrContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetFilterElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_FILTER_AND:
+        case XML_ELEMENT( TABLE, XML_FILTER_AND ):
         {
-            pContext = new ScXMLDPAndContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pFilterContext);
+            pContext = new ScXMLDPAndContext( GetScImport(), nElement, xAttrList, pFilterContext);
         }
         break;
-        case XML_TOK_FILTER_CONDITION:
+        case XML_ELEMENT( TABLE, XML_FILTER_CONDITION ):
         {
-            pContext = new ScXMLDPConditionContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, pFilterContext);
+            pContext = new ScXMLDPConditionContext( GetScImport(), nElement, xAttrList, pFilterContext);
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
 
-void ScXMLDPOrContext::EndElement()
+void SAL_CALL ScXMLDPOrContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     pFilterContext->CloseConnection();
 }
 
 ScXMLDPConditionContext::ScXMLDPConditionContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLDPFilterContext* pTempFilterContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pFilterContext(pTempFilterContext),
     sDataType(GetXMLToken(XML_TEXT)),
     nField(0),
     bIsCaseSensitive(false)
 {
 
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetFilterConditionAttrTokenMap());
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName ));
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_CONDITION_ATTR_FIELD_NUMBER :
-            {
-                nField = sValue.toInt32();
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_CASE_SENSITIVE :
-            {
-                bIsCaseSensitive = IsXMLToken(sValue, XML_TRUE);
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_DATA_TYPE :
-            {
-                sDataType = sValue;
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_VALUE :
-            {
-                sConditionValue = sValue;
-            }
-            break;
-            case XML_TOK_CONDITION_ATTR_OPERATOR :
+            switch (aIter.getToken())
             {
-                sOperator = sValue;
+                case XML_ELEMENT( TABLE, XML_FIELD_NUMBER ):
+                {
+                    nField = aIter.toInt32();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_CASE_SENSITIVE ):
+                {
+                    bIsCaseSensitive = IsXMLToken(aIter, XML_TRUE);
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_DATA_TYPE ):
+                {
+                    sDataType = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_VALUE ):
+                {
+                    sConditionValue = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_OPERATOR ):
+                {
+                    sOperator = aIter.toString();
+                }
+                break;
             }
-            break;
         }
     }
 }
@@ -787,13 +744,6 @@ ScXMLDPConditionContext::~ScXMLDPConditionContext()
 {
 }
 
-SvXMLImportContext *ScXMLDPConditionContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
 void ScXMLDPConditionContext::getOperatorXML(
     const OUString& sTempOperator, ScQueryOp& aFilterOperator, utl::SearchParam::SearchType& rSearchType)
 {
@@ -830,7 +780,7 @@ void ScXMLDPConditionContext::getOperatorXML(
         aFilterOperator = SC_TOPVAL;
 }
 
-void ScXMLDPConditionContext::EndElement()
+void SAL_CALL ScXMLDPConditionContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     ScQueryEntry aFilterField;
     if (pFilterContext->GetConnection())
diff --git a/sc/source/filter/xml/xmlfilti.hxx b/sc/source/filter/xml/xmlfilti.hxx
index 8767d4957091..224a2f5c2da5 100644
--- a/sc/source/filter/xml/xmlfilti.hxx
+++ b/sc/source/filter/xml/xmlfilti.hxx
@@ -62,9 +62,8 @@ public:
 
     virtual ~ScXMLFilterContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
     virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
@@ -80,19 +79,17 @@ class ScXMLAndContext : public ScXMLImportContext
 
 public:
 
-    ScXMLAndContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                     const OUString& rLName,
-                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLAndContext( ScXMLImport& rImport, sal_Int32 nElement,
+                     const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                      ScQueryParam& rParam,
                      ScXMLFilterContext* pTempFilterContext);
 
     virtual ~ScXMLAndContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLOrContext : public ScXMLImportContext
@@ -102,19 +99,17 @@ class ScXMLOrContext : public ScXMLImportContext
 
 public:
 
-    ScXMLOrContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                    const OUString& rLName,
-                    const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLOrContext( ScXMLImport& rImport, sal_Int32 nElement,
+                    const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                     ScQueryParam& rParam,
                     ScXMLFilterContext* pTempFilterContext);
 
     virtual ~ScXMLOrContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLConditionContext : public ScXMLImportContext
@@ -131,19 +126,17 @@ class ScXMLConditionContext : public ScXMLImportContext
 
 public:
 
-    ScXMLConditionContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                           const OUString& rLName,
-                           const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
+                           const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                            ScQueryParam& rParam,
                            ScXMLFilterContext* pTempFilterContext);
 
     virtual ~ScXMLConditionContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
     static void GetOperator(const OUString& aOpStr, ScQueryParam& rParam, ScQueryEntry& rEntry);
     void AddSetItem(const ScQueryEntry::Item& rItem);
@@ -152,19 +145,11 @@ public:
 class ScXMLSetItemContext : public ScXMLImportContext
 {
 public:
-    ScXMLSetItemContext(ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSetItemContext(ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLConditionContext& rParent);
 
     virtual ~ScXMLSetItemContext() override;
-
-    virtual SvXMLImportContext *CreateChildContext(
-        sal_uInt16 nPrefix,
-        const OUString& rLocalName,
-        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override;
-
-    virtual void EndElement() override;
 };
 
 // Datapilot (Core)
@@ -194,9 +179,8 @@ public:
 
     virtual ~ScXMLDPFilterContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
     virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
@@ -238,18 +222,16 @@ class ScXMLDPAndContext : public ScXMLImportContext
     ScXMLDPFilterContext* pFilterContext;
 public:
 
-    ScXMLDPAndContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLDPAndContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDPFilterContext* pTempFilterContext);
 
     virtual ~ScXMLDPAndContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLDPOrContext : public ScXMLImportContext
@@ -257,18 +239,16 @@ class ScXMLDPOrContext : public ScXMLImportContext
     ScXMLDPFilterContext* pFilterContext;
 public:
 
-    ScXMLDPOrContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLDPOrContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDPFilterContext* pTempFilterContext);
 
     virtual ~ScXMLDPOrContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 class ScXMLDPConditionContext : public ScXMLImportContext
@@ -283,20 +263,15 @@ class ScXMLDPConditionContext : public ScXMLImportContext
 
 public:
 
-    ScXMLDPConditionContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLDPConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLDPFilterContext* pTempFilterContext);
 
     virtual ~ScXMLDPConditionContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
     static void getOperatorXML(
         const OUString& sTempOperator, ScQueryOp& aFilterOperator, utl::SearchParam::SearchType& rSearchType);
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 #endif
diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx
index 3f97cb99527a..e7689f3f895e 100644
--- a/sc/source/filter/xml/xmlsorti.cxx
+++ b/sc/source/filter/xml/xmlsorti.cxx
@@ -111,25 +111,22 @@ ScXMLSortContext::~ScXMLSortContext()
 {
 }
 
-SvXMLImportContext *ScXMLSortContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
+uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSortContext::createFastChildContext(
+    sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetSortElemTokenMap());
-    switch( rTokenMap.Get( nPrefix, rLName ) )
+    switch (nElement)
     {
-        case XML_TOK_SORT_SORT_BY :
+        case XML_ELEMENT( TABLE, XML_SORT_BY ):
         {
-            pContext = new ScXMLSortByContext( GetScImport(), nPrefix,
-                                                          rLName, xAttrList, this);
+            pContext = new ScXMLSortByContext( GetScImport(), nElement, xAttrList, this );
         }
         break;
     }
 
     if( !pContext )
-        pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
+        pContext = new SvXMLImportContext( GetImport() );
 
     return pContext;
 }
@@ -205,42 +202,39 @@ void ScXMLSortContext::AddSortField(const OUString& sFieldNumber, const OUString
 }
 
 ScXMLSortByContext::ScXMLSortByContext( ScXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+                                      sal_Int32 /*nElement*/,
+                                      const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                                       ScXMLSortContext* pTempSortContext) :
-    ScXMLImportContext( rImport, nPrfx, rLName ),
+    ScXMLImportContext( rImport ),
     pSortContext(pTempSortContext),
     sDataType(GetXMLToken(XML_AUTOMATIC)),
     sOrder(GetXMLToken(XML_ASCENDING))
 {
-    sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetSortSortByAttrTokenMap());
-    for( sal_Int16 i=0; i < nAttrCount; ++i )
+    if ( xAttrList.is() )
     {
-        const OUString& sAttrName(xAttrList->getNameByIndex( i ));
-        OUString aLocalName;
-        sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
-                                            sAttrName, &aLocalName ));
-        const OUString& sValue(xAttrList->getValueByIndex( i ));
+        sax_fastparser::FastAttributeList *pAttribList =
+            sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
 
-        switch( rAttrTokenMap.Get( nPrefix, aLocalName ) )
+        for (auto &aIter : *pAttribList)
         {
-            case XML_TOK_SORT_BY_ATTR_FIELD_NUMBER :
-            {
-                sFieldNumber = sValue;
-            }
-            break;
-            case XML_TOK_SORT_BY_ATTR_DATA_TYPE :
-            {
-                sDataType = sValue;
-            }
-            break;
-            case XML_TOK_SORT_BY_ATTR_ORDER :
+            switch (aIter.getToken())
             {
-                sOrder = sValue;
+                case XML_ELEMENT( TABLE, XML_FIELD_NUMBER ):
+                {
+                    sFieldNumber = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_DATA_TYPE ):
+                {
+                    sDataType = aIter.toString();
+                }
+                break;
+                case XML_ELEMENT( TABLE, XML_ORDER ):
+                {
+                    sOrder = aIter.toString();
+                }
+                break;
             }
-            break;
         }
     }
 }
@@ -249,14 +243,7 @@ ScXMLSortByContext::~ScXMLSortByContext()
 {
 }
 
-SvXMLImportContext *ScXMLSortByContext::CreateChildContext( sal_uInt16 nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference<css::xml::sax::XAttributeList>& /* xAttrList */ )
-{
-    return new SvXMLImportContext( GetImport(), nPrefix, rLName );
-}
-
-void ScXMLSortByContext::EndElement()
+void SAL_CALL ScXMLSortByContext::endFastElement( sal_Int32 /*nElement*/ )
 {
     pSortContext->AddSortField(sFieldNumber, sDataType, sOrder);
 }
diff --git a/sc/source/filter/xml/xmlsorti.hxx b/sc/source/filter/xml/xmlsorti.hxx
index 25fb1856fcbf..87a0713f18d1 100644
--- a/sc/source/filter/xml/xmlsorti.hxx
+++ b/sc/source/filter/xml/xmlsorti.hxx
@@ -52,9 +52,8 @@ public:
 
     virtual ~ScXMLSortContext() override;
 
-    virtual SvXMLImportContext *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 >& xAttrList ) override;
 
     virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 
@@ -71,18 +70,13 @@ class ScXMLSortByContext : public ScXMLImportContext
 
 public:
 
-    ScXMLSortByContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
-                        const OUString& rLName,
-                        const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    ScXMLSortByContext( ScXMLImport& rImport, sal_Int32 nElement,
+                        const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
                         ScXMLSortContext* pTempSortContext);
 
     virtual ~ScXMLSortByContext() override;
 
-    virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
-
-    virtual void EndElement() override;
+    virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
 };
 
 #endif


More information about the Libreoffice-commits mailing list