summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-13 13:30:07 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-17 14:28:22 +0200
commit900d60b3cd648be79aaaa84c992edf9953c0c7f9 (patch)
tree8d2c6eb55fa57ee8917b6f2c27663ad92a17f2ad /desktop
parente3c05e34fddcecb81a8bd1f625ebcd601a0c0238 (diff)
fdo#46808, Adapt bridge::BridgeFactory UNO service to new style
Create a merged XBridgeFactory2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I7309f4d30f0e772bc203c701eb3407b920ffafcc
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/offacc/acceptor.cxx18
-rw-r--r--desktop/source/offacc/acceptor.hxx6
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx25
3 files changed, 21 insertions, 28 deletions
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index 64a3d3c77541..2fd0da302885 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -32,6 +32,7 @@
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
#include <cppuhelper/factory.hxx>
@@ -44,12 +45,11 @@ extern "C" void workerfunc (void * acc)
((Acceptor*)acc)->run();
}
-static Reference<XInterface> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
+static Reference<XComponentContext> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
{
- Reference<XInterface> rContext;
+ Reference<XComponentContext> rContext;
Reference< XPropertySet > rPropSet( rFactory, UNO_QUERY );
- Any a = rPropSet->getPropertyValue(
- ::rtl::OUString( "DefaultContext" ) );
+ Any a = rPropSet->getPropertyValue( ::rtl::OUString( "DefaultContext" ) );
a >>= rContext;
return rContext;
}
@@ -65,14 +65,12 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
, m_bDying(false)
{
m_rSMgr = rFactory;
+ // get component context
+ m_rContext = getComponentContext(m_rSMgr);
m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance(
rtl::OUString("com.sun.star.connection.Acceptor" )),
UNO_QUERY );
- m_rBridgeFactory = Reference < XBridgeFactory > (m_rSMgr->createInstance(
- rtl::OUString("com.sun.star.bridge.BridgeFactory" )),
- UNO_QUERY );
- // get component context
- m_rContext = getComponentContext(m_rSMgr);
+ m_rBridgeFactory = BridgeFactory::create(m_rContext);
}
@@ -108,7 +106,7 @@ Acceptor::~Acceptor()
void SAL_CALL Acceptor::run()
{
- while ( m_rAcceptor.is() && m_rBridgeFactory.is() )
+ while ( m_rAcceptor.is() )
{
RTL_LOGFILE_CONTEXT( aLog, "desktop (lo119109) Acceptor::run" );
try
diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx
index e25f4e308d80..0cb2dd3f6472 100644
--- a/desktop/source/offacc/acceptor.hxx
+++ b/desktop/source/offacc/acceptor.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/connection/XAcceptor.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/bridge/XInstanceProvider.hpp>
-#include <com/sun/star/bridge/XBridgeFactory.hpp>
+#include <com/sun/star/bridge/XBridgeFactory2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -66,9 +66,9 @@ private:
Condition m_cEnable;
Reference< XMultiServiceFactory > m_rSMgr;
- Reference< XInterface > m_rContext;
+ Reference< XComponentContext > m_rContext;
Reference< XAcceptor > m_rAcceptor;
- Reference< XBridgeFactory > m_rBridgeFactory;
+ Reference< XBridgeFactory2 > m_rBridgeFactory;
OUString m_aAcceptString;
OUString m_aConnectString;
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index ef16ea1b6a41..c3387f0ec0a5 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -51,6 +51,7 @@
#include "com/sun/star/lang/DisposedException.hpp"
#include "boost/scoped_array.hpp"
#include "com/sun/star/ui/dialogs/XDialogClosedListener.hpp"
+#include "com/sun/star/bridge/BridgeFactory.hpp"
#include "com/sun/star/bridge/XBridgeFactory.hpp"
#include <stdio.h>
#include <vector>
@@ -197,25 +198,19 @@ void disposeBridges(Reference<css::uno::XComponentContext> ctx)
if (!ctx.is())
return;
- Reference<css::bridge::XBridgeFactory> bridgeFac(
- ctx->getServiceManager()->createInstanceWithContext(
- OUSTR("com.sun.star.bridge.BridgeFactory"), ctx),
- UNO_QUERY);
+ Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(ctx) );
- if (bridgeFac.is())
+ const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
+ for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
{
- const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
- for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
+ Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
+ if (comp.is())
{
- Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
- if (comp.is())
+ try {
+ comp->dispose();
+ }
+ catch ( const css::lang::DisposedException& )
{
- try {
- comp->dispose();
- }
- catch ( const css::lang::DisposedException& )
- {
- }
}
}
}