File indexing completed on 2024-04-28 16:26:14

0001 /***************************************************************************
0002     begin                : Sunday Jun 27 2008
0003     copyright            : (C) 2008 by Mathias Soeken
0004     email                : msoeken@informatik.uni-bremen.de
0005  ***************************************************************************/
0006 
0007 /***************************************************************************
0008  *                                                                         *
0009  *   This program is free software; you can redistribute it and/or modify  *
0010  *   it under the terms of the GNU General Public License as published by  *
0011  *   the Free Software Foundation; either version 2 of the License, or     *
0012  *   (at your option) any later version.                                   *
0013  *                                                                         *
0014  ***************************************************************************/
0015 
0016 #ifndef NEW_TABULARDIALOG_H
0017 #define NEW_TABULARDIALOG_H
0018 
0019 #include <QTableWidgetItem>
0020 
0021 #include "kilewizard.h"
0022 
0023 class QAction;
0024 class QCheckBox;
0025 class QComboBox;
0026 class QIcon;
0027 class QLineEdit;
0028 class QMenu;
0029 class QPushButton;
0030 class QSpinBox;
0031 class QTableWidget;
0032 class QToolBar;
0033 
0034 class KComboBox;
0035 
0036 namespace KileDocument {
0037 class LatexCommands;
0038 }
0039 
0040 namespace KileDialog {
0041 
0042 class SelectColorAction;
0043 class SelectFrameAction;
0044 class TabularProperties;
0045 class TabularCell;
0046 class TabularTable;
0047 
0048 class NewTabularDialog : public Wizard {
0049     Q_OBJECT
0050 
0051 public:
0052     NewTabularDialog(const QString &environment, KileDocument::LatexCommands *commands, KConfig *config, QWidget *parent = 0);
0053     ~NewTabularDialog();
0054 
0055     const QStringList& requiredPackages() const;
0056     QString environment() const;
0057 
0058 private:
0059     void initEnvironments();
0060     QAction * addAction(const QIcon &icon, const QString &text, const char *method, QObject *parent = Q_NULLPTR);
0061     QAction * addAction(const QIcon &icon, const QString &text, QObject *receiver, const char *method, QObject *parent = Q_NULLPTR);
0062     void alignItems(int alignment);
0063     bool checkForColumnAlignment(int column);
0064     QIcon generateColorIcon(bool background) const;
0065     bool canJoin() const;
0066 
0067 public Q_SLOTS:
0068     int exec() override;
0069     void slotAccepted();
0070 
0071 private Q_SLOTS:
0072     void updateColsAndRows();
0073     void slotEnvironmentChanged(const QString &environment);
0074     void slotItemSelectionChanged();
0075     void slotHeaderCustomContextMenuRequested(const QPoint &pos);
0076     void slotAlignColumn(int alignment);
0077     void slotAlignLeft();
0078     void slotAlignCenter();
0079     void slotAlignRight();
0080     void slotBold();
0081     void slotItalic();
0082     void slotUnderline();
0083     void slotJoinCells();
0084     void slotSplitCells();
0085     void slotFrame(int border);
0086     void slotBackground(const QColor &color);
0087     void slotForeground(const QColor &color);
0088     void slotCurrentBackground();
0089     void slotCurrentForeground();
0090     void slotClearText();
0091     void slotClearAttributes();
0092     void slotClearAll();
0093     void slotRowAppended();
0094     void slotColAppended();
0095     void slotStarredChanged();
0096 
0097 private:
0098     KileDocument::LatexCommands *m_latexCommands;
0099 
0100     QAction *m_acLeft, *m_acCenter, *m_acRight,
0101             *m_acBold, *m_acItalic, *m_acUnderline,
0102             *m_acJoin, *m_acSplit,
0103             *m_acClearText, *m_acClearAttributes, *m_acClearAll,
0104             *m_acPaste;
0105     SelectFrameAction *m_acFrame;
0106     SelectColorAction *m_acBackground, *m_acForeground;
0107     QToolBar *m_tbFormat;
0108     TabularTable *m_Table;
0109     QComboBox *m_cmbName, *m_cmbParameter;
0110     QSpinBox *m_sbRows, *m_sbCols;
0111     QCheckBox *m_cbStarred, *m_cbCenter, *m_cbBooktabs, *m_cbBullets;
0112     QLineEdit *m_leTableWidth;
0113     QColor m_clCurrentBackground, m_clCurrentForeground;
0114     QString m_defaultEnvironment;
0115     QStringList m_requiredPackages;
0116 };
0117 
0118 }
0119 
0120 #endif