summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-20 08:39:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-20 13:22:04 +0100
commit1bad449a6a2427a2c9d217a3f84d9b350b28c0b3 (patch)
tree16b0eea8202e050ef480117de9f1bf74b2e7817a /xmloff
parentb5724a53b4f3e53768429544f604cd374ed49a0c (diff)
fastparser in SdXMLEventContext
Change-Id: I52eb0ef77c54386a9774f746caba4b05785937aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/eventimp.cxx49
1 files changed, 23 insertions, 26 deletions
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index 9d6415cfe013..9f0e79bef84a 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -86,7 +86,9 @@ public:
SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
- virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList ) override;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
};
@@ -94,38 +96,27 @@ class XMLEventSoundContext : public SvXMLImportContext
{
public:
- XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
+ XMLEventSoundContext( SvXMLImport& rImport, const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent );
};
}
-XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
-: SvXMLImportContext( rImp, nPrfx, rLocalName )
+XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent )
+: SvXMLImportContext( rImp )
{
- if( !(pParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND )) )
- return;
-
- const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
- for(sal_Int16 i=0; i < nAttrCount; i++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aAttrLocalName;
- sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
- OUString sValue = xAttrList->getValueByIndex( i );
-
- switch( nAttrPrefix )
+ OUString sValue = aIter.toString();
+ switch( aIter.getToken() )
{
- case XML_NAMESPACE_XLINK:
- if( IsXMLToken( aAttrLocalName, XML_HREF ) )
- {
+ case XML_ELEMENT(XLINK, XML_HREF):
pParent->maData.msSoundURL = rImp.GetAbsoluteReference(sValue);
- }
- break;
- case XML_NAMESPACE_PRESENTATION:
- if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
- {
+ break;
+ case XML_ELEMENT(PRESENTATION, XML_PLAY_FULL):
pParent->maData.mbPlayFull = IsXMLToken( sValue, XML_TRUE );
- }
+ break;
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
}
}
@@ -236,9 +227,15 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
maData.mbValid = !sEventName.isEmpty();
}
-SvXMLImportContextRef SdXMLEventContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLEventContext::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+ if( nElement == XML_ELEMENT(PRESENTATION, XML_SOUND) )
+ return new XMLEventSoundContext( GetImport(), xAttrList, this );
+ else
+ XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+ return nullptr;
}
void SdXMLEventContext::endFastElement(sal_Int32 )