1 /* This file is part of the KDE project
2  * Copyright (C) 2007 Thomas Zander <zander@kde.org>
3  * Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef CHARACTERGENERAL_H
22 #define CHARACTERGENERAL_H
23 
24 #include <ui_CharacterGeneral.h>
25 
26 #include <QWidget>
27 
28 class KoCharacterStyle;
29 class KoStyleManager;
30 class KoStyleThumbnailer;
31 class FontDecorations;
32 class CharacterHighlighting;
33 class LanguageTab;
34 class StylesModel;
35 
36 class CharacterGeneral : public QWidget
37 {
38     Q_OBJECT
39 public:
40     explicit CharacterGeneral(QWidget *parent = 0);
41 
42     void setStyle(KoCharacterStyle *style, bool directFormattingMode);
43     void hideStyleName(bool hide);
44     bool isStyleChanged();
45     QString styleName() const;
46     void selectName();
47     void setStyleManager(KoStyleManager *sm); // set style manager for m_paragraph style model
48     void updateNextStyleCombo(KoParagraphStyle *style); // set current style in next style combo
49     int nextStyleId(); //return the current style id in next style combo
50 
51     KoCharacterStyle *style() const;
52 
53 public Q_SLOTS:
54     void save(KoCharacterStyle *style = 0);
55 
56     void switchToGeneralTab();
57 
58 Q_SIGNALS:
59     void nameChanged(const QString &name);
60     void styleAltered(const KoCharacterStyle *style); // when saving
61     void styleChanged(); /// when user modifying
62 
63 private Q_SLOTS:
64     void setPreviewCharacterStyle();
65 
66 protected:
67     Ui::CharacterGeneral widget;
68 
69 private:
70     bool m_nameHidden;
71 
72     FontDecorations *m_characterDecorations;
73     CharacterHighlighting *m_characterHighlighting;
74     LanguageTab *m_languageTab;
75 
76     KoCharacterStyle *m_style;
77     KoStyleManager *m_styleManager;
78     KoStyleThumbnailer *m_thumbnail;
79     StylesModel *m_paragraphStyleModel;
80     StylesModel *m_characterInheritedStyleModel;
81 };
82 
83 #endif
84