diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-16 16:17:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-21 08:23:59 +0200 |
commit | be50ad28f5bbdaeff527f646481ce263843c2401 (patch) | |
tree | 65ecdaa5762dda2d9a42cff394a536bf568ed4f6 /scripting | |
parent | 6c61b20a8d4a6dcac28801cde82a211fb7e30654 (diff) |
fdo#46808, Convert awt::XUnoControlDialog to new style
Change-Id: I40d2e2ddd92186a2ba22ebfbdda8367391e8d355
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 64 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.hxx | 11 |
2 files changed, 33 insertions, 42 deletions
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index ea0856e95759..98ae353c9ddf 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -21,6 +21,7 @@ #include "DialogModelProvider.hxx" #include "dlgprov.hxx" #include "dlgevtatt.hxx" +#include <com/sun/star/awt/UnoControlDialog.hpp> #include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XControlContainer.hpp> @@ -457,55 +458,44 @@ namespace dlgprov // ----------------------------------------------------------------------------- - Reference< XControl > DialogProviderImpl::createDialogControl + Reference< XUnoControlDialog > DialogProviderImpl::createDialogControl ( const Reference< XControlModel >& rxDialogModel, const Reference< XWindowPeer >& xParent ) { OSL_ENSURE( rxDialogModel.is(), "DialogProviderImpl::getDialogControl: no dialog model" ); - Reference< XControl > xDialogControl; + Reference< XUnoControlDialog > xDialogControl; if ( m_xContext.is() ) { - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); + xDialogControl = UnoControlDialog::create( m_xContext ); - if ( xSMgr.is() ) - { - xDialogControl = Reference< XControl >( xSMgr->createInstanceWithContext( - OUString( "com.sun.star.awt.UnoControlDialog" ), m_xContext ), UNO_QUERY ); + // set the model + if ( rxDialogModel.is() ) + xDialogControl->setModel( rxDialogModel ); - if ( xDialogControl.is() ) - { - // set the model - if ( rxDialogModel.is() ) - xDialogControl->setModel( rxDialogModel ); - - // set visible - Reference< XWindow > xW( xDialogControl, UNO_QUERY ); - if ( xW.is() ) - xW->setVisible( sal_False ); - - // get the parent of the dialog control - Reference< XWindowPeer > xPeer; - if( xParent.is() ) - { - xPeer = xParent; - } - else if ( m_xModel.is() ) - { - Reference< frame::XController > xController( m_xModel->getCurrentController(), UNO_QUERY ); - if ( xController.is() ) - { - Reference< frame::XFrame > xFrame( xController->getFrame(), UNO_QUERY ); - if ( xFrame.is() ) - xPeer = Reference< XWindowPeer>( xFrame->getContainerWindow(), UNO_QUERY ); - } - } + // set visible + xDialogControl->setVisible( sal_False ); - // create a peer - Reference< XToolkit> xToolkit( Toolkit::create( m_xContext ), UNO_QUERY_THROW ); - xDialogControl->createPeer( xToolkit, xPeer ); + // get the parent of the dialog control + Reference< XWindowPeer > xPeer; + if( xParent.is() ) + { + xPeer = xParent; + } + else if ( m_xModel.is() ) + { + Reference< frame::XController > xController( m_xModel->getCurrentController(), UNO_QUERY ); + if ( xController.is() ) + { + Reference< frame::XFrame > xFrame( xController->getFrame(), UNO_QUERY ); + if ( xFrame.is() ) + xPeer = Reference< XWindowPeer>( xFrame->getContainerWindow(), UNO_QUERY ); } } + + // create a peer + Reference< XToolkit> xToolkit( Toolkit::create( m_xContext ), UNO_QUERY_THROW ); + xDialogControl->createPeer( xToolkit, xPeer ); } return xDialogControl; diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index a515b9448e9f..515f25a4d3bd 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -24,16 +24,17 @@ #include <com/sun/star/awt/XContainerWindowProvider.hpp> #include <com/sun/star/awt/XDialog.hpp> #include <com/sun/star/awt/XDialogProvider2.hpp> +#include <com/sun/star/awt/XUnoControlDialog.hpp> #include <com/sun/star/awt/XUnoControlDialogModel.hpp> +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/script/XScriptEventsAttacher.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/beans/XIntrospectionAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/resource/XStringResourceManager.hpp> +#include <com/sun/star/script/XScriptEventsAttacher.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase4.hxx> #include <osl/mutex.hxx> @@ -85,7 +86,7 @@ namespace dlgprov ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > createDialogModel( const OUString& sURL ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialog > createDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent ); |