diff options
-rw-r--r-- | xmloff/source/text/XMLIndexTemplateContext.cxx | 51 | ||||
-rw-r--r-- | xmloff/source/text/XMLIndexTemplateContext.hxx | 5 |
2 files changed, 22 insertions, 34 deletions
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx index 2c23fe3227f8..32e2ad5b4e27 100644 --- a/xmloff/source/text/XMLIndexTemplateContext.cxx +++ b/xmloff/source/text/XMLIndexTemplateContext.cxx @@ -95,44 +95,31 @@ void XMLIndexTemplateContext::addTemplateEntry( } -void XMLIndexTemplateContext::StartElement( - const Reference<XAttributeList> & xAttrList) +void XMLIndexTemplateContext::startFastElement( + sal_Int32 /*nElement*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { // process two attributes: style-name, outline-level - 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) + if (aIter.getToken() == XML_ELEMENT(TEXT, XML_STYLE_NAME) ) { - if ( IsXMLToken( sLocalName, XML_STYLE_NAME ) ) - { - // style name - sStyleName = xAttrList->getValueByIndex(nAttr); - bStyleNameOK = true; - } - else if (eOutlineLevelAttrName != XML_TOKEN_INVALID) + // style name + sStyleName = aIter.toString(); + bStyleNameOK = true; + } + else if (eOutlineLevelAttrName != XML_TOKEN_INVALID && + aIter.getToken() == XML_ELEMENT(TEXT, eOutlineLevelAttrName)) + { + // we have an attr name! Then see if we have the attr, too. + // outline level + sal_uInt16 nTmp; + if (SvXMLUnitConverter::convertEnum(nTmp, aIter.toString(), pOutlineLevelNameMap)) { - // we have an attr name! Then see if we have the attr, too. - if (IsXMLToken(sLocalName, eOutlineLevelAttrName)) - { - // outline level - sal_uInt16 nTmp; - if (SvXMLUnitConverter::convertEnum( - nTmp, xAttrList->getValueByIndex(nAttr), - pOutlineLevelNameMap)) - { - nOutlineLevel = nTmp; - bOutlineLevelOK = true; - } - // else: illegal value -> ignore - } - // else: unknown attribute -> ignore + nOutlineLevel = nTmp; + bOutlineLevelOK = true; } - // else: we don't care about outline-level -> ignore + // else: illegal value -> ignore } // else: attribute not in text namespace -> ignore } diff --git a/xmloff/source/text/XMLIndexTemplateContext.hxx b/xmloff/source/text/XMLIndexTemplateContext.hxx index b1a5ede7eab9..2aa8a9db56c7 100644 --- a/xmloff/source/text/XMLIndexTemplateContext.hxx +++ b/xmloff/source/text/XMLIndexTemplateContext.hxx @@ -112,8 +112,9 @@ 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 SAL_CALL endFastElement(sal_Int32 nElement) override; |