File indexing completed on 2024-05-12 16:34:02

0001 /* This file is part of the KDE project
0002    Copyright (C) 2007 Martin Pfeiffer <hubipete@gmx.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 FORMULATOOLWIDGET_H
0021 #define FORMULATOOLWIDGET_H
0022 
0023 #include <QTabWidget>
0024 #include <QMenu>
0025 #include "ui_FormulaToolWidget.h"
0026 
0027 class KoFormulaTool;
0028 class QTableWidgetItem;
0029 
0030 /**
0031  * @short A widget providing options for the FormulaTool
0032  *
0033  * The FormulaToolOptions widget provides the combobox - listwidget combination
0034  * which is used to select templates for inserting in the formula. Further the
0035  * widget provides two buttons - save and load formula. For saving and loading it
0036  * uses the loadOdf() and saveOdf() methods of KoFormulaShape.
0037  */
0038 class FormulaToolWidget : public QTabWidget, Ui::mainTabWidget {
0039 Q_OBJECT
0040 public:
0041     /// Standard constructor
0042     explicit FormulaToolWidget( KoFormulaTool* tool, QWidget* parent = 0 );
0043 
0044     /// Standard destructor
0045     ~FormulaToolWidget() override;
0046 
0047     /// Set the KoFormulaTool @p tool this options widget belongs to
0048     void setFormulaTool( KoFormulaTool* tool );
0049 
0050 public Q_SLOTS:
0051     void insertSymbol(QTableWidgetItem* item);
0052 
0053 private:
0054     void setupButton(QToolButton* button, QMenu& menu, const QString& text, QList<QString>, int length=8);
0055 
0056     static QList<QString> symbolsInRange(int start, int length);
0057     
0058 private:
0059     /// The KoFormulaTool this options widget belongs to
0060     KoFormulaTool* m_tool;
0061 
0062     QMenu m_scriptsMenu;
0063     QMenu m_fractionMenu;
0064     QMenu m_tableMenu;
0065     QMenu m_fenceMenu;
0066     QMenu m_rootMenu;
0067     QMenu m_arrowMenu;
0068     QMenu m_greekMenu;
0069     QMenu m_miscMenu;
0070     QMenu m_relationMenu;
0071     QMenu m_operatorMenu;
0072     QMenu m_alterTableMenu;
0073     QMenu m_rowMenu;
0074 };
0075 
0076 #endif // FORMULATOOLWIDGET_H