diff options
author | Malte Timmermann <mt@openoffice.org> | 2001-04-11 14:10:57 +0000 |
---|---|---|
committer | Malte Timmermann <mt@openoffice.org> | 2001-04-11 14:10:57 +0000 |
commit | 1504f20381cf828693600a08dbfc2257cb80eac3 (patch) | |
tree | 17afedc9521235db357dc1ec791f6da1b01afae2 /toolkit | |
parent | 735a494747162903c7d8ef9eb55c0243a6f833e9 (diff) |
DialogControl supports XTopWindow
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/controls/unocontrols.hxx | 42 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrols.cxx | 60 |
2 files changed, 89 insertions, 13 deletions
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 6031bf7c0f3f..c16bdd3a5c2c 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unocontrols.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: mt $ $Date: 2001-04-04 16:03:03 $ + * last change: $Author: mt $ $Date: 2001-04-11 15:10:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,6 +119,9 @@ #ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_ #include <com/sun/star/awt/XPatternField.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ +#include <com/sun/star/awt/XTopWindow.hpp> +#endif // #ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_ // #include <com/sun/star/container/XIndexContainer.hpp> // #endif @@ -220,8 +223,12 @@ public: // ---------------------------------------------------- class UnoDialogControl : public UnoControlContainer, public ::com::sun::star::container::XContainerListener, + public ::com::sun::star::awt::XTopWindow, public ::com::sun::star::awt::XDialog { +private: + TopWindowListenerMultiplexer maTopWindowListeners; + protected: void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName ); @@ -242,6 +249,13 @@ public: void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlContainer::disposing( Source ); } void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XTopWindow + void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL toFront( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL toBack( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::beans::XPropertiesChangeListener void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException); @@ -441,16 +455,12 @@ class UnoControlButtonModel : public ::com::sun::star::awt::XImageProducer, public UnoControlModel { private: -// ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > mxImageProducer; - std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners; protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > ImplGetImageProducer(); - public: UnoControlButtonModel(); UnoControlButtonModel( const UnoControlButtonModel& rModel ) : UnoControlModel( rModel ) {;} @@ -469,9 +479,6 @@ public: void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); - // ::cppu::OPropertySetHelper - // void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); - // ::com::sun::star::beans::XMultiPropertySet ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); @@ -547,8 +554,12 @@ public: // ---------------------------------------------------- // class UnoControlImageControlModel // ---------------------------------------------------- -class UnoControlImageControlModel : public UnoControlModel +class UnoControlImageControlModel : public ::com::sun::star::awt::XImageProducer, + public UnoControlModel { +private: + std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners; + protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); @@ -561,6 +572,15 @@ public: ::rtl::OUString getServiceName() const; + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlModel::queryInterface(rType); } + ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); } + + // ::com::sun::star::awt::XImageProducer + void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::beans::XMultiPropertySet ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); @@ -593,6 +613,8 @@ public: UnoImageControlControl(); ::rtl::OUString GetComponentServiceName(); + void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); } diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 8b31a32b4e3e..43496afd4db0 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unocontrols.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: mt $ $Date: 2001-04-10 11:42:28 $ + * last change: $Author: mt $ $Date: 2001-04-11 15:10:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -425,7 +425,7 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(c // ---------------------------------------------------- // class UnoDialogControl // ---------------------------------------------------- -UnoDialogControl::UnoDialogControl() +UnoDialogControl::UnoDialogControl() : maTopWindowListeners( *this ) { maComponentInfos.nWidth = 300; maComponentInfos.nHeight = 450; @@ -440,6 +440,7 @@ UnoDialogControl::UnoDialogControl() uno::Any UnoDialogControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException) { uno::Any aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( awt::XTopWindow*, this ), SAL_STATIC_CAST( awt::XDialog*, this ) ); return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType )); } @@ -447,6 +448,7 @@ uno::Any UnoDialogControl::queryAggregation( const uno::Type & rType ) throw(uno // lang::XTypeProvider IMPL_XTYPEPROVIDER_START( UnoDialogControl ) getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ), +getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ), UnoControlContainer::getTypes() IMPL_XTYPEPROVIDER_END @@ -553,6 +555,9 @@ void UnoDialogControl::ImplSetPosSize( uno::Reference< awt::XControl >& rxCtrl ) void UnoDialogControl::dispose() throw(uno::RuntimeException) { + lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maTopWindowListeners.disposeAndClear( aEvt ); UnoControlContainer::dispose(); } @@ -614,6 +619,10 @@ void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno void UnoDialogControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) { UnoControlContainer::createPeer( rxToolkit, rParentPeer ); + + uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY ); + if ( maTopWindowListeners.getLength() ) + xTW->addTopWindowListener( &maTopWindowListeners ); } void UnoDialogControl::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException) @@ -647,6 +656,51 @@ void UnoDialogControl::elementReplaced( const ::com::sun::star::container::Conta ImplInsertControl( xModel, aName ); } +void UnoDialogControl::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw (::com::sun::star::uno::RuntimeException) +{ + maTopWindowListeners.addInterface( rxListener ); + if( mxPeer.is() && maTopWindowListeners.getLength() == 1 ) + { + uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY ); + xTW->addTopWindowListener( &maTopWindowListeners ); + } +} + +void UnoDialogControl::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw (::com::sun::star::uno::RuntimeException) +{ + if( mxPeer.is() && maTopWindowListeners.getLength() == 1 ) + { + uno::Reference < awt::XTopWindow > xTW( mxPeer, uno::UNO_QUERY ); + xTW->removeTopWindowListener( &maTopWindowListeners ); + } + maTopWindowListeners.removeInterface( rxListener ); +} + +void UnoDialogControl::toFront( ) throw (::com::sun::star::uno::RuntimeException) +{ + if ( getPeer().is() ) + { + uno::Reference< awt::XTopWindow > xTW( getPeer(), uno::UNO_QUERY ); + if( xTW.is() ) + xTW->toFront(); + } +} + +void UnoDialogControl::toBack( ) throw (::com::sun::star::uno::RuntimeException) +{ + if ( getPeer().is() ) + { + uno::Reference< awt::XTopWindow > xTW( getPeer(), uno::UNO_QUERY ); + if( xTW.is() ) + xTW->toBack(); + } +} + +void UnoDialogControl::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& ) throw (::com::sun::star::uno::RuntimeException) +{ + DBG_ERROR( "UnoDialogControl::setMenuBar niy" ); +} + // beans::XPropertiesChangeListener void UnoDialogControl::propertiesChange( const uno::Sequence< beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException) { |