richtextedit.h

00001 /*
00002  * Silence
00003  *
00004  * Copyright (C) 2009 Manuel Unglaub
00005  *
00006  * This file is part of Silence.
00007  *
00008  * Silence is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, version GPLv2 only of the License.
00011  *
00012  * Silence is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016 
00017  * You should have received a copy of the GNU General Public License
00018  * along with Silence.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef RICHTEXTEDIT_H
00022 #define RICHTEXTEDIT_H
00023 
00024 #include <QAction>
00025 #include <QComboBox>
00026 #include <QFontComboBox>
00027 #include <QToolBar>
00028 #include <QVBoxLayout>
00029 #include "src/data/node/richtextnodecontent.h"
00030 #include "src/gui/view/abstractcontentview.h"
00031 #include "src/gui/widget/rtfedit.h"
00032 #include "src/gui/widget/textfind.h"
00033 
00034 
00042 class RichTextEdit : public AbstractContentView
00043 {
00044     Q_OBJECT
00045 
00046     public:
00051         RichTextEdit();
00052 
00057         ~RichTextEdit();
00058 
00063         void setContent(RichTextNodeContent *content);
00064 
00069         void setHtml(QString text);
00070 
00071         bool hasChanged();
00072         AbstractContentChange* getChange();
00073 
00074     public slots:
00079         void setVisible(bool visible);
00080 
00081     private slots:
00082         void saveContent();
00083         void textBold();
00084         void textItalic();
00085         void textUnderline();
00086         void textAlign(QAction *action);
00087         void cursorPositionChanged();
00088         void textColor();
00089         void textBgColor();
00090         void textFamily(const QString &font);
00091         void textSize(const QString &p);
00092         void currentCharFormatChanged(const QTextCharFormat &format);
00093         void clipboardDataChanged();
00094 
00095         void contentChanged();
00096 
00097         void findNext();
00098         void findPrev();
00099         void findFirst();
00100         void replace();
00101         void replaceAll();
00102 
00103         void increaseIndent();
00104         void decreaseIndent();
00105         void createOrderedList();
00106         void createUnorderedList();
00107 
00108         void addPicture();
00109         void insertHtml(QString html);
00110         void insertRule();
00111         void insertLink();
00112 
00113         void insertTable();
00114         void insertTableRow();
00115         void insertTableColumn();
00116         void removeTableRow();
00117         void removeTableColumn();
00118 
00119     private:
00120         RichTextNodeContent *content;
00121         bool isChanged;
00122         TextFind *findWidget;
00123 
00124         QVBoxLayout *layout;
00125 
00126         QToolBar *toolbar;
00127         QToolBar *fontToolbar;
00128         RtfEdit *textedit;
00129 
00130         QAction *actionSave,
00131                 *actionUndo,
00132                 *actionRedo,
00133                 *actionCut,
00134                 *actionCopy,
00135                 *actionPaste,
00136                 *actionSelectAll,
00137                 *actionTextBold,
00138                 *actionTextItalic,
00139                 *actionTextUnderline,
00140                 *actionAlignLeft,
00141                 *actionAlignCenter,
00142                 *actionAlignRight,
00143                 *actionAlignJustify,
00144                 *actionTextColor,
00145                 *actionTextBgColor,
00146                 *actionFind,
00147                 *actionFindReplace,
00148                 *actionIncreaseIndent,
00149                 *actionDecreaseIndent,
00150                 *actionOrderedList,
00151                 *actionUnorderedList,
00152                 *actionAddPicture,
00153                 *actionInsertRule,
00154                 *actionInsertLink,
00155                 *actionInsertTable,
00156                 *actionInsertTableRow,
00157                 *actionInsertTableColumn,
00158                 *actionRemoveTableRow,
00159                 *actionRemoveTableColumn;
00160 
00161         QFontComboBox *comboFont;
00162         QComboBox *comboSize;
00163 
00164         void setupActions();
00165         void setupFontActions();
00166 
00167         void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
00168         void alignmentChanged(Qt::Alignment alignment);
00169         void fontChanged(const QFont &font);
00170         bool find(bool forward);
00171 
00172         void createList(QTextListFormat::Style style);
00173         void changeIndent(bool increase);
00174         void editTable(bool row, bool insert);
00175 };
00176 
00177 #endif // RICHTEXTEDIT_H
00178 
Generated on Fri May 14 19:12:50 2010 for Silence by  doxygen 1.6.3