File indexing completed on 2024-05-12 16:34:03
0001 /* This file is part of the KDE project 0002 Copyright (C) 2011 Cyrille Berger <cberger@cberger.net> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KOM2MMLFORMULATOOL_H_ 0021 #define KOM2MMLFORMULATOOL_H_ 0022 0023 #include <KoToolBase.h> 0024 #include <KoToolFactoryBase.h> 0025 0026 class QComboBox; 0027 class QLabel; 0028 class KoFormulaShape; 0029 class QLineEdit; 0030 0031 class KoM2MMLFormulaTool : public KoToolBase 0032 { 0033 Q_OBJECT 0034 public: 0035 explicit KoM2MMLFormulaTool(KoCanvasBase *canvas); 0036 0037 void activate(ToolActivation toolActivation, const QSet< KoShape* >& shapes) override; 0038 0039 void mouseReleaseEvent(KoPointerEvent* event) override; 0040 void mousePressEvent(KoPointerEvent* event) override; 0041 void mouseMoveEvent(KoPointerEvent* event) override; 0042 void paint(QPainter& painter, const KoViewConverter& converter) override; 0043 QWidget* createOptionWidget() override; 0044 public Q_SLOTS: 0045 void textEdited(); 0046 private: 0047 void setMathML(const QString& mathml, const QString& mode); 0048 private: 0049 QLineEdit* m_lineEdit; 0050 QLabel* m_errorLabel; 0051 KoFormulaShape* m_formulaShape; 0052 QString m_text; 0053 QComboBox* m_comboBox; 0054 QString m_mode; 0055 }; 0056 0057 class KoM2MMLFormulaToolFactory : public KoToolFactoryBase { 0058 public: 0059 /// The constructor - reimplemented from KoToolFactoryBase 0060 explicit KoM2MMLFormulaToolFactory(); 0061 0062 /// The destructor - reimplemented from KoToolFactoryBase 0063 ~KoM2MMLFormulaToolFactory() override; 0064 0065 /// @return an instance of KoFormulaTool 0066 KoToolBase* createTool( KoCanvasBase* canvas ) override; 0067 }; 0068 0069 #endif