1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/log.hxx>
21 #include <osl/diagnose.h>
22 #include <osl/mutex.hxx>
23 #include <cppuhelper/basemutex.hxx>
24 #include <cppuhelper/weak.hxx>
25 #include <cppuhelper/compbase.hxx>
26 #include <cppuhelper/factory.hxx>
27 #include <cppuhelper/implbase.hxx>
28 #include <cppuhelper/queryinterface.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <rtl/unload.h>
32 #include <cppuhelper/propshlp.hxx>
33 #include <o3tl/string_view.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
37 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/loader/XImplementationLoader.hpp>
41 #include <com/sun/star/lang/XComponent.hpp>
42 #include <com/sun/star/lang/IllegalArgumentException.hpp>
43 #include <com/sun/star/uno/XUnloadingPreference.hpp>
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
51 using namespace com::sun::star
;
52 using namespace com::sun::star::uno
;
53 using namespace com::sun::star::lang
;
54 using namespace com::sun::star::loader
;
55 using namespace com::sun::star::registry
;
62 class OFactoryComponentHelper
63 : public cppu::BaseMutex
64 , public WeakComponentImplHelper
<
66 XSingleServiceFactory
,
67 lang::XSingleComponentFactory
,
71 OFactoryComponentHelper(
72 const Reference
<XMultiServiceFactory
> & rServiceManager
,
73 OUString aImplementationName_
,
74 ComponentInstantiation pCreateFunction_
,
75 ComponentFactoryFunc fptr
,
76 const Sequence
< OUString
> * pServiceNames_
,
78 : WeakComponentImplHelper( m_aMutex
)
79 , bOneInstance( bOneInstance_
)
80 , xSMgr( rServiceManager
)
81 , pCreateFunction( pCreateFunction_
)
83 , aImplementationName(std::move( aImplementationName_
))
86 aServiceNames
= *pServiceNames_
;
89 // XSingleServiceFactory
90 Reference
<XInterface
> SAL_CALL
createInstance() override
;
91 Reference
<XInterface
> SAL_CALL
createInstanceWithArguments( const Sequence
<Any
>& Arguments
) override
;
92 // XSingleComponentFactory
93 virtual Reference
< XInterface
> SAL_CALL
createInstanceWithContext(
94 Reference
< XComponentContext
> const & xContext
) override
;
95 virtual Reference
< XInterface
> SAL_CALL
createInstanceWithArgumentsAndContext(
96 Sequence
< Any
> const & rArguments
,
97 Reference
< XComponentContext
> const & xContext
) override
;
100 OUString SAL_CALL
getImplementationName() override
;
101 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
102 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
105 virtual Sequence
< Type
> SAL_CALL
getTypes() override
;
107 // XUnloadingPreference
108 virtual sal_Bool SAL_CALL
releaseOnNotification() override
;
110 // WeakComponentImplHelper
111 void SAL_CALL
disposing() override
;
114 css::uno::Reference
<css::uno::XInterface
> createInstanceWithArgumentsEveryTime(
115 css::uno::Sequence
<css::uno::Any
> const & rArguments
,
116 css::uno::Reference
<css::uno::XComponentContext
> const & xContext
);
118 Reference
<XInterface
> xTheInstance
;
121 // needed for implementing XUnloadingPreference in inheriting classes
122 bool isOneInstance() const {return bOneInstance
;}
123 bool isInstance() const {return xTheInstance
.is();}
126 * Create an instance specified by the factory. The one instance logic is implemented
127 * in the createInstance and createInstanceWithArguments methods.
128 * @return the newly created instance. Do not return a previous (one instance) instance.
129 * @throw css::uno::Exception
130 * @throw css::uno::RuntimeException
132 virtual Reference
<XInterface
> createInstanceEveryTime(
133 Reference
< XComponentContext
> const & xContext
);
135 Reference
<XMultiServiceFactory
> xSMgr
;
136 ComponentInstantiation pCreateFunction
;
137 ComponentFactoryFunc m_fptr
;
138 Sequence
< OUString
> aServiceNames
;
139 OUString aImplementationName
;
145 Sequence
< Type
> OFactoryComponentHelper::getTypes()
148 ar
[ 0 ] = cppu::UnoType
<XSingleServiceFactory
>::get();
149 ar
[ 1 ] = cppu::UnoType
<XServiceInfo
>::get();
150 ar
[ 2 ] = cppu::UnoType
<XUnloadingPreference
>::get();
153 ar
[ 3 ] = cppu::UnoType
<XSingleComponentFactory
>::get();
155 return Sequence
< Type
>( ar
, m_fptr
? 4 : 3 );
158 // OFactoryComponentHelper
159 Reference
<XInterface
> OFactoryComponentHelper::createInstanceEveryTime(
160 Reference
< XComponentContext
> const & xContext
)
164 return (*m_fptr
)( xContext
);
166 if( pCreateFunction
)
170 Reference
< lang::XMultiServiceFactory
> xContextMgr(
171 xContext
->getServiceManager(), UNO_QUERY
);
172 if (xContextMgr
.is())
173 return (*pCreateFunction
)( xContextMgr
);
175 return (*pCreateFunction
)( xSMgr
);
177 return Reference
< XInterface
>();
180 // XSingleServiceFactory
181 Reference
<XInterface
> OFactoryComponentHelper::createInstance()
185 if( !xTheInstance
.is() )
187 MutexGuard
aGuard( m_aMutex
);
188 if( !xTheInstance
.is() )
189 xTheInstance
= createInstanceEveryTime( Reference
< XComponentContext
>() );
193 return createInstanceEveryTime( Reference
< XComponentContext
>() );
196 Reference
<XInterface
> OFactoryComponentHelper::createInstanceWithArguments(
197 const Sequence
<Any
>& Arguments
)
201 if( !xTheInstance
.is() )
203 MutexGuard
aGuard( m_aMutex
);
204 // OSL_ENSURE( !xTheInstance.is(), "### arguments will be ignored!" );
205 if( !xTheInstance
.is() )
206 xTheInstance
= createInstanceWithArgumentsEveryTime(
207 Arguments
, Reference
< XComponentContext
>() );
211 return createInstanceWithArgumentsEveryTime( Arguments
, Reference
< XComponentContext
>() );
214 // XSingleComponentFactory
216 Reference
< XInterface
> OFactoryComponentHelper::createInstanceWithContext(
217 Reference
< XComponentContext
> const & xContext
)
221 if( !xTheInstance
.is() )
223 MutexGuard
aGuard( m_aMutex
);
224 // OSL_ENSURE( !xTheInstance.is(), "### context will be ignored!" );
225 if( !xTheInstance
.is() )
226 xTheInstance
= createInstanceEveryTime( xContext
);
230 return createInstanceEveryTime( xContext
);
233 Reference
< XInterface
> OFactoryComponentHelper::createInstanceWithArgumentsAndContext(
234 Sequence
< Any
> const & rArguments
,
235 Reference
< XComponentContext
> const & xContext
)
239 if( !xTheInstance
.is() )
241 MutexGuard
aGuard( m_aMutex
);
242 // OSL_ENSURE( !xTheInstance.is(), "### context and arguments will be ignored!" );
243 if( !xTheInstance
.is() )
244 xTheInstance
= createInstanceWithArgumentsEveryTime( rArguments
, xContext
);
248 return createInstanceWithArgumentsEveryTime( rArguments
, xContext
);
251 css::uno::Reference
<css::uno::XInterface
>
252 OFactoryComponentHelper::createInstanceWithArgumentsEveryTime(
253 css::uno::Sequence
<css::uno::Any
> const & rArguments
,
254 css::uno::Reference
<css::uno::XComponentContext
> const & xContext
)
256 Reference
< XInterface
> xRet( createInstanceEveryTime( xContext
) );
258 Reference
< lang::XInitialization
> xInit( xRet
, UNO_QUERY
);
259 // always call initialize, even if there are no arguments. #i63511#
262 xInit
->initialize( rArguments
);
266 if ( rArguments
.hasElements() )
268 // dispose the here created UNO object before throwing out exception
269 // to avoid risk of memory leaks #i113722#
270 Reference
<XComponent
> xComp( xRet
, UNO_QUERY
);
274 throw lang::IllegalArgumentException(
275 "cannot pass arguments to component => no XInitialization implemented!",
276 Reference
< XInterface
>(), 0 );
284 // WeakComponentImplHelper
285 void OFactoryComponentHelper::disposing()
287 Reference
<XInterface
> x
;
289 // do not delete in the guard section
290 MutexGuard
aGuard( m_aMutex
);
292 xTheInstance
.clear();
294 // if it is a component call dispose at the component
295 Reference
<XComponent
> xComp( x
, UNO_QUERY
);
301 OUString
OFactoryComponentHelper::getImplementationName()
303 return aImplementationName
;
307 sal_Bool
OFactoryComponentHelper::supportsService(
308 const OUString
& ServiceName
)
310 return cppu::supportsService(this, ServiceName
);
314 Sequence
< OUString
> OFactoryComponentHelper::getSupportedServiceNames()
316 return aServiceNames
;
319 // XUnloadingPreference
320 // This class is used for single factories, component factories and
321 // one-instance factories. Depending on the usage this function has
322 // to return different values.
323 // one-instance factory: sal_False
324 // single factory: sal_True
325 // component factory: sal_True
326 sal_Bool SAL_CALL
OFactoryComponentHelper::releaseOnNotification()
335 class ORegistryFactoryHelper
: public OFactoryComponentHelper
,
336 public OPropertySetHelper
340 ORegistryFactoryHelper(
341 const Reference
<XMultiServiceFactory
> & rServiceManager
,
342 const OUString
& rImplementationName_
,
343 const Reference
<XRegistryKey
> & xImplementationKey_
,
345 : OFactoryComponentHelper(
346 rServiceManager
, rImplementationName_
, nullptr, nullptr, nullptr, bOneInstance_
),
347 OPropertySetHelper( WeakComponentImplHelper::rBHelper
),
348 xImplementationKey( xImplementationKey_
)
352 virtual Any SAL_CALL
queryInterface( Type
const & type
) override
;
353 virtual void SAL_CALL
acquire() noexcept override
;
354 virtual void SAL_CALL
release() noexcept override
;
356 virtual Sequence
< Type
> SAL_CALL
getTypes() override
;
358 virtual Reference
< beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
360 // OPropertySetHelper
361 virtual IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
362 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
363 Any
& rConvertedValue
, Any
& rOldValue
,
364 sal_Int32 nHandle
, Any
const & rValue
) override
;
365 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
366 sal_Int32 nHandle
, Any
const & rValue
) override
;
367 using OPropertySetHelper::getFastPropertyValue
;
368 virtual void SAL_CALL
getFastPropertyValue(
369 Any
& rValue
, sal_Int32 nHandle
) const override
;
371 // OFactoryComponentHelper
372 Reference
<XInterface
> createInstanceEveryTime(
373 Reference
< XComponentContext
> const & xContext
) override
;
375 // XSingleServiceFactory
376 Reference
<XInterface
> SAL_CALL
createInstanceWithArguments(const Sequence
<Any
>& Arguments
) override
;
377 // XSingleComponentFactory
378 Reference
< XInterface
> SAL_CALL
createInstanceWithArgumentsAndContext(
379 Sequence
< Any
> const & rArguments
,
380 Reference
< XComponentContext
> const & xContext
) override
;
383 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
384 // XUnloadingPreference
385 sal_Bool SAL_CALL
releaseOnNotification() override
;
389 /// @throws css::uno::Exception
390 /// @throws css::uno::RuntimeException
391 Reference
< XInterface
> createModuleFactory();
393 /** The registry key of the implementation section */
394 Reference
<XRegistryKey
> xImplementationKey
;
395 /** The factory created with the loader. */
396 Reference
<XSingleComponentFactory
> xModuleFactory
;
397 Reference
<XSingleServiceFactory
> xModuleFactoryDepr
;
398 Reference
< beans::XPropertySetInfo
> m_xInfo
;
399 std::unique_ptr
< IPropertyArrayHelper
> m_property_array_helper
;
401 using OPropertySetHelper::getTypes
;
408 Any SAL_CALL
ORegistryFactoryHelper::queryInterface(
411 Any
ret( OFactoryComponentHelper::queryInterface( type
) );
414 return OPropertySetHelper::queryInterface( type
);
418 void ORegistryFactoryHelper::acquire() noexcept
420 OFactoryComponentHelper::acquire();
424 void ORegistryFactoryHelper::release() noexcept
426 OFactoryComponentHelper::release();
431 Sequence
< Type
> ORegistryFactoryHelper::getTypes()
433 Sequence
< Type
> types( OFactoryComponentHelper::getTypes() );
434 sal_Int32 pos
= types
.getLength();
435 types
.realloc( pos
+ 3 );
436 Type
* p
= types
.getArray();
437 p
[ pos
++ ] = cppu::UnoType
<beans::XMultiPropertySet
>::get();
438 p
[ pos
++ ] = cppu::UnoType
<beans::XFastPropertySet
>::get();
439 p
[ pos
++ ] = cppu::UnoType
<beans::XPropertySet
>::get();
445 Reference
< beans::XPropertySetInfo
>
446 ORegistryFactoryHelper::getPropertySetInfo()
448 ::osl::MutexGuard
guard( m_aMutex
);
450 m_xInfo
= createPropertySetInfo( getInfoHelper() );
454 // OPropertySetHelper
456 IPropertyArrayHelper
& ORegistryFactoryHelper::getInfoHelper()
458 ::osl::MutexGuard
guard( m_aMutex
);
459 if (m_property_array_helper
== nullptr)
461 beans::Property
prop(
462 "ImplementationKey" /* name */,
464 cppu::UnoType
<decltype(xImplementationKey
)>::get(),
465 beans::PropertyAttribute::READONLY
|
466 beans::PropertyAttribute::OPTIONAL
);
467 m_property_array_helper
.reset(
468 new ::cppu::OPropertyArrayHelper( &prop
, 1 ) );
470 return *m_property_array_helper
;
474 sal_Bool
ORegistryFactoryHelper::convertFastPropertyValue(
475 Any
&, Any
&, sal_Int32
, Any
const & )
477 OSL_FAIL( "unexpected!" );
482 void ORegistryFactoryHelper::setFastPropertyValue_NoBroadcast(
483 sal_Int32
, Any
const & )
485 throw beans::PropertyVetoException(
486 "unexpected: only readonly properties!",
487 static_cast< OWeakObject
* >(this) );
491 void ORegistryFactoryHelper::getFastPropertyValue(
492 Any
& rValue
, sal_Int32 nHandle
) const
496 rValue
<<= xImplementationKey
;
501 throw beans::UnknownPropertyException(
502 "unknown property!", static_cast< OWeakObject
* >(
503 const_cast< ORegistryFactoryHelper
* >(this) ) );
507 Reference
<XInterface
> ORegistryFactoryHelper::createInstanceEveryTime(
508 Reference
< XComponentContext
> const & xContext
)
510 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
512 Reference
< XInterface
> x( createModuleFactory() );
515 MutexGuard
aGuard( m_aMutex
);
516 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
518 xModuleFactory
.set( x
, UNO_QUERY
);
519 xModuleFactoryDepr
.set( x
, UNO_QUERY
);
523 if( xModuleFactory
.is() )
525 return xModuleFactory
->createInstanceWithContext( xContext
);
527 if( xModuleFactoryDepr
.is() )
529 return xModuleFactoryDepr
->createInstance();
532 return Reference
<XInterface
>();
535 Reference
<XInterface
> SAL_CALL
ORegistryFactoryHelper::createInstanceWithArguments(
536 const Sequence
<Any
>& Arguments
)
538 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
540 Reference
< XInterface
> x( createModuleFactory() );
543 MutexGuard
aGuard( m_aMutex
);
544 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
546 xModuleFactory
.set( x
, UNO_QUERY
);
547 xModuleFactoryDepr
.set( x
, UNO_QUERY
);
551 if( xModuleFactoryDepr
.is() )
553 return xModuleFactoryDepr
->createInstanceWithArguments( Arguments
);
555 if( xModuleFactory
.is() )
557 SAL_INFO("cppuhelper", "no context ORegistryFactoryHelper::createInstanceWithArgumentsAndContext()!");
558 return xModuleFactory
->createInstanceWithArgumentsAndContext( Arguments
, Reference
< XComponentContext
>() );
561 return Reference
<XInterface
>();
564 Reference
< XInterface
> ORegistryFactoryHelper::createInstanceWithArgumentsAndContext(
565 Sequence
< Any
> const & rArguments
,
566 Reference
< XComponentContext
> const & xContext
)
568 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
570 Reference
< XInterface
> x( createModuleFactory() );
573 MutexGuard
aGuard( m_aMutex
);
574 if( !xModuleFactory
.is() && !xModuleFactoryDepr
.is() )
576 xModuleFactory
.set( x
, UNO_QUERY
);
577 xModuleFactoryDepr
.set( x
, UNO_QUERY
);
581 if( xModuleFactory
.is() )
583 return xModuleFactory
->createInstanceWithArgumentsAndContext( rArguments
, xContext
);
585 if( xModuleFactoryDepr
.is() )
587 SAL_INFO_IF(xContext
.is(), "cppuhelper", "ignoring context calling ORegistryFactoryHelper::createInstanceWithArgumentsAndContext()!");
588 return xModuleFactoryDepr
->createInstanceWithArguments( rArguments
);
591 return Reference
<XInterface
>();
595 Reference
< XInterface
> ORegistryFactoryHelper::createModuleFactory()
597 OUString aActivatorUrl
;
598 OUString aActivatorName
;
601 Reference
<XRegistryKey
> xActivatorKey
= xImplementationKey
->openKey(
603 if( xActivatorKey
.is() && xActivatorKey
->getValueType() == RegistryValueType_ASCII
)
605 aActivatorUrl
= xActivatorKey
->getAsciiValue();
607 aActivatorName
= o3tl::getToken(aActivatorUrl
, 0, ':');
609 Reference
<XRegistryKey
> xLocationKey
= xImplementationKey
->openKey(
611 if( xLocationKey
.is() && xLocationKey
->getValueType() == RegistryValueType_ASCII
)
612 aLocation
= xLocationKey
->getAsciiValue();
617 // the location of the program code of the implementation
618 Reference
<XRegistryKey
> xLocationKey
= xImplementationKey
->openKey(
620 // is the key of the right type ?
621 if( xLocationKey
.is() && xLocationKey
->getValueType() == RegistryValueType_ASCII
)
623 // one implementation found -> try to activate
624 aLocation
= xLocationKey
->getAsciiValue();
626 // search protocol delimiter
627 sal_Int32 nPos
= aLocation
.indexOf("://");
630 aActivatorName
= aLocation
.subView( 0, nPos
);
631 if( aActivatorName
== u
"java" )
632 aActivatorName
= u
"com.sun.star.loader.Java"_ustr
;
633 else if( aActivatorName
== u
"module" )
634 aActivatorName
= u
"com.sun.star.loader.SharedLibrary"_ustr
;
635 aLocation
= aLocation
.copy( nPos
+ 3 );
640 Reference
< XInterface
> xFactory
;
641 if( !aActivatorName
.isEmpty() )
643 Reference
<XInterface
> x
= xSMgr
->createInstance( aActivatorName
);
644 Reference
<XImplementationLoader
> xLoader( x
, UNO_QUERY
);
647 xFactory
= xLoader
->activate( aImplementationName
, aActivatorUrl
, aLocation
, xImplementationKey
);
654 Sequence
< OUString
> ORegistryFactoryHelper::getSupportedServiceNames()
656 MutexGuard
aGuard( m_aMutex
);
657 if( !aServiceNames
.hasElements() )
662 Reference
<XRegistryKey
> xKey
= xImplementationKey
->openKey( "UNO/SERVICES" );
666 // length of prefix. +1 for the '/' at the end
667 sal_Int32 nPrefixLen
= xKey
->getKeyName().getLength() + 1;
669 // Full qualified names like "IMPLEMENTATIONS/TEST/UNO/SERVICES/com.sun.star..."
670 Sequence
<OUString
> seqKeys
= xKey
->getKeyNames();
671 for( OUString
& key
: asNonConstRange(seqKeys
) )
672 key
= key
.copy(nPrefixLen
);
674 aServiceNames
= seqKeys
;
677 catch (InvalidRegistryException
&)
681 return aServiceNames
;
684 sal_Bool SAL_CALL
ORegistryFactoryHelper::releaseOnNotification()
687 if( isOneInstance() && isInstance())
691 else if( ! isOneInstance())
694 if( xModuleFactory
.is())
696 Reference
<XUnloadingPreference
> xunloading( xModuleFactory
, UNO_QUERY
);
698 retVal
= xunloading
->releaseOnNotification();
700 else if( xModuleFactoryDepr
.is())
702 Reference
<XUnloadingPreference
> xunloading( xModuleFactoryDepr
, UNO_QUERY
);
704 retVal
= xunloading
->releaseOnNotification();
712 class OFactoryProxyHelper
: public WeakImplHelper
< XServiceInfo
, XSingleServiceFactory
,
713 XUnloadingPreference
>
715 Reference
<XSingleServiceFactory
> xFactory
;
719 explicit OFactoryProxyHelper( const Reference
<XSingleServiceFactory
> & rFactory
)
720 : xFactory( rFactory
)
723 // XSingleServiceFactory
724 Reference
<XInterface
> SAL_CALL
createInstance() override
;
725 Reference
<XInterface
> SAL_CALL
createInstanceWithArguments(const Sequence
<Any
>& Arguments
) override
;
728 OUString SAL_CALL
getImplementationName() override
;
729 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
730 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
731 //XUnloadingPreference
732 sal_Bool SAL_CALL
releaseOnNotification() override
;
738 // XSingleServiceFactory
739 Reference
<XInterface
> OFactoryProxyHelper::createInstance()
741 return xFactory
->createInstance();
744 // XSingleServiceFactory
745 Reference
<XInterface
> OFactoryProxyHelper::createInstanceWithArguments
747 const Sequence
<Any
>& Arguments
750 return xFactory
->createInstanceWithArguments( Arguments
);
754 OUString
OFactoryProxyHelper::getImplementationName()
756 Reference
<XServiceInfo
> xInfo( xFactory
, UNO_QUERY
);
758 return xInfo
->getImplementationName();
763 sal_Bool
OFactoryProxyHelper::supportsService(const OUString
& ServiceName
)
765 return cppu::supportsService(this, ServiceName
);
769 Sequence
< OUString
> OFactoryProxyHelper::getSupportedServiceNames()
771 Reference
<XServiceInfo
> xInfo( xFactory
, UNO_QUERY
);
773 return xInfo
->getSupportedServiceNames();
774 return Sequence
< OUString
>();
777 sal_Bool SAL_CALL
OFactoryProxyHelper::releaseOnNotification()
780 Reference
<XUnloadingPreference
> pref( xFactory
, UNO_QUERY
);
782 return pref
->releaseOnNotification();
787 Reference
<XSingleServiceFactory
> SAL_CALL
createSingleFactory(
788 const Reference
<XMultiServiceFactory
> & rServiceManager
,
789 const OUString
& rImplementationName
,
790 ComponentInstantiation pCreateFunction
,
791 const Sequence
< OUString
> & rServiceNames
,
794 return new OFactoryComponentHelper(
795 rServiceManager
, rImplementationName
, pCreateFunction
, nullptr, &rServiceNames
, false );
799 Reference
<XSingleServiceFactory
> SAL_CALL
createFactoryProxy(
800 SAL_UNUSED_PARAMETER
const Reference
<XMultiServiceFactory
> &,
801 const Reference
<XSingleServiceFactory
> & rFactory
)
803 return new OFactoryProxyHelper( rFactory
);
807 Reference
<XSingleServiceFactory
> SAL_CALL
createOneInstanceFactory(
808 const Reference
<XMultiServiceFactory
> & rServiceManager
,
809 const OUString
& rImplementationName
,
810 ComponentInstantiation pCreateFunction
,
811 const Sequence
< OUString
> & rServiceNames
,
814 return new OFactoryComponentHelper(
815 rServiceManager
, rImplementationName
, pCreateFunction
, nullptr, &rServiceNames
, true );
819 Reference
<XSingleServiceFactory
> SAL_CALL
createSingleRegistryFactory(
820 const Reference
<XMultiServiceFactory
> & rServiceManager
,
821 const OUString
& rImplementationName
,
822 const Reference
<XRegistryKey
> & rImplementationKey
)
824 return new ORegistryFactoryHelper(
825 rServiceManager
, rImplementationName
, rImplementationKey
, false );
829 Reference
<XSingleServiceFactory
> SAL_CALL
createOneInstanceRegistryFactory(
830 const Reference
<XMultiServiceFactory
> & rServiceManager
,
831 const OUString
& rImplementationName
,
832 const Reference
<XRegistryKey
> & rImplementationKey
)
834 return new ORegistryFactoryHelper(
835 rServiceManager
, rImplementationName
, rImplementationKey
, true );
839 Reference
< lang::XSingleComponentFactory
> SAL_CALL
createSingleComponentFactory(
840 ComponentFactoryFunc fptr
,
841 OUString
const & rImplementationName
,
842 Sequence
< OUString
> const & rServiceNames
,
845 return new OFactoryComponentHelper(
846 Reference
< XMultiServiceFactory
>(), rImplementationName
, nullptr, fptr
, &rServiceNames
, false );
849 Reference
< lang::XSingleComponentFactory
> SAL_CALL
createOneInstanceComponentFactory(
850 ComponentFactoryFunc fptr
,
851 OUString
const & rImplementationName
,
852 Sequence
< OUString
> const & rServiceNames
,
855 return new OFactoryComponentHelper(
856 Reference
< XMultiServiceFactory
>(), rImplementationName
, nullptr, fptr
, &rServiceNames
, true );
862 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */