diff options
author | kripton <yeliztaneroglu@gmail.com> | 2015-10-29 16:51:23 +0300 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-11-02 21:29:37 +0000 |
commit | c5d16f557c3dbac8b7c0736216e8da5d681d8075 (patch) | |
tree | 6eaab126bf3a9a281bb3d608139370a8d0c3fe62 /xmloff/source/meta | |
parent | e4f60820fd94557f87ef7dbdfb740e45daa18426 (diff) |
tdf#74608 xmloff: Constructor feature for XMLMetaImportComponent.
Change-Id: I3f97625552bf993d67b537456e09c9acf3cba6b8
Reviewed-on: https://gerrit.libreoffice.org/19671
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'xmloff/source/meta')
-rw-r--r-- | xmloff/source/meta/MetaImportComponent.cxx | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx index 6ec29e387146..0ffcc128d3f4 100644 --- a/xmloff/source/meta/MetaImportComponent.cxx +++ b/xmloff/source/meta/MetaImportComponent.cxx @@ -17,18 +17,56 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "MetaImportComponent.hxx" #include <xmloff/xmlnmspe.hxx> - #include <xmloff/xmltoken.hxx> #include <xmloff/xmlmetai.hxx> #include <xmloff/nmspmap.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <xmloff/xmlimp.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/document/XDocumentProperties.hpp> using namespace ::com::sun::star; using namespace ::xmloff::token; +class XMLMetaImportComponent : public SvXMLImport +{ +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> mxDocProps; + +public: + // XMLMetaImportComponent() throw(); + XMLMetaImportComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext + ) throw(); + + virtual ~XMLMetaImportComponent() throw(); + +protected: + + virtual SvXMLImportContext* CreateContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) override; + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) override; +}; + +// global functions to support the component + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +XMLMetaImportComponent_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new XMLMetaImportComponent(context)); +} + XMLMetaImportComponent::XMLMetaImportComponent( const uno::Reference< uno::XComponentContext >& xContext) throw() : SvXMLImport(xContext, ""), mxDocProps() @@ -72,25 +110,4 @@ void SAL_CALL XMLMetaImportComponent::setTargetDocument( "XDocumentProperties"), uno::Reference<uno::XInterface>(*this), 0); } -uno::Sequence< OUString > SAL_CALL - XMLMetaImportComponent_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( "com.sun.star.document.XMLOasisMetaImporter" ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -OUString SAL_CALL XMLMetaImportComponent_getImplementationName() throw() -{ - return OUString( "XMLMetaImportComponent" ); -} - -uno::Reference< uno::XInterface > SAL_CALL XMLMetaImportComponent_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - return static_cast<cppu::OWeakObject*>(new XMLMetaImportComponent( comphelper::getComponentContext(rSMgr))); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |