summaryrefslogtreecommitdiff
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
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
-rw-r--r--basic/source/runtime/iosys.cxx20
-rw-r--r--binaryurp/source/bridgefactory.hxx4
-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
-rw-r--r--offapi/type_reference/types.rdbbin7655424 -> 7655424 bytes
-rw-r--r--remotebridges/source/unourl_resolver/unourl_resolver.cxx10
-rw-r--r--udkapi/UnoApi_udkapi.mk3
-rw-r--r--udkapi/com/sun/star/bridge/BridgeFactory.idl16
-rw-r--r--udkapi/com/sun/star/bridge/XBridgeFactory2.idl49
10 files changed, 85 insertions, 66 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index ea1b0f7c11d6..aa595157807a 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -41,6 +41,8 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
+#include <com/sun/star/bridge/XBridge.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -52,8 +54,6 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/bridge/XBridge.hpp>
-#include <com/sun/star/bridge/XBridgeFactory.hpp>
using namespace comphelper;
using namespace com::sun::star::uno;
@@ -214,19 +214,11 @@ bool needSecurityRestrictions( void )
return true;
}
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( !xSMgr.is() )
- return true;
- Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance
- ( ::rtl::OUString("com.sun.star.bridge.BridgeFactory" ) ), UNO_QUERY );
+ Reference< XComponentContext > xContext = getProcessComponentContext();
+ Reference< XBridgeFactory2 > xBridgeFac( BridgeFactory::create(xContext) );
- Sequence< Reference< XBridge > > aBridgeSeq;
- sal_Int32 nBridgeCount = 0;
- if( xBridgeFac.is() )
- {
- aBridgeSeq = xBridgeFac->getExistingBridges();
- nBridgeCount = aBridgeSeq.getLength();
- }
+ Sequence< Reference< XBridge > > aBridgeSeq = xBridgeFac->getExistingBridges();
+ sal_Int32 nBridgeCount = aBridgeSeq.getLength();
if( nBridgeCount == 0 )
{
diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx
index c08209247a86..a949e636402e 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -26,7 +26,7 @@
#include <map>
#include "boost/noncopyable.hpp"
-#include "com/sun/star/bridge/XBridgeFactory.hpp"
+#include "com/sun/star/bridge/XBridgeFactory2.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
@@ -50,7 +50,7 @@ namespace binaryurp {
typedef
cppu::WeakComponentImplHelper2<
com::sun::star::lang::XServiceInfo,
- com::sun::star::bridge::XBridgeFactory >
+ com::sun::star::bridge::XBridgeFactory2 >
BridgeFactoryBase;
class BridgeFactory:
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& )
- {
- }
}
}
}
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 8f2fe3bdb063..c0d725b57da4 100644
--- a/offapi/type_reference/types.rdb
+++ b/offapi/type_reference/types.rdb
Binary files differ
diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
index b3a54c6a67a8..a44d0b481320 100644
--- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx
+++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/connection/XConnector.hpp>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/bridge/XBridgeFactory.hpp>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
@@ -158,14 +159,7 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl )
Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) );
// As soon as singletons are ready, switch to singleton !
- Reference< XBridgeFactory > xBridgeFactory(
- _xSMgr->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ),
- _xCtx ),
- UNO_QUERY );
-
- if (! xBridgeFactory.is())
- throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no bridge factory!" ) ), Reference< XInterface >() );
+ Reference< XBridgeFactory2 > xBridgeFactory( BridgeFactory::create(_xCtx) );
// bridge
Reference< XBridge > xBridge( xBridgeFactory->createBridge(
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index cdffbda1dd7c..164e439685aa 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -44,7 +44,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/beans,\
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/bridge,\
Bridge \
- BridgeFactory \
IiopBridge \
OleApplicationRegistration \
OleBridgeSupplier \
@@ -229,11 +228,13 @@ $(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/beans,\
))
$(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/bridge,\
BridgeExistsException \
+ BridgeFactory \
InvalidProtocolChangeException \
ModelDependent \
ProtocolProperty \
XBridge \
XBridgeFactory \
+ XBridgeFactory2 \
XBridgeSupplier \
XBridgeSupplier2 \
XInstanceProvider \
diff --git a/udkapi/com/sun/star/bridge/BridgeFactory.idl b/udkapi/com/sun/star/bridge/BridgeFactory.idl
index 75fe2f78204f..765d2e481ad1 100644
--- a/udkapi/com/sun/star/bridge/BridgeFactory.idl
+++ b/udkapi/com/sun/star/bridge/BridgeFactory.idl
@@ -19,11 +19,10 @@
#ifndef __com_sun_star_bridge_BridgeFactory_idl__
#define __com_sun_star_bridge_BridgeFactory_idl__
-#include <com/sun/star/lang/XComponent.idl>
-#include <com/sun/star/bridge/XBridgeFactory.idl>
+#include <com/sun/star/bridge/XBridgeFactory2.idl>
- module com { module sun { module star { module bridge {
+module com { module sun { module star { module bridge {
/** allows to create new or access existing interprocess bridges.
@@ -34,16 +33,7 @@
@see com::sun::star::bridge::Bridge
*/
-published service BridgeFactory
-{
- /** The main interface of the service
- */
- interface com::sun::star::bridge::XBridgeFactory;
-
- /** This interface allows to break possible cyclic references.
- */
- interface com::sun::star::lang::XComponent;
-};
+published service BridgeFactory : com::sun::star::bridge::XBridgeFactory2;
}; }; }; };
diff --git a/udkapi/com/sun/star/bridge/XBridgeFactory2.idl b/udkapi/com/sun/star/bridge/XBridgeFactory2.idl
new file mode 100644
index 000000000000..b301024a1e5a
--- /dev/null
+++ b/udkapi/com/sun/star/bridge/XBridgeFactory2.idl
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_bridge_XBridgeFactory2_idl__
+#define __com_sun_star_bridge_XBridgeFactory2_idl__
+
+#include <com/sun/star/lang/XComponent.idl>
+#include <com/sun/star/bridge/XBridgeFactory.idl>
+
+
+module com { module sun { module star { module bridge {
+
+
+/**
+ Provides a unified interface for the BridgeFactory service to implement.
+
+ @since LibreOffice 3.7
+ */
+published interface XBridgeFactory2
+{
+ /** The main interface of the service
+ */
+ interface com::sun::star::bridge::XBridgeFactory;
+
+ /** This interface allows to break possible cyclic references.
+ */
+ interface com::sun::star::lang::XComponent;
+};
+
+
+}; }; }; };
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */