summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-12-01 08:19:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-01 11:00:55 +0100
commita4a15dc18c4be7fdb840b5d478c39cb1e8206b1a (patch)
treee78970f6ff6c1b0c57de00e32df7de4201299929 /xmloff
parent2622cd9c31a5db423c6f878f990a41191d0079af (diff)
fastparser in XMLIndexTitleTemplateContext
Change-Id: I40231fdd13410f1c69f2d6f71458aff43a462df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106920 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/XMLIndexTitleTemplateContext.cxx20
-rw-r--r--xmloff/source/text/XMLIndexTitleTemplateContext.hxx5
2 files changed, 12 insertions, 13 deletions
diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
index 14b4608d8877..e5c690f09d49 100644
--- a/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.cxx
@@ -23,6 +23,7 @@
#include <xmloff/namespacemap.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
+#include <sal/log.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -50,27 +51,24 @@ XMLIndexTitleTemplateContext::~XMLIndexTitleTemplateContext()
{
}
-void XMLIndexTitleTemplateContext::StartElement(
- const Reference<XAttributeList> & xAttrList)
+void XMLIndexTitleTemplateContext::startFastElement(
+ sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
// there's only one attribute: style-name
- sal_Int16 nLength = xAttrList->getLength();
- for(sal_Int16 nAttr = 0; nAttr < nLength; 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) &&
- (IsXMLToken(sLocalName, XML_STYLE_NAME)) )
+ if ( aIter.getToken() == XML_ELEMENT(TEXT, XML_STYLE_NAME) )
{
- sStyleName = xAttrList->getValueByIndex(nAttr);
+ sStyleName = aIter.toString();
OUString sDisplayStyleName = GetImport().GetStyleDisplayName(
XmlStyleFamily::TEXT_PARAGRAPH, sStyleName );
const Reference < css::container::XNameContainer >&
rStyles = GetImport().GetTextImport()->GetParaStyles();
bStyleNameOK = rStyles.is() && rStyles->hasByName( sDisplayStyleName );
}
+ else
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
diff --git a/xmloff/source/text/XMLIndexTitleTemplateContext.hxx b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
index a5b698242e68..b517ab9e8015 100644
--- a/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
+++ b/xmloff/source/text/XMLIndexTitleTemplateContext.hxx
@@ -58,8 +58,9 @@ public:
protected:
/** process parameters */
- 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;
/** set values */
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;