2 #ifndef _Trans_Manager_h_
3 #define _Trans_Manager_h_
9 #include "tex-accent.h"
10 #include "trans_decl.h"
21 virtual ~TransState();
23 virtual string
normalkey(char,char*)=0;
25 virtual bool backspace()=0;
27 virtual string
deadkey(char,KmodInfo
)=0;
29 static const char TOKEN_SEP
;
37 virtual ~TransFSMData()
42 KmodInfo deadkey_info_
;
46 KmodInfo deadkey2_info_
;
48 KmodException comb_info_
;
50 TransState
* init_state_
;
52 TransState
* deadkey_state_
;
54 TransState
* combined_state_
;
60 TransState
* currentState
;
66 virtual public TransFSMData
,
72 virtual string
normalkey(char,char*);
74 virtual bool backspace() { return true; }
76 virtual string
deadkey(char,KmodInfo
);
81 class TransDeadkeyState
:
82 virtual public TransFSMData
,
88 virtual string
normalkey(char,char*);
90 virtual bool backspace()
92 currentState
=init_state_
;
96 virtual string
deadkey(char,KmodInfo
);
101 class TransCombinedState
:
102 virtual public TransFSMData
,
106 TransCombinedState();
108 virtual string
normalkey(char,char*);
110 virtual bool backspace()
112 // cancel the second deadkey
114 deadkey2_info_
.accent
=TEX_NOACCENT
;
115 currentState
=deadkey_state_
;
120 virtual string
deadkey(char,KmodInfo
);
126 virtual public TransFSMData
,
127 public TransInitState
,
128 public TransDeadkeyState
,
129 public TransCombinedState
149 static Trans
* default_
;
151 CharacterSet
* chset_
;
153 void insert(string
,LyXText
*);
155 void insertVerbatim(const string
&,LyXText
*);
160 virtual ~TransManager();
162 int SetPrimary(string
const &);
164 int SetSecondary(string
const &);
166 void EnablePrimary();
168 void EnableSecondary();
170 void DisableKeymap();
172 bool setCharset(const char*);
176 return trans_fsm_
.currentState
->backspace();
179 void TranslateAndInsert(char,LyXText
*);
181 inline string
deadkey(char,KmodInfo
);
183 inline string
normalkey(char,char*);
185 void deadkey(char,tex_accent
,LyXText
*);
190 string
TransManager::normalkey(char c
,char *t
)
192 return trans_fsm_
.currentState
->normalkey(c
,t
);
196 string
TransManager::deadkey(char c
,KmodInfo t
)
198 return trans_fsm_
.currentState
->deadkey(c
,t
);