1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/***************************************************************************
latexcmd.h
----------
date : Jul 25 2005
version : 0.20
copyright : (C) 2005 by Holger Danielsson
email : holger.danielsson@t-online.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// kommandos mit weiteren Parametern
#ifndef LATEXCMD_H
#define LATEXCMD_H
#include <tqobject.h>
#include <tqstringlist.h>
#include <tqmap.h>
#include <kconfig.h>
class KileInfo;
namespace KileDocument
{
const uint MaxEnvAttr = 8;
const uint MaxCmdAttr = 5;
enum CmdAttribute {
CmdAttrNone=0, // unknown
CmdAttrAmsmath=1,CmdAttrMath=2,CmdAttrList=4,CmdAttrTabular=8,CmdAttrVerbatim=16, // environments
CmdAttrLabel=32,CmdAttrReference=64,CmdAttrCitations=128,CmdAttrIncludes=256 // commands
};
class LatexCmdAttributes
{
public:
bool standard;
CmdAttribute type;
bool starred;
bool cr;
bool mathmode;
bool displaymathmode;
TQString tabulator;
TQString option;
TQString parameter;
};
class LatexCommands : public TQObject
{
Q_OBJECT
public:
LatexCommands(KConfig *config, KileInfo *info);
~LatexCommands() {};
TQString envGroupName() { return m_envGroupName; }
TQString cmdGroupName() { return m_cmdGroupName; }
TQString configString(LatexCmdAttributes &attr,bool env);
bool isMathEnv(const TQString &name);
bool isListEnv(const TQString &name) { return isType(name,'l'); }
bool isTabularEnv(const TQString &name) { return isType(name,'t'); }
bool isVerbatimEnv(const TQString &name) { return isType(name,'v'); }
bool isLabelCmd(const TQString &name) { return isType(name,'L'); }
bool isReferenceCmd(const TQString &name) { return isType(name,'R'); }
bool isCitationCmd(const TQString &name) { return isType(name,'C'); }
bool isInputCmd(const TQString &name) { return isType(name,'I'); }
bool isStarredEnv(const TQString &name);
bool isCrEnv(const TQString &name);
bool isMathModeEnv(const TQString &name);
bool isDisplaymathModeEnv(const TQString &name);
bool needsMathMode(const TQString &name);
TQString getTabulator(const TQString &name);
void commandList(TQStringList &list, uint attr, bool userdefined);
bool commandAttributes(const TQString &name, LatexCmdAttributes &attr);
void resetCommands();
private:
KConfig *m_config;
KileInfo *m_ki;
TQString m_envGroupName, m_cmdGroupName;
TQMap<TQString,TQString> m_latexCommands;
void addUserCommands(const TQString &name, TQStringList &list);
void insert(const TQStringList &list);
TQString getValue(const TQString &name);
bool isUserDefined(const TQString &name);
bool isType(const TQString &name, TQChar ch);
TQString getAttrAt(const TQString &name, uint index);
TQChar getAttrChar(CmdAttribute attr);
CmdAttribute getCharAttr(TQChar ch);
};
}
#endif
|