summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-12-20 15:12:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-12-21 08:29:31 +0100
commitccdcc25a085299bda45bc5ea4b3594e856f2d315 (patch)
treeda294bdcb433814e8327bbc41c2865d87b76a05d /xmloff
parenta445b24d1eef6b81db962894d4c3990e1067f4ad (diff)
convert XMLSectionSourceImportContext to FastParser APIs
Change-Id: I488d0e521a445055a33a7972d78005047b2c5b2f Reviewed-on: https://gerrit.libreoffice.org/85647 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/XMLSectionSourceImportContext.cxx52
-rw-r--r--xmloff/source/text/XMLSectionSourceImportContext.hxx6
2 files changed, 18 insertions, 40 deletions
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx
index 2ae4e671f7c0..82e01979ab0c 100644
--- a/xmloff/source/text/XMLSectionSourceImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx
@@ -32,6 +32,7 @@
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::xml::sax::XAttributeList;
+using ::com::sun::star::xml::sax::XFastAttributeList;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
@@ -52,54 +53,31 @@ XMLSectionSourceImportContext::~XMLSectionSourceImportContext()
{
}
-namespace {
-enum XMLSectionSourceToken
-{
- XML_TOK_SECTION_XLINK_HREF,
- XML_TOK_SECTION_TEXT_FILTER_NAME,
- XML_TOK_SECTION_TEXT_SECTION_NAME
-};
-
-}
-
-static const SvXMLTokenMapEntry aSectionSourceTokenMap[] =
-{
- { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF },
- { XML_NAMESPACE_TEXT, XML_FILTER_NAME, XML_TOK_SECTION_TEXT_FILTER_NAME },
- { XML_NAMESPACE_TEXT, XML_SECTION_NAME,
- XML_TOK_SECTION_TEXT_SECTION_NAME },
- XML_TOKEN_MAP_END
-};
-
-void XMLSectionSourceImportContext::StartElement(
- const Reference<XAttributeList> & xAttrList)
+void XMLSectionSourceImportContext::startFastElement(sal_Int32 /*nElement*/,
+ const Reference<XFastAttributeList> & xAttrList)
{
- static const SvXMLTokenMap aTokenMap(aSectionSourceTokenMap);
OUString sURL;
OUString sFilterName;
OUString sSectionName;
- sal_Int16 nLength = xAttrList->getLength();
- for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
- {
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
- &sLocalName );
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
- switch (aTokenMap.Get(nPrefix, sLocalName))
+ for (auto &aIter : *pAttribList)
+ {
+ switch (aIter.getToken())
{
- case XML_TOK_SECTION_XLINK_HREF:
- sURL = xAttrList->getValueByIndex(nAttr);
+ case XML_ELEMENT(XLINK, XML_HREF):
+ sURL = aIter.toString();
break;
- case XML_TOK_SECTION_TEXT_FILTER_NAME:
- sFilterName = xAttrList->getValueByIndex(nAttr);
+ case XML_ELEMENT(TEXT, XML_FILTER_NAME):
+ sFilterName = aIter.toString();
break;
- case XML_TOK_SECTION_TEXT_SECTION_NAME:
- sSectionName = xAttrList->getValueByIndex(nAttr);
+ case XML_ELEMENT(TEXT, XML_SECTION_NAME):
+ sSectionName = aIter.toString();
break;
default:
@@ -127,7 +105,7 @@ void XMLSectionSourceImportContext::StartElement(
}
}
-void XMLSectionSourceImportContext::EndElement()
+void XMLSectionSourceImportContext::endFastElement(sal_Int32 /*nElement*/)
{
// this space intentionally left blank.
}
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.hxx b/xmloff/source/text/XMLSectionSourceImportContext.hxx
index 865e9753ff6f..838375ff7e78 100644
--- a/xmloff/source/text/XMLSectionSourceImportContext.hxx
+++ b/xmloff/source/text/XMLSectionSourceImportContext.hxx
@@ -45,10 +45,10 @@ public:
protected:
- virtual void StartElement(
- const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+ virtual void SAL_CALL startFastElement(sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override;
- virtual void EndElement() override;
+ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
#endif