1
/* This file is part of the KDE project
2
* Copyright (C) 2005, 2007 Thomas Zander <zander@kde.org>
3
* Copyright (C) 2012 Shreya Pandit <shreya@shreyapandit.com>
4
* Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
#ifndef KWSTATISTICSWIDGET_H
23
#define KWSTATISTICSWIDGET_H
26
#include <QToolButton>
31
// FIXME: Don't cross include
32
//#include "KWStatisticsDocker.h"
33
#include "StatisticsPreferencesPopup.h"
39
class KoCanvasResourceManager;
42
class StatisticsPreferencesPopup;
44
/** KWStatisticswidget shows text statistics about a text document.
46
* In addition to being a widget, it also contains the statistics data
47
* itself and functions to update this data.
49
* FIXME: The pure statistics part should be separated from the
50
* widget, e.g. to a QAbstractListModel so that it could also
51
* be used from a QML based interface.
54
class KWStatisticsWidget : public QWidget
58
KWStatisticsWidget(KoCanvasResourceManager *provider, KWDocument *m_document,
59
KoSelection *selection = 0, QWidget *parent = 0);
61
virtual ~KWStatisticsWidget();
64
friend class KWStatisticsDocker;
65
friend class StatisticsPreferencesPopup;
68
void wordsDisplayChanged(int);
69
void sentencesDisplayChanged(int);
70
void linesDisplayChanged(int);
71
void syllablesDisplayChanged(int);
72
void charspaceDisplayChanged(int);
73
void charnospaceDisplayChanged(int);
74
void eastDisplayChanged(int);
75
void fleschDisplayChanged(int);
78
void selectionChanged();
81
int countCJKChars(const QString &text);
83
// Labels, e.g. "Words:"
85
QLabel *m_sentencesLabel;
86
QLabel *m_syllablesLabel;
87
QLabel *m_spacesLabel;
88
QLabel *m_fleschLabel;
89
QLabel *m_cjkcharsLabel;
90
QLabel *m_nospacesLabel;
95
QLabel *m_countSentences;
96
QLabel *m_countSyllables;
97
QLabel *m_countSpaces;
98
QLabel *m_countFlesch;
99
QLabel *m_countCjkchars;
100
QLabel *m_countNospaces;
101
QLabel *m_countLines;
103
KoCanvasResourceManager *m_resourceManager;
104
KoSelection *m_selection;
105
KWDocument *m_document;
106
QTextDocument *m_textDocument;
109
QToolButton *m_preferencesButton;
110
StatisticsPreferencesPopup *m_menu;
113
long m_charsWithSpace;
114
long m_charsWithoutSpace;
123
#endif // KWSTATISTICSWIDGET_H