2010-10-14 01:30:07 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-12-05 05:46:50 -06:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 09:29:57 -05:00
|
|
|
#ifndef _CPPUHELPER_FACTORY_HXX_
|
|
|
|
#define _CPPUHELPER_FACTORY_HXX_
|
|
|
|
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
#include <uno/dispatcher.h>
|
2001-05-18 09:34:08 -05:00
|
|
|
#include <rtl/unload.h>
|
|
|
|
|
2001-05-08 09:56:02 -05:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
|
|
|
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
|
2000-09-18 09:29:57 -05:00
|
|
|
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/registry/XRegistryKey.hpp>
|
2011-08-23 07:47:42 -05:00
|
|
|
#include "cppuhelperdllapi.h"
|
2000-09-18 09:29:57 -05:00
|
|
|
|
|
|
|
//##################################################################################################
|
|
|
|
|
|
|
|
#define COMPONENT_GETENV "component_getImplementationEnvironment"
|
2007-05-09 07:24:47 -05:00
|
|
|
#define COMPONENT_GETENVEXT "component_getImplementationEnvironmentExt"
|
2000-09-18 09:29:57 -05:00
|
|
|
#define COMPONENT_GETDESCRIPTION "component_getDescription"
|
|
|
|
#define COMPONENT_WRITEINFO "component_writeInfo"
|
|
|
|
#define COMPONENT_GETFACTORY "component_getFactory"
|
|
|
|
|
|
|
|
typedef struct _uno_Environment uno_Environment;
|
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
/** Function pointer declaration.
|
|
|
|
Function determines the environment of the component implementation, i.e. which compiler
|
|
|
|
compiled it. If the environment is NOT session specific (needs no additional context),
|
|
|
|
then this function should return the environment type name and leave ppEnv (to 0).
|
|
|
|
|
2010-08-30 09:10:01 -05:00
|
|
|
@param ppEnvTypeName environment type name; string must be constant
|
2001-11-09 06:49:16 -06:00
|
|
|
@param ppEnv function returns its environment if the environment is session specific,
|
|
|
|
i.e. has special context
|
|
|
|
*/
|
2000-09-18 09:29:57 -05:00
|
|
|
typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)(
|
|
|
|
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv );
|
|
|
|
|
2007-05-09 07:24:47 -05:00
|
|
|
/** Function pointer declaration.
|
|
|
|
Function determines the environment of the component implementation, i.e. the compiler.
|
|
|
|
If the environment is NOT session specific (needs no additional context),
|
|
|
|
then this function should return the environment type name and leave ppEnv (to 0).
|
|
|
|
|
|
|
|
@param ppEnvTypeName environment type name; string must be a constant
|
|
|
|
@param ppEnv function returns an environment if the environment is session specific,
|
|
|
|
i.e. has special context
|
|
|
|
@param pImplName
|
|
|
|
*/
|
|
|
|
typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
|
|
|
|
sal_Char const ** ppEnvTypeName,
|
|
|
|
uno_Environment ** ppEnv,
|
|
|
|
sal_Char const * pImplName,
|
|
|
|
uno_Environment * pTargetEnv
|
|
|
|
);
|
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
/** Function pointer declaration.
|
|
|
|
Function retrieves a component description.
|
|
|
|
|
|
|
|
@return an XML formatted string containing a short component description
|
2007-06-26 10:45:15 -05:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2000-09-18 09:29:57 -05:00
|
|
|
typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void);
|
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
/** Function pointer declaration.
|
2010-09-10 06:10:07 -05:00
|
|
|
|
2012-01-05 12:40:38 -06:00
|
|
|
@deprecated component_writeInfo should no longer be used in new components
|
2010-09-10 06:10:07 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
Function writes component registry info, at least writing the supported service names.
|
|
|
|
|
|
|
|
@param pServiceManager
|
|
|
|
a service manager (the type is an XMultiServiceFactory that can be used
|
|
|
|
by the environment returned by component_getImplementationEnvironment)
|
|
|
|
@param pRegistryKey a registry key
|
|
|
|
(the type is XRegistryKey that can be used by the environment
|
|
|
|
returned by component_getImplementationEnvironment)
|
|
|
|
@return true if everything went fine
|
|
|
|
*/
|
2000-09-18 09:29:57 -05:00
|
|
|
typedef sal_Bool (SAL_CALL * component_writeInfoFunc)(
|
|
|
|
void * pServiceManager, void * pRegistryKey );
|
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
/** Function pointer declaration.
|
|
|
|
Retrieves a factory to create component instances.
|
|
|
|
|
|
|
|
@param pImplName
|
|
|
|
desired implementation name
|
|
|
|
@param pServiceManager
|
|
|
|
a service manager (the type is XMultiServiceFactory that can be used by the environment
|
|
|
|
returned by component_getImplementationEnvironment)
|
|
|
|
@param pRegistryKey
|
|
|
|
a registry key (the type is XRegistryKey that can be used by the environment
|
|
|
|
returned by component_getImplementationEnvironment)
|
|
|
|
@return acquired component factory
|
|
|
|
(the type is lang::XSingleComponentFactory or lang::XSingleServiceFactory to be used by the
|
|
|
|
environment returned by component_getImplementationEnvironment)
|
|
|
|
*/
|
2000-09-18 09:29:57 -05:00
|
|
|
typedef void * (SAL_CALL * component_getFactoryFunc)(
|
|
|
|
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
|
|
|
|
|
|
|
|
//##################################################################################################
|
|
|
|
|
|
|
|
namespace cppu
|
|
|
|
{
|
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
/** Function pointer declaration.
|
|
|
|
Function creates component instance passing the component context to be used.
|
|
|
|
|
|
|
|
@param xContext component context to be used
|
|
|
|
@return component instance
|
|
|
|
*/
|
2001-05-08 09:56:02 -05:00
|
|
|
typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(
|
|
|
|
SAL_CALL * ComponentFactoryFunc)(
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
|
|
|
|
SAL_THROW( (::com::sun::star::uno::Exception) );
|
|
|
|
|
|
|
|
/** Creates a single component factory supporting the XSingleComponentFactory interface.
|
|
|
|
|
|
|
|
@param fptr function pointer for instanciating the object
|
|
|
|
@param rImplementationName implementation name of service
|
|
|
|
@param rServiceNames supported services
|
2013-04-16 08:34:41 -05:00
|
|
|
@param pModCount a backwards-compatibility remainder of a removed library
|
|
|
|
unloading feature; always set to null
|
2001-05-08 09:56:02 -05:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >
|
2001-05-08 09:56:02 -05:00
|
|
|
SAL_CALL createSingleComponentFactory(
|
|
|
|
ComponentFactoryFunc fptr,
|
|
|
|
::rtl::OUString const & rImplementationName,
|
2001-05-18 09:34:08 -05:00
|
|
|
::com::sun::star::uno::Sequence< ::rtl::OUString > const & rServiceNames,
|
|
|
|
rtl_ModuleCount * pModCount = 0 )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2001-05-08 09:56:02 -05:00
|
|
|
|
2010-03-23 06:51:25 -05:00
|
|
|
/** Creates a single service factory which holds the instance created only once.
|
|
|
|
|
|
|
|
@param fptr function pointer for instanciating the object
|
|
|
|
@param rImplementationName implementation name of service
|
|
|
|
@param rServiceNames supported services
|
2013-04-16 08:34:41 -05:00
|
|
|
@param pModCount a backwards-compatibility remainder of a removed library
|
|
|
|
unloading feature; always set to null
|
2010-03-23 06:51:25 -05:00
|
|
|
|
|
|
|
@see createSingleComponentFactory
|
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > SAL_CALL
|
2010-03-23 06:51:25 -05:00
|
|
|
createOneInstanceComponentFactory(
|
|
|
|
ComponentFactoryFunc fptr,
|
|
|
|
::rtl::OUString const & rImplementationName,
|
|
|
|
::com::sun::star::uno::Sequence< ::rtl::OUString > const & rServiceNames,
|
|
|
|
rtl_ModuleCount * pModCount = 0 )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2010-03-23 06:51:25 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. The type of the instanciate function used as argument of the create*Fcatory functions.
|
2001-11-09 06:49:16 -06:00
|
|
|
|
|
|
|
@see createSingleFactory
|
|
|
|
@see createOneInstanceFactory
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2001-03-09 05:15:28 -06:00
|
|
|
typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(SAL_CALL * ComponentInstantiation)(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager );
|
2000-09-18 09:29:57 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. Creates a single service factory.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@param rServiceManager the service manager used by the implementation.
|
|
|
|
@param rImplementationName the implementation name. An empty string is possible.
|
2012-02-23 09:47:59 -06:00
|
|
|
@param pCreateFunction the function pointer to create an object.
|
|
|
|
@param rServiceNames the service supported by the implementation.
|
2013-04-16 08:34:41 -05:00
|
|
|
@param pModCount a backwards-compatibility remainder of a removed library
|
|
|
|
unloading feature; always set to null.
|
2001-11-09 06:49:16 -06:00
|
|
|
@return a factory that support the interfaces XServiceProvider, XServiceInfo
|
|
|
|
XSingleServiceFactory and XComponent.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@see createOneInstanceFactory
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
|
2001-03-09 05:15:28 -06:00
|
|
|
createSingleFactory(
|
2000-09-18 09:29:57 -05:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
|
|
|
|
const ::rtl::OUString & rImplementationName,
|
|
|
|
ComponentInstantiation pCreateFunction,
|
2001-05-18 09:34:08 -05:00
|
|
|
const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rServiceNames,
|
|
|
|
rtl_ModuleCount * pModCount = 0 )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2000-09-18 09:29:57 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. Creates a factory wrapping another one.
|
2001-11-09 06:49:16 -06:00
|
|
|
This means the methods of the interfaces XServiceProvider, XServiceInfo and
|
|
|
|
XSingleServiceFactory are forwarded.
|
|
|
|
@attention
|
|
|
|
The XComponent interface is not supported!
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@param rServiceManager the service manager used by the implementation.
|
2012-02-25 16:20:44 -06:00
|
|
|
@param rFactory the wrapped service factory.
|
2001-11-09 06:49:16 -06:00
|
|
|
@return a factory that support the interfaces XServiceProvider, XServiceInfo
|
|
|
|
XSingleServiceFactory.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@see createSingleFactory
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
|
2001-03-09 05:15:28 -06:00
|
|
|
createFactoryProxy(
|
2000-09-18 09:29:57 -05:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
|
2001-03-09 05:15:28 -06:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > & rFactory )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2000-09-18 09:29:57 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. Creates a single service factory which holds the instance created only once.
|
2001-11-09 06:49:16 -06:00
|
|
|
|
|
|
|
@param rServiceManager the service manager used by the implementation.
|
2012-02-25 16:20:44 -06:00
|
|
|
@param rComponentName the implementation name. An empty string is possible.
|
2012-02-23 09:47:59 -06:00
|
|
|
@param pCreateFunction the function pointer to create an object.
|
|
|
|
@param rServiceNames the service supported by the implementation.
|
2013-04-16 08:34:41 -05:00
|
|
|
@param pModCount a backwards-compatibility remainder of a removed library
|
|
|
|
unloading feature; always set to null.
|
2001-11-09 06:49:16 -06:00
|
|
|
@return a factory that support the interfaces XServiceProvider, XServiceInfo
|
|
|
|
XSingleServiceFactory and XComponent.
|
|
|
|
|
|
|
|
@see createSingleFactory
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
|
2001-03-09 05:15:28 -06:00
|
|
|
createOneInstanceFactory(
|
2000-09-18 09:29:57 -05:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
|
|
|
|
const ::rtl::OUString & rComponentName,
|
|
|
|
ComponentInstantiation pCreateFunction,
|
2001-05-18 09:34:08 -05:00
|
|
|
const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rServiceNames,
|
|
|
|
rtl_ModuleCount * pModCount = 0 )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2000-09-18 09:29:57 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. Creates a single service factory based on a registry.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@param rServiceManager the service manager used by the implementation.
|
|
|
|
@param rImplementationName the implementation name. An empty string is possible.
|
|
|
|
@param rImplementationKey the registry key of the implementation section.
|
|
|
|
@return a factory that support the interfaces XServiceProvider, XServiceInfo
|
|
|
|
XSingleServiceFactory and XComponent.
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
|
|
|
|
createSingleRegistryFactory(
|
2000-09-18 09:29:57 -05:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
|
|
|
|
const ::rtl::OUString & rImplementationName,
|
2001-03-09 05:15:28 -06:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > & rImplementationKey )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2000-09-18 09:29:57 -05:00
|
|
|
|
2001-12-13 10:35:52 -06:00
|
|
|
/** Deprecated. Creates a single service factory which holds the instance created only once
|
|
|
|
based on a registry.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@param rServiceManager the service manager used by the implementation.
|
2012-02-25 16:20:44 -06:00
|
|
|
@param rComponentName the implementation name. An empty string is possible.
|
2001-11-09 06:49:16 -06:00
|
|
|
@param rImplementationKey the registry key of the implementation section.
|
|
|
|
@return a factory that support the interfaces XServiceProvider, XServiceInfo
|
|
|
|
XSingleServiceFactory and XComponent.
|
2001-05-18 09:34:08 -05:00
|
|
|
|
2001-11-09 06:49:16 -06:00
|
|
|
@see createSingleRegistryFactory
|
2001-12-13 10:35:52 -06:00
|
|
|
@deprecated
|
2001-11-09 06:49:16 -06:00
|
|
|
*/
|
2011-08-23 07:47:42 -05:00
|
|
|
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
|
|
|
|
createOneInstanceRegistryFactory(
|
2000-09-18 09:29:57 -05:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
|
|
|
|
const ::rtl::OUString & rComponentName,
|
2001-03-09 05:15:28 -06:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > & rImplementationKey )
|
2012-01-26 09:00:09 -06:00
|
|
|
SAL_THROW(());
|
2000-09-18 09:29:57 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 01:30:07 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|