00001 00002 // MathCore = a WYSIWYG equation editor + a powerful math engine // 00003 // Copyright (C) 2003 by Francesco Montorsi // 00004 // // 00005 // This library is free software; you can redistribute it and/or // 00006 // modify it under the terms of the GNU Lesser General Public // 00007 // License as published by the Free Software Foundation; either // 00008 // version 2.1 of the License, or (at your option) any later // 00009 // version. // 00010 // // 00011 // This library is distributed in the hope that it will be useful, // 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00014 // GNU Lesser General Public License for more details. // 00015 // // 00016 // You should have received a copy of the GNU Lesser General Public // 00017 // License along with this program; if not, write to the Free // 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, // 00019 // MA 02111-1307, USA. // 00020 // // 00021 // For any comment, suggestion or feature request, please contact // 00022 // the administrator of the project at frm@users.sourceforge.net // 00023 // // 00030 00031 00032 00033 #ifndef MULTDIVOP_H 00034 #define MULTDIVOP_H 00035 00036 // optimization for GCC compiler 00037 #ifdef __GNUG__ 00038 #pragma interface "MultDivOp.h" 00039 #endif 00040 00041 // required includes 00042 #include "mc/Operator.h" 00043 00044 00045 mcDEFINE_HELPER_CLASSES(mcMultDivOp) 00046 00047 00048 00049 00050 00051 00052 class mcMultDivOpHelpers : public mcOperatorHelpers 00053 { 00054 mcDEFINE_REFERENCE_DATA(mcMultDivOp, mdata_nType); 00055 00056 #ifdef mcENABLE_GUI 00057 public: // customizable variables 00058 00061 static bool sgui_bUseColon; 00062 #endif 00063 00064 00065 public: 00066 00067 mcMultDivOpHelpers() { data_Init(); } 00068 virtual ~mcMultDivOpHelpers() {} 00069 00070 00071 #ifdef mcENABLE_DATA 00072 public: // DATA variables 00073 00074 bool data_isMultOp() const { return data_GetType() == mcET_MULTOP; } 00075 bool data_isDivOp() const { return data_GetType() == mcET_DIVOP; } 00076 00077 #ifdef __MCDEBUG__ 00078 wxString data_Debug(long flags) const { 00079 return wxString(wxT("mcMultDivOp ")) + (data_isMultOp() ? wxT("*\n") : wxT("/\n")); 00080 } 00081 #endif 00082 #endif 00083 00084 00085 00086 #ifdef mcENABLE_GUI 00087 public: 00088 00089 bool gui_isBeginKey(const mcKey &) const; 00090 int gui_Draw(wxDC &hDC, int Offsetx, int Offsety, long flags, const wxPoint &) const; 00091 void gui_DoRecalcSize(); 00092 00093 #endif // mcENABLE_GUI 00094 00095 00096 00097 #ifdef mcENABLE_MATH 00098 public: 00099 00100 bool math_CanBeApplied(const mcElement &, const mcElement &) const; 00101 mcRealValue math_Evaluate(mcRealValue v1, mcRealValue v2) const { return v1*v2; } 00102 00103 mcBasicOpRes math_ApplySimple(mcElement &m1, const mcElement &m2) const; 00104 mcBasicOpRes math_Apply(mcElement &, const mcElement &, mcElement *) const; 00105 00106 #endif // mcENABLE_MATH 00107 00108 00109 00110 #ifdef mcENABLE_IO 00111 public: 00112 00113 wxXml2Node io_GetMathML(bool bGetPresentation) const; 00114 bool io_ImportPresentationMathML(wxXml2Node tag, wxString &pErr); 00115 00116 #endif // mcENABLE_IO 00117 }; 00118 00119 00121 class mcMultDivOp : public mcOperator 00122 { 00123 mcDEFINE_MAIN_CLASS(MultDivOp, mcOperator); 00124 00125 public: 00126 00129 mcMultDivOp(mcElementType t); 00130 00131 00132 bool isMultOp() const { return hlp()->data_isMultOp(); } 00133 bool isDivOp() const { return hlp()->data_isDivOp(); } 00134 00135 bool data_isValidContainerFor(mcElementType t) const 00136 { return t == mcET_MULTOP || t == mcET_DIVOP; } 00137 }; 00138 00139 #endif // MULTDIVOP_H 00140
[ Top ] |