Kaydet (Commit) 53ca3f6f authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Stephan Bergmann

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
üst 6c6caf02
......@@ -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 \
))
......
/* -*- 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: */
......@@ -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
......@@ -146,29 +146,18 @@ 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: */
......@@ -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
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment