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>
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_XMLOFF_INC_METAIMPORTCOMPONENT_HXX
|
||||
#define INCLUDED_XMLOFF_INC_METAIMPORTCOMPONENT_HXX
|
||||
|
||||
#include <xmloff/xmlimp.hxx>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/document/XDocumentProperties.hpp>
|
||||
|
||||
|
||||
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
|
||||
|
||||
::com::sun::star::uno::Sequence< OUString > SAL_CALL
|
||||
XMLMetaImportComponent_getSupportedServiceNames()
|
||||
throw();
|
||||
|
||||
OUString SAL_CALL XMLMetaImportComponent_getImplementationName()
|
||||
throw();
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
|
||||
XMLMetaImportComponent_createInstance(
|
||||
const ::com::sun::star::uno::Reference<
|
||||
::com::sun::star::lang::XMultiServiceFactory > & )
|
||||
throw( ::com::sun::star::uno::Exception );
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -290,13 +290,6 @@ css::uno::Reference<css::uno::XInterface> SAL_CALL XMLMetaExportComponent_create
|
||||
css::uno::Reference<css::lang::XMultiServiceFactory> const & rSMgr)
|
||||
throw (css::uno::Exception);
|
||||
|
||||
// meta import
|
||||
OUString SAL_CALL XMLMetaImportComponent_getImplementationName() throw();
|
||||
css::uno::Sequence<OUString> SAL_CALL XMLMetaImportComponent_getSupportedServiceNames() throw();
|
||||
css::uno::Reference<css::uno::XInterface> SAL_CALL XMLMetaImportComponent_createInstance(
|
||||
css::uno::Reference<css::lang::XMultiServiceFactory> const & rSMgr)
|
||||
throw (css::uno::Exception);
|
||||
|
||||
// meta export OOo
|
||||
OUString SAL_CALL XMLMetaExportOOO_getImplementationName() throw();
|
||||
css::uno::Sequence<OUString> SAL_CALL XMLMetaExportOOO_getSupportedServiceNames() throw();
|
||||
|
@@ -127,7 +127,6 @@ XMLOFF_DLLPUBLIC void * SAL_CALL xo_component_getFactory( const sal_Char * pImpl
|
||||
|
||||
// meta import/export
|
||||
else SINGLEFACTORY( XMLMetaExportComponent )
|
||||
else SINGLEFACTORY( XMLMetaImportComponent )
|
||||
|
||||
// meta import/export OOo
|
||||
else SINGLEFACTORY( XMLMetaExportOOO )
|
||||
|
@@ -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: */
|
||||
|
@@ -146,7 +146,8 @@
|
||||
<implementation name="XMLMetaExportOOo">
|
||||
<service name="com.sun.star.document.XMLMetaExporter"/>
|
||||
</implementation>
|
||||
<implementation name="XMLMetaImportComponent">
|
||||
<implementation name="XMLMetaImportComponent"
|
||||
constructor="XMLMetaImportComponent_get_implementation">
|
||||
<service name="com.sun.star.document.XMLOasisMetaImporter"/>
|
||||
</implementation>
|
||||
<implementation name="XMLVersionListPersistence"
|
||||
|
Reference in New Issue
Block a user