Scribus
Open source desktop publishing at your fingertips
numeration.h
1 #ifndef NUMERATION_H
2 #define NUMERATION_H
3 
4 #include <QString>
5 #include <QStringList>
6 #include <QMap>
7 
8 typedef enum
9 {
10  Type_1_2_3,
11  Type_i_ii_iii,
12  Type_I_II_III,
13  Type_a_b_c,
14  Type_A_B_C,
15  Type_asterix,
16  Type_CJK,
17  Type_None=99
18 } NumFormat;
19 
20 typedef enum {
21  NSRdocument,
22  NSRsection,
23  NSRstory,
24  NSRpage,
25  NSRframe
26 // NSRblock //used for contignous numeration eg. paragraphs - paragraph without numbering reset counter
27 } NumerationRange;
28 
30 {
31 public:
32  Numeration() : numFormat(Type_1_2_3), asterix(QString()), lead('0'), len(0), range(NSRdocument), prefix(QString()), suffix(QString()), start(1) {}
33  Numeration(NumFormat f) : numFormat(f), asterix("*") {}
34 
35  QString numString(int num) const;
36 
37  NumFormat numFormat;
38  QString asterix;
39  QChar lead;
40  int len;
41  NumerationRange range;
42  QString prefix;
43  QString suffix;
44  int start;
45 };
46 
47 //struct used by ScribusDoc for storing numerations used in document
48 typedef struct {
49  QString m_name;
50  QList<Numeration> m_nums;
51  QList<int> m_counters;
52  int m_lastlevel;
53 } NumStruct;
54 
55 //util functions for use without Numeration class
56 //convert passed num to string using numeration style
57 QString getStringFromNum(NumFormat format, int num, QChar leadingChar='0', int charsLen=0);
58 //convert passed num to string with custom chars
59 QString getAsterixStringFromNum(int num, QString asterix, QChar leadingChar='_', int charsLen=0);
60 //return numeration name from type
61 QString getFormatName(int format);
62 QStringList getFormatList();
63 
64 #endif // NUMERATION_H
Definition: numeration.h:48
Definition: numeration.h:29