diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-14 12:58:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 10:57:09 +0200 |
commit | bb121c864cc3c101ef733a4088c7ba3e36eced14 (patch) | |
tree | 2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /connectivity | |
parent | 6d818ed651aaafcfb12ebc21449d35947d2e85a9 (diff) |
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface
because it introduced method name conflicts (addEventListener).
Shouldn't be an issue since it was scheduled to be dropped anyhow,
and the service implementation still implements it, so existing clients
will be fine.
I dropped the interface XPropertySet from the combined IDL because nobody
seems to be using it, and it's primary purpose appears to be to set weird
flags.
I dropped the optional interfaces
XStatusIndicatorFactory
XDispatchInformationProvider
from the combined IDL because the service does not implement them, and
nobody seems to be using them. I suspect they were mistakenly copied
from XFrame.
I also did not convert the Title, UserDefinedAttributes and LayoutManager
properties to attributes, again because no-one is using them.
Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/cpool/ZPoolCollection.cxx | 19 | ||||
-rw-r--r-- | connectivity/source/cpool/ZPoolCollection.hxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/calc/CConnection.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HDriver.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/kab/KDriver.cxx | 23 | ||||
-rw-r--r-- | connectivity/source/drivers/kab/KDriver.hxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/macab/MacabDriver.cxx | 20 | ||||
-rw-r--r-- | connectivity/source/drivers/macab/MacabDriver.hxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx | 13 |
9 files changed, 54 insertions, 79 deletions
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index b7d0abd075d5..3ab3f752719d 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/reflection/ProxyFactory.hpp> #include <com/sun/star/sdbc/DriverManager.hpp> #include <comphelper/extract.hxx> @@ -72,13 +73,13 @@ static const ::rtl::OUString& getEnableNodeName() } //-------------------------------------------------------------------- -OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxFactory) - :m_xServiceFactory(_rxFactory) +OPoolCollection::OPoolCollection(const Reference< XComponentContext >& _rxContext) + :m_xContext(_rxContext) { // bootstrap all objects supporting the .sdb.Driver service - m_xManager = DriverManager::create( comphelper::getComponentContext(m_xServiceFactory) ); + m_xManager = DriverManager::create( m_xContext ); - m_xProxyFactory = ProxyFactory::create( comphelper::getComponentContext(m_xServiceFactory) ); + m_xProxyFactory = ProxyFactory::create( m_xContext ); Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY); if ( xProp.is() ) @@ -87,9 +88,8 @@ OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxF osl_atomic_increment( &m_refCount ); { - m_xDesktop = Reference< ::com::sun::star::frame::XDesktop>( m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener(this); + m_xDesktop = ::com::sun::star::frame::Desktop::create( m_xContext ); + m_xDesktop->addTerminateListener(this); } osl_atomic_decrement( &m_refCount ); @@ -164,7 +164,7 @@ Sequence< ::rtl::OUString > SAL_CALL OPoolCollection::getSupportedServiceNames( //---------------------------------------OPoolCollection---------------------------------- Reference< XInterface > SAL_CALL OPoolCollection::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) { - return static_cast<XDriverManager*>(new OPoolCollection(_rxFactory)); + return static_cast<XDriverManager*>(new OPoolCollection(comphelper::getComponentContext(_rxFactory))); } //-------------------------------------------------------------------------- @@ -332,8 +332,7 @@ OConnectionPool* OPoolCollection::getConnectionPool(const ::rtl::OUString& _sImp Reference< XInterface > OPoolCollection::createWithServiceFactory(const ::rtl::OUString& _rPath) const { return createWithProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getComponentContext(m_xServiceFactory)), + com::sun::star::configuration::theDefaultProvider::get(m_xContext), _rPath); } //------------------------------------------------------------------------ diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx index 6fb05bb31339..b601c53a21e2 100644 --- a/connectivity/source/cpool/ZPoolCollection.hxx +++ b/connectivity/source/cpool/ZPoolCollection.hxx @@ -29,7 +29,8 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/reflection/XProxyFactory.hpp> #include <comphelper/stl_types.hxx> @@ -65,11 +66,11 @@ namespace connectivity MapDriver2DriverRef m_aDriverProxies; ::osl::Mutex m_aMutex; OConnectionPools m_aPools; // the driver pools - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager2 > m_xManager; ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory > m_xProxyFactory; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xConfigNode; // config node for generel connection pooling - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> m_xDesktop; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2> m_xDesktop; private: OPoolCollection(); // never implemented @@ -77,7 +78,7 @@ namespace connectivity int operator= (const OPoolCollection&); // never implemented OPoolCollection( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // some configuration helper methods ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createWithServiceFactory(const ::rtl::OUString& _rPath) const; diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index 6576fc1a729b..3ba98f43182c 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -24,6 +24,7 @@ #include "resource/calc_res.hrc" #include "resource/sharedresources.hxx" #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <tools/urlobj.hxx> @@ -32,6 +33,7 @@ #include <unotools/pathoptions.hxx> #include <connectivity/dbexception.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <comphelper/processfactory.hxx> #include <rtl/logfile.hxx> using namespace connectivity::calc; @@ -126,13 +128,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() aArgs[nPos].Value <<= m_sPassword; } - Reference< XComponentLoader > xDesktop( getDriver()->getFactory()->createInstance( - ::rtl::OUString("com.sun.star.frame.Desktop")), UNO_QUERY ); - if (!xDesktop.is()) - { - OSL_FAIL("no desktop"); - throw SQLException(); - } + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getDriver()->getFactory()) ); Reference< XComponent > xComponent; Any aLoaderException; try diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index a805bfcf7756..25087d2ebd24 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -33,7 +33,7 @@ #include <jvmfwk/framework.h> #include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/util/XFlushable.hpp> #include "HTerminateListener.hxx" @@ -372,13 +372,10 @@ namespace connectivity static Reference< XTerminateListener> s_xTerminateListener; if( !s_xTerminateListener.is() ) { - Reference< XDesktop > xDesktop( m_xFactory->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(m_xFactory) ); - if( xDesktop.is() ) - { - s_xTerminateListener = new OConnectionController(this); - xDesktop->addTerminateListener(s_xTerminateListener); - } + s_xTerminateListener = new OConnectionController(this); + xDesktop->addTerminateListener(s_xTerminateListener); } Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, comphelper::getComponentContext(m_xFactory) ); xConnection.set(xIfc,UNO_QUERY); diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index 04ee1195631d..9f32fdb54329 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -45,8 +45,8 @@ using namespace connectivity::kab; // = KabImplModule // ======================================================================= // -------------------------------------------------------------------------------- -KabImplModule::KabImplModule( const Reference< XMultiServiceFactory >& _rxFactory ) - :m_xORB(_rxFactory) +KabImplModule::KabImplModule( const Reference< XComponentContext >& _rxContext ) + :m_xContext(_rxContext) ,m_bAttemptedLoadModule(false) ,m_bAttemptedInitialize(false) ,m_hConnectorModule(NULL) @@ -55,7 +55,7 @@ KabImplModule::KabImplModule( const Reference< XMultiServiceFactory >& _rxFactor ,m_pApplicationShutdownFunc(NULL) ,m_pKDEVersionCheckFunc(NULL) { - if ( !m_xORB.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); } @@ -181,8 +181,7 @@ bool KabImplModule::impl_doAllowNewKDEVersion() try { Reference< XMultiServiceFactory > xConfigProvider( - com::sun::star::configuration::theDefaultProvider::get( - comphelper::getComponentContext( m_xORB ) ) ); + com::sun::star::configuration::theDefaultProvider::get( m_xContext ) ); Sequence< Any > aCreationArgs(1); aCreationArgs[0] <<= PropertyValue( ::rtl::OUString( "nodepath" ), @@ -303,20 +302,18 @@ void KabImplModule::shutdown() // = KabDriver // ======================================================================= KabDriver::KabDriver( - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : KDriver_BASE(m_aMutex), - m_xMSFactory(_rxFactory), - m_aImplModule(_rxFactory) + m_xContext(_rxContext), + m_aImplModule(_rxContext) { - if ( !m_xMSFactory.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); osl_atomic_increment( &m_refCount ); try { - Reference< XDesktop > xDesktop( - m_xMSFactory->createInstance( ::rtl::OUString( "com.sun.star.frame.Desktop" ) ), - UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext); xDesktop->addTerminateListener( this ); } catch( const Exception& ) @@ -462,7 +459,7 @@ const sal_Char* KabDriver::impl_getAsciiImplementationName() // -------------------------------------------------------------------------------- Reference< XInterface > SAL_CALL KabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception ) { - return *(new KabDriver(_rxFactory)); + return *(new KabDriver( comphelper::getComponentContext(_rxFactory))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/kab/KDriver.hxx b/connectivity/source/drivers/kab/KDriver.hxx index 1243f7425185..678f5a835924 100644 --- a/connectivity/source/drivers/kab/KDriver.hxx +++ b/connectivity/source/drivers/kab/KDriver.hxx @@ -47,8 +47,8 @@ namespace connectivity class KabImplModule { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; /// Did we already attempt to load the module and to retrieve the symbols? bool m_bAttemptedLoadModule; @@ -62,7 +62,7 @@ namespace connectivity KDEVersionCheckFunction m_pKDEVersionCheckFunc; public: - KabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); + KabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); /** determines whether there is a KDE present in the environment */ @@ -151,8 +151,8 @@ namespace connectivity ::osl::Mutex m_aMutex; // mutex is need to control member access OWeakRefArray m_xConnections; // vector containing a list of all the // KabConnection objects for this Driver - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xMSFactory; // the multi-service factory + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; // the multi-service factory KabImplModule m_aImplModule; public: @@ -163,7 +163,7 @@ namespace connectivity static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - getComponentContext() const { return comphelper::getComponentContext(m_xMSFactory); } + getComponentContext() const { return m_xContext; } /** returns the driver's implementation name (being pure ASCII) for reference in various places */ @@ -174,7 +174,7 @@ namespace connectivity static ::rtl::OUString impl_getConfigurationSettingsPath(); protected: - KabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + KabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // OComponentHelper virtual void SAL_CALL disposing(void); diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index ea60ded3156c..a2adc78d11b2 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -27,6 +27,7 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> #include "resource/macab_res.hrc" +#include <comphelper/processfactory.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -40,14 +41,11 @@ using namespace connectivity::macab; // = MacabImplModule // ======================================================================= // -------------------------------------------------------------------------------- -MacabImplModule::MacabImplModule( const Reference< XMultiServiceFactory >& _rxFactory ) - :m_xORB(_rxFactory) - ,m_bAttemptedLoadModule(false) +MacabImplModule::MacabImplModule( const Reference< XMultiServiceFactory >& _rxContext ) + :m_bAttemptedLoadModule(false) ,m_hConnectorModule(NULL) ,m_pConnectionFactoryFunc(NULL) { - if ( !m_xORB.is() ) - throw NullPointerException(); } // -------------------------------------------------------------------------------- @@ -172,20 +170,18 @@ void MacabImplModule::shutdown() // = MacabDriver // ======================================================================= MacabDriver::MacabDriver( - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : MacabDriver_BASE(m_aMutex), - m_xMSFactory(_rxFactory), + m_xContext(_rxContext), m_aImplModule(_rxFactory) { - if ( !m_xMSFactory.is() ) + if ( !m_xContext.is() ) throw NullPointerException(); osl_atomic_increment( &m_refCount ); try { - Reference< XDesktop > xDesktop( - m_xMSFactory->createInstance( ::rtl::OUString( "com.sun.star.frame.Desktop" ) ), - UNO_QUERY_THROW ); + Reference< XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); xDesktop->addTerminateListener( this ); } catch( const Exception& ) @@ -331,7 +327,7 @@ const sal_Char* MacabDriver::impl_getAsciiImplementationName() // -------------------------------------------------------------------------------- Reference< XInterface > SAL_CALL MacabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception ) { - return *(new MacabDriver(_rxFactory)); + return *(new MacabDriver(comphelper::getComponentContext(_rxFactory))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/macab/MacabDriver.hxx b/connectivity/source/drivers/macab/MacabDriver.hxx index cbfe0c035bdc..d1d6fe24515b 100644 --- a/connectivity/source/drivers/macab/MacabDriver.hxx +++ b/connectivity/source/drivers/macab/MacabDriver.hxx @@ -23,7 +23,6 @@ #include <com/sun/star/sdbc/XDriver.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> -#include <comphelper/processfactory.hxx> #include <cppuhelper/compbase3.hxx> #include <osl/module.h> @@ -49,16 +48,13 @@ namespace connectivity class MacabImplModule { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - /// Did we already attempt to load the module and to retrieve the symbols? bool m_bAttemptedLoadModule; oslModule m_hConnectorModule; ConnectionFactoryFunction m_pConnectionFactoryFunc; public: - MacabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); + MacabImplModule(); /** determines whether there is a mac OS present in the environment */ @@ -124,8 +120,8 @@ namespace connectivity ::osl::Mutex m_aMutex; // mutex is need to control member access OWeakRefArray m_xConnections; // vector containing a list of all the // MacabConnection objects for this Driver - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xMSFactory; // the multi-service factory + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; // the multi-service factory MacabImplModule m_aImplModule; public: @@ -136,7 +132,7 @@ namespace connectivity static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - getComponentContext() const { return comphelper::getComponentContext(m_xMSFactory); } + getComponentContext() const { return m_xContext; } /** returns the driver's implementation name (being pure ASCII) for reference in various places */ @@ -147,7 +143,7 @@ namespace connectivity static ::rtl::OUString impl_getConfigurationSettingsPath(); protected: - MacabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + MacabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); // OComponentHelper virtual void SAL_CALL disposing(void); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx index 389aa6dcd546..be8d8e637ae2 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx @@ -19,7 +19,7 @@ #include "MNSTerminateListener.hxx" #include <comphelper/processfactory.hxx> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include "bootstrap/MNSInit.hxx" @@ -63,15 +63,8 @@ void SAL_CALL MNSTerminateListener::notifyTermination( const EventObject& /*aEve void MNSTerminateListener::addTerminateListener() { - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - - if( xFact.is() ) - { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString("com.sun.star.frame.Desktop") ), UNO_QUERY ); - - if( xDesktop.is() ) - xDesktop->addTerminateListener(mxTerminateListener); - } + Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); + xDesktop->addTerminateListener(mxTerminateListener); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |