diff options
-rw-r--r-- | UnoControls/inc/basecontrol.hxx | 44 | ||||
-rw-r--r-- | UnoControls/source/base/basecontainercontrol.cxx | 11 | ||||
-rw-r--r-- | UnoControls/source/base/basecontrol.cxx | 71 |
3 files changed, 115 insertions, 11 deletions
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx index ba0ec0ef2..98ee9931b 100644 --- a/UnoControls/inc/basecontrol.hxx +++ b/UnoControls/inc/basecontrol.hxx @@ -2,9 +2,9 @@ * * $RCSfile: basecontrol.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $ + * last change: $Author: as $ $Date: 2000-10-12 10:33:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -398,6 +398,7 @@ struct IMPL_MutexContainer class BaseControl : public UNO3_XSERVICEINFO , public UNO3_XPAINTLISTENER + , public UNO3_XWINDOWLISTENER , public UNO3_XVIEW , public UNO3_XWINDOW , public UNO3_XCONTROL @@ -1197,7 +1198,29 @@ public: @onerror - */ - virtual void SAL_CALL windowPaint( const UNO3_PAINTEVENT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + virtual void SAL_CALL windowPaint( const UNO3_PAINTEVENT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XWindowListener + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL windowResized( const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + virtual void SAL_CALL windowMoved( const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + virtual void SAL_CALL windowShown( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + virtual void SAL_CALL windowHidden( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ); //________________________________________________________________________________________________________ // impl but public method to register service @@ -1359,6 +1382,21 @@ protected: @onerror - */ + virtual void impl_recalcLayout( const UNO3_WINDOWEVENT& aEvent ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + UNO3_REFERENCE< UNO3_XINTERFACE > impl_getDelegator(); //____________________________________________________________________________________________________________ diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx index 5d73e6203..d19f9ea7b 100644 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basecontainercontrol.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $ + * last change: $Author: as $ $Date: 2000-10-12 10:33:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -279,9 +279,10 @@ void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException ) } m_pControlInfoList->Clear(); + for ( nCount = 0; nCount < nCtrls; ++nCount ) { - pCtrls [ nCount ] -> removeEventListener ( this ) ; + pCtrls [ nCount ] -> removeEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ) ; pCtrls [ nCount ] -> dispose ( ) ; } @@ -330,7 +331,7 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re // initialize new control pNewControl->xControl->setContext ( (OWeakObject*)this ) ; - pNewControl->xControl->addEventListener ( this ) ; + pNewControl->xControl->addEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ) ; // when container has a peer ... if (getPeer().is()) @@ -395,7 +396,7 @@ void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > if ( rControl == pControl->xControl ) { //.is it found ... remove listener from control - pControl->xControl->removeEventListener ( this ) ; + pControl->xControl->removeEventListener (static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) )) ; pControl->xControl->setContext ( Reference< XInterface > () ) ; // ... free memory diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx index 6f2edd9c2..151451954 100644 --- a/UnoControls/source/base/basecontrol.cxx +++ b/UnoControls/source/base/basecontrol.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basecontrol.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $ + * last change: $Author: as $ $Date: 2000-10-12 10:33:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -218,6 +218,7 @@ Sequence< Type > SAL_CALL BaseControl::getTypes() throw( RuntimeException ) { // Create a static typecollection ... static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XPaintListener >*)NULL ) , + ::getCppuType(( const Reference< XWindowListener>*)NULL ) , ::getCppuType(( const Reference< XView >*)NULL ) , ::getCppuType(( const Reference< XWindow >*)NULL ) , ::getCppuType(( const Reference< XServiceInfo >*)NULL ) , @@ -286,6 +287,7 @@ Any SAL_CALL BaseControl::queryAggregation( const Type& aType ) throw( RuntimeEx // Attention: XTypeProvider and XInterface are supported by OComponentHelper! Any aReturn ( ::cppu::queryInterface( aType , static_cast< XPaintListener*> ( this ) , + static_cast< XWindowListener*> ( this ) , static_cast< XView* > ( this ) , static_cast< XWindow* > ( this ) , static_cast< XServiceInfo* > ( this ) , @@ -446,6 +448,7 @@ void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToolkit , if ( m_xGraphicsPeer.is() == sal_True ) { addPaintListener( this ); + addWindowListener( this ); } // PosSize_POSSIZE defined in <stardiv/uno/awt/window.hxx> @@ -831,6 +834,7 @@ void SAL_CALL BaseControl::disposing( const EventObject& aSource ) throw( Runtim if ( m_xGraphicsPeer.is() == sal_True ) { removePaintListener( this ); + removeWindowListener( this ); m_xGraphicsPeer = Reference< XGraphics >(); } @@ -856,6 +860,56 @@ void SAL_CALL BaseControl::windowPaint( const PaintEvent& aEvent ) throw( Runtim } //____________________________________________________________________________________________________________ +// XWindowListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::windowResized( const WindowEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + m_nWidth = aEvent.Width ; + m_nHeight = aEvent.Height ; + WindowEvent aMappedEvent = aEvent; + aMappedEvent.X = 0; + aMappedEvent.Y = 0; + impl_recalcLayout( aMappedEvent ); +} + +//____________________________________________________________________________________________________________ +// XWindowListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::windowMoved( const WindowEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + m_nWidth = aEvent.Width ; + m_nHeight = aEvent.Height ; + WindowEvent aMappedEvent = aEvent; + aMappedEvent.X = 0; + aMappedEvent.Y = 0; + impl_recalcLayout( aMappedEvent ); +} + +//____________________________________________________________________________________________________________ +// XWindowListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::windowShown( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//____________________________________________________________________________________________________________ +// XWindowListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::windowHidden( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//____________________________________________________________________________________________________________ // impl but public method to register service in DLL // (In this BASE-implementation not implemented! Overwrite it in derived classes.) //____________________________________________________________________________________________________________ @@ -927,7 +981,7 @@ const sal_Int32& BaseControl::impl_getHeight() WindowDescriptor* BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer ) { // - used from "createPeer()" to set the values of an ::com::sun::star::awt::WindowDescriptor !!! - // - if you will change the descriptor-values, you must override thid virtuell function + // - if you will change the descriptor-values, you must override this virtuell function // - the caller must release the memory for this dynamical descriptor !!! WindowDescriptor* pDescriptor = new WindowDescriptor ; @@ -959,6 +1013,16 @@ void BaseControl::impl_paint( sal_Int32 nX , // protected method //____________________________________________________________________________________________________________ +void BaseControl::impl_recalcLayout( const WindowEvent& aEvent ) +{ + // We need as virtual function to support automaticly resizing of derived controls! + // But we make it not pure virtual because it's not neccessary for all derived classes! +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + Reference< XInterface > BaseControl::impl_getDelegator() { return m_xDelegator ; @@ -975,6 +1039,7 @@ void BaseControl::impl_releasePeer() if ( m_xGraphicsPeer.is() == sal_True ) { removePaintListener( this ); + removeWindowListener( this ); m_xGraphicsPeer = Reference< XGraphics >(); } |