xmloff/inc/XMLImageMapContext.hxx | 7 +-- xmloff/source/draw/XMLImageMapContext.cxx | 64 +++++++++--------------------- 2 files changed, 24 insertions(+), 47 deletions(-)
New commits: commit df3e347b30e60e3fbb6f32cbbed67377518e7862 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Nov 14 18:00:36 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Nov 14 19:06:04 2020 +0100 use fastparser in XMLImageMapContext Change-Id: Ibdb7338298182515b624df4815c9d0177fe4badc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105838 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmloff/inc/XMLImageMapContext.hxx b/xmloff/inc/XMLImageMapContext.hxx index 90b014000e4c..d026477a6c3a 100644 --- a/xmloff/inc/XMLImageMapContext.hxx +++ b/xmloff/inc/XMLImageMapContext.hxx @@ -50,10 +50,9 @@ public: virtual ~XMLImageMapContext() override; - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::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; }; diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx index a8f8d13d98b8..0585bd60407f 100644 --- a/xmloff/source/draw/XMLImageMapContext.cxx +++ b/xmloff/source/draw/XMLImageMapContext.cxx @@ -41,6 +41,7 @@ #include <tools/debug.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <sal/log.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -118,8 +119,6 @@ public: XMLImageMapObjectContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, css::uno::Reference<css::container::XIndexContainer> const & xMap, const char* pServiceName); @@ -147,11 +146,9 @@ protected: XMLImageMapObjectContext::XMLImageMapObjectContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, Reference<XIndexContainer> const & xMap, const char* pServiceName) : - SvXMLImportContext(rImport, nPrefix, rLocalName), + SvXMLImportContext(rImport), xImageMap(xMap), bIsActive(true), bValid(false) @@ -290,8 +287,6 @@ public: XMLImageMapRectangleContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, css::uno::Reference<css::container::XIndexContainer> const & xMap); protected: @@ -307,10 +302,8 @@ protected: XMLImageMapRectangleContext::XMLImageMapRectangleContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, Reference<XIndexContainer> const & xMap) : - XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap, + XMLImageMapObjectContext(rImport, xMap, "com.sun.star.image.ImageMapRectangleObject"), bXOK(false), bYOK(false), @@ -388,8 +381,6 @@ public: XMLImageMapPolygonContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, css::uno::Reference<css::container::XIndexContainer> const & xMap); protected: @@ -405,10 +396,8 @@ protected: XMLImageMapPolygonContext::XMLImageMapPolygonContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, Reference<XIndexContainer> const & xMap) : - XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap, + XMLImageMapObjectContext(rImport, xMap, "com.sun.star.image.ImageMapPolygonObject"), bViewBoxOK(false), bPointsOK(false) @@ -474,8 +463,6 @@ public: XMLImageMapCircleContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, css::uno::Reference<css::container::XIndexContainer> const & xMap); protected: @@ -491,10 +478,8 @@ protected: XMLImageMapCircleContext::XMLImageMapCircleContext( SvXMLImport& rImport, - sal_uInt16 nPrefix, - const OUString& rLocalName, Reference<XIndexContainer> const & xMap) - : XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap, + : XMLImageMapObjectContext(rImport, xMap, "com.sun.star.image.ImageMapCircleObject") , nRadius(0) , bXOK(false) @@ -582,33 +567,26 @@ XMLImageMapContext::~XMLImageMapContext() { } -SvXMLImportContextRef XMLImageMapContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference<XAttributeList> & /*xAttrList*/ ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLImageMapContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { - SvXMLImportContextRef xContext; - - if ( XML_NAMESPACE_DRAW == nPrefix ) + switch (nElement) { - if ( IsXMLToken(rLocalName, XML_AREA_RECTANGLE) ) - { - xContext = new XMLImageMapRectangleContext( - GetImport(), nPrefix, rLocalName, xImageMap); - } - else if ( IsXMLToken(rLocalName, XML_AREA_POLYGON) ) - { - xContext = new XMLImageMapPolygonContext( - GetImport(), nPrefix, rLocalName, xImageMap); - } - else if ( IsXMLToken(rLocalName, XML_AREA_CIRCLE) ) - { - xContext = new XMLImageMapCircleContext( - GetImport(), nPrefix, rLocalName, xImageMap); - } + case XML_ELEMENT(DRAW, XML_AREA_RECTANGLE): + return new XMLImageMapRectangleContext( + GetImport(), xImageMap); + case XML_ELEMENT(DRAW, XML_AREA_POLYGON): + return new XMLImageMapPolygonContext( + GetImport(), xImageMap); + case XML_ELEMENT(DRAW, XML_AREA_CIRCLE): + return new XMLImageMapCircleContext( + GetImport(), xImageMap); + default: + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); } - return xContext; + return nullptr; } void XMLImageMapContext::endFastElement(sal_Int32 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits