19#include <unordered_map>
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/beans/XPropertySetInfo.hpp>
25#include <com/sun/star/container/XContentEnumerationAccess.hpp>
26#include <com/sun/star/container/XSet.hpp>
27#include <com/sun/star/lang/XEventListener.hpp>
28#include <com/sun/star/lang/XInitialization.hpp>
29#include <com/sun/star/lang/XMultiComponentFactory.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <com/sun/star/lang/XServiceInfo.hpp>
32#include <com/sun/star/uno/Reference.hxx>
33#include <compbase2.hxx>
34#include <rtl/ustring.hxx>
37 class XSingleComponentFactory;
39namespace cppu {
struct ContextEntry_Init; }
40namespace com :: sun :: star :: lang {
class XSingleServiceFactory; }
41namespace com :: sun :: star ::
uno {
class XComponentContext; }
50 css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any>
const &);
54typedef std::function<css::uno::XInterface * (css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any>
const&)>
WrapperConstructorFn;
57 css::lang::XServiceInfo, css::lang::XMultiServiceFactory,
58 css::lang::XMultiComponentFactory, css::container::XSet,
59 css::container::XContentEnumerationAccess, css::beans::XPropertySet,
60 css::beans::XPropertySetInfo, css::lang::XEventListener,
61 css::lang::XInitialization>
74 OUString theName, OUString theLoader,
75 OUString theUri, OUString theEnvironment,
76 OUString theConstructorName,
78 bool theIsSingleInstance,
79 css::uno::Reference< css::uno::XComponentContext > theAlienContext,
90 css::uno::Reference< css::lang::XSingleComponentFactory >
92 css::uno::Reference< css::lang::XSingleServiceFactory >
const &
94 css::uno::Reference< css::lang::XComponent > theComponent):
98 { assert(theFactory1.is() || theFactory2.is()); }
104 css::uno::Reference<css::uno::XComponentContext>
const &
106 bool singletonRequest);
108 css::uno::Reference<css::uno::XInterface>
110 css::uno::Reference<css::uno::XComponentContext>
const &
112 bool singletonRequest,
113 css::uno::Sequence<css::uno::Any>
const & arguments);
142 css::uno::Reference< css::lang::XSingleComponentFactory >
factory1;
143 css::uno::Reference< css::lang::XSingleServiceFactory >
factory2;
154 css::uno::Reference<css::uno::XComponentContext>
const & context);
157 css::uno::Reference<css::uno::XComponentContext>
const & context,
158 css::uno::Sequence<css::uno::Any>
const & arguments);
161 bool singletonRequest,
162 css::uno::Reference<css::uno::XInterface>
const & instance);
165 typedef std::unordered_map< OUString, std::shared_ptr< Implementation > >
170 css::uno::Reference< css::lang::XServiceInfo >,
171 std::shared_ptr< Implementation > >
177 std::vector< std::shared_ptr< Implementation > > >
194 void init(std::u16string_view rdbUris);
197 css::uno::Reference< css::uno::XComponentContext >
const & context)
199 assert(context.is());
205 std::vector< cppu::ContextEntry_Init > * entries);
207 css::uno::Reference< css::uno::XComponentContext >
const &
getContext()
215 css::uno::Reference< css::uno::XComponentContext >
const & context,
216 std::shared_ptr< Data::Implementation >
const & implementation);
221 virtual void disposing(std::unique_lock<std::mutex>&)
override;
227 virtual css::uno::Sequence< OUString > SAL_CALL
230 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstance(
231 OUString
const & aServiceSpecifier)
override;
233 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
235 OUString
const & ServiceSpecifier,
236 css::uno::Sequence< css::uno::Any >
const & Arguments)
override;
238 virtual css::uno::Sequence< OUString > SAL_CALL
241 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
243 OUString
const & aServiceSpecifier,
244 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
246 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
248 OUString
const & ServiceSpecifier,
249 css::uno::Sequence< css::uno::Any >
const & Arguments,
250 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
256 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
259 virtual sal_Bool SAL_CALL
has(css::uno::Any
const & aElement)
override;
261 virtual void SAL_CALL
insert(css::uno::Any
const & aElement)
override;
263 virtual void SAL_CALL
remove(css::uno::Any
const & aElement)
override;
265 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
268 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
272 OUString
const & aPropertyName, css::uno::Any
const & aValue)
override;
275 OUString
const & PropertyName)
override;
278 OUString
const & aPropertyName,
279 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
283 OUString
const & aPropertyName,
284 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
288 OUString
const & PropertyName,
289 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
293 OUString
const & PropertyName,
294 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
297 virtual css::uno::Sequence< css::beans::Property > SAL_CALL
getProperties()
override;
300 OUString
const & aName)
override;
304 virtual void SAL_CALL
disposing(css::lang::EventObject
const & Source)
override;
307 css::uno::Sequence<css::uno::Any>
const & aArguments)
311 css::uno::Reference< css::lang::XComponent >
const & component);
315 void readRdbFile(OUString
const & uri,
bool optional);
321 OUString
const & path);
325 OUString
const & path, std::vector< OUString > * strings);
328 std::vector< OUString >
const & uris,
329 css::uno::Reference< css::uno::XComponentContext >
const &
333 css::uno::Reference< css::lang::XServiceInfo >
const & factoryInfo);
340 css::uno::Reference< css::lang::XServiceInfo >
const & factoryInfo,
341 bool removeListener);
346 css::uno::Reference< css::uno::XComponentContext >
const & context,
347 OUString
const & specifier);
351 css::uno::Reference< css::uno::XComponentContext >
context_;
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
bool readLegacyRdbFile(OUString const &uri)
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
const ServiceManager & operator=(const ServiceManager &)=delete
virtual void SAL_CALL removeVetoableChangeListener(OUString const &PropertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &aListener) override
void loadImplementation(css::uno::Reference< css::uno::XComponentContext > const &context, std::shared_ptr< Data::Implementation > const &implementation)
bool insertExtraData(Data const &extra)
void addSingletonContextEntries(std::vector< cppu::ContextEntry_Init > *entries)
void removeEventListenerFromComponent(css::uno::Reference< css::lang::XComponent > const &component)
virtual void SAL_CALL setPropertyValue(OUString const &aPropertyName, css::uno::Any const &aValue) override
virtual sal_Bool SAL_CALL hasPropertyByName(OUString const &Name) override
virtual void SAL_CALL insert(css::uno::Any const &aElement) override
void insertLegacyFactory(css::uno::Reference< css::lang::XServiceInfo > const &factoryInfo)
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL removePropertyChangeListener(OUString const &aPropertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &aListener) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual ~ServiceManager() override
void readRdbDirectory(std::u16string_view uri, bool optional)
virtual css::beans::Property SAL_CALL getPropertyByName(OUString const &aName) override
virtual void SAL_CALL addVetoableChangeListener(OUString const &PropertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const &aListener) override
void insertRdbFiles(std::vector< OUString > const &uris, css::uno::Reference< css::uno::XComponentContext > const &alientContext)
void readLegacyRdbStrings(std::u16string_view uri, RegistryKey &key, OUString const &path, std::vector< OUString > *strings)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext(OUString const &ServiceSpecifier, css::uno::Sequence< css::uno::Any > const &Arguments, css::uno::Reference< css::uno::XComponentContext > const &Context) override
std::shared_ptr< Data::Implementation > findServiceImplementation(css::uno::Reference< css::uno::XComponentContext > const &context, OUString const &specifier)
void removeImplementation(const OUString &name)
virtual void disposing(std::unique_lock< std::mutex > &) override
Called by dispose for subclasses to do dispose() work.
bool removeLegacyFactory(css::uno::Reference< css::lang::XServiceInfo > const &factoryInfo, bool removeListener)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL has(css::uno::Any const &aElement) override
css::uno::Reference< css::uno::XComponentContext > const & getContext() const
virtual void SAL_CALL remove(css::uno::Any const &aElement) override
void removeRdbFiles(std::vector< OUString > const &uris)
void setContext(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual css::uno::Any SAL_CALL getPropertyValue(OUString const &PropertyName) override
void preloadImplementations()
Used only by LibreOfficeKit when used by Online to pre-initialize.
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(OUString const &aServiceSpecifier) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithContext(OUString const &aServiceSpecifier, css::uno::Reference< css::uno::XComponentContext > const &Context) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(OUString const &ServiceSpecifier, css::uno::Sequence< css::uno::Any > const &Arguments) override
ServiceManager(const ServiceManager &)=delete
virtual void SAL_CALL initialize(css::uno::Sequence< css::uno::Any > const &aArguments) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createContentEnumeration(OUString const &aServiceName) override
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
void readRdbFile(OUString const &uri, bool optional)
css::uno::Reference< css::uno::XComponentContext > context_
OUString readLegacyRdbString(std::u16string_view uri, RegistryKey &key, OUString const &path)
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL addPropertyChangeListener(OUString const &aPropertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const &xListener) override
void init(std::u16string_view rdbUris)
virtual void SAL_CALL release() noexcept override
decreasing m_refCount
virtual void SAL_CALL acquire() noexcept override
increasing m_refCount
This is a straight copy of the include/comphelper/compbase.hxx file, copied here because it is nigh i...
WeakComponentImplHelper2< css::lang::XServiceInfo, css::lang::XMultiServiceFactory, css::lang::XMultiComponentFactory, css::container::XSet, css::container::XContentEnumerationAccess, css::beans::XPropertySet, css::beans::XPropertySetInfo, css::lang::XEventListener, css::lang::XInitialization > ServiceManagerBase
css::uno::XInterface * ImplementationConstructorFn(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
std::function< css::uno::XInterface *(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)> WrapperConstructorFn
css::uno::Reference< css::lang::XComponent > disposeInstance
css::uno::Reference< css::uno::XInterface > createInstanceWithArguments(css::uno::Reference< css::uno::XComponentContext > const &context, bool singletonRequest, css::uno::Sequence< css::uno::Any > const &arguments)
const Implementation & operator=(const Implementation &)=delete
bool shallDispose() const
css::uno::Reference< css::uno::XInterface > doCreateInstanceWithArguments(css::uno::Reference< css::uno::XComponentContext > const &context, css::uno::Sequence< css::uno::Any > const &arguments)
css::uno::Reference< css::uno::XInterface > createInstance(css::uno::Reference< css::uno::XComponentContext > const &context, bool singletonRequest)
Implementation(OUString theName, OUString theLoader, OUString theUri, OUString theEnvironment, OUString theConstructorName, OUString thePrefix, bool theIsSingleInstance, css::uno::Reference< css::uno::XComponentContext > theAlienContext, OUString theRdbFile)
std::vector< OUString > singletons
css::uno::Reference< css::uno::XInterface > doCreateInstance(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::Reference< css::lang::XSingleServiceFactory > factory2
css::uno::Reference< css::lang::XSingleComponentFactory > factory1
Implementation(OUString theName, css::uno::Reference< css::lang::XSingleComponentFactory > const &theFactory1, css::uno::Reference< css::lang::XSingleServiceFactory > const &theFactory2, css::uno::Reference< css::lang::XComponent > theComponent)
Implementation(const Implementation &)=delete
WrapperConstructorFn constructorFn
css::uno::Reference< css::uno::XInterface > singleInstance
css::uno::Reference< css::lang::XComponent > component
void updateDisposeInstance(bool singletonRequest, css::uno::Reference< css::uno::XInterface > const &instance)
css::uno::Reference< css::uno::XComponentContext > alienContext
std::vector< OUString > services
std::unordered_map< OUString, std::shared_ptr< Implementation > > NamedImplementations
ImplementationMap services
DynamicImplementations dynamicImplementations
std::unordered_map< css::uno::Reference< css::lang::XServiceInfo >, std::shared_ptr< Implementation > > DynamicImplementations
const Data & operator=(const Data &)=delete
Data(const Data &)=delete
NamedImplementations namedImplementations
ImplementationMap singletons
std::unordered_map< OUString, std::vector< std::shared_ptr< Implementation > > > ImplementationMap