kplato

kptwbsdefinition.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
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;
7 version 2 of the License.
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
20#ifndef KPTWBSDEFINITION_H
21#define KPTWBSDEFINITION_H
22
23#include <tqstring.h>
24#include <tqmap.h>
25#include <tqpair.h>
26#include <tqvaluelist.h>
27
28class TQStringList;
29
30namespace KPlato
31{
32
33class Part;
34
35class WBSDefinition {
36
37public:
38 WBSDefinition();
39 ~WBSDefinition();
40
41 class CodeDef {
42 public:
43 CodeDef() {}
44 CodeDef(TQString c, TQString s) { code = c; separator = s; }
45 ~CodeDef() {}
46 void clear() { code = separator = TQString(); }
47 bool isEmpty() { return code.isEmpty(); }
48 TQString code;
49 TQString separator;
50 };
51
52 void clear();
53
55 TQString wbs(uint index, int level);
57 TQString code(uint index, int level);
59 TQString separator(int level);
60
61 CodeDef &defaultDef() { return m_defaultDef; }
62 void setDefaultDef(CodeDef def) { m_defaultDef = def; }
63
64 bool isLevelsDefEnabled() const { return m_levelsEnabled; }
65 bool level0Enabled();
66 void setLevelsDefEnabled(bool on) { m_levelsEnabled = on; }
67 void clearLevelsDef() { m_levelsDef.clear(); }
68 const TQMap<int, CodeDef> &levelsDef() const { return m_levelsDef; }
69 void setLevelsDef(TQMap<int, CodeDef> def);
70 CodeDef levelsDef(int level) const;
71 void setLevelsDef(int level, CodeDef def);
72 void setLevelsDef(int level, TQString c, TQString s);
73
74 TQStringList codeList();
75 int defaultCodeIndex() const;
76 bool setDefaultCode(uint index);
77 TQString defaultSeparator() const { return m_defaultDef.separator; }
78 void setDefaultSeparator(TQString s);
79
80protected:
81 TQString code(CodeDef &def, uint index);
82 TQString toRoman(int n, bool upper = false);
83
84private:
85 CodeDef m_defaultDef;
86
87 bool m_levelsEnabled;
88 TQMap<int, CodeDef> m_levelsDef;
89
90 TQValueList<TQPair<TQString, TQString> > m_codeLists;
91};
92
93} //namespace KPlato
94
95#endif //WBSDEFINITION_H