summaryrefslogtreecommitdiff
path: root/UnoControls
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
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')
-rw-r--r--UnoControls/inc/basecontainercontrol.hxx2
-rw-r--r--UnoControls/inc/basecontrol.hxx6
-rw-r--r--UnoControls/source/base/basecontainercontrol.cxx4
-rw-r--r--UnoControls/source/base/basecontrol.cxx15
-rw-r--r--UnoControls/source/base/registercontrols.cxx3
-rw-r--r--UnoControls/source/controls/framecontrol.cxx12
-rw-r--r--UnoControls/source/controls/progressbar.cxx4
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx28
-rw-r--r--UnoControls/source/controls/statusindicator.cxx10
-rw-r--r--UnoControls/source/inc/framecontrol.hxx2
-rw-r--r--UnoControls/source/inc/progressbar.hxx2
-rw-r--r--UnoControls/source/inc/progressmonitor.hxx2
-rw-r--r--UnoControls/source/inc/statusindicator.hxx2
13 files changed, 48 insertions, 44 deletions
diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx
index 857a8d7c50a2..a6a0906bdb08 100644
--- a/UnoControls/inc/basecontainercontrol.hxx
+++ b/UnoControls/inc/basecontainercontrol.hxx
@@ -78,7 +78,7 @@ public:
@onerror -
*/
- BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ BaseContainerControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_______________________________________________________________________________________________________
@short -
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx
index f54033ef84d8..0aa633d41f95 100644
--- a/UnoControls/inc/basecontrol.hxx
+++ b/UnoControls/inc/basecontrol.hxx
@@ -144,7 +144,7 @@ public:
@onerror -
*/
- BaseControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ BaseControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_______________________________________________________________________________________________________
@short -
@@ -1049,7 +1049,7 @@ protected:
@onerror -
*/
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > impl_getMultiServiceFactory();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > impl_getComponentContext();
/**_______________________________________________________________________________________________________
@short -
@@ -1217,7 +1217,7 @@ private:
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory ;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xComponentContext ;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDelegator ;
OMRCListenerMultiplexerHelper* m_pMultiplexer ; // multiplex events
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xMultiplexer ;
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) )) ); \
}
//******************************************************************************************************************************
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index 53f2ce080daf..27afd5d4e83b 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -49,8 +49,8 @@ namespace unocontrols{
// construct/destruct
//______________________________________________________________________________________________________________
-FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory )
- : BaseControl ( xFactory )
+FrameControl::FrameControl( const Reference< XComponentContext >& rxContext)
+ : BaseControl ( rxContext )
, OBroadcastHelper ( m_aMutex )
, OPropertySetHelper ( *(static_cast< OBroadcastHelper * >(this)) )
, m_aInterfaceContainer ( m_aMutex )
@@ -467,7 +467,9 @@ void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPee
xOldFrame = m_xFrame ;
}
- xNewFrame = Reference< XFrame > ( impl_getMultiServiceFactory()->createInstance ( "com.sun.star.frame.Frame" ), UNO_QUERY ) ;
+
+
+ xNewFrame = Reference< XFrame > ( impl_getComponentContext()->getServiceManager()->createInstanceWithContext("com.sun.star.frame.Frame", impl_getComponentContext()), UNO_QUERY ) ;
Reference< XDispatchProvider > xDSP ( xNewFrame, UNO_QUERY ) ;
if (xDSP.is())
@@ -478,9 +480,7 @@ void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPee
// option
//xFrame->setName( "WhatYouWant" );
- Reference< XURLTransformer > xTrans (
- URLTransformer::create(
- ::comphelper::getComponentContext( impl_getMultiServiceFactory() ) ) );
+ Reference< XURLTransformer > xTrans = URLTransformer::create( impl_getComponentContext() );
// load file
URL aURL ;
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx
index aff0ff069907..ce7c5eb2c1e8 100644
--- a/UnoControls/source/controls/progressbar.cxx
+++ b/UnoControls/source/controls/progressbar.cxx
@@ -42,8 +42,8 @@ namespace unocontrols{
// construct/destruct
//____________________________________________________________________________________________________________
-ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory )
- : BaseControl ( xFactory )
+ProgressBar::ProgressBar( const Reference< XComponentContext >& rxContext )
+ : BaseControl ( rxContext )
, m_bHorizontal ( PROGRESSBAR_DEFAULT_HORIZONTAL )
, m_aBlockSize ( PROGRESSBAR_DEFAULT_BLOCKDIMENSION )
, m_nForegroundColor ( PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR )
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index cea1990b81f8..ef4d53f01797 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -47,20 +47,21 @@ namespace unocontrols{
// construct/destruct
//____________________________________________________________________________________________________________
-ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory )
- : BaseContainerControl ( xFactory )
+ProgressMonitor::ProgressMonitor( const Reference< XComponentContext >& rxContext )
+ : BaseContainerControl ( rxContext )
{
// Its not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
++m_refCount ;
// Create instances for fixedtext, button and progress ...
- m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
- m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
- m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
- m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( FIXEDTEXT_SERVICENAME ), UNO_QUERY ) ;
- m_xButton = Reference< XButton > ( xFactory->createInstance ( BUTTON_SERVICENAME ), UNO_QUERY ) ;
- m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( SERVICENAME_PROGRESSBAR ), UNO_QUERY ) ;
+
+ m_xTopic_Top = Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+ m_xText_Top = Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+ m_xTopic_Bottom = Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+ m_xText_Bottom = Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY ) ;
+ m_xButton = Reference< XButton > ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_SERVICENAME, rxContext ), UNO_QUERY ) ;
+ m_xProgressBar = Reference< XProgressBar > ( rxContext->getServiceManager()->createInstanceWithContext( SERVICENAME_PROGRESSBAR, rxContext ), UNO_QUERY ) ;
// ... cast controls to Reference< XControl > (for "setModel"!) ...
Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ;
@@ -70,12 +71,13 @@ ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFact
Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ;
Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ;
+
// ... set models ...
- xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
- xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
- xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
- xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( FIXEDTEXT_MODELNAME ), UNO_QUERY ) ) ;
- xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( BUTTON_MODELNAME ), UNO_QUERY ) ) ;
+ xRef_Topic_Top->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+ xRef_Text_Top->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+ xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+ xRef_Text_Bottom->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) ) ;
+ xRef_Button->setModel ( Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext( BUTTON_MODELNAME, rxContext ), UNO_QUERY ) ) ;
// ProgressBar has no model !!!
// ... and add controls to basecontainercontrol!
diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx
index 87d44a2a2395..a3e9515eb551 100644
--- a/UnoControls/source/controls/statusindicator.cxx
+++ b/UnoControls/source/controls/statusindicator.cxx
@@ -39,21 +39,21 @@ namespace unocontrols{
// construct/destruct
//____________________________________________________________________________________________________________
-StatusIndicator::StatusIndicator( const Reference< XMultiServiceFactory >& xFactory )
- : BaseContainerControl ( xFactory )
+StatusIndicator::StatusIndicator( const Reference< XComponentContext >& rxContext )
+ : BaseContainerControl ( rxContext )
{
// Its not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
++m_refCount ;
// Create instances for fixedtext and progress ...
- m_xText = Reference< XFixedText > ( xFactory->createInstance( FIXEDTEXT_SERVICENAME ), UNO_QUERY );
- m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance( SERVICENAME_PROGRESSBAR ), UNO_QUERY );
+ m_xText = Reference< XFixedText > ( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_SERVICENAME, rxContext ), UNO_QUERY );
+ m_xProgressBar = Reference< XProgressBar > ( rxContext->getServiceManager()->createInstanceWithContext( SERVICENAME_PROGRESSBAR, rxContext ), UNO_QUERY );
// ... cast controls to Reference< XControl > and set model ...
// ( ProgressBar has no model !!! )
Reference< XControl > xTextControl ( m_xText , UNO_QUERY );
Reference< XControl > xProgressControl ( m_xProgressBar, UNO_QUERY );
- xTextControl->setModel( Reference< XControlModel >( xFactory->createInstance( FIXEDTEXT_MODELNAME ), UNO_QUERY ) );
+ xTextControl->setModel( Reference< XControlModel >( rxContext->getServiceManager()->createInstanceWithContext( FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
// ... and add controls to basecontainercontrol!
addControl( CONTROLNAME_TEXT, xTextControl );
addControl( CONTROLNAME_PROGRESSBAR, xProgressControl );
diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
index 7f4340ccd808..ca913f638a77 100644
--- a/UnoControls/source/inc/framecontrol.hxx
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -84,7 +84,7 @@ public:
@onerror
*/
- FrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ FrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_________________________________________________________________________________________________________
@short
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
index 8fb3d8bcdeab..1c8d89255512 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -73,7 +73,7 @@ public:
@onerror
*/
- ProgressBar( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ ProgressBar( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_________________________________________________________________________________________________________
@short
diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx
index 3915b46509fc..163dc0963626 100644
--- a/UnoControls/source/inc/progressmonitor.hxx
+++ b/UnoControls/source/inc/progressmonitor.hxx
@@ -128,7 +128,7 @@ public:
@onerror
*/
- ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_______________________________________________________________________________________________________
@short
diff --git a/UnoControls/source/inc/statusindicator.hxx b/UnoControls/source/inc/statusindicator.hxx
index 688e18689a82..300cfc6711c3 100644
--- a/UnoControls/source/inc/statusindicator.hxx
+++ b/UnoControls/source/inc/statusindicator.hxx
@@ -84,7 +84,7 @@ class StatusIndicator : public ::com::sun::star::awt::XLayoutConstrains
@onerror
*/
- StatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ StatusIndicator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/**_______________________________________________________________________________________________________
@short