Scribus
Open source desktop publishing at your fingertips
chartablemodel.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef CHARTABLEMODEL_H
8 #define CHARTABLEMODEL_H
9 
10 #include <QAbstractTableModel>
11 #include <QStringList>
12 #include <QMimeData>
13 
14 #include "scribusapi.h"
15 
16 class ScribusDoc;
17 class ScFace;
18 class QItemSelectionModel;
19 
20 
22 typedef QList<uint> CharClassDef;
23 
24 
30 class SCRIBUS_API CharTableModel : public QAbstractTableModel
31 {
32  Q_OBJECT
33 
34 public:
35  CharTableModel(QObject *parent = 0, int cols = 4, ScribusDoc * doc = 0, const QString & font = 0);
36 
37  int rowCount(const QModelIndex &parent = QModelIndex()) const;
38  int columnCount(const QModelIndex &parent = QModelIndex()) const;
39 
41  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
42 
43  void setFontInUse(QString font);
44 
46  ScFace fontFace();
47 
48  void setCharacters(CharClassDef ch);
49  void setCharactersAndFonts(CharClassDef ch, QStringList fonts);
50  void addCharacter(QString ch);
51  CharClassDef characters() {
52  return m_characters;
53  };
54 
55  QStringList fonts() { return m_fonts; }
56 
58  bool removeCharacter(int index);
59 
60  void setDoc(ScribusDoc *doc);
61 
62  void setViewWidth(int w) {
63  m_viewWidth = w;
64  };
65 
66 public slots:
74  void appendUnicode(const QString & s, uint base = 16);
75 
76 signals:
80  void selectionChanged(QItemSelectionModel * model);
82  void rowAppended();
83 
84 private:
85  ScribusDoc *m_doc;
87  int m_cols;
89  int m_viewWidth;
90 
91  QString m_fontInUse;
92  CharClassDef m_characters;
93  QStringList m_fonts;
94 
96  QItemSelectionModel * m_selectionModel;
97 
101  Qt::ItemFlags flags(const QModelIndex &index) const;
102  Qt::DropActions supportedDropActions() const;
103  QStringList mimeTypes() const;
104  QMimeData * mimeData(const QModelIndexList &indexes) const;
105  bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
106 };
107 
108 #endif
A model (MVC) to handle unicode characters map. It's a backend for CharTableView - its GUI representa...
Definition: chartablemodel.h:30
the Document Class
Definition: scribusdoc.h:90
Base Class ScFace : This is a total rewrite of the old Foi class.
Definition: scface.h:73