20#include <com/sun/star/beans/NamedValue.hpp>
21#include <com/sun/star/beans/PropertyAttribute.hpp>
22#include <com/sun/star/container/ElementExistException.hpp>
23#include <com/sun/star/container/XEnumeration.hpp>
24#include <com/sun/star/container/XNameContainer.hpp>
25#include <com/sun/star/lang/XInitialization.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/lang/XSingleComponentFactory.hpp>
28#include <com/sun/star/lang/XSingleServiceFactory.hpp>
29#include <com/sun/star/loader/XImplementationLoader.hpp>
30#include <com/sun/star/registry/InvalidRegistryException.hpp>
31#include <com/sun/star/uno/DeploymentException.hpp>
32#include <com/sun/star/uno/Reference.hxx>
33#include <com/sun/star/uno/XComponentContext.hpp>
41#include <osl/file.hxx>
42#include <osl/module.hxx>
45#include <rtl/ustring.hxx>
46#include <rtl/ustrbuf.hxx>
48#include <uno/environment.hxx>
49#include <uno/mapping.hxx>
62void insertImplementationMap(
66 assert(destination !=
nullptr);
67 for (
const auto& [rName, rImpls] : source)
72 = (*destination)[rName];
73 impls.insert(impls.end(), rImpls.begin(), rImpls.end());
77void removeFromImplementationMap(
79 std::vector< OUString >
const & elements,
80 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
81 const & implementation)
85 assert(map !=
nullptr);
86 for (
const auto& rElement : elements)
88 cppuhelper::ServiceManager::Data::ImplementationMap::iterator j(
90 assert(j !=
map->end());
94 k(std::find(j->second.begin(), j->second.end(), implementation));
95 assert(k != j->second.end());
97 if (j->second.empty()) {
109 OUString
const & uri,
110 css::uno::Reference< css::uno::XComponentContext > alienContext,
113 Parser(
const Parser&) =
delete;
114 const Parser& operator=(
const Parser&) =
delete;
117 void handleComponent();
119 void handleImplementation();
121 void handleService();
123 void handleSingleton();
125 OUString getNameAttribute();
128 css::uno::Reference< css::uno::XComponentContext > alienContext_;
130 OUString attrLoader_;
132 OUString attrEnvironment_;
133 OUString attrPrefix_;
134 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
139 OUString
const & uri,
140 css::uno::Reference< css::uno::XComponentContext > alienContext,
142 reader_(uri), alienContext_(
std::move(alienContext)), data_(data)
144 assert(data !=
nullptr);
145 int ucNsId = reader_.registerNamespaceIri(
147 RTL_CONSTASCII_STRINGPARAM(
148 "http://openoffice.org/2010/uno-components")));
150 STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL,
151 STATE_COMPONENT, STATE_IMPLEMENTATION, STATE_SERVICE, STATE_SINGLETON };
152 for (
State state = STATE_BEGIN;;) {
156 xmlreader::XmlReader::Text::NONE, &name, &nsId);
159 if (res == xmlreader::XmlReader::Result::Begin && nsId == ucNsId
160 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"components")))
162 state = STATE_COMPONENTS;
165 throw css::registry::InvalidRegistryException(
166 reader_.getUrl() +
": unexpected item in outer level");
168 if (res == xmlreader::XmlReader::Result::Done) {
171 throw css::registry::InvalidRegistryException(
172 reader_.getUrl() +
": unexpected item in outer level");
173 case STATE_COMPONENTS:
174 if (res == xmlreader::XmlReader::Result::End) {
178 if (res == xmlreader::XmlReader::Result::Begin && nsId == ucNsId
179 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"component")))
182 state = STATE_COMPONENT_INITIAL;
185 throw css::registry::InvalidRegistryException(
186 reader_.getUrl() +
": unexpected item in <components>");
187 case STATE_COMPONENT:
188 if (res == xmlreader::XmlReader::Result::End) {
189 state = STATE_COMPONENTS;
193 case STATE_COMPONENT_INITIAL:
194 if (res == xmlreader::XmlReader::Result::Begin && nsId == ucNsId
195 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"implementation")))
197 handleImplementation();
198 state = STATE_IMPLEMENTATION;
201 throw css::registry::InvalidRegistryException(
202 reader_.getUrl() +
": unexpected item in <component>");
203 case STATE_IMPLEMENTATION:
204 if (res == xmlreader::XmlReader::Result::End) {
205 state = STATE_COMPONENT;
208 if (res == xmlreader::XmlReader::Result::Begin && nsId == ucNsId
209 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"service")))
212 state = STATE_SERVICE;
215 if (res == xmlreader::XmlReader::Result::Begin && nsId == ucNsId
216 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"singleton")))
219 state = STATE_SINGLETON;
222 throw css::registry::InvalidRegistryException(
223 reader_.getUrl() +
": unexpected item in <implementation>");
225 if (res == xmlreader::XmlReader::Result::End) {
226 state = STATE_IMPLEMENTATION;
229 throw css::registry::InvalidRegistryException(
230 reader_.getUrl() +
": unexpected item in <service>");
231 case STATE_SINGLETON:
232 if (res == xmlreader::XmlReader::Result::End) {
233 state = STATE_IMPLEMENTATION;
236 throw css::registry::InvalidRegistryException(
237 reader_.getUrl() +
": unexpected item in <service>");
242void Parser::handleComponent() {
243 attrLoader_ = OUString();
244 attrUri_ = OUString();
245 attrEnvironment_ = OUString();
246 attrPrefix_ = OUString();
249 while (reader_.nextAttribute(&nsId, &name)) {
251 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"loader")))
253 if (!attrLoader_.isEmpty()) {
254 throw css::registry::InvalidRegistryException(
256 +
": <component> has multiple \"loader\" attributes");
258 attrLoader_ = reader_.getAttributeValue(
false).convertFromUtf8();
259 if (attrLoader_.isEmpty()) {
260 throw css::registry::InvalidRegistryException(
262 +
": <component> has empty \"loader\" attribute");
265 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"uri")))
267 if (!attrUri_.isEmpty()) {
268 throw css::registry::InvalidRegistryException(
270 +
": <component> has multiple \"uri\" attributes");
272 attrUri_ = reader_.getAttributeValue(
false).convertFromUtf8();
273 if (attrUri_.isEmpty()) {
274 throw css::registry::InvalidRegistryException(
276 +
": <component> has empty \"uri\" attribute");
279 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"environment")))
281 if (!attrEnvironment_.isEmpty()) {
282 throw css::registry::InvalidRegistryException(
284 ": <component> has multiple \"environment\" attributes");
286 attrEnvironment_ = reader_.getAttributeValue(
false)
288 if (attrEnvironment_.isEmpty()) {
289 throw css::registry::InvalidRegistryException(
291 ": <component> has empty \"environment\" attribute");
294 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"prefix")))
296 if (!attrPrefix_.isEmpty()) {
297 throw css::registry::InvalidRegistryException(
299 ": <component> has multiple \"prefix\" attributes");
301 attrPrefix_ = reader_.getAttributeValue(
false).convertFromUtf8();
302 if (attrPrefix_.isEmpty()) {
303 throw css::registry::InvalidRegistryException(
305 ": <component> has empty \"prefix\" attribute");
308 throw css::registry::InvalidRegistryException(
309 reader_.getUrl() +
": unexpected attribute \""
310 +
name.convertFromUtf8() +
"\" in <component>");
313 if (attrLoader_.isEmpty()) {
314 throw css::registry::InvalidRegistryException(
315 reader_.getUrl() +
": <component> is missing \"loader\" attribute");
317 if (attrUri_.isEmpty()) {
318 throw css::registry::InvalidRegistryException(
319 reader_.getUrl() +
": <component> is missing \"uri\" attribute");
321#ifndef DISABLE_DYNLOADING
323 attrUri_ = rtl::Uri::convertRelToAbs(reader_.getUrl(), attrUri_);
324 }
catch (
const rtl::MalformedUriException & e) {
325 throw css::registry::InvalidRegistryException(
326 reader_.getUrl() +
": bad \"uri\" attribute: " + e.getMessage());
331void Parser::handleImplementation() {
333 OUString attrConstructor;
334 bool attrSingleInstance =
false;
337 while (reader_.nextAttribute(&nsId, &name)) {
339 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"name")))
342 throw css::registry::InvalidRegistryException(
344 +
": <implementation> has multiple \"name\" attributes");
346 attrName = reader_.getAttributeValue(
false).convertFromUtf8();
348 throw css::registry::InvalidRegistryException(
350 +
": <implementation> has empty \"name\" attribute");
353 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"constructor")))
355 if (!attrConstructor.isEmpty()) {
356 throw css::registry::InvalidRegistryException(
358 +
": <implementation> has multiple \"constructor\""
361 attrConstructor = reader_.getAttributeValue(
false)
363 if (attrConstructor.isEmpty()) {
364 throw css::registry::InvalidRegistryException(
366 +
": element has empty \"constructor\" attribute");
368 if (attrEnvironment_.isEmpty()) {
369 throw css::registry::InvalidRegistryException(
371 +
": <implementation> has \"constructor\" attribute but"
372 " <component> has no \"environment\" attribute");
375 &&
name.equals(RTL_CONSTASCII_STRINGPARAM(
"single-instance")))
377 if (attrSingleInstance) {
378 throw css::registry::InvalidRegistryException(
380 +
": <implementation> has multiple \"single-instance\" attributes");
382 if (!reader_.getAttributeValue(
false).equals(RTL_CONSTASCII_STRINGPARAM(
"true"))) {
383 throw css::registry::InvalidRegistryException(
384 reader_.getUrl() +
": <implementation> has bad \"single-instance\" attribute");
386 attrSingleInstance =
true;
388 throw css::registry::InvalidRegistryException(
389 reader_.getUrl() +
": unexpected element attribute \""
390 +
name.convertFromUtf8() +
"\" in <implementation>");
394 throw css::registry::InvalidRegistryException(
396 +
": <implementation> is missing \"name\" attribute");
399 std::make_shared<cppuhelper::ServiceManager::Data::Implementation>(
400 attrName, attrLoader_, attrUri_, attrEnvironment_, attrConstructor,
401 attrPrefix_, attrSingleInstance, alienContext_, reader_.getUrl());
402 if (!data_->namedImplementations.emplace(attrName, implementation_).
405 throw css::registry::InvalidRegistryException(
406 reader_.getUrl() +
": duplicate <implementation name=\"" + attrName
411void Parser::handleService() {
412 OUString
name(getNameAttribute());
413 implementation_->services.push_back(name);
414 data_->services[
name].push_back(implementation_);
417void Parser::handleSingleton() {
418 OUString
name(getNameAttribute());
419 implementation_->singletons.push_back(name);
420 data_->singletons[
name].push_back(implementation_);
423OUString Parser::getNameAttribute() {
427 while (reader_.nextAttribute(&nsId, &name)) {
429 || !
name.equals(RTL_CONSTASCII_STRINGPARAM(
"name")))
431 throw css::registry::InvalidRegistryException(
432 reader_.getUrl() +
": expected element attribute \"name\"");
435 throw css::registry::InvalidRegistryException(
437 +
": element has multiple \"name\" attributes");
439 attrName = reader_.getAttributeValue(
false).convertFromUtf8();
441 throw css::registry::InvalidRegistryException(
442 reader_.getUrl() +
": element has empty \"name\" attribute");
446 throw css::registry::InvalidRegistryException(
447 reader_.getUrl() +
": element is missing \"name\" attribute");
452class ContentEnumeration:
453 public cppu::WeakImplHelper< css::container::XEnumeration >
456 explicit ContentEnumeration(std::vector< css::uno::Any >&& factories):
459 ContentEnumeration(
const ContentEnumeration&) =
delete;
460 const ContentEnumeration& operator=(
const ContentEnumeration&) =
delete;
463 virtual ~ContentEnumeration()
override {}
465 virtual sal_Bool SAL_CALL hasMoreElements()
override;
467 virtual css::uno::Any SAL_CALL nextElement()
override;
470 std::vector< css::uno::Any > factories_;
471 std::vector< css::uno::Any >::const_iterator
iterator_;
474sal_Bool ContentEnumeration::hasMoreElements()
476 std::scoped_lock g(mutex_);
480css::uno::Any ContentEnumeration::nextElement()
482 std::scoped_lock g(mutex_);
483 if (iterator_ == factories_.end()) {
484 throw css::container::NoSuchElementException(
485 "Bootstrap service manager service enumerator has no more elements",
491css::beans::Property getDefaultContextProperty() {
492 return css::beans::Property(
493 "DefaultContext", -1,
495 css::beans::PropertyAttribute::READONLY);
498class SingletonFactory:
499 public cppu::WeakImplHelper<css::lang::XSingleComponentFactory>
508 { assert(
manager.is()); assert(implementation); }
510 SingletonFactory(
const SingletonFactory&) =
delete;
511 const SingletonFactory& operator=(
const SingletonFactory&) =
delete;
514 virtual ~SingletonFactory()
override {}
516 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
517 createInstanceWithContext(
518 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
520 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
521 createInstanceWithArgumentsAndContext(
522 css::uno::Sequence< css::uno::Any >
const & Arguments,
523 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
526 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
530css::uno::Reference< css::uno::XInterface >
531SingletonFactory::createInstanceWithContext(
532 css::uno::Reference< css::uno::XComponentContext >
const & Context)
534 manager_->loadImplementation(Context, implementation_);
535 return implementation_->createInstance(Context,
true);
538css::uno::Reference< css::uno::XInterface >
539SingletonFactory::createInstanceWithArgumentsAndContext(
540 css::uno::Sequence< css::uno::Any >
const & Arguments,
541 css::uno::Reference< css::uno::XComponentContext >
const & Context)
543 manager_->loadImplementation(Context, implementation_);
544 return implementation_->createInstanceWithArguments(
545 Context,
true, Arguments);
548class ImplementationWrapper:
549 public cppu::WeakImplHelper<
550 css::lang::XSingleComponentFactory, css::lang::XSingleServiceFactory,
551 css::lang::XServiceInfo >
554 ImplementationWrapper(
560 { assert(
manager.is()); assert(implementation); }
562 ImplementationWrapper(
const ImplementationWrapper&) =
delete;
563 const ImplementationWrapper& operator=(
const ImplementationWrapper&) =
delete;
566 virtual ~ImplementationWrapper()
override {}
568 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
569 createInstanceWithContext(
570 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
572 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
573 createInstanceWithArgumentsAndContext(
574 css::uno::Sequence< css::uno::Any >
const & Arguments,
575 css::uno::Reference< css::uno::XComponentContext >
const & Context)
override;
577 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
580 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
581 createInstanceWithArguments(
582 css::uno::Sequence< css::uno::Any >
const & Arguments)
override;
588 virtual css::uno::Sequence< OUString > SAL_CALL
592 std::weak_ptr< cppuhelper::ServiceManager::Data::Implementation >
596css::uno::Reference< css::uno::XInterface >
597ImplementationWrapper::createInstanceWithContext(
598 css::uno::Reference< css::uno::XComponentContext >
const & Context)
600 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
impl = implementation_.lock();
603 return impl->createInstance(Context,
false);
606css::uno::Reference< css::uno::XInterface >
607ImplementationWrapper::createInstanceWithArgumentsAndContext(
608 css::uno::Sequence< css::uno::Any >
const & Arguments,
609 css::uno::Reference< css::uno::XComponentContext >
const & Context)
611 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
impl = implementation_.lock();
614 return impl->createInstanceWithArguments(
615 Context,
false, Arguments);
618css::uno::Reference< css::uno::XInterface >
619ImplementationWrapper::createInstance()
621 return createInstanceWithContext(
manager_->getContext());
624css::uno::Reference< css::uno::XInterface >
625ImplementationWrapper::createInstanceWithArguments(
626 css::uno::Sequence< css::uno::Any >
const & Arguments)
628 return createInstanceWithArgumentsAndContext(
632OUString ImplementationWrapper::getImplementationName()
634 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
impl = implementation_.lock();
644css::uno::Sequence< OUString >
645ImplementationWrapper::getSupportedServiceNames()
647 std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
impl = implementation_.lock();
649 if (
impl->services.size()
652 throw css::uno::RuntimeException(
653 (
"Implementation " +
impl->name
654 +
" supports too many services"),
662css::uno::Reference<css::uno::XInterface>
664 css::uno::Reference<css::uno::XComponentContext>
const & context,
665 bool singletonRequest)
667 css::uno::Reference<css::uno::XInterface> inst;
669 std::unique_lock g(
mutex);
681css::uno::Reference<css::uno::XInterface>
683 css::uno::Reference<css::uno::XComponentContext>
const & context,
684 bool singletonRequest, css::uno::Sequence<css::uno::Any>
const & arguments)
686 css::uno::Reference<css::uno::XInterface> inst;
687 if (isSingleInstance) {
688 std::unique_lock g(
mutex);
689 if (!singleInstance.is()) {
690 singleInstance = doCreateInstanceWithArguments(context, arguments);
692 inst = singleInstance;
694 inst = doCreateInstanceWithArguments(context, arguments);
696 updateDisposeInstance(singletonRequest, inst);
700css::uno::Reference<css::uno::XInterface>
702 css::uno::Reference<css::uno::XComponentContext>
const & context)
705 return css::uno::Reference<css::uno::XInterface>(
706 constructorFn(context.get(), css::uno::Sequence<css::uno::Any>()),
708 }
else if (factory1.is()) {
709 return factory1->createInstanceWithContext(context);
711 assert(factory2.is());
712 return factory2->createInstance();
716css::uno::Reference<css::uno::XInterface>
718 css::uno::Reference<css::uno::XComponentContext>
const & context,
719 css::uno::Sequence<css::uno::Any>
const & arguments)
722 css::uno::Reference<css::uno::XInterface> inst(
723 constructorFn(context.get(), arguments), SAL_NO_ACQUIRE);
729 css::uno::Reference<css::lang::XInitialization>
init(
730 inst, css::uno::UNO_QUERY);
732 init->initialize(arguments);
735 }
else if (factory1.is()) {
736 return factory1->createInstanceWithArgumentsAndContext(
739 assert(factory2.is());
740 return factory2->createInstanceWithArguments(arguments);
745 bool singletonRequest,
746 css::uno::Reference<css::uno::XInterface>
const & instance)
754 if (singletonRequest) {
755 std::unique_lock g(
mutex);
756 disposeInstance.clear();
758 }
else if (shallDispose()) {
759 css::uno::Reference<css::lang::XComponent>
comp(
760 instance, css::uno::UNO_QUERY);
762 std::unique_lock g(
mutex);
764 disposeInstance =
comp;
771 std::vector< cppu::ContextEntry_Init > * entries)
773 assert(entries !=
nullptr);
776 assert(!rImpls.empty());
779 rImpls.size() > 1,
"cppuhelper",
780 "Arbitrarily choosing " << rImpls[0]->name
781 <<
" among multiple implementations for " << rName);
784 "/singletons/" + rName,
786 css::uno::Reference<css::lang::XSingleComponentFactory>(
787 new SingletonFactory(
this, rImpls[0]))),
793 css::uno::Reference< css::uno::XComponentContext >
const & context,
794 std::shared_ptr< Data::Implementation >
const & implementation)
796 assert(implementation);
806 }
catch (css::lang::IllegalArgumentException & e) {
807 throw css::uno::DeploymentException(
808 "Cannot expand URI" + implementation->uri +
": " + e.Message,
812 css::uno::Reference< css::uno::XInterface > f0;
815 if (!implementation->alienContext.is()
816 && implementation->loader ==
"com.sun.star.loader.SharedLibrary")
819 uri, implementation->environment,
820 implementation->prefix, implementation->name,
821 implementation->constructorName,
this, &ctor, &f0);
823 assert(!implementation->environment.isEmpty());
827 !implementation->environment.isEmpty(),
"cppuhelper",
828 "Loader " << implementation->loader
829 <<
" and non-empty environment "
830 << implementation->environment);
832 !implementation->prefix.isEmpty(),
"cppuhelper",
833 "Loader " << implementation->loader
834 <<
" and non-empty constructor "
835 << implementation->constructorName);
837 !implementation->prefix.isEmpty(),
"cppuhelper",
838 "Loader " << implementation->loader
839 <<
" and non-empty prefix " << implementation->prefix);
840 css::uno::Reference< css::uno::XComponentContext > ctxt;
841 css::uno::Reference< css::lang::XMultiComponentFactory > smgr;
842 if (implementation->alienContext.is()) {
843 ctxt = implementation->alienContext;
844 smgr.set(ctxt->getServiceManager(), css::uno::UNO_SET_THROW);
846 assert(context.is());
850 css::uno::Reference< css::loader::XImplementationLoader >
loader(
851 smgr->createInstanceWithContext(implementation->loader, ctxt),
852 css::uno::UNO_QUERY_THROW);
854 implementation->name, OUString(), uri,
855 css::uno::Reference< css::registry::XRegistryKey >());
857 css::uno::Reference<css::lang::XSingleComponentFactory> f1;
858 css::uno::Reference<css::lang::XSingleServiceFactory> f2;
860 f1.set(f0, css::uno::UNO_QUERY);
862 f2.set(f0, css::uno::UNO_QUERY);
864 throw css::uno::DeploymentException(
865 (
"Implementation " + implementation->name
866 +
" does not provide a constructor or factory"),
879 implementation->constructorFn = ctor;
880 implementation->factory1 = f1;
881 implementation->factory2 = f2;
886 std::vector< css::uno::Reference<css::lang::XComponent> > sngls;
887 std::vector< css::uno::Reference< css::lang::XComponent > > comps;
892 assert(rEntry.second);
893 if (rEntry.second->shallDispose()) {
894 std::unique_lock g2(rEntry.second->mutex);
895 if (rEntry.second->disposeInstance.is()) {
896 sngls.push_back(rEntry.second->disposeInstance);
902 assert(rEntry.second);
903 if (rEntry.second->shallDispose()) {
904 std::unique_lock g2(rEntry.second->mutex);
905 if (rEntry.second->disposeInstance.is()) {
906 sngls.push_back(rEntry.second->disposeInstance);
909 if (rEntry.second->component.is()) {
910 comps.push_back(rEntry.second->component);
919 for (
const auto& rxSngl : sngls)
923 }
catch (css::uno::RuntimeException & e) {
924 SAL_WARN(
"cppuhelper",
"Ignoring " << e <<
" while disposing singleton");
927 for (
const auto& rxComp : comps)
935 css::uno::Sequence<css::uno::Any>
const & aArguments)
941 throw css::lang::IllegalArgumentException(
942 "invalid ServiceManager::initialize argument",
943 css::uno::Reference<css::uno::XInterface>(), 0);
951 "com.sun.star.comp.cppuhelper.bootstrap.ServiceManager";
955 OUString
const & ServiceName)
960css::uno::Sequence< OUString >
963 return {
"com.sun.star.lang.MultiServiceFactory",
"com.sun.star.lang.ServiceManager" };
966css::uno::Reference< css::uno::XInterface >
968 OUString
const & aServiceSpecifier)
974css::uno::Reference< css::uno::XInterface >
976 OUString
const & ServiceSpecifier,
977 css::uno::Sequence< css::uno::Any >
const & Arguments)
981 ServiceSpecifier, Arguments,
context_);
984css::uno::Sequence< OUString >
989 return css::uno::Sequence< OUString >();
992 throw css::uno::RuntimeException(
993 "getAvailableServiceNames: too many services",
999css::uno::Reference< css::uno::XInterface >
1001 OUString
const & aServiceSpecifier,
1002 css::uno::Reference< css::uno::XComponentContext >
const & Context)
1004 std::shared_ptr< Data::Implementation >
impl(
1006 return impl ==
nullptr ? css::uno::Reference<css::uno::XInterface>()
1007 :
impl->createInstance(Context,
false);
1010css::uno::Reference< css::uno::XInterface >
1012 OUString
const & ServiceSpecifier,
1013 css::uno::Sequence< css::uno::Any >
const & Arguments,
1014 css::uno::Reference< css::uno::XComponentContext >
const & Context)
1016 std::shared_ptr< Data::Implementation >
impl(
1018 return impl ==
nullptr ? css::uno::Reference<css::uno::XInterface>()
1019 :
impl->createInstanceWithArguments(Context,
false, Arguments);
1024 return css::uno::Type();
1035css::uno::Reference< css::container::XEnumeration >
1038 throw css::uno::RuntimeException(
1039 "ServiceManager createEnumeration: method not supported",
1045 throw css::uno::RuntimeException(
1046 "ServiceManager has: method not supported",
1052 css::uno::Sequence< css::beans::NamedValue >
args;
1053 if (aElement >>=
args) {
1054 std::vector< OUString > uris;
1055 css::uno::Reference< css::uno::XComponentContext > alienContext;
1056 for (
const auto & arg : std::as_const(
args)) {
1057 if (arg.Name ==
"uri") {
1059 if (!(arg.Value >>= uri)) {
1060 throw css::lang::IllegalArgumentException(
1064 uris.push_back(uri);
1065 }
else if (arg.Name ==
"component-context") {
1066 if (alienContext.is()) {
1067 throw css::lang::IllegalArgumentException(
1068 "Multiple component-context arguments",
1071 if (!(arg.Value >>= alienContext) || !alienContext.is()) {
1072 throw css::lang::IllegalArgumentException(
1073 "Bad component-context argument",
1077 throw css::lang::IllegalArgumentException(
1078 "Bad argument " + arg.Name,
1085 css::uno::Reference< css::lang::XServiceInfo > info;
1086 if ((aElement >>= info) && info.is()) {
1091 throw css::lang::IllegalArgumentException(
1097 css::uno::Sequence< css::beans::NamedValue >
args;
1098 if (aElement >>=
args) {
1099 std::vector< OUString > uris;
1100 for (
const auto &
i : std::as_const(
args)) {
1101 if (
i.Name !=
"uri") {
1102 throw css::lang::IllegalArgumentException(
1103 "Bad argument " +
i.Name,
1107 if (!(
i.Value >>= uri)) {
1108 throw css::lang::IllegalArgumentException(
1112 uris.push_back(uri);
1117 css::uno::Reference< css::lang::XServiceInfo > info;
1118 if ((aElement >>= info) && info.is()) {
1120 throw css::container::NoSuchElementException(
1121 "Remove non-inserted factory object",
1127 if (aElement >>=
impl) {
1132 throw css::lang::IllegalArgumentException(
1136css::uno::Reference< css::container::XEnumeration >
1138 OUString
const & aServiceName)
1140 std::vector< std::shared_ptr< Data::Implementation > > impls;
1143 Data::ImplementationMap::const_iterator
i(
1149 std::vector< css::uno::Any > factories;
1150 for (
const auto& rxImpl : impls)
1153 assert(
impl !=
nullptr);
1167 impl->factory1 =
new ImplementationWrapper(
this, rxImpl);
1170 if (
impl->constructorFn !=
nullptr && !
impl->factory1.is()) {
1171 impl->factory1 =
new ImplementationWrapper(
this, rxImpl);
1174 if (
impl->factory1.is()) {
1175 factories.push_back(css::uno::Any(
impl->factory1));
1177 assert(
impl->factory2.is());
1178 factories.push_back(css::uno::Any(
impl->factory2));
1181 return new ContentEnumeration(std::move(factories));
1184css::uno::Reference< css::beans::XPropertySetInfo >
1191 OUString
const & aPropertyName, css::uno::Any
const &)
1193 if (aPropertyName ==
"DefaultContext") {
1194 throw css::beans::PropertyVetoException(
1197 throw css::beans::UnknownPropertyException(
1203 OUString
const & PropertyName)
1205 if (PropertyName !=
"DefaultContext") {
1206 throw css::beans::UnknownPropertyException(
1214 OUString
const & aPropertyName,
1215 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
1218 if (!aPropertyName.isEmpty() && aPropertyName !=
"DefaultContext") {
1219 throw css::beans::UnknownPropertyException(
1227 OUString
const & aPropertyName,
1228 css::uno::Reference< css::beans::XPropertyChangeListener >
const &
1231 if (!aPropertyName.isEmpty() && aPropertyName !=
"DefaultContext") {
1232 throw css::beans::UnknownPropertyException(
1240 OUString
const & PropertyName,
1241 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
1244 if (!PropertyName.isEmpty() && PropertyName !=
"DefaultContext") {
1245 throw css::beans::UnknownPropertyException(
1253 OUString
const & PropertyName,
1254 css::uno::Reference< css::beans::XVetoableChangeListener >
const &
1257 if (!PropertyName.isEmpty() && PropertyName !=
"DefaultContext") {
1258 throw css::beans::UnknownPropertyException(
1265css::uno::Sequence< css::beans::Property >
1267 return { getDefaultContextProperty() };
1271 OUString
const & aName)
1273 if (
aName !=
"DefaultContext") {
1274 throw css::beans::UnknownPropertyException(
1277 return getDefaultContextProperty();
1281 OUString
const & Name)
1283 return Name ==
"DefaultContext";
1289 css::lang::EventObject
const & Source)
1292 css::uno::Reference< css::lang::XServiceInfo >(
1293 Source.Source, css::uno::UNO_QUERY_THROW),
1298 css::uno::Reference< css::lang::XComponent >
const & component)
1300 assert(component.is());
1302 component->removeEventListener(
this);
1303 }
catch (css::uno::RuntimeException & e) {
1306 "Ignored removeEventListener RuntimeException " + e.Message);
1311 for (sal_Int32
i = 0;
i != -1;) {
1328 std::u16string_view uri,
bool optional)
1330 osl::Directory dir = OUString(uri);
1331 switch (dir.open()) {
1332 case osl::FileBase::E_None:
1334 case osl::FileBase::E_NOENT:
1336 SAL_INFO(
"cppuhelper",
"Ignored optional " << OUString(uri));
1341 throw css::uno::DeploymentException(
1342 OUString::Concat(
"Cannot open directory ") + uri,
1355 OUString
const & uri,
bool optional)
1359 uri, css::uno::Reference< css::uno::XComponentContext >(), &
data_);
1360 }
catch (css::container::NoSuchElementException &) {
1362 throw css::uno::DeploymentException(
1363 uri +
": no such file",
1366 SAL_INFO(
"cppuhelper",
"Ignored optional " << uri);
1367 }
catch (css::registry::InvalidRegistryException & e) {
1369 throw css::uno::DeploymentException(
1370 "InvalidRegistryException: " + e.Message,
1373 }
catch (css::uno::RuntimeException &) {
1382 switch (reg.
open(uri, RegAccessMode::READONLY)) {
1383 case RegError::NO_ERROR:
1385 case RegError::REGISTRY_NOT_EXISTS:
1386 case RegError::INVALID_REGISTRY:
1391 osl::DirectoryItem item;
1392 if (osl::DirectoryItem::get(uri, item) == osl::FileBase::E_None) {
1393 osl::FileStatus status(osl_FileStatus_Mask_FileSize);
1394 if (item.getFileStatus(status) == osl::FileBase::E_None
1395 && status.getFileSize() == 0)
1406 if (reg.
openRootKey(rootKey) != RegError::NO_ERROR) {
1407 throw css::uno::DeploymentException(
1408 "Failure reading legacy rdb file " + uri,
1412 switch (rootKey.
openSubKeys(
"IMPLEMENTATIONS", impls)) {
1413 case RegError::NO_ERROR:
1415 case RegError::KEY_NOT_EXISTS:
1418 throw css::uno::DeploymentException(
1419 "Failure reading legacy rdb file " + uri,
1424 assert(implKey.
getName().match(
"/IMPLEMENTATIONS/"));
1426 implKey.
getName().copy(RTL_CONSTASCII_LENGTH(
"/IMPLEMENTATIONS/")));
1427 std::shared_ptr< Data::Implementation >
impl =
1428 std::make_shared<Data::Implementation>(
1431 css::uno::Reference< css::uno::XComponentContext >(), uri);
1434 throw css::registry::InvalidRegistryException(
1435 uri +
": duplicate <implementation name=\"" +
name +
"\">");
1438 uri, implKey,
"UNO/SERVICES", &
impl->services);
1439 for (
const auto& rService :
impl->services)
1444 uri, implKey,
"UNO/SINGLETONS", &
impl->singletons);
1445 for (
const auto& rSingleton :
impl->singletons)
1454 std::u16string_view uri,
RegistryKey & key, OUString
const & path)
1459 if (key.
openKey(path, subkey) != RegError::NO_ERROR
1460 || subkey.
getValueInfo(OUString(), &
t, &s) != RegError::NO_ERROR
1461 ||
t != RegValueType::STRING
1464 throw css::uno::DeploymentException(
1465 OUString::Concat(
"Failure reading legacy rdb file ") + uri,
1469 std::vector< char >
v(s);
1470 if (subkey.
getValue(OUString(),
v.data()) != RegError::NO_ERROR
1472 || !rtl_convertStringToUString(
1473 &val.pData,
v.data(),
static_cast< sal_Int32
>(s - 1),
1474 RTL_TEXTENCODING_UTF8,
1475 (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
1476 | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
1477 | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
1479 throw css::uno::DeploymentException(
1480 OUString::Concat(
"Failure reading legacy rdb file ") + uri,
1487 std::u16string_view uri,
RegistryKey & key, OUString
const & path,
1488 std::vector< OUString > * strings)
1490 assert(strings !=
nullptr);
1492 switch (key.
openKey(path, subkey)) {
1493 case RegError::NO_ERROR:
1495 case RegError::KEY_NOT_EXISTS:
1498 throw css::uno::DeploymentException(
1499 OUString::Concat(
"Failure reading legacy rdb file ") + uri,
1504 if (subkey.
getKeyNames(OUString(), names) != RegError::NO_ERROR) {
1505 throw css::uno::DeploymentException(
1506 OUString::Concat(
"Failure reading legacy rdb file ") + uri,
1516 std::vector< OUString >
const & uris,
1517 css::uno::Reference< css::uno::XComponentContext >
const & alienContext)
1520 for (
const auto& rUri : uris)
1523 Parser(rUri, alienContext, &extra);
1524 }
catch (css::container::NoSuchElementException &) {
1525 throw css::lang::IllegalArgumentException(
1528 }
catch (css::registry::InvalidRegistryException & e) {
1529 throw css::lang::IllegalArgumentException(
1530 "InvalidRegistryException: " + e.Message,
1538 css::uno::Reference< css::lang::XServiceInfo >
const & factoryInfo)
1540 assert(factoryInfo.is());
1541 OUString
name(factoryInfo->getImplementationName());
1542 css::uno::Reference< css::lang::XSingleComponentFactory > f1(
1543 factoryInfo, css::uno::UNO_QUERY);
1544 css::uno::Reference< css::lang::XSingleServiceFactory > f2;
1546 f2.set(factoryInfo, css::uno::UNO_QUERY);
1548 throw css::lang::IllegalArgumentException(
1549 (
"Bad XServiceInfo argument implements neither"
1550 " XSingleComponentFactory nor XSingleServiceFactory"),
1554 css::uno::Reference< css::lang::XComponent >
comp(
1555 factoryInfo, css::uno::UNO_QUERY);
1556 std::shared_ptr< Data::Implementation >
impl =
1557 std::make_shared<Data::Implementation>(
name, f1, f2,
comp);
1559 if (!
name.isEmpty()) {
1563 const css::uno::Sequence< OUString >
services(
1564 factoryInfo->getSupportedServiceNames());
1566 impl->services.push_back(
i);
1570 comp->addEventListener(
this);
1581 [
this](
const Data::NamedImplementations::value_type& rEntry) {
1582 return data_.namedImplementations.find(rEntry.first) != data_.namedImplementations.end(); });
1585 throw css::lang::IllegalArgumentException(
1586 "Insert duplicate implementation name " +
i->first,
1590 [
this](
const Data::DynamicImplementations::value_type& rEntry) {
1591 return data_.dynamicImplementations.find(rEntry.first) != data_.dynamicImplementations.end(); });
1594 throw css::lang::IllegalArgumentException(
1595 "Insert duplicate factory object",
1614 css::uno::Reference< css::container::XNameContainer > cont(
1615 context_, css::uno::UNO_QUERY_THROW);
1616 for (
const auto& [rName, rImpls] : extra.
singletons)
1618 OUString
name(
"/singletons/" + rName);
1621 cont->removeByName(
name +
"/arguments");
1622 }
catch (
const css::container::NoSuchElementException &) {}
1623 assert(!rImpls.empty());
1626 rImpls.size() > 1,
"cppuhelper",
1627 "Arbitrarily choosing " << rImpls[0]->name
1628 <<
" among multiple implementations for singleton "
1632 name +
"/service", css::uno::Any(rImpls[0]->
name));
1633 }
catch (css::container::ElementExistException &) {
1634 cont->replaceByName(
1635 name +
"/service", css::uno::Any(rImpls[0]->
name));
1638 cont->insertByName(
name, css::uno::Any());
1639 }
catch (css::container::ElementExistException &) {
1640 SAL_INFO(
"cppuhelper",
"Overwriting singleton " << rName);
1641 cont->replaceByName(
name, css::uno::Any());
1648 std::vector< OUString >
const & uris)
1653 std::vector< std::shared_ptr< Data::Implementation > > clear;
1656 for (
const auto& rUri : uris)
1658 for (Data::NamedImplementations::iterator j(
1663 if (j->second->rdbFile == rUri) {
1664 clear.push_back(j->second);
1667 removeFromImplementationMap(
1669 removeFromImplementationMap(
1683 css::uno::Reference< css::lang::XServiceInfo >
const & factoryInfo,
1684 bool removeListener)
1686 assert(factoryInfo.is());
1687 std::shared_ptr< Data::Implementation > clear;
1688 css::uno::Reference< css::lang::XComponent >
comp;
1691 Data::DynamicImplementations::iterator
i(
1699 comp =
i->second->component;
1702 removeFromImplementationMap(
1704 removeFromImplementationMap(
1706 if (!
i->second->name.isEmpty()) {
1720 std::shared_ptr< Data::Implementation > clear;
1726 Data::NamedImplementations::iterator
i(
1729 throw css::container::NoSuchElementException(
1730 "Remove non-inserted implementation " +
name,
1736 removeFromImplementationMap(
1738 removeFromImplementationMap(
1741 [&
i](
const Data::DynamicImplementations::value_type& rEntry) { return rEntry.second == i->second; });
1748std::shared_ptr< cppuhelper::ServiceManager::Data::Implementation >
1750 css::uno::Reference< css::uno::XComponentContext >
const & context,
1751 OUString
const & specifier)
1753 std::shared_ptr< Data::Implementation >
impl;
1757 Data::ImplementationMap::const_iterator
i(
1760 Data::NamedImplementations::const_iterator j(
1763 SAL_INFO(
"cppuhelper",
"No implementation for " << specifier);
1764 return std::shared_ptr< Data::Implementation >();
1768 assert(!
i->second.empty());
1770 i->second.size() > 1,
"cppuhelper",
1771 "Arbitrarily choosing " <<
i->second[0]->name
1772 <<
" among multiple implementations for " <<
i->first);
1773 impl =
i->second[0];
1785#ifndef DISABLE_DYNLOADING
1789 OUStringBuffer edit(uri);
1790 if ((nIdx = edit.lastIndexOf(
'/')) > 0)
1791 edit.remove(0,nIdx+1);
1792 if ((nIdx = edit.lastIndexOf(
':')) > 0)
1793 edit.remove(0,nIdx+1);
1794 if ((nIdx = edit.lastIndexOf(
"lo.so")) > 0)
1795 edit.truncate(nIdx);
1796 if ((nIdx = edit.lastIndexOf(
".3")) > 0)
1797 edit.truncate(nIdx);
1798 if ((nIdx = edit.lastIndexOf(
"gcc3.so")) > 0)
1799 edit.truncate(nIdx);
1800 if ((nIdx = edit.lastIndexOf(
".so")) > 0)
1801 edit.truncate(nIdx);
1802 if ((nIdx = edit.lastIndexOf(
"_uno")) > 0)
1803 edit.truncate(nIdx);
1804 if ((nIdx = edit.lastIndexOf(
".jar")) > 0)
1805 edit.truncate(nIdx);
1806 if (edit.indexOf(
"lib") == 0)
1808 return edit.makeStringAndClear();
1814#ifdef DISABLE_DYNLOADING
1819 css::uno::Environment aSourceEnv(css::uno::Environment::getCurrent());
1821 std::cerr <<
"preload:";
1822 std::vector<OUString> aReported;
1823 std::vector<OUString> aDisabled;
1824 OUStringBuffer aDisabledMsg;
1825 OUStringBuffer aMissingMsg;
1828 const char *pDisable = getenv(
"UNODISABLELIBRARY");
1831 OUString aDisable(pDisable, strlen(pDisable), RTL_TEXTENCODING_UTF8);
1832 for (sal_Int32
i = 0;
i >= 0; )
1834 OUString tok( aDisable.getToken(0,
' ',
i) );
1837 aDisabled.push_back(tok);
1844 if (rEntry.second->loader !=
"com.sun.star.loader.SharedLibrary" ||
1848 OUString simplified;
1851 const OUString &aLibrary = rEntry.second->uri;
1853 if (aLibrary.isEmpty())
1859 std::find(aDisabled.begin(), aDisabled.end(), simplified) != aDisabled.end();
1861 if (std::find(aReported.begin(), aReported.end(), aLibrary) == aReported.end())
1865 aDisabledMsg.append(simplified +
" ");
1869 std::cerr <<
" " << simplified;
1872 aReported.push_back(aLibrary);
1881 catch (css::lang::IllegalArgumentException& aError)
1883 throw css::uno::DeploymentException(
1884 "Cannot expand URI" + rEntry.second->uri +
": " + aError.Message,
1889 osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL);
1893 aMissingMsg.append(simplified +
" ");
1897 !rEntry.second->environment.isEmpty())
1899 oslGenericFunction fpFactory;
1900 css::uno::Environment aTargetEnv;
1901 css::uno::Reference<css::uno::XInterface>
xFactory;
1903 if(rEntry.second->constructorName.isEmpty())
1905 OUString aSymFactory;
1907 if (rEntry.second->prefix ==
"direct")
1909 else if (!rEntry.second->prefix.isEmpty())
1915 fpFactory = aModule.getFunctionSymbol(aSymFactory);
1916 if (fpFactory ==
nullptr)
1918 throw css::loader::CannotActivateFactoryException(
1919 (
"no factory symbol \"" + aSymFactory +
"\" in component library :" + aUri),
1920 css::uno::Reference<css::uno::XInterface>());
1926 if (aSourceEnv.get() == aTargetEnv.get())
1929 OString aImpl(
OUStringToOString(rEntry.second->name, RTL_TEXTENCODING_ASCII_US));
1930 xFactory.set(css::uno::Reference<css::uno::XInterface>(
static_cast<css::uno::XInterface *
>(
1931 (*fpComponentFactory)(aImpl.getStr(),
this,
nullptr)), SAL_NO_ACQUIRE));
1938 fpFactory = (aSourceEnv.get() == aTargetEnv.get()) ?
1939 aModule.getFunctionSymbol(rEntry.second->constructorName) :
nullptr;
1942 css::uno::Reference<css::lang::XSingleComponentFactory> xSCFactory;
1943 css::uno::Reference<css::lang::XSingleServiceFactory> xSSFactory;
1948 xSCFactory.set(
xFactory, css::uno::UNO_QUERY);
1949 if (!xSCFactory.is())
1951 xSSFactory.set(
xFactory, css::uno::UNO_QUERY);
1952 if (!xSSFactory.is())
1953 throw css::uno::DeploymentException(
1954 (
"Implementation " + rEntry.second->name
1955 +
" does not provide a constructor or factory"),
1960 if (!rEntry.second->constructorName.isEmpty() && fpFactory)
1963 rEntry.second->factory1 = xSCFactory;
1964 rEntry.second->factory2 = xSSFactory;
1970 oslGenericFunction fpPreload = aModule.getFunctionSymbol(
"lok_preload_hook" );
1973 static std::vector<oslGenericFunction> aPreloaded;
1974 if (std::find(aPreloaded.begin(), aPreloaded.end(), fpPreload) == aPreloaded.end())
1976 aPreloaded.push_back(fpPreload);
1984 std::cerr << std::endl;
1986 if (aMissingMsg.getLength() > 0)
1988 OUString aMsg = aMissingMsg.makeStringAndClear();
1989 std::cerr <<
"Absent (often optional): " << aMsg <<
"\n";
1991 if (aDisabledMsg.getLength() > 0)
1993 OUString aMsg = aDisabledMsg.makeStringAndClear();
1994 std::cerr <<
"Disabled: " << aMsg <<
"\n";
2002 const char *mpPurpose;
2003 }
const aMappingLoad[] = {
2004 {
"gcc3",
"uno",
"" },
2005 {
"uno",
"gcc3",
"" },
2008 static std::vector<css::uno::Mapping> maMaps;
2009 for (
auto &it : aMappingLoad)
2011 maMaps.push_back(css::uno::Mapping(
2012 OUString::createFromAscii(it.mpFrom),
2013 OUString::createFromAscii(it.mpTo),
2014 OUString::createFromAscii(it.mpPurpose)));
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
sal_uInt32 getLength() const
RegistryKey getElement(sal_uInt32 index)
OUString getElement(sal_uInt32 index)
sal_uInt32 getLength() const
RegError getKeyNames(const OUString &keyName, RegistryKeyNames &rSubKeyNames)
RegError openKey(const OUString &keyName, RegistryKey &rOpenKey)
RegError getValueInfo(const OUString &keyName, RegValueType *pValueType, sal_uInt32 *pValueSize)
RegError getValue(const OUString &keyName, RegValue pValue)
RegError openSubKeys(const OUString &keyName, RegistryKeyArray &rSubKeys)
RegError openRootKey(RegistryKey &rRootKey)
RegError open(const OUString ®istryName, RegAccessMode accessMode)
Base class to implement a UNO object supporting weak references, i.e.
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
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
virtual void SAL_CALL remove(css::uno::Any const &aElement) override
void removeRdbFiles(std::vector< OUString > const &uris)
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
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 dispose() noexcept final override
virtual void SAL_CALL removeEventListener(css::uno::Reference< css::lang::XEventListener > const &rxListener) final override
virtual void SAL_CALL addEventListener(css::uno::Reference< css::lang::XEventListener > const &rxListener) final override
rtl::Reference< ParseManager > manager
Reference< XSingleServiceFactory > xFactory
#define COMPONENT_GETFACTORY
void *(SAL_CALL * component_getFactoryFunc)(const char *pImplName, void *pServiceManager, void *pRegistryKey)
Function pointer declaration.
Sequence< PropertyValue > aArguments
rtl::Reference< Manager > manager_
#define SAL_INFO_IF(condition, area, stream)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
void removeListener(const InterfaceRef &xObject, const css::uno::Reference< css::lang::XEventListener > &xListener)
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
OUString bootstrap_expandUri(OUString const &uri)
void decodeRdbUri(std::u16string_view *uri, bool *optional, bool *directory)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
A helper for implementations of com.sun.star.lang.XServiceInfo.
bool nextDirectoryItem(osl::Directory &directory, OUString *url)
css::uno::Environment getEnvironment(OUString const &name, std::u16string_view implementation)
void loadSharedLibComponentFactory(OUString const &uri, OUString const &environment, OUString const &prefix, OUString const &implementation, OUString const &constructor, css::uno::Reference< css::lang::XMultiServiceFactory > const &serviceManager, WrapperConstructorFn *constructorFunction, css::uno::Reference< css::uno::XInterface > *factory)
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
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
enumrange< T >::Iterator begin(enumrange< T >)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
enum SAL_DLLPUBLIC_RTTI RegValueType
static OUString simplifyModule(std::u16string_view uri)
Make a simpler unique name for preload / progress reporting.
std::map< OUString, rtl::Reference< Entity > >::const_iterator iterator_
std::map< OUString, rtl::Reference< Entity > > map
Context entries init struct calling createComponentContext().
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)
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)
css::uno::Reference< css::uno::XInterface > doCreateInstance(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::Reference< css::uno::XInterface > singleInstance
void updateDisposeInstance(bool singletonRequest, css::uno::Reference< css::uno::XInterface > const &instance)
ImplementationMap services
DynamicImplementations dynamicImplementations
NamedImplementations namedImplementations
ImplementationMap singletons
std::unordered_map< OUString, std::vector< std::shared_ptr< Implementation > > > ImplementationMap