[Libreoffice-commits] core.git: xmloff/inc xmloff/source xmloff/util

kripton yeliztaneroglu at gmail.com
Mon Nov 2 13:30:00 PST 2015


 xmloff/inc/MetaImportComponent.hxx         |   75 -----------------------------
 xmloff/inc/facreg.hxx                      |    7 --
 xmloff/source/core/facreg.cxx              |    1 
 xmloff/source/meta/MetaImportComponent.cxx |   63 +++++++++++++++---------
 xmloff/util/xo.component                   |    3 -
 5 files changed, 42 insertions(+), 107 deletions(-)

New commits:
commit c5d16f557c3dbac8b7c0736216e8da5d681d8075
Author: kripton <yeliztaneroglu at gmail.com>
Date:   Thu Oct 29 16:51:23 2015 +0300

    tdf#74608 xmloff: Constructor feature for XMLMetaImportComponent.
    
    Change-Id: I3f97625552bf993d67b537456e09c9acf3cba6b8
    Reviewed-on: https://gerrit.libreoffice.org/19671
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/xmloff/inc/MetaImportComponent.hxx b/xmloff/inc/MetaImportComponent.hxx
deleted file mode 100644
index 0df495d..0000000
--- a/xmloff/inc/MetaImportComponent.hxx
+++ /dev/null
@@ -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: */
diff --git a/xmloff/inc/facreg.hxx b/xmloff/inc/facreg.hxx
index f0f415f..d6f6f0a 100644
--- a/xmloff/inc/facreg.hxx
+++ b/xmloff/inc/facreg.hxx
@@ -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();
diff --git a/xmloff/source/core/facreg.cxx b/xmloff/source/core/facreg.cxx
index 1e38ca8..be929c2 100644
--- a/xmloff/source/core/facreg.cxx
+++ b/xmloff/source/core/facreg.cxx
@@ -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 )
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
index 6ec29e3..0ffcc128 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: */
diff --git a/xmloff/util/xo.component b/xmloff/util/xo.component
index ad180f6..efc9118 100644
--- a/xmloff/util/xo.component
+++ b/xmloff/util/xo.component
@@ -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"


More information about the Libreoffice-commits mailing list