summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-13 11:01:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-14 18:24:48 +0200
commit2e284203da7f9882842111265f5f68ea0a145065 (patch)
tree40eb08bffa732c6371bb15eff73a8d2ff18859a3 /ucbhelper
parent82e94dcaab4534f657458a2461033d686f10cb10 (diff)
fdo#46808, Adapt ucb::UniversalContentBroker UNO service to new style
Create a merged XUniversalContentBroker interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: Id264387bf8af8bf211050e15b8801a1fde368167
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/source/client/contentbroker.cxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index bd85d2f5076b..219a7a13d077 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -26,8 +26,10 @@
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
@@ -40,6 +42,7 @@
#include <ucbhelper/configurationkeys.hxx>
#endif
+using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
@@ -310,13 +313,21 @@ bool ContentBroker_Impl::initialize()
{
try
{
- xIfc = m_xSMgr->createInstanceWithArguments(
- OUString(
- "com.sun.star.ucb.UniversalContentBroker" ),
- m_aArguments );
+ Reference< XPropertySet > xFactoryProperties( m_xSMgr, UNO_QUERY_THROW );
+ Reference< XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY_THROW );
+ if( m_aArguments.getLength() == 0 )
+ xIfc = UniversalContentBroker::createDefault(xContext);
+ else
+ {
+ rtl::OUString aPrimaryConfigKey, aSecondaryConfigKey;
+ m_aArguments[0] >>= aPrimaryConfigKey;
+ m_aArguments[1] >>= aSecondaryConfigKey;
+ xIfc = UniversalContentBroker::createWithKeys(xContext, aPrimaryConfigKey, aSecondaryConfigKey);
+ }
}
- catch ( Exception const & )
+ catch ( const Exception & e)
{
+ SAL_WARN("ucbhelper", "exception while initialising UniversalContentBroker " << e.Message);
}
}