summaryrefslogtreecommitdiff
path: root/UnoControls/source/base
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-17 10:52:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-24 16:49:49 +0200
commit33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 (patch)
treeabd469ffb224c8d7b2de1cf76e3aada03e035fc1 /UnoControls/source/base
parentf252b332dd2652abb02851ba0c2521c045787801 (diff)
fdo#46808, Adapt awt::Toolkit UNO service to new style
Create a merged XToolkit2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Also mark sub-interfaces as non-optional. Change-Id: I278d0288e92be277033013302267cf93f7d70480
Diffstat (limited to 'UnoControls/source/base')
-rw-r--r--UnoControls/source/base/basecontainercontrol.cxx4
-rw-r--r--UnoControls/source/base/basecontrol.cxx15
-rw-r--r--UnoControls/source/base/registercontrols.cxx3
3 files changed, 12 insertions, 10 deletions
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
index 83bedbf3cfc5..2ef9a9e6e1de 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -39,8 +39,8 @@ namespace unocontrols{
// construct/destruct
//____________________________________________________________________________________________________________
-BaseContainerControl::BaseContainerControl( const Reference< XMultiServiceFactory >& xFactory )
- : BaseControl ( xFactory )
+BaseContainerControl::BaseContainerControl( const Reference< XComponentContext >& rxContext )
+ : BaseControl ( rxContext )
, m_aListeners ( m_aMutex )
{
}
diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx
index 068317b9075b..02e3a04dbe0f 100644
--- a/UnoControls/source/base/basecontrol.cxx
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -24,6 +24,8 @@
#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -48,16 +50,15 @@ namespace unocontrols{
#define DEFAULT_VISIBLE sal_False
#define DEFAULT_INDESIGNMODE sal_False
#define DEFAULT_ENABLE sal_True
-#define SERVICE_VCLTOOLKIT "com.sun.star.awt.Toolkit"
//____________________________________________________________________________________________________________
// construct/destruct
//____________________________________________________________________________________________________________
-BaseControl::BaseControl( const Reference< XMultiServiceFactory >& xFactory )
+BaseControl::BaseControl( const Reference< XComponentContext >& rxContext )
: IMPL_MutexContainer ( )
, OComponentHelper ( m_aMutex )
- , m_xFactory ( xFactory )
+ , m_xComponentContext ( rxContext )
, m_pMultiplexer ( DEFAULT_PMULTIPLEXER )
, m_nX ( DEFAULT_X )
, m_nY ( DEFAULT_Y )
@@ -335,8 +336,8 @@ void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToo
Reference< XToolkit > xLocalToolkit = xToolkit ;
if ( xLocalToolkit.is() == sal_False )
{
- // but first create wellknown toolkit, if it not exist
- xLocalToolkit = Reference< XToolkit > ( m_xFactory->createInstance( SERVICE_VCLTOOLKIT ), UNO_QUERY );
+ // but first create well known toolkit, if it not exist
+ xLocalToolkit = Reference< XToolkit > ( Toolkit::create(m_xComponentContext), UNO_QUERY_THROW );
}
m_xPeer = xLocalToolkit->createWindow( *pDescriptor );
m_xPeerWindow = Reference< XWindow >( m_xPeer, UNO_QUERY );
@@ -848,9 +849,9 @@ const OUString BaseControl::impl_getStaticImplementationName()
// protected method
//____________________________________________________________________________________________________________
-const Reference< XMultiServiceFactory > BaseControl::impl_getMultiServiceFactory()
+const Reference< XComponentContext > BaseControl::impl_getComponentContext()
{
- return m_xFactory ;
+ return m_xComponentContext ;
}
//____________________________________________________________________________________________________________
diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx
index 5738fec896b9..dfcdfb0d8f67 100644
--- a/UnoControls/source/base/registercontrols.cxx
+++ b/UnoControls/source/base/registercontrols.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -55,7 +56,7 @@ using namespace ::com::sun::star::registry ;
\
static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \
{ \
- return Reference< XInterface >( *(OWeakObject*)(new CLASS( rServiceManager )) ); \
+ return Reference< XInterface >( *(OWeakObject*)(new CLASS( comphelper::getComponentContext(rServiceManager) )) ); \
}
//******************************************************************************************************************************