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@redhat.com>
This commit is contained in:
parent
50a0cca89b
commit
94fc8ec1b1
@ -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 \
|
||||
))
|
||||
|
||||
|
@ -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: */
|
@ -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: */
|
||||
|
@ -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;
|
||||
|
@ -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"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user