diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-20 15:18:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-21 11:07:04 +0100 |
commit | df1e9136d7ed8b1fbe87f128bd1e843020921413 (patch) | |
tree | adcb9a119307beb4108721ca97862a329a97259c /xmloff/source/text | |
parent | fa3cb1a31ef0bbe9ebc8ab8a79463c7f4d760d89 (diff) |
convert XMLSectionSourceDDEImportContext to FastParser API
Change-Id: I4a2ca35d75a352d5f2b763114de9e9151125f001
Reviewed-on: https://gerrit.libreoffice.org/85648
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/text')
-rw-r--r-- | xmloff/source/text/XMLSectionSourceDDEImportContext.cxx | 63 | ||||
-rw-r--r-- | xmloff/source/text/XMLSectionSourceDDEImportContext.hxx | 6 |
2 files changed, 20 insertions, 49 deletions
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx index 658056968b16..34a5dedc4ac0 100644 --- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx +++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx @@ -33,7 +33,7 @@ using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XMultiPropertySet; 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; @@ -53,63 +53,34 @@ XMLSectionSourceDDEImportContext::~XMLSectionSourceDDEImportContext() { } -namespace { - -enum XMLSectionSourceDDEToken -{ - XML_TOK_SECTION_DDE_APPLICATION, - XML_TOK_SECTION_DDE_TOPIC, - XML_TOK_SECTION_DDE_ITEM, - XML_TOK_SECTION_IS_AUTOMATIC_UPDATE -}; - -} - -static const SvXMLTokenMapEntry aSectionSourceDDETokenMap[] = -{ - { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, - XML_TOK_SECTION_DDE_APPLICATION }, - { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_SECTION_DDE_TOPIC }, - { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_SECTION_DDE_ITEM }, - { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, - XML_TOK_SECTION_IS_AUTOMATIC_UPDATE }, - XML_TOKEN_MAP_END -}; - - -void XMLSectionSourceDDEImportContext::StartElement( - const Reference<XAttributeList> & xAttrList) +void XMLSectionSourceDDEImportContext::startFastElement(sal_Int32 /*nElement*/, + const Reference<XFastAttributeList> & xAttrList) { - static const SvXMLTokenMap aTokenMap(aSectionSourceDDETokenMap); OUString sApplication; OUString sTopic; OUString sItem; bool bAutomaticUpdate = false; - 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_DDE_APPLICATION: - sApplication = xAttrList->getValueByIndex(nAttr); + case XML_ELEMENT(OFFICE, XML_DDE_APPLICATION): + sApplication = aIter.toString(); break; - case XML_TOK_SECTION_DDE_TOPIC: - sTopic = xAttrList->getValueByIndex(nAttr); + case XML_ELEMENT(OFFICE, XML_DDE_TOPIC): + sTopic = aIter.toString(); break; - case XML_TOK_SECTION_DDE_ITEM: - sItem = xAttrList->getValueByIndex(nAttr); + case XML_ELEMENT(OFFICE, XML_DDE_ITEM): + sItem = aIter.toString(); break; - case XML_TOK_SECTION_IS_AUTOMATIC_UPDATE: + case XML_ELEMENT(OFFICE, XML_AUTOMATIC_UPDATE): { bool bTmp(false); - if (::sax::Converter::convertBool( - bTmp, xAttrList->getValueByIndex(nAttr))) + if (::sax::Converter::convertBool(bTmp, aIter.toString())) { bAutomaticUpdate = bTmp; } @@ -151,7 +122,7 @@ void XMLSectionSourceDDEImportContext::StartElement( } -void XMLSectionSourceDDEImportContext::EndElement() +void XMLSectionSourceDDEImportContext::endFastElement(sal_Int32 /*nElement*/) { // nothing to be done! } diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx index 8d6c2b1ddcc9..a67058f680cb 100644 --- a/xmloff/source/text/XMLSectionSourceDDEImportContext.hxx +++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.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 |