summaryrefslogtreecommitdiff
path: root/framework/source/tabwin
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 /framework/source/tabwin
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 'framework/source/tabwin')
-rw-r--r--framework/source/tabwin/tabwindow.cxx6
-rw-r--r--framework/source/tabwin/tabwinfactory.cxx51
2 files changed, 26 insertions, 31 deletions
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index d1b287492639..e0bdb92bfb2f 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -32,6 +32,7 @@
#include <threadhelp/resetableguard.hxx>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowDescriptor.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -299,15 +300,14 @@ throw (css::uno::Exception, css::uno::RuntimeException)
{
css::beans::PropertyValue aPropValue;
css::uno::Reference< css::awt::XTopWindow > xTopWindow;
- css::uno::Reference< css::awt::XToolkit > xToolkit;
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit;
css::awt::WindowDescriptor aDescriptor;
if ( xSMGR.is() )
{
try
{
- xToolkit = css::uno::Reference< css::awt::XToolkit >(
- xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
+ xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) );
}
catch ( const css::uno::RuntimeException& )
{
diff --git a/framework/source/tabwin/tabwinfactory.cxx b/framework/source/tabwin/tabwinfactory.cxx
index a3d7815fd7ce..89a58d2928a9 100644
--- a/framework/source/tabwin/tabwinfactory.cxx
+++ b/framework/source/tabwin/tabwinfactory.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
@@ -90,7 +91,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException )
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ResetableGuard aLock( m_aLock );
- css::uno::Reference< css::awt::XToolkit > xToolkit = m_xToolkit;
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit = m_xToolkit;
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xServiceManager );
aLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -110,37 +111,31 @@ throw ( css::uno::Exception, css::uno::RuntimeException )
if ( !xToolkit.is() && xSMGR.is() )
{
- xToolkit = css::uno::Reference< css::awt::XToolkit >( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
- if ( xToolkit.is() )
- {
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- aLock.lock();
- m_xToolkit = xToolkit;
- aLock.unlock();
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- }
+ xToolkit = css::awt::Toolkit::create( comphelper::getComponentContext(xSMGR) );
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ aLock.lock();
+ m_xToolkit = xToolkit;
+ aLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
}
if ( !xTopWindow.is() )
{
- if ( xToolkit.is() )
- {
- // describe window properties.
- css::awt::WindowDescriptor aDescriptor;
- aDescriptor.Type = css::awt::WindowClass_TOP ;
- aDescriptor.ParentIndex = -1 ;
- aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ;
- aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ;
- aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER|
- css::awt::WindowAttribute::SIZEABLE|
- css::awt::WindowAttribute::MOVEABLE|
- css::awt::WindowAttribute::CLOSEABLE|
- css::awt::WindowAttribute::MINSIZE;
-
- // create a parent window
- xTopWindow = css::uno::Reference< css::awt::XTopWindow >(
- xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY );
- }
+ // describe window properties.
+ css::awt::WindowDescriptor aDescriptor;
+ aDescriptor.Type = css::awt::WindowClass_TOP ;
+ aDescriptor.ParentIndex = -1 ;
+ aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ;
+ aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ;
+ aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER|
+ css::awt::WindowAttribute::SIZEABLE|
+ css::awt::WindowAttribute::MOVEABLE|
+ css::awt::WindowAttribute::CLOSEABLE|
+ css::awt::WindowAttribute::MINSIZE;
+
+ // create a parent window
+ xTopWindow = css::uno::Reference< css::awt::XTopWindow >(
+ xToolkit->createWindow( aDescriptor ), css::uno::UNO_QUERY );
}
if ( xTopWindow.is() )