diff options
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 2 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.cxx | 16 | ||||
-rw-r--r-- | filter/source/t602/t602filter.cxx | 28 | ||||
-rw-r--r-- | include/toolkit/controls/dialogcontrol.hxx | 74 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/awt/UnoControlDialog.idl | 20 | ||||
-rw-r--r-- | offapi/com/sun/star/awt/XUnoControlDialog.idl | 58 | ||||
-rw-r--r-- | offapi/type_reference/offapi.rdb | bin | 6832128 -> 6831616 bytes | |||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 64 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.hxx | 11 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 2 | ||||
-rw-r--r-- | sdext/source/minimizer/unodialog.cxx | 38 | ||||
-rw-r--r-- | sdext/source/minimizer/unodialog.hxx | 8 | ||||
-rw-r--r-- | xmlscript/test/imexp.cxx | 24 |
15 files changed, 213 insertions, 139 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index c4683f91d44f..5bad05d4d4af 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/XDialog.hpp> +#include <com/sun/star/awt/UnoControlDialog.hpp> #include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/resource/StringResource.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -89,9 +90,10 @@ DlgEdHint::~DlgEdHint() void DlgEditor::ShowDialog() { uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); // create a dialog - uno::Reference< awt::XControl > xDlg( xMSF->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 ); 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 22ddd5d02c2d..1852581b9751 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -31,9 +31,10 @@ #include <com/sun/star/style/VerticalAlignment.hpp> -#include "com/sun/star/awt/UnoControlDialogModel.hpp" #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/UnoControlDialogModel.hpp" #include "com/sun/star/awt/VclWindowPeerAttribute.hpp" #include "com/sun/star/awt/WindowAttribute.hpp" #include "com/sun/star/awt/XButton.hpp" @@ -1320,26 +1321,19 @@ void UpdateHandler::createDialog() aProps); } - uno::Reference< lang::XMultiComponentFactory > xFactory( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - 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 0e2d6cff6606..54876048ebc6 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> @@ -1062,33 +1063,20 @@ 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< XInterface > toolkit = _InstCtx("com.sun.star.awt.ExtToolkit", rComponentContext); Reference < XToolkit > xToolkit (toolkit,UNO_QUERY); - 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; @@ -1107,9 +1095,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 73d1c62a520e..812bb3d5f5d5 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/XUnoControlDialog.hpp> #include <com/sun/star/awt/XUnoControlDialogModel.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/XDialog2.hpp> @@ -32,6 +33,7 @@ #include <toolkit/controls/unocontrolcontainer.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> #include <list> @@ -217,9 +219,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 @@ -268,6 +269,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 0313680fc02e..796fff58503d 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 \ UnoControlDialogModel \ UnoControlDialogModelProvider \ )) @@ -514,7 +515,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/awt,\ UnoControlCurrencyFieldModel \ UnoControlDateField \ UnoControlDateFieldModel \ - UnoControlDialog \ UnoControlDialogElement \ UnoControlEdit \ UnoControlEditModel \ @@ -1874,6 +1874,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ XTopWindowListener \ XUnitConversion \ XUnoControlContainer \ + XUnoControlDialog \ XUnoControlDialogModel \ XUserInputInterception \ XVclContainer \ 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 Binary files differindex c257c38e5132..c117713b5b11 100644 --- a/offapi/type_reference/offapi.rdb +++ b/offapi/type_reference/offapi.rdb 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 ); diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index e8ef92b40248..0a3ff9551e44 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -93,7 +93,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 29291b73f022..3bf603c474ba 100644 --- a/sdext/source/minimizer/unodialog.cxx +++ b/sdext/source/minimizer/unodialog.cxx @@ -19,6 +19,7 @@ #include "unodialog.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/XMessageBoxFactory.hpp> @@ -48,15 +49,10 @@ UnoDialog::UnoDialog( const Reference< XComponentContext > &rxContext, Reference mxContext( rxContext ), mxController( rxFrame->getController() ), mxDialogModel( UnoControlDialogModel::create(rxContext) ), - mxDialog( mxContext->getServiceManager()->createInstanceWithContext( OUString( - "com.sun.star.awt.UnoControlDialog" ), mxContext ), UNO_QUERY_THROW ), - mxControl( mxDialog, UNO_QUERY_THROW ), + mxDialog( UnoControlDialog::create(rxContext) ), mbStatus( sal_False ) { - mxControl->setModel( mxDialogModel ); - mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW ); - mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW ); - mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW ); + mxDialog->setModel( mxDialogModel ); Reference< XFrame > xFrame( mxController->getFrame() ); Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() ); @@ -75,8 +71,8 @@ UnoDialog::~UnoDialog() void UnoDialog::execute() { - mxDialogWindow->setEnable( sal_True ); - mxDialogWindow->setVisible( sal_True ); + mxDialog->setEnable( sal_True ); + mxDialog->setVisible( sal_True ); mxDialog->execute(); } @@ -91,14 +87,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( mxContext ), 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(); } // ----------------------------------------------------------------------------- @@ -126,7 +122,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 ); } @@ -147,7 +143,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() ) { @@ -172,7 +168,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& ) { @@ -190,7 +186,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& ) { @@ -208,7 +204,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& ) { @@ -226,7 +222,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& ) { @@ -244,7 +240,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& ) { @@ -262,7 +258,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& ) { @@ -280,7 +276,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 37be5e01149b..032fe6cf47af 100644 --- a/sdext/source/minimizer/unodialog.hxx +++ b/sdext/source/minimizer/unodialog.hxx @@ -44,6 +44,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> @@ -113,14 +114,9 @@ public : com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialogModel > mxDialogModel; - com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxDialog; - com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxControl; + com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialog > mxDialog; 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 7d73bd82099c..9466af05b822 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/UnoControlDialogModel.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/io/XActiveDataSource.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/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.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; @@ -185,11 +182,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) { |