source/inc/basedlg.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  
00029 #ifndef _BASEDLG_HXX_
00030 #define _BASEDLG_HXX_
00031 
00032 #include "tool/global.hxx"
00033 #include <unoglobal.hxx>
00034 #include <memory>
00035 #include <com/sun/star/awt/PushButtonType.hpp>
00036 
00037 #ifdef SCSOLVER_UNO_COMPONENT
00038 class ResMgr;
00039 #else
00040 #include <tools/resmgr.hxx>
00041 #endif
00042 
00043 using namespace com::sun::star;
00044 using uno::Reference;
00045 using uno::XInterface;
00046 
00047 namespace com { namespace sun { namespace star {
00048 
00049         namespace awt
00050         {
00051         struct Rectangle;
00052                 class XControlModel;
00053         }
00054 
00055 }}}
00056 
00057 namespace scsolver {
00058 
00059 class SolverImpl;
00060 class Listener;
00061 class FocusListener;
00062 class MouseListener;
00063 class ActionListener;
00064 class ItemListener;
00065 class TopWindowListener;
00066 
00067 class BaseDialogImpl;
00068 class ObjProperty;
00069 class ObjPropertyImpl;
00070 class WidgetProperty;
00071 class WidgetPropertyImpl;
00072 
00073 typedef std::auto_ptr<ObjProperty> apObjProp;
00074 typedef std::auto_ptr<WidgetProperty> apWidgetProp;
00075 
00076 
00078 class BaseDialog
00079 {
00080 public:
00081         BaseDialog( SolverImpl* );
00082         virtual ~BaseDialog() throw() = 0;
00083         
00090         virtual const rtl::OUString getDialogName() const = 0;
00091         virtual void setVisible( bool ) = 0;
00092 
00102         virtual bool doneRangeSelection() const = 0;
00103 
00104         virtual void close() = 0;
00105 
00106     void setRefBoundingBox(const ::com::sun::star::awt::Rectangle* rect);
00107     const ::com::sun::star::awt::Rectangle* getPosSize() const;
00108 
00109         // Widget creation methods
00110         
00111         apWidgetProp addButton( sal_Int32, sal_Int32, sal_Int32, sal_Int32,
00112                         const rtl::OUString&, const rtl::OUString&, sal_Int16 = awt::PushButtonType_STANDARD );
00113                 
00114         apWidgetProp addButtonImage( sal_Int32, sal_Int32, sal_Int32, sal_Int32,
00115                         const rtl::OUString &, const rtl::OUString &, sal_Int16 = awt::PushButtonType_STANDARD );
00116                 
00117         apWidgetProp addEdit( sal_Int32, sal_Int32, sal_Int32, sal_Int32, const rtl::OUString & );
00118 
00119         apWidgetProp addFixedLine( sal_Int32, sal_Int32, sal_Int32, sal_Int32,
00120                         const rtl::OUString &, const rtl::OUString &, sal_Int32 = 0 );
00121                 
00122         apWidgetProp addFixedText( sal_Int32, sal_Int32, sal_Int32, sal_Int32,
00123                         const rtl::OUString &, const rtl::OUString & );
00124                 
00125         apWidgetProp addGroupBox( sal_Int32, sal_Int32, sal_Int32, sal_Int32, const rtl::OUString & );
00126                 
00127         apWidgetProp addListBox( sal_Int32, sal_Int32, sal_Int32, sal_Int32, const rtl::OUString & );
00128         
00129         apWidgetProp addRadioButton( sal_Int32, sal_Int32, sal_Int32, sal_Int32, 
00130                         const rtl::OUString &, const rtl::OUString & );
00131 
00132         apWidgetProp addCheckBox( sal_Int32 x, sal_Int32 y, sal_Int32 w, sal_Int32 h,
00133                         const rtl::OUString& name, const rtl::OUString& label );
00134                 
00135         apWidgetProp addRangeEdit( sal_Int32, sal_Int32, sal_Int32, sal_Int32,
00136                         const rtl::OUString &, const rtl::OUString & );
00137                         
00138         // Widget registration methods
00139 
00140         void registerListener( TopWindowListener* p ) const;
00141         void registerListener( FocusListener* ) const;
00142         void registerListener( MouseListener* ) const;
00143         void registerListener( const rtl::OUString&, ActionListener* ) const;
00144         void registerListener( const rtl::OUString&, ItemListener* ) const;
00145 
00146         void unregisterListener( TopWindowListener* p ) const;
00147         void unregisterListener( FocusListener* ) const;
00148         void unregisterListener( MouseListener* ) const;
00149         void unregisterListener( const rtl::OUString&, ActionListener* ) const;
00150         void unregisterListener( const rtl::OUString&, ItemListener* ) const;
00151 
00152         // Other methods
00153 
00154         SolverImpl* getSolverImpl() const;
00155         const Reference < XInterface > getWidgetByName( const rtl::OUString& ) const;
00156         const Reference < awt::XControlModel > getWidgetModelByName( const rtl::OUString& ) const;
00157         void enableWidget( const rtl::OUString&, sal_Bool = true ) const;
00158         void toFront() const;
00159     void setFocus() const;
00160         void execute() const;
00161 
00162         rtl::OUString getResStr( int resid ) const;
00163 
00164 protected:
00165 
00166         void initializeDefault( sal_Int16, sal_Int16, const rtl::OUString& ) const;
00167         void setVisibleDefault( bool ) const;
00168 
00169 private:
00170         std::auto_ptr<BaseDialogImpl> m_pImpl;
00171 };
00172 
00173 //--------------------------------------------------------------------------
00174 // ObjProperty
00175 
00176 class ObjProperty
00177 {
00178 public:
00179         ObjProperty( const Reference< XInterface >& );
00180         virtual ~ObjProperty() throw() = 0;
00181         
00182         void setPropertyValueAny( const char*, const uno::Any& );
00183 
00184         template<typename AnyValue>
00185         void setPropertyValue( const char*, const AnyValue& );
00186         
00187 private:
00188         std::auto_ptr<ObjPropertyImpl> m_pImpl;
00189 };
00190 
00191 //--------------------------------------------------------------------------
00192 // WidgetProperty
00193 
00194 class WidgetProperty : public ObjProperty
00195 {
00196 public:
00197         WidgetProperty( const Reference< XInterface >& );
00198         virtual ~WidgetProperty() throw();
00199         
00200         void setPositionX( sal_Int32 ) const;
00201         void setPositionY( sal_Int32 ) const;
00202         void setWidth( sal_Int32 ) const;
00203         void setHeight( sal_Int32 ) const;
00204         void setName( const rtl::OUString& ) const;
00205         void setLabel( const rtl::OUString& ) const;
00206         
00207 private:
00208         std::auto_ptr<WidgetPropertyImpl> m_pImpl;
00209 };
00210 
00211 
00212 // Helper function
00213 
00214 const rtl::OUString getTextByWidget( BaseDialog*, const rtl::OUString& );
00215 void setTextByWidget( BaseDialog*, const rtl::OUString&, const rtl::OUString& );
00216 
00217 
00218 }
00219 
00220 #endif // _BASEDLG_HXX_
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 

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