summaryrefslogtreecommitdiff
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
parent61fffd72ac9f09b95faf266f29e643c7bff802bd (diff)
fdo#46808, Convert awt::UnoControlDialog to new style
Change-Id: I9a5256c8dbacda60167403b4e26900588943a9b2
-rw-r--r--basctl/source/dlged/dlged.cxx11
-rw-r--r--basic/source/runtime/methods1.cxx2
-rw-r--r--extensions/source/update/check/updatehdl.cxx13
-rw-r--r--filter/source/t602/t602filter.cxx28
-rw-r--r--include/toolkit/controls/dialogcontrol.hxx74
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/awt/UnoControlDialog.idl20
-rw-r--r--offapi/com/sun/star/awt/XUnoControlDialog.idl58
-rw-r--r--offapi/type_reference/offapi.rdbbin6833152 -> 6832128 bytes
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx92
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx11
-rw-r--r--sdext/source/minimizer/optimizerdialog.cxx2
-rw-r--r--sdext/source/minimizer/unodialog.cxx51
-rw-r--r--sdext/source/minimizer/unodialog.hxx7
-rw-r--r--xmlscript/test/imexp.cxx24
15 files changed, 235 insertions, 161 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 54aef41b16ba..d2f55c589810 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -33,6 +33,7 @@
#include "baside3.hxx"
#include <com/sun/star/awt/Toolkit.hpp>
+#include <com/sun/star/awt/UnoControlDialog.hpp>
#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/resource/StringResource.hpp>
#include <com/sun/star/util/XCloneable.hpp>
@@ -91,7 +92,7 @@ void DlgEditor::ShowDialog()
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
// create a dialog
- uno::Reference< awt::XControl > xDlg( getProcessServiceFactory()->createInstance( "com.sun.star.awt.UnoControlDialog" ), uno::UNO_QUERY );
+ uno::Reference< awt::XUnoControlDialog > xDlg = awt::UnoControlDialog::create( xContext );
// clone the dialog model
uno::Reference< util::XCloneable > xC( m_xUnoControlDialogModel, uno::UNO_QUERY );
@@ -138,12 +139,10 @@ void DlgEditor::ShowDialog()
uno::Reference< awt::XToolkit> xToolkit = awt::Toolkit::create( xContext );
xDlg->createPeer( xToolkit, rWindow.GetComponentInterface() );
- uno::Reference< awt::XDialog > xD( xDlg, uno::UNO_QUERY );
- xD->execute();
+ xDlg->execute();
- uno::Reference< lang::XComponent > xComponent(xDlg, uno::UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
+ // need to cast because of multiple inheritance
+ Reference<awt::XControl>(xDlg)->dispose();
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 5847754cac22..7b7ea190eb0a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1607,7 +1607,7 @@ RTLFUNC(EqualUnoObjects)
RTL_Impl_EqualUnoObjects( pBasic, rPar, bWrite );
}
-// Instanciate "com.sun.star.awt.UnoControlDialog" on basis
+// Instantiate "com.sun.star.awt.UnoControlDialog" on basis
// of a DialogLibrary entry: Convert from XML-ByteSequence
// and attach events. Implemented in classes\eventatt.cxx
void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx
index 96a74aa9a10d..5abe4c8432f4 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -33,6 +33,7 @@
#include "com/sun/star/awt/ActionEvent.hpp"
#include "com/sun/star/awt/PushButtonType.hpp"
+#include "com/sun/star/awt/UnoControlDialog.hpp"
#include "com/sun/star/awt/VclWindowPeerAttribute.hpp"
#include "com/sun/star/awt/WindowAttribute.hpp"
#include "com/sun/star/awt/XButton.hpp"
@@ -1322,25 +1323,19 @@ void UpdateHandler::createDialog()
aProps);
}
- uno::Reference< awt::XControl > xControl(
- xFactory->createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", mxContext),
- uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XUnoControlDialog > xControl = awt::UnoControlDialog::create( mxContext );
xControl->setModel( xControlModel );
if ( mbVisible == false )
{
- uno::Reference< awt::XWindow > xWindow( xControl, uno::UNO_QUERY );
-
- if ( xWindow.is() )
- xWindow->setVisible( false );
+ xControl->setVisible( false );
}
xControl->createPeer( NULL, NULL );
{
- uno::Reference< awt::XControlContainer > xContainer (xControl, uno::UNO_QUERY);
for ( int i = 0; i < HELP_BUTTON; i++ )
{
- uno::Reference< awt::XButton > xButton ( xContainer->getControl( msButtonIDs[i] ), uno::UNO_QUERY);
+ uno::Reference< awt::XButton > xButton ( xControl->getControl( msButtonIDs[i] ), uno::UNO_QUERY);
if (xButton.is())
{
xButton->setActionCommand( msButtonIDs[i] );
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index 4ef5b6deeecf..9218eb75483e 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/awt/UnoControlDialog.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
@@ -1067,31 +1068,18 @@ sal_Bool T602ImportFilterDialog::OptionsDlg()
_Insert(xNameCont, T602DLG_CODE_LB, ListBoxModel);
_Insert(xNameCont, T602DLG_CODE_TXT, TextModel);
- Reference< XInterface > dialog = _InstCtx("com.sun.star.awt.UnoControlDialog",rComponentContext);
+ Reference< XUnoControlDialog > dialog = UnoControlDialog::create(rComponentContext);
- Reference < XControl > xControl (dialog,UNO_QUERY);
Reference < XControlModel > xControlModel (rInstance,UNO_QUERY);
- if(!xControl.is())
- return sal_False;
-
- xControl->setModel( xControlModel );
+ dialog->setModel( xControlModel );
Reference < XToolkit > xToolkit = Toolkit::create( rComponentContext );
- Reference < XWindow > xWindow (xControl,UNO_QUERY);
-
- if(!xWindow.is())
- return sal_False;
- xWindow->setVisible( false );
- xControl->createPeer( xToolkit, NULL );
+ dialog->setVisible( false );
+ dialog->createPeer( xToolkit, NULL );
- Reference < XDialog > xDialog (dialog,UNO_QUERY);
-
- if(!xDialog.is())
- return sal_False;
-
- ret = ( xDialog->execute() != 0 );
+ ret = ( dialog->execute() != 0 );
if ( ret ) {
sal_Int16 tt = 0;
@@ -1110,9 +1098,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg()
}
}
- Reference < XComponent > xComponent (dialog,UNO_QUERY);
-
- xComponent->dispose();
+ Reference<XControl>(dialog)->dispose();
return ret;
}
diff --git a/include/toolkit/controls/dialogcontrol.hxx b/include/toolkit/controls/dialogcontrol.hxx
index e8b95647c80f..cb044cf7068c 100644
--- a/include/toolkit/controls/dialogcontrol.hxx
+++ b/include/toolkit/controls/dialogcontrol.hxx
@@ -21,6 +21,7 @@
#define TOOLKIT_DIALOG_CONTROL_HXX
#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <com/sun/star/awt/UnoControlDialog.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/awt/XSimpleTabController.hpp>
@@ -30,6 +31,7 @@
#include "toolkit/helper/macros.hxx"
#include <toolkit/controls/unocontrolcontainer.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <list>
@@ -62,9 +64,8 @@ public:
};
-typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase
- , ::com::sun::star::awt::XTopWindow
- , ::com::sun::star::awt::XDialog2
+typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase
+ , ::com::sun::star::awt::XUnoControlDialog
, ::com::sun::star::awt::XWindowListener
> UnoDialogControl_Base;
class UnoDialogControl : public UnoDialogControl_Base
@@ -113,6 +114,73 @@ public:
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ // resolve some ambigous methods
+ virtual com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> SAL_CALL getPeer() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getPeer(); }
+ virtual void SAL_CALL addWindowListener(const com::sun::star::uno::Reference<com::sun::star::awt::XWindowListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1); }
+ virtual com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> SAL_CALL getModel() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getModel(); }
+ virtual void SAL_CALL addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1); }
+ virtual void SAL_CALL removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1); }
+ virtual void SAL_CALL setContext(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setContext(p1); }
+ virtual com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL getContext() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getContext(); }
+ virtual com::sun::star::uno::Reference<com::sun::star::awt::XView> SAL_CALL getView() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getView(); }
+ virtual void SAL_CALL setDesignMode(sal_Bool p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1); }
+ virtual sal_Bool SAL_CALL isDesignMode() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); }
+ virtual sal_Bool SAL_CALL isTransparent() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); }
+ virtual void SAL_CALL setPosSize(sal_Int32 p1, sal_Int32 p2, sal_Int32 p3, sal_Int32 p4, sal_Int16 p5) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1, p2, p3, p4, p5); }
+ virtual com::sun::star::awt::Rectangle SAL_CALL getPosSize() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); }
+ virtual void SAL_CALL setVisible(sal_Bool p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setVisible(p1); }
+ virtual void SAL_CALL setEnable(sal_Bool p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setEnable(p1); }
+ virtual void SAL_CALL setFocus() throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setFocus(); }
+ virtual void SAL_CALL removeWindowListener(const com::sun::star::uno::Reference<com::sun::star::awt::XWindowListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1); }
+ virtual void SAL_CALL addFocusListener(const com::sun::star::uno::Reference<com::sun::star::awt::XFocusListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1); }
+ virtual void SAL_CALL removeFocusListener(const com::sun::star::uno::Reference<com::sun::star::awt::XFocusListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1); }
+ virtual void SAL_CALL addKeyListener(const com::sun::star::uno::Reference<com::sun::star::awt::XKeyListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1); }
+ virtual void SAL_CALL removeKeyListener(const com::sun::star::uno::Reference<com::sun::star::awt::XKeyListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1); }
+ virtual void SAL_CALL addMouseListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1); }
+ virtual void SAL_CALL removeMouseListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1); }
+ virtual void SAL_CALL addMouseMotionListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseMotionListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1); }
+ virtual void SAL_CALL removeMouseMotionListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseMotionListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1); }
+ virtual void SAL_CALL addPaintListener(const com::sun::star::uno::Reference<com::sun::star::awt::XPaintListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1); }
+ virtual void SAL_CALL removePaintListener(const com::sun::star::uno::Reference<com::sun::star::awt::XPaintListener>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1); }
+ virtual void SAL_CALL setStatusText(const rtl::OUString& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1); }
+ virtual com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::awt::XControl> > SAL_CALL getControls() throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getControls(); }
+ virtual com::sun::star::uno::Reference<com::sun::star::awt::XControl> SAL_CALL getControl(const rtl::OUString& p1) throw (com::sun::star::uno::RuntimeException)
+ { return UnoDialogControl_Base::ControlContainerBase::getControl(p1); }
+ virtual void SAL_CALL addControl(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::awt::XControl>& p2) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::addControl(p1, p2); }
+ virtual void SAL_CALL removeControl(const com::sun::star::uno::Reference<com::sun::star::awt::XControl>& p1) throw (com::sun::star::uno::RuntimeException)
+ { UnoDialogControl_Base::ControlContainerBase::removeControl(p1); }
+
+
// ::com::sun::star::lang::XServiceInfo
DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index dcaf757c6a79..a0488b127c4a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt,\
PopupMenu \
TabController \
Toolkit \
+ UnoControlDialog \
UnoControlDialogModelProvider \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/grid,\
@@ -524,7 +525,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/awt,\
UnoControlCurrencyFieldModel \
UnoControlDateField \
UnoControlDateFieldModel \
- UnoControlDialog \
UnoControlDialogElement \
UnoControlDialogModel \
UnoControlEdit \
@@ -1884,6 +1884,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\
XTopWindowListener \
XUnitConversion \
XUnoControlContainer \
+ XUnoControlDialog \
XUserInputInterception \
XVclContainer \
XVclContainerListener \
diff --git a/offapi/com/sun/star/awt/UnoControlDialog.idl b/offapi/com/sun/star/awt/UnoControlDialog.idl
index 4cc079e4f082..67e0b79b8381 100644
--- a/offapi/com/sun/star/awt/UnoControlDialog.idl
+++ b/offapi/com/sun/star/awt/UnoControlDialog.idl
@@ -19,28 +19,14 @@
#ifndef __com_sun_star_awt_UnoControlDialog_idl__
#define __com_sun_star_awt_UnoControlDialog_idl__
-#include <com/sun/star/awt/UnoControlContainer.idl>
+#include <com/sun/star/awt/XUnoControlDialog.idl>
-#include <com/sun/star/awt/XTopWindow.idl>
-
-#include <com/sun/star/awt/XDialog2.idl>
-
-
-
- module com { module sun { module star { module awt {
+module com { module sun { module star { module awt {
/** specifies a dialog control.
*/
-published service UnoControlDialog
-{
- service com::sun::star::awt::UnoControlContainer;
-
- interface com::sun::star::awt::XTopWindow;
-
- interface com::sun::star::awt::XDialog2;
-
-};
+published service UnoControlDialog : XUnoControlDialog;
}; }; }; };
diff --git a/offapi/com/sun/star/awt/XUnoControlDialog.idl b/offapi/com/sun/star/awt/XUnoControlDialog.idl
new file mode 100644
index 000000000000..3d513b71adc3
--- /dev/null
+++ b/offapi/com/sun/star/awt/XUnoControlDialog.idl
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_awt_XUnoControlDialog_idl__
+#define __com_sun_star_awt_XUnoControlDialog_idl__
+
+#include <com/sun/star/container/XNameContainer.idl>
+#include <com/sun/star/awt/XControl.idl>
+#include <com/sun/star/awt/XDialog2.idl>
+#include <com/sun/star/awt/XTopWindow.idl>
+#include <com/sun/star/awt/XControlContainer.idl>
+#include <com/sun/star/awt/XWindow.idl>
+
+
+module com { module sun { module star { module awt {
+
+/**
+ The interface for the UnoControlDialog service.
+ This service actually implements a whole whack of interfaces. This is the just
+ the subset that our code needs.
+
+ @since LibreOffice 4.1
+ */
+published interface XUnoControlDialog
+{
+
+ interface com::sun::star::awt::XControlContainer; // -> XInterface
+
+ interface com::sun::star::awt::XControl; // -> XComponent
+
+ interface com::sun::star::awt::XWindow; // -> XComponent
+
+ interface com::sun::star::awt::XTopWindow; // -> XInterface
+
+ interface com::sun::star::awt::XDialog2; // -> XDialog -> XInterface
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb
index 0d73ab1bc233..88226211f543 100644
--- a/offapi/type_reference/offapi.rdb
+++ b/offapi/type_reference/offapi.rdb
Binary files differ
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 );
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx
index d6c73488725d..acc45bf74df0 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -110,7 +110,7 @@ void OptimizerDialog::InitRoadmap()
Reference< XPropertySet > xPropertySet( mxRoadmapControlModel, UNO_QUERY_THROW );
xPropertySet->setPropertyValue( TKGet( TK_Name ), Any( TKGet( TK_rdmNavi ) ) );
- mxRoadmapControl = mxDialogControlContainer->getControl( TKGet( TK_rdmNavi ) );
+ mxRoadmapControl = mxDialog->getControl( TKGet( TK_rdmNavi ) );
InsertRoadmapItem( 0, sal_True, getString( STR_INTRODUCTION ), ITEM_ID_INTRODUCTION );
InsertRoadmapItem( 1, sal_True, getString( STR_SLIDES ), ITEM_ID_SLIDES );
InsertRoadmapItem( 2, sal_True, getString( STR_IMAGE_OPTIMIZATION ), ITEM_ID_GRAPHIC_OPTIMIZATION );
diff --git a/sdext/source/minimizer/unodialog.cxx b/sdext/source/minimizer/unodialog.cxx
index 922527e2a88d..8c2eafe3e3de 100644
--- a/sdext/source/minimizer/unodialog.cxx
+++ b/sdext/source/minimizer/unodialog.cxx
@@ -19,15 +19,16 @@
#include "unodialog.hxx"
-#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/awt/Toolkit.hpp>
+#include <com/sun/star/awt/UnoControlDialog.hpp>
+#include <com/sun/star/awt/XMessageBoxFactory.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/view/XControlAccess.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/awt/Toolkit.hpp>
-#include <com/sun/star/awt/XMessageBoxFactory.hpp>
-#include <com/sun/star/awt/MessageBoxButtons.hpp>
// -------------
// - UnoDialog -
@@ -43,8 +44,8 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::script;
-UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame ) :
- mxMSF( rxMSF ),
+UnoDialog::UnoDialog( const Reference< XComponentContext > &rxContext, Reference< XFrame >& rxFrame ) :
+ mxMSF( rxContext ),
mxController( rxFrame->getController() ),
mxDialogModel( mxMSF->getServiceManager()->createInstanceWithContext( OUString(
"com.sun.star.awt.UnoControlDialogModel" ), mxMSF ), UNO_QUERY_THROW ),
@@ -54,15 +55,11 @@ UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference< XF
mxDialogModelNameContainer( mxDialogModel, UNO_QUERY_THROW ),
mxDialogModelNameAccess( mxDialogModel, UNO_QUERY_THROW ),
mxControlModel( mxDialogModel, UNO_QUERY_THROW ),
- mxDialog( mxMSF->getServiceManager()->createInstanceWithContext( OUString(
- "com.sun.star.awt.UnoControlDialog" ), mxMSF ), UNO_QUERY_THROW ),
+ mxDialog( UnoControlDialog::create(rxContext) ),
mxControl( mxDialog, UNO_QUERY_THROW ),
mbStatus( sal_False )
{
mxControl->setModel( mxControlModel );
- mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW );
- mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW );
- mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW );
Reference< XFrame > xFrame( mxController->getFrame() );
Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() );
@@ -81,8 +78,8 @@ UnoDialog::~UnoDialog()
void UnoDialog::execute()
{
- mxDialogWindow->setEnable( sal_True );
- mxDialogWindow->setVisible( sal_True );
+ mxDialog->setEnable( sal_True );
+ mxDialog->setVisible( sal_True );
mxDialog->execute();
}
@@ -97,14 +94,14 @@ void UnoDialog::endExecute( sal_Bool bStatus )
Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer > xParentPeer )
throw ( Exception )
{
- mxDialogWindow->setVisible( sal_False );
+ mxDialog->setVisible( sal_False );
Reference< XToolkit > xToolkit( Toolkit::create( mxMSF ), UNO_QUERY_THROW );
if ( !xParentPeer.is() )
xParentPeer = xToolkit->getDesktopWindow();
mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY );
- mxControl->createPeer( xToolkit, xParentPeer );
+ mxDialog->createPeer( xToolkit, xParentPeer );
// xWindowPeer = xControl.getPeer();
- return mxControl->getPeer();
+ return mxDialog->getPeer();
}
// -----------------------------------------------------------------------------
@@ -132,7 +129,7 @@ void UnoDialog::setVisible( const OUString& rName, sal_Bool bVisible )
{
try
{
- Reference< XInterface > xControl( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ Reference< XInterface > xControl( mxDialog->getControl( rName ), UNO_QUERY_THROW );
Reference< XWindow > xWindow( xControl, UNO_QUERY_THROW );
xWindow->setVisible( bVisible );
}
@@ -153,7 +150,7 @@ Reference< XButton > UnoDialog::insertButton( const OUString& rName, Reference<
rName, rPropertyNames, rPropertyValues ) );
Reference< XPropertySet > xPropertySet( xButtonModel, UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xButton = Reference< XButton >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xButton = Reference< XButton >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
if ( xActionListener.is() )
{
@@ -178,7 +175,7 @@ Reference< XFixedText > UnoDialog::insertFixedText( const OUString& rName, const
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlFixedTextModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xFixedText = Reference< XFixedText >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xFixedText = Reference< XFixedText >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -196,7 +193,7 @@ Reference< XCheckBox > UnoDialog::insertCheckBox( const OUString& rName, const S
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlCheckBoxModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xCheckBox = Reference< XCheckBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xCheckBox = Reference< XCheckBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -214,7 +211,7 @@ Reference< XControl > UnoDialog::insertFormattedField( const OUString& rName, co
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlFormattedFieldModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xControl = Reference< XControl >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xControl = Reference< XControl >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -232,7 +229,7 @@ Reference< XComboBox > UnoDialog::insertComboBox( const OUString& rName, const S
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlComboBoxModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xControl = Reference< XComboBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xControl = Reference< XComboBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -250,7 +247,7 @@ Reference< XRadioButton > UnoDialog::insertRadioButton( const OUString& rName, c
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xControl = Reference< XRadioButton >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xControl = Reference< XRadioButton >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -268,7 +265,7 @@ Reference< XListBox > UnoDialog::insertListBox( const OUString& rName, const Seq
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlListBoxModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xControl = Reference< XListBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xControl = Reference< XListBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
@@ -286,7 +283,7 @@ Reference< XControl > UnoDialog::insertImage( const OUString& rName, const Seque
Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlImageControlModel" ),
rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW );
xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) );
- xControl = Reference< XControl >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW );
+ xControl = Reference< XControl >( mxDialog->getControl( rName ), UNO_QUERY_THROW );
}
catch ( Exception& )
{
diff --git a/sdext/source/minimizer/unodialog.hxx b/sdext/source/minimizer/unodialog.hxx
index b08ce1e5d8fe..b06aab794d85 100644
--- a/sdext/source/minimizer/unodialog.hxx
+++ b/sdext/source/minimizer/unodialog.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/awt/XRadioButton.hpp>
#include <com/sun/star/awt/XListBox.hpp>
#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XUnoControlDialog.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XReschedule.hpp>
#include <com/sun/star/awt/XDialog.hpp>
@@ -119,14 +120,10 @@ public :
com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel;
- com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxDialog;
+ com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialog > mxDialog;
com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxControl;
com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > mxWindowPeer;
- com::sun::star::uno::Reference< com::sun::star::awt::XControlContainer > mxDialogControlContainer;
- com::sun::star::uno::Reference< com::sun::star::lang::XComponent > mxDialogComponent;
- com::sun::star::uno::Reference< com::sun::star::awt::XWindow > mxDialogWindow;
-
sal_Bool mbStatus;
};
diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx
index de88975f1191..37f34125cd4c 100644
--- a/xmlscript/test/imexp.cxx
+++ b/xmlscript/test/imexp.cxx
@@ -34,24 +34,21 @@
#include <vcl/svapp.hxx>
+#include <com/sun/star/awt/UnoControlDialog.hpp>
#include <com/sun/star/awt/Toolkit.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
+#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/registry/XImplementationRegistration.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
-
-#include <com/sun/star/container/XNameContainer.hpp>
-
using namespace ::rtl;
using namespace ::cppu;
@@ -186,11 +183,10 @@ void MyApp::Main()
importFile( aParam1.getStr(), xContext ) );
OSL_ASSERT( xModel.is() );
- Reference< awt::XControl > xDlg( xMSF->createInstance( "com.sun.star.awt.UnoControlDialog" ), UNO_QUERY );
- xDlg->setModel( Reference< awt::XControlModel >::query( xModel ) );
+ Reference< awt::XUnoControlDialog > xDlg = UnoControlDialog::create( xContext );;
+ xDlg->setModel( xModel );
xDlg->createPeer( xToolkit, 0 );
- Reference< awt::XDialog > xD( xDlg, UNO_QUERY );
- xD->execute();
+ xDlg->execute();
if (GetCommandLineParamCount() == 3)
{