[Libreoffice-commits] core.git: xmloff/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 1 17:01:48 UTC 2020
xmloff/source/text/XMLIndexTOCContext.cxx | 41 ++++++++++++++----------------
xmloff/source/text/XMLIndexTOCContext.hxx | 5 ++-
2 files changed, 23 insertions(+), 23 deletions(-)
New commits:
commit cebf5e827bcda80093bd02f62967dd205e9204e5
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Tue Dec 1 10:33:07 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 18:00:58 2020 +0100
fastparser in XMLIndexTOCContext
Change-Id: I237a9a03e2a2cf2e1ad93081e1c824575dc728ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106977
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
index 3c05f623d23a..829bf0a74c45 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <sax/tools/converter.hxx>
+#include <sal/log.hxx>
#include "XMLIndexTOCSourceContext.hxx"
#include "XMLIndexObjectSourceContext.hxx"
#include "XMLIndexAlphabeticalSourceContext.hxx"
@@ -117,8 +118,9 @@ XMLIndexTOCContext::~XMLIndexTOCContext()
{
}
-void XMLIndexTOCContext::StartElement(
- const Reference<XAttributeList> & xAttrList)
+void XMLIndexTOCContext::startFastElement(
+ sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
if (!bValid)
return;
@@ -126,44 +128,41 @@ void XMLIndexTOCContext::StartElement(
// find text:style-name attribute and set section style
// find text:protected and set value
// find text:name and set value (if not empty)
- sal_Int16 nCount = xAttrList->getLength();
bool bProtected = false;
OUString sIndexName;
OUString sXmlId;
XMLPropStyleContext* pStyle(nullptr);
- for(sal_Int16 nAttr = 0; nAttr < nCount; nAttr++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
- &sLocalName );
- if ( XML_NAMESPACE_TEXT == nPrefix)
+ switch(aIter.getToken())
{
- if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) )
+ case XML_ELEMENT(TEXT, XML_STYLE_NAME):
{
pStyle = GetImport().GetTextImport()->FindSectionStyle(
- xAttrList->getValueByIndex(nAttr));
+ aIter.toString());
+ break;
}
- else if ( IsXMLToken( sLocalName, XML_PROTECTED ) )
+ case XML_ELEMENT(TEXT, XML_PROTECTED):
{
bool bTmp(false);
- if (::sax::Converter::convertBool(
- bTmp, xAttrList->getValueByIndex(nAttr)))
+ if (::sax::Converter::convertBool(bTmp, aIter.toString()))
{
bProtected = bTmp;
}
+ break;
}
- else if ( IsXMLToken( sLocalName, XML_NAME ) )
+ case XML_ELEMENT(TEXT, XML_NAME):
{
- sIndexName = xAttrList->getValueByIndex(nAttr);
+ sIndexName = aIter.toString();
+ break;
}
- }
- else if ( XML_NAMESPACE_XML == nPrefix)
- {
- if ( IsXMLToken( sLocalName, XML_ID ) )
+ case XML_ELEMENT(XML, XML_ID):
{
- sXmlId = xAttrList->getValueByIndex(nAttr);
+ sXmlId = aIter.toString();
+ break;
}
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
diff --git a/xmloff/source/text/XMLIndexTOCContext.hxx b/xmloff/source/text/XMLIndexTOCContext.hxx
index b67381ca8ef1..b179d35013a9 100644
--- a/xmloff/source/text/XMLIndexTOCContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCContext.hxx
@@ -72,8 +72,9 @@ public:
virtual ~XMLIndexTOCContext() override;
- 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 SAL_CALL endFastElement(sal_Int32 nElement) override;
More information about the Libreoffice-commits
mailing list