[Libreoffice-commits] core.git: 2 commits - sw/Library_swd.mk sw/source sw/util

Stephan Bergmann sbergman at redhat.com
Thu Feb 26 05:46:45 PST 2015


 sw/Library_swd.mk             |    1 
 sw/source/ui/uno/detreg.cxx   |   66 ------------------------------------------
 sw/source/ui/uno/swdetect.cxx |   23 +++-----------
 sw/source/ui/uno/swdetect.hxx |   11 +++----
 sw/util/swd.component         |    5 +--
 5 files changed, 14 insertions(+), 92 deletions(-)

New commits:
commit 185eacbb8b5ef35cc5bc554f20004379e305e8b6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 26 14:46:03 2015 +0100

    Clean up previous commit
    
    Change-Id: I754ac95c851892bdf7630d6f6241ed86f3750cf1

diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index ed91a6d..af951ce 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -113,7 +113,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
 /* XServiceInfo */
 OUString SAL_CALL SwFilterDetect::getImplementationName() throw( RuntimeException, std::exception )
 {
-    return impl_getStaticImplementationName();
+    return OUString("com.sun.star.comp.writer.FormatDetector" );
 }
 
 /* XServiceInfo */
@@ -125,12 +125,6 @@ sal_Bool SAL_CALL SwFilterDetect::supportsService( const OUString& sServiceName
 /* XServiceInfo */
 Sequence< OUString > SAL_CALL SwFilterDetect::getSupportedServiceNames() throw( RuntimeException, std::exception )
 {
-    return impl_getStaticSupportedServiceNames();
-}
-
-/* Helper for XServiceInfo */
-Sequence< OUString > SwFilterDetect::impl_getStaticSupportedServiceNames()
-{
     Sequence< OUString > seqServiceNames( 3 );
     seqServiceNames.getArray() [0] = "com.sun.star.frame.ExtendedTypeDetection";
     seqServiceNames.getArray() [1] = "com.sun.star.text.FormatDetector";
@@ -138,14 +132,8 @@ Sequence< OUString > SwFilterDetect::impl_getStaticSupportedServiceNames()
     return seqServiceNames ;
 }
 
-/* Helper for XServiceInfo */
-OUString SwFilterDetect::impl_getStaticImplementationName()
-{
-    return OUString("com.sun.star.comp.writer.FormatDetector" );
-}
-
 extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
-com_sun_star_comp_writer_FormatDetector_get_implementation(::com::sun::star::uno::XComponentContext* component,
+com_sun_star_comp_writer_FormatDetector_get_implementation(::com::sun::star::uno::XComponentContext*,
                                                            ::com::sun::star::uno::Sequence<css::uno::Any> const &)
 {
     return cppu::acquire(new SwFilterDetect());
diff --git a/sw/source/ui/uno/swdetect.hxx b/sw/source/ui/uno/swdetect.hxx
index eba0753..d213862 100644
--- a/sw/source/ui/uno/swdetect.hxx
+++ b/sw/source/ui/uno/swdetect.hxx
@@ -39,10 +39,6 @@ namespace com
     {
         namespace star
         {
-            namespace lang
-            {
-                class XMultiServiceFactory;
-            }
             namespace beans
             {
                 struct PropertyValue;
@@ -66,10 +62,6 @@ public:
     virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
 
-    /* Helper for XServiceInfo */
-    static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
-    static OUString impl_getStaticImplementationName();
-
     // XExtendedFilterDetect
     virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
 };
diff --git a/sw/util/swd.component b/sw/util/swd.component
index e09b385..be51018 100644
--- a/sw/util/swd.component
+++ b/sw/util/swd.component
@@ -18,9 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="swd" xmlns="http://openoffice.org/2010/uno-components">
-    <implementation name="com.sun.star.comp.writer.FormatDetector"
-        constructor="com_sun_star_comp_writer_FormatDetector_get_implementation">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.writer.FormatDetector"
+      constructor="com_sun_star_comp_writer_FormatDetector_get_implementation">
     <service name="com.sun.star.frame.ExtendedTypeDetection"/>
     <service name="com.sun.star.text.FormatDetector"/>
     <service name="com.sun.star.text.W4WFormatDetector"/>
commit 94fc8ec1b1fb6571a1ef898fb5198161e021b3a0
Author: Chris Sherlock <chris.sherlock at collabora.com>
Date:   Tue Feb 24 14:06:26 2015 +1100

    sw: convert swd.component to constructor usage
    
    Whilst we are about it, need to expand the macro
    SFX_DECL_XSERVICEINFO_NOFACTORY and remove the impl_createInstance
    function. Also removed factory parameter from constructor as not
    needed.
    
    Change-Id: I400274fa9aaaa95be1c9929bce9dd6f25c780196
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk
index 8657cf1..6396a28 100644
--- a/sw/Library_swd.mk
+++ b/sw/Library_swd.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_libraries,swd,\
 ))
 
 $(eval $(call gb_Library_add_exception_objects,swd,\
-    sw/source/ui/uno/detreg \
     sw/source/ui/uno/swdetect \
 ))
 
diff --git a/sw/source/ui/uno/detreg.cxx b/sw/source/ui/uno/detreg.cxx
deleted file mode 100644
index d6d6208..0000000
--- a/sw/source/ui/uno/detreg.cxx
+++ /dev/null
@@ -1,66 +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 .
- */
-
-#include "swdetect.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL swd_component_getFactory(
-    const sal_Char* pImplementationName,
-    void* pServiceManager,
-    void* /*pRegistryKey*/ )
-{
-    // Set default return value for this operation - if it failed.
-    void* pReturn = NULL ;
-
-    if  (
-            ( pImplementationName   !=  NULL ) &&
-            ( pServiceManager       !=  NULL )
-        )
-    {
-        // Define variables which are used in following macros.
-        Reference< XSingleServiceFactory >   xFactory                                                                                                ;
-        Reference< XMultiServiceFactory >    xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
-
-        if( SwFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
-        {
-            xFactory = ::cppu::createSingleFactory( xServiceManager,
-            SwFilterDetect::impl_getStaticImplementationName(),
-            SwFilterDetect::impl_createInstance,
-            SwFilterDetect::impl_getStaticSupportedServiceNames() );
-        }
-
-        // Factory is valid - service was found.
-        if ( xFactory.is() )
-        {
-            xFactory->acquire();
-            pReturn = xFactory.get();
-        }
-    }
-
-    // Return with result of this operation.
-    return pReturn ;
-}
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index eff1d64..ed91a6d 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -34,7 +34,7 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using utl::MediaDescriptor;
 
-SwFilterDetect::SwFilterDetect( const Reference < XMultiServiceFactory >& /*xFactory*/ )
+SwFilterDetect::SwFilterDetect()
 {
 }
 
@@ -144,10 +144,11 @@ OUString SwFilterDetect::impl_getStaticImplementationName()
     return OUString("com.sun.star.comp.writer.FormatDetector" );
 }
 
-/* Helper for registry */
-Reference< XInterface > SAL_CALL SwFilterDetect::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( Exception )
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+com_sun_star_comp_writer_FormatDetector_get_implementation(::com::sun::star::uno::XComponentContext* component,
+                                                           ::com::sun::star::uno::Sequence<css::uno::Any> const &)
 {
-    return Reference< XInterface >( *new SwFilterDetect( xServiceManager ) );
+    return cppu::acquire(new SwFilterDetect());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/uno/swdetect.hxx b/sw/source/ui/uno/swdetect.hxx
index ea28ccf..eba0753 100644
--- a/sw/source/ui/uno/swdetect.hxx
+++ b/sw/source/ui/uno/swdetect.hxx
@@ -58,10 +58,17 @@ class SfxFilter;
 class SwFilterDetect : public ::cppu::WeakImplHelper2< css::document::XExtendedFilterDetection, css::lang::XServiceInfo >
 {
 public:
-                            SwFilterDetect( const css::uno::Reference < css::lang::XMultiServiceFactory >& xFactory );
+                            SwFilterDetect();
     virtual                 ~SwFilterDetect();
 
-    SFX_DECL_XSERVICEINFO_NOFACTORY
+    /* XServiceInfo */
+    virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+    virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+    /* Helper for XServiceInfo */
+    static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
+    static OUString impl_getStaticImplementationName();
 
     // XExtendedFilterDetect
     virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
diff --git a/sw/util/swd.component b/sw/util/swd.component
index a342f05..e09b385 100644
--- a/sw/util/swd.component
+++ b/sw/util/swd.component
@@ -19,7 +19,8 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     prefix="swd" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.writer.FormatDetector">
+    <implementation name="com.sun.star.comp.writer.FormatDetector"
+        constructor="com_sun_star_comp_writer_FormatDetector_get_implementation">
     <service name="com.sun.star.frame.ExtendedTypeDetection"/>
     <service name="com.sun.star.text.FormatDetector"/>
     <service name="com.sun.star.text.W4WFormatDetector"/>


More information about the Libreoffice-commits mailing list