summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock@collabora.com>2015-03-02 15:47:28 +1100
committerStephan Bergmann <sbergman@redhat.com>2015-03-11 22:32:35 +0100
commit53ca3f6f9e006b6cc584be17fe8971ffa67f5721 (patch)
tree397c4d06ea93e4cf9d84976989274d13e12da5f3
parentbetter way to check for empty strings (diff)
downloadcore-53ca3f6f9e006b6cc584be17fe8971ffa67f5721.tar.gz
core-53ca3f6f9e006b6cc584be17fe8971ffa67f5721.zip
sd: use constructor syntax for sdd.component
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, with small fix to com_sun_star_comp_draw_FormatDetector_get_implementation signature Change-Id: Idf42503710f2ac536c620c80f8b5e21c3704389d
-rw-r--r--sd/Library_sdd.mk1
-rw-r--r--sd/source/ui/unoidl/detreg.cxx71
-rw-r--r--sd/source/ui/unoidl/sddetect.cxx23
-rw-r--r--sd/source/ui/unoidl/sddetect.hxx8
-rw-r--r--sd/util/sdd.component3
5 files changed, 14 insertions, 92 deletions
diff --git a/sd/Library_sdd.mk b/sd/Library_sdd.mk
index 272602378e87..cfabf2218b53 100644
--- a/sd/Library_sdd.mk
+++ b/sd/Library_sdd.mk
@@ -34,7 +34,6 @@ $(eval $(call gb_Library_use_libraries,sdd,\
$(eval $(call gb_Library_set_componentfile,sdd,sd/util/sdd))
$(eval $(call gb_Library_add_exception_objects,sdd,\
- sd/source/ui/unoidl/detreg \
sd/source/ui/unoidl/sddetect \
))
diff --git a/sd/source/ui/unoidl/detreg.cxx b/sd/source/ui/unoidl/detreg.cxx
deleted file mode 100644
index 791f3993bf5d..000000000000
--- a/sd/source/ui/unoidl/detreg.cxx
+++ /dev/null
@@ -1,71 +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 "sddetect.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/uno/Sequence.h>
-#include <rtl/ustring.hxx>
-#include "sal/types.h"
-
-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 sdd_component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* )
-{
- // 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( SdFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SdFilterDetect::impl_getStaticImplementationName(),
- SdFilterDetect::impl_createInstance,
- SdFilterDetect::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/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
index 81b7da2241c9..f2e2a714e896 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -41,7 +41,7 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using utl::MediaDescriptor;
-SdFilterDetect::SdFilterDetect( const Reference < XMultiServiceFactory >& )
+SdFilterDetect::SdFilterDetect()
{
}
@@ -135,7 +135,7 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes
// XServiceInfo
OUString SAL_CALL SdFilterDetect::getImplementationName() throw( RuntimeException, std::exception )
{
- return impl_getStaticImplementationName();
+ return OUString( "com.sun.star.comp.draw.FormatDetector" );
}
// XServiceInfo
@@ -147,28 +147,17 @@ sal_Bool SAL_CALL SdFilterDetect::supportsService( const OUString& sServiceName
// XServiceInfo
Sequence< OUString > SAL_CALL SdFilterDetect::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
- return impl_getStaticSupportedServiceNames();
-}
-
-// Helper for XServiceInfo
-Sequence< OUString > SdFilterDetect::impl_getStaticSupportedServiceNames()
-{
Sequence< OUString > seqServiceNames( 1 );
seqServiceNames.getArray() [0] = "com.sun.star.frame.ExtendedTypeDetection" ;
return seqServiceNames ;
}
-// Helper for XServiceInfo
-OUString SdFilterDetect::impl_getStaticImplementationName()
-{
- return OUString( "com.sun.star.comp.draw.FormatDetector" );
-}
-// Helper for registry
-Reference< XInterface > SAL_CALL SdFilterDetect::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( Exception )
+extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
+com_sun_star_comp_draw_FormatDetector_get_implementation(::com::sun::star::uno::XComponentContext*,
+ ::com::sun::star::uno::Sequence<css::uno::Any> const &)
{
- return static_cast< cppu::OWeakObject * >(
- new SdFilterDetect( xServiceManager ) );
+ return cppu::acquire(new SdFilterDetect());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/sddetect.hxx b/sd/source/ui/unoidl/sddetect.hxx
index 68eb990a682c..13fb23d1c6a7 100644
--- a/sd/source/ui/unoidl/sddetect.hxx
+++ b/sd/source/ui/unoidl/sddetect.hxx
@@ -53,10 +53,14 @@ namespace com
class SdFilterDetect : public ::cppu::WeakImplHelper2< css::document::XExtendedFilterDetection, css::lang::XServiceInfo >
{
public:
- SdFilterDetect( const css::uno::Reference < css::lang::XMultiServiceFactory >& xFactory );
+ SdFilterDetect();
virtual ~SdFilterDetect();
- 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;
// XExtendedFilterDetect
diff --git a/sd/util/sdd.component b/sd/util/sdd.component
index 9899c985d6cc..85d8120d85ac 100644
--- a/sd/util/sdd.component
+++ b/sd/util/sdd.component
@@ -19,7 +19,8 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="sdd" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.draw.FormatDetector">
+ <implementation name="com.sun.star.comp.draw.FormatDetector"
+ constructor="com_sun_star_comp_draw_FormatDetector_get_implementation">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation>
</component>