diff options
author | Daniel Sikeler <d.sikeler94@gmail.com> | 2014-10-24 07:22:31 +0000 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-31 09:22:30 +0100 |
commit | c0a5d390e519603dbc19a38c610d0a114b80cfa1 (patch) | |
tree | e68c3f55c9718d2d3f290be154c83a5a6121a6fc /include/xmloff | |
parent | 4482f50197f8787f8e187def2cc96758e3c31800 (diff) |
fdo#80403: Import baseclasses implement FastParser interfaces
SvXMLImportContext implements XFastContextHandler
SvXMLImport implements XFastDocumentHandler
Change-Id: Id400260af112f4a448fe469c9580f0ebacec4ab6
Diffstat (limited to 'include/xmloff')
-rw-r--r-- | include/xmloff/xmlictxt.hxx | 34 | ||||
-rw-r--r-- | include/xmloff/xmlimp.hxx | 38 |
2 files changed, 68 insertions, 4 deletions
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx index bd21e95436f6..35f693d08e8c 100644 --- a/include/xmloff/xmlictxt.hxx +++ b/include/xmloff/xmlictxt.hxx @@ -24,14 +24,17 @@ #include <xmloff/dllapi.h> #include <sal/types.h> #include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XFastContextHandler.hpp> #include <tools/ref.hxx> #include <rtl/ustring.hxx> #include <tools/rtti.hxx> +#include <cppuhelper/implbase1.hxx> class SvXMLNamespaceMap; class SvXMLImport; -class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase +class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase, + public ::cppu::WeakImplHelper1< ::css::xml::sax::XFastContextHandler > { friend class SvXMLImport; @@ -64,6 +67,8 @@ public: SvXMLImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName ); + SvXMLImportContext( SvXMLImport& rImport ); + /** A contexts destructor does anything that is required if an element * ends. By default, nothing is done. * Note that virtual methods cannot be used inside destructors. Use @@ -90,6 +95,33 @@ public: * current element. The default is to ignore them. */ virtual void Characters( const OUString& rChars ); + // ::com::sun::star::xml::sax::XFastContextHandler: + virtual void SAL_CALL startFastElement (sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL startUnknownElement(const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL endFastElement(sal_Int32 Element) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL endUnknownElement(const OUString & Namespace, const OUString & Name) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, + const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( + const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL characters(const OUString & aChars) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + // #i124143# allow to copy evtl. useful data from another temporary import context, e.g. used to // support multiple images and to rescue evtl. GluePoints imported with one of the // to be deprecated contents diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx index 43afbeabe58e..4c3e35f4647d 100644 --- a/include/xmloff/xmlimp.hxx +++ b/include/xmloff/xmlimp.hxx @@ -48,11 +48,15 @@ #include <xmloff/shapeimport.hxx> #include <xmloff/SchXMLImportHelper.hxx> #include <xmloff/ProgressBarHelper.hxx> -#include <cppuhelper/implbase6.hxx> +#include <cppuhelper/implbase7.hxx> #include <xmloff/formlayerimport.hxx> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XFastContextHandler.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> + namespace com { namespace sun { namespace star { namespace frame { class XModel; } namespace io { class XOutputStream; } @@ -71,6 +75,8 @@ class XMLErrors; class StyleMap; typedef std::vector<SvXMLImportContext *> SvXMLImportContexts_Impl; +typedef std::vector< ::css::uno::Reference< ::css::xml::sax::XFastContextHandler>> + FastSvXMLImportContexts_Impl; namespace xmloff { class RDFaImportHelper; @@ -90,8 +96,9 @@ namespace xmloff { -class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6< +class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper7< ::com::sun::star::xml::sax::XExtendedDocumentHandler, + ::com::sun::star::xml::sax::XFastDocumentHandler, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XInitialization, ::com::sun::star::document::XImporter, @@ -131,6 +138,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6< SvXMLNamespaceMap *mpNamespaceMap; SvXMLUnitConverter *mpUnitConv; SvXMLImportContexts_Impl *mpContexts; + FastSvXMLImportContexts_Impl *mpFastContexts; SvXMLNumFmtHelper *mpNumImport; ProgressBarHelper *mpProgressBarHelper; XMLEventImportHelper *mpEventImportHelper; @@ -156,6 +164,8 @@ protected: virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element, + const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ); virtual XMLTextImportHelper* CreateTextImport(); inline void ClearTextImport() { mxTextImport = 0; } @@ -205,7 +215,7 @@ public: ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL startElement(const OUString& aName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs) + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual void SAL_CALL endElement(const OUString& aName) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; @@ -219,6 +229,28 @@ public: virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + // ::css::xml::sax::XFastContextHandler + virtual void SAL_CALL startFastElement(sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL startUnknownElement(const OUString & Namespace, + const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL endFastElement(sal_Int32 Element) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL endUnknownElement(const OUString & Namespace, + const OUString & Name) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext(sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createUnknownChildContext(const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + // ::com::sun::star::xml::sax::XExtendedDocumentHandler virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; |