source/inc/baselistener.hxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  The Contents of this file are made available subject to
00004  *  the terms of GNU Lesser General Public License Version 2.1.
00005  *
00006  *
00007  *    GNU Lesser General Public License Version 2.1
00008  *    =============================================
00009  *    Copyright 2005 by Kohei Yoshida.
00010  *    1039 Kingsway Dr., Apex, NC 27502, USA
00011  *
00012  *    This library is free software; you can redistribute it and/or
00013  *    modify it under the terms of the GNU Lesser General Public
00014  *    License version 2.1, as published by the Free Software Foundation.
00015  *
00016  *    This library is distributed in the hope that it will be useful,
00017  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *    Lesser General Public License for more details.
00020  *
00021  *    You should have received a copy of the GNU Lesser General Public
00022  *    License along with this library; if not, write to the Free Software
00023  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024  *    MA  02111-1307  USA
00025  *
00026  ************************************************************************/
00027 
00028 #ifndef _BASELISTENER_HXX_
00029 #define _BASELISTENER_HXX_
00030 
00031 #ifndef _CPPU_MACROS_HXX_
00032 #include "cppu/macros.hxx"
00033 #endif
00034 
00035 #include "unoglobal.hxx"
00036 
00037 #include <cppuhelper/implbase1.hxx>
00038 #include <com/sun/star/awt/XActionListener.hpp>
00039 #include <com/sun/star/awt/XItemListener.hpp>
00040 #include <com/sun/star/awt/XFocusListener.hpp>
00041 #include <com/sun/star/awt/XMouseListener.hpp>
00042 #include <com/sun/star/awt/XTopWindowListener.hpp>
00043 
00044 #include <memory>
00045 
00046 using namespace ::com::sun::star;
00047 using namespace ::com::sun::star::uno;
00048 
00049 namespace scsolver {
00050 
00051 class BaseDialog;
00052 
00053 //--------------------------------------------------------------------------
00054 // Listener Class for Dialog Widgets
00055 
00061 class Listener
00062 {
00063 public:
00064         Listener( BaseDialog* pDlg ) { m_pDlg = pDlg; }
00065         virtual ~Listener() throw() = 0;
00066         
00067 protected:
00068         BaseDialog* getDialog() const { return m_pDlg; }
00069         
00070 private:
00071         BaseDialog* m_pDlg;
00072 };
00073 
00074 class SimpleActionObject
00075 {
00076 public:
00077         SimpleActionObject();
00078         virtual ~SimpleActionObject() throw() = 0;
00079         virtual void execute( BaseDialog* dlg ) = 0;
00080 };
00081 
00085 class ActionObject
00086 {
00087 public:
00088         ActionObject();
00089         virtual ~ActionObject() throw() = 0;
00090         virtual void execute( BaseDialog* dlg, const awt::ActionEvent& e ) = 0;
00091 };
00092 
00100 class ActionListener : public ::cppu::WeakImplHelper1< awt::XActionListener >, public Listener
00101 {
00102 public:
00103         ActionListener( BaseDialog* pDlg );
00104         ActionListener( BaseDialog* pDlg, ActionObject* pAction );
00105         virtual ~ActionListener() throw();
00106         
00107         virtual void SAL_CALL disposing( const lang::EventObject& e ) throw ( RuntimeException );
00108         virtual void SAL_CALL actionPerformed( const awt::ActionEvent& e ) throw ( RuntimeException );
00109 
00110 private:
00111         ActionObject* m_pAction;
00112 };
00113 
00114 class ItemListener : public ::cppu::WeakImplHelper1< awt::XItemListener >, public Listener
00115 {
00116 public:
00117         ItemListener( BaseDialog* pDlg ) : Listener( pDlg ) {}
00118         virtual ~ItemListener() throw() = 0;
00119 
00120         virtual void SAL_CALL disposing( const lang::EventObject& ) throw ( RuntimeException ) {}
00121         virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) throw ( RuntimeException ) {}
00122 };
00123 
00124 
00125 class FocusListener : public ::cppu::WeakImplHelper1< awt::XFocusListener >, public Listener
00126 {
00127 public:
00128         FocusListener( BaseDialog* pDlg ) : Listener( pDlg ) {}
00129         virtual ~FocusListener() throw() = 0;
00130         
00131         virtual void SAL_CALL focusGained( const awt::FocusEvent& ) throw( RuntimeException ) {}
00132         virtual void SAL_CALL focusLost( const awt::FocusEvent& ) throw( RuntimeException ) {}
00133         virtual void SAL_CALL disposing( const lang::EventObject& ) throw ( RuntimeException ) {}
00134 };      
00135 
00136 class MouseListener : public ::cppu::WeakImplHelper1< awt::XMouseListener >, public Listener
00137 {
00138 public:
00139         MouseListener( BaseDialog* pDlg ) : Listener( pDlg ) {}
00140         virtual ~MouseListener() throw() = 0;
00141         
00142         virtual void SAL_CALL mousePressed( const awt::MouseEvent& ) throw( RuntimeException ) {}
00143         virtual void SAL_CALL mouseReleased( const awt::MouseEvent& ) throw( RuntimeException ) {}
00144         virtual void SAL_CALL mouseEntered( const awt::MouseEvent& ) throw( RuntimeException ) {}
00145         virtual void SAL_CALL mouseExited( const awt::MouseEvent& ) throw( RuntimeException ) {}
00146         
00147         virtual void SAL_CALL disposing( const lang::EventObject& ) throw ( RuntimeException ) {}
00148 };
00149 
00150 class TopWindowListenerImpl;
00151 
00152 class TopWindowListener : public ::cppu::WeakImplHelper1<awt::XTopWindowListener>, public Listener
00153 {
00154 public:
00155         TopWindowListener( BaseDialog* pDlg );
00156         virtual ~TopWindowListener() throw();
00157 
00158         virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e )
00159                         throw (RuntimeException);
00160 
00161         virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e )
00162                         throw (RuntimeException);
00163 
00164         virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e )
00165                         throw (RuntimeException);
00166 
00167         virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e )
00168                         throw (RuntimeException);
00169 
00170         virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e )
00171                         throw (RuntimeException);
00172 
00173         virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e )
00174                         throw (RuntimeException);
00175 
00176         virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e )
00177                         throw (RuntimeException);
00178 
00179         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& e )
00180                         throw (RuntimeException);
00181 
00182         void setActionClosing( SimpleActionObject* p );
00183 
00184 private:
00185         ::std::auto_ptr<TopWindowListenerImpl> m_pImpl;
00186 };
00187 
00188 }
00189 
00190 #endif

Generated on Mon Jul 28 09:13:19 2008 for scsolver by  doxygen 1.5.3