1 /* This file is part of the KDE project
2  * Copyright (C) 2007-2008 Thomas Zander <zander@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #ifndef STYLESWIDGET_H
20 #define STYLESWIDGET_H
21 
22 #include <QFrame>
23 #include <QList>
24 #include <QTextBlockFormat>
25 #include <QTextCharFormat>
26 
27 #include <ui_StylesWidget.h>
28 
29 class KoStyleManager;
30 class KoStyleThumbnailer;
31 class KoParagraphStyle;
32 class KoCharacterStyle;
33 class StylesModel;
34 class StylesDelegate;
35 
36 class StylesWidget : public QFrame
37 {
38     Q_OBJECT
39 public:
40     explicit StylesWidget(QWidget *parent = 0,  bool paragraphMode=true, Qt::WindowFlags f = 0);
41     virtual ~StylesWidget();
42 
43     virtual QSize sizeHint() const;
44 
45 public Q_SLOTS:
46     void setStyleManager(KoStyleManager *sm);
47     void setCurrentFormat(const QTextBlockFormat &format);
48     void setCurrentFormat(const QTextCharFormat &format);
49 
50 Q_SIGNALS:
51     void doneWithFocus();
52     void paragraphStyleSelected(KoParagraphStyle *paragraphStyle, bool canDelete);
53     void characterStyleSelected(KoCharacterStyle *characterStyle, bool canDelete);
54 
55 private Q_SLOTS:
56     void applyParagraphStyle();
57     void applyCharacterStyle();
58 
59 Q_SIGNALS:
60     void paragraphStyleSelected(KoParagraphStyle *style);
61     void characterStyleSelected(KoCharacterStyle *style);
62 
63 private:
64     Ui::StylesWidget widget;
65     KoStyleManager *m_styleManager;
66     KoStyleThumbnailer *m_styleThumbnailer;
67 
68     QTextBlockFormat m_currentBlockFormat;
69     QTextCharFormat m_currentCharFormat;
70     StylesModel *m_stylesModel;
71     StylesDelegate *m_stylesDelegate;
72     bool m_blockSignals;
73     bool m_isEmbedded;
74     bool m_isHovered;
75 };
76 
77 #endif
78