summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-27 11:24:12 +0200
committerNoel Grandin <noel@peralex.com>2013-05-28 08:10:22 +0200
commit1d1825db869d3c633ec222fdaa7e4a813ac0627a (patch)
treed1c84dfbe5780bc063d78c335783fa9cffda800e /scripting
parent61fffd72ac9f09b95faf266f29e643c7bff802bd (diff)
fdo#46808, Convert awt::UnoControlDialog to new style
Change-Id: I9a5256c8dbacda60167403b4e26900588943a9b2
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx92
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx11
2 files changed, 47 insertions, 56 deletions
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 86c792774156..32a993020d26 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -21,34 +21,35 @@
#include "DialogModelProvider.hxx"
#include "dlgprov.hxx"
#include "dlgevtatt.hxx"
+#include <com/sun/star/awt/UnoControlDialog.hpp>
#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/io/XInputStreamProvider.hpp>
+#include <com/sun/star/beans/Introspection.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <com/sun/star/beans/Introspection.hpp>
+#include <com/sun/star/io/XInputStreamProvider.hpp>
+#include <com/sun/star/resource/XStringResourceWithLocation.hpp>
#include <com/sun/star/resource/XStringResourceSupplier.hpp>
#include <com/sun/star/resource/XStringResourceManager.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/resource/XStringResourceWithLocation.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <sfx2/app.hxx>
-#include <sfx2/objsh.hxx>
-#include <xmlscript/xmldlg_imexp.hxx>
-#include <tools/urlobj.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-
#include <com/sun/star/uri/XUriReference.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
+#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <xmlscript/xmldlg_imexp.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+
#include <util/MiscUtils.hxx>
using namespace ::com::sun::star;
@@ -472,55 +473,44 @@ static OUString aResourceResolverPropName("ResourceResolver");
// -----------------------------------------------------------------------------
- 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 651edfa32cb0..ac201e844c40 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -24,15 +24,16 @@
#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/awt/XDialogProvider2.hpp>
#include <com/sun/star/awt/XContainerWindowProvider.hpp>
+#include <com/sun/star/awt/XUnoControlDialog.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>
@@ -84,7 +85,7 @@ namespace dlgprov
OUString msDialogLibName;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > 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 );