]>
Commit | Line | Data |
---|---|---|
9a29912f JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tex2any.h | |
3 | // Purpose: Latex conversion header | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 7.9.93 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include <stdio.h> | |
9a29912f JS |
13 | #include "wx/utils.h" |
14 | #include "wx/list.h" | |
15 | #include "wx/hash.h" | |
6c155d33 | 16 | #include "wx/tokenzr.h" |
9c9691ba WS |
17 | #include "wx/wfstream.h" |
18 | #include "wx/txtstrm.h" | |
9a29912f JS |
19 | #include "wxhlpblk.h" |
20 | ||
21 | /* | |
22 | * Conversion modes | |
23 | * | |
24 | */ | |
5c66e5b2 | 25 | |
9a29912f JS |
26 | #define TEX_RTF 1 |
27 | #define TEX_XLP 2 | |
28 | #define TEX_HTML 3 | |
29 | ||
30 | /* | |
31 | * We have a list of macro definitions which we must define | |
32 | * in advance to enable the parsing to recognize macros. | |
33 | */ | |
34 | ||
35 | #define FORBID_OK 0 | |
36 | #define FORBID_WARN 1 | |
37 | #define FORBID_ABSOLUTELY 2 | |
38 | ||
1e33e2f3 GT |
39 | |
40 | #ifdef __WXMSW__ | |
dda2e4fd | 41 | const unsigned long MAX_LINE_BUFFER_SIZE = 600; |
1e33e2f3 | 42 | #else |
dda2e4fd | 43 | const unsigned long MAX_LINE_BUFFER_SIZE = 11000; |
1e33e2f3 GT |
44 | #endif |
45 | ||
9a29912f JS |
46 | class TexMacroDef: public wxObject |
47 | { | |
48 | public: | |
49 | int no_args; | |
6c155d33 | 50 | wxChar *name; |
9a29912f JS |
51 | bool ignore; |
52 | int forbidden; | |
53 | int macroId; | |
54 | ||
6c155d33 | 55 | TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel = FORBID_OK); |
d3c7fc99 | 56 | virtual ~TexMacroDef(void); |
9a29912f JS |
57 | }; |
58 | ||
59 | #define CHUNK_TYPE_MACRO 1 | |
60 | #define CHUNK_TYPE_ARG 2 | |
61 | #define CHUNK_TYPE_STRING 3 | |
62 | ||
63 | /* | |
64 | We have nested lists to represent the Tex document. | |
65 | Each element of a list of chunks can be one of: | |
66 | - a plain string | |
67 | - a macro with/without arguments. Arguments are lists of TexChunks. | |
68 | ||
69 | Example (\toplevel is implicit but made explicit here): | |
70 | ||
71 | AddMacroDef(ltMYMAT, "mymat", 2); | |
72 | ||
73 | \toplevel{The cat sat on the \mymat{very coarse and {\it cheap}}{mat}}. | |
74 | ||
75 | Parsed as: | |
76 | ||
77 | TexChunk: type = macro, name = toplevel, no_args = 1 | |
78 | Children: | |
79 | ||
80 | TexChunk: type = argument | |
81 | ||
82 | Children: | |
83 | TexChunk: type = string, value = "The cat sat on the " | |
84 | TexChunk: type = macro, name = mymat, no_args = 2 | |
85 | ||
86 | Children: | |
87 | TexChunk: type = argument | |
88 | ||
89 | Children: | |
90 | TexChunk: type = string, value = "very coarse and " | |
91 | TexChunk: type = macro, name = it, no_args = 1 | |
92 | ||
93 | Children: | |
94 | TexChunk: type = argument | |
95 | ||
96 | Children: | |
97 | TexChunk: type = string, value = "cheap" | |
98 | ||
99 | TexChunk: type = argument | |
100 | ||
101 | Children: | |
102 | TexChunk: type = string, value = mat | |
103 | */ | |
104 | ||
105 | class TexChunk | |
106 | { | |
107 | public: | |
108 | int type; | |
109 | // char *name; | |
110 | TexMacroDef *def; | |
6c155d33 | 111 | wxChar *value; |
9a29912f JS |
112 | int macroId; |
113 | int no_args; | |
114 | int argn; | |
115 | bool optional; // Is an optional argument | |
116 | ||
117 | wxList children; | |
118 | TexChunk(int the_type, TexMacroDef *the_def = NULL); | |
119 | TexChunk(TexChunk& toCopy); | |
120 | virtual ~TexChunk(void); | |
121 | }; | |
122 | ||
123 | // Represents a topic, used for generating a table of contents file (.cnt). | |
124 | // Also for storing keywords found in a topic, a list of which is then inserted | |
125 | // into the topic in the next pass. | |
126 | class TexTopic: public wxObject | |
127 | { | |
128 | public: | |
129 | // This flag is set to indicate that the topic has children. | |
130 | // If this is the case, we know to insert a 'book' icon at this level, | |
131 | // not just a 'page' icon. We don't want to have to open a book only | |
132 | // to find there's only one page in it. We might force a book to be used if | |
133 | // a top-level topic has no children (?) | |
134 | bool hasChildren; | |
6c155d33 | 135 | wxChar *filename; |
9a29912f | 136 | wxStringList *keywords; |
6c155d33 | 137 | TexTopic(wxChar *f = NULL); |
d3c7fc99 | 138 | virtual ~TexTopic(void); |
9a29912f JS |
139 | }; |
140 | extern wxHashTable TopicTable; | |
6c155d33 | 141 | void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename = NULL); |
9a29912f JS |
142 | void ClearKeyWordTable(void); |
143 | ||
6c155d33 | 144 | extern wxChar wxTex2RTFBuffer[]; |
9a29912f JS |
145 | extern TexChunk *TopLevel; |
146 | extern wxHashTable MacroDefs; | |
147 | extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex | |
148 | ||
6c155d33 | 149 | bool read_a_line(wxChar *buf); |
5c66e5b2 | 150 | bool TexLoadFile(const wxString& filename); |
6c155d33 | 151 | int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, |
b63b07a8 | 152 | wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); |
6c155d33 | 153 | int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args, |
b63b07a8 | 154 | wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL); |
9a29912f | 155 | void TraverseDocument(void); |
b63b07a8 RL |
156 | void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false); |
157 | #define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true) | |
9a29912f JS |
158 | void SetCurrentOutput(FILE *fd); |
159 | void SetCurrentOutputs(FILE *fd1, FILE *fd2); | |
160 | extern FILE *CurrentOutput1; | |
161 | extern FILE *CurrentOutput2; | |
b63b07a8 | 162 | void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false); |
9a29912f JS |
163 | void TexInitialize(int bufSize); |
164 | void TexCleanUp(void); | |
b63b07a8 | 165 | void TexOutput(const wxChar *s, bool ordinaryText = false); |
6c155d33 JS |
166 | wxChar *GetArgData(TexChunk *chunk); |
167 | wxChar *GetArgData(void); // Get the string for the current argument | |
9a29912f JS |
168 | int GetNoArgs(void); // Get the number of arguments for the current macro |
169 | TexChunk *GetArgChunk(void); // Get the chunk for the current argument | |
170 | TexChunk *GetTopLevelChunk(void); // Get the chunk for the top level | |
171 | TexChunk *GetNextChunk(void); // Look ahead to the next chunk | |
172 | bool IsArgOptional(void); // Is this argument an optional argument? | |
173 | void DefineDefaultMacros(void); // Optional set of default macros | |
174 | int GetCurrentColumn(void); // number of characters on current line | |
6c155d33 | 175 | wxChar *ConvertCase(wxChar *s); // Convert case, according to upperCaseNames setting. |
9a29912f JS |
176 | extern wxPathList TexPathList; // Path list, can be used for file searching. |
177 | ||
b63b07a8 | 178 | extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false); |
2b5f62a0 | 179 | |
9a29912f | 180 | // Define a variable value from the .ini file |
9c9691ba | 181 | wxChar *RegisterSetting(const wxString& settingName, const wxString& settingValue, bool interactive = true); |
9a29912f JS |
182 | |
183 | // Major document styles | |
184 | #define LATEX_REPORT 1 | |
185 | #define LATEX_ARTICLE 2 | |
186 | #define LATEX_LETTER 3 | |
187 | #define LATEX_BOOK 4 | |
188 | #define LATEX_SLIDES 5 | |
189 | ||
190 | extern TexChunk *DocumentTitle; | |
191 | extern TexChunk *DocumentAuthor; | |
192 | extern TexChunk *DocumentDate; | |
193 | extern int DocumentStyle; | |
194 | extern int MinorDocumentStyle; | |
6c155d33 JS |
195 | extern wxChar *BibliographyStyleString; |
196 | extern wxChar *DocumentStyleString; | |
197 | extern wxChar *MinorDocumentStyleString; | |
9a29912f JS |
198 | |
199 | extern int normalFont; | |
200 | extern int smallFont; | |
201 | extern int tinyFont; | |
202 | extern int largeFont1; | |
203 | extern int LargeFont2; | |
204 | extern int LARGEFont3; | |
205 | extern int hugeFont1; | |
206 | extern int HugeFont2; | |
207 | extern int HUGEFont3; | |
208 | ||
209 | /* | |
210 | * USER-ADJUSTABLE SETTINGS | |
211 | * | |
212 | */ | |
213 | ||
214 | // Section font sizes | |
215 | extern int chapterFont; | |
216 | extern int sectionFont; | |
217 | extern int subsectionFont; | |
218 | extern int titleFont; | |
219 | extern int authorFont; | |
4fe30bce | 220 | extern bool winHelp; // Output in Windows Help format if true, linear otherwise |
9a29912f JS |
221 | extern bool isInteractive; |
222 | extern bool runTwice; | |
223 | extern int convertMode; | |
88fd7006 | 224 | extern bool checkCurlyBraces; |
fad535ee | 225 | extern bool checkSyntax; |
9a29912f JS |
226 | extern bool stopRunning; |
227 | extern int mirrorMargins; | |
228 | extern bool headerRule; | |
229 | extern bool footerRule; | |
230 | extern int labelIndentTab; // From left indent to item label (points) | |
231 | extern int itemIndentTab; // From left indent to item (points) | |
232 | extern bool useUpButton; | |
233 | extern int htmlBrowseButtons; | |
234 | extern bool useHeadingStyles; // Insert \s1, s2 etc. | |
235 | extern bool useWord; // Insert Word table of contents, etc. etc. | |
236 | extern bool indexSubsections; // put subsections in index | |
237 | extern bool compatibilityMode; | |
238 | extern bool generateHPJ; // Generate WinHelp HPJ file | |
6c155d33 | 239 | extern wxChar *winHelpTitle; // Title for Windows Help file |
9a29912f | 240 | extern int defaultTableColumnWidth; |
6c155d33 | 241 | extern wxChar *bitmapMethod; |
9a29912f JS |
242 | extern bool truncateFilenames; // Truncate for DOS |
243 | extern int winHelpVersion; // Version e.g. 4 for Win95 | |
244 | extern bool winHelpContents; // Generate .cnt file | |
245 | extern bool htmlIndex; // Generate .htx HTML index file | |
246 | extern bool htmlFrameContents; // Use frames for HTML contents page | |
6c155d33 | 247 | extern wxChar *htmlStylesheet; // Use this CSS stylesheet for HTML pages |
9a29912f JS |
248 | extern int contentsDepth; // Depth of contents for linear RTF files |
249 | extern bool upperCaseNames; // Filenames; default is lower case | |
6c155d33 JS |
250 | extern wxChar *backgroundImageString; // HTML background image |
251 | extern wxChar *backgroundColourString; // HTML background colour | |
252 | extern wxChar *textColourString; // HTML text colour | |
253 | extern wxChar *linkColourString; // HTML link colour | |
254 | extern wxChar *followedLinkColourString; // HTML followed link colour | |
9a29912f | 255 | extern bool combineSubSections; // Stop splitting files below section |
14204c7a | 256 | extern bool htmlWorkshopFiles; // generate HTML Help Workshop project files |
bf16085d | 257 | extern bool ignoreBadRefs; // Don't insert (REF NOT FOUND) |
6c155d33 | 258 | extern wxChar *htmlFaceName; // HTML face name |
9a29912f JS |
259 | |
260 | // Names to help with internationalisation | |
6c155d33 JS |
261 | extern wxChar *ContentsNameString; |
262 | extern wxChar *AbstractNameString; | |
263 | extern wxChar *GlossaryNameString; | |
264 | extern wxChar *ReferencesNameString; | |
265 | extern wxChar *FiguresNameString; | |
266 | extern wxChar *TablesNameString; | |
267 | extern wxChar *FigureNameString; | |
268 | extern wxChar *TableNameString; | |
269 | extern wxChar *IndexNameString; | |
270 | extern wxChar *ChapterNameString; | |
271 | extern wxChar *SectionNameString; | |
272 | extern wxChar *SubsectionNameString; | |
273 | extern wxChar *SubsubsectionNameString; | |
274 | extern wxChar *UpNameString; | |
9a29912f JS |
275 | |
276 | /* | |
277 | * HTML button identifiers: what kind of browse buttons | |
278 | * are placed in HTML files, if any. | |
279 | * | |
280 | */ | |
281 | ||
282 | #define HTML_BUTTONS_NONE 0 | |
283 | #define HTML_BUTTONS_BITMAP 1 | |
284 | #define HTML_BUTTONS_TEXT 2 | |
285 | ||
286 | /* | |
287 | * Section numbering | |
288 | * | |
289 | */ | |
290 | ||
291 | extern int chapterNo; | |
292 | extern int sectionNo; | |
293 | extern int subsectionNo; | |
294 | extern int subsubsectionNo; | |
295 | extern int figureNo; | |
296 | extern int tableNo; | |
297 | ||
298 | extern int ParSkip; | |
299 | extern int ParIndent; | |
300 | ||
301 | extern bool isSync; | |
302 | ||
303 | // Set by client and by Tex2Any | |
304 | extern TexChunk *currentSection; | |
305 | ||
306 | // Header/footers/pagestyle | |
307 | extern TexChunk * LeftHeaderOdd; | |
308 | extern TexChunk * LeftFooterOdd; | |
309 | extern TexChunk * CentreHeaderOdd; | |
310 | extern TexChunk * CentreFooterOdd; | |
311 | extern TexChunk * RightHeaderOdd; | |
312 | extern TexChunk * RightFooterOdd; | |
313 | extern TexChunk * LeftHeaderEven; | |
314 | extern TexChunk * LeftFooterEven; | |
315 | extern TexChunk * CentreHeaderEven; | |
316 | extern TexChunk * CentreFooterEven; | |
317 | extern TexChunk * RightHeaderEven; | |
318 | extern TexChunk * RightFooterEven; | |
6c155d33 | 319 | extern wxChar * PageStyle; |
9a29912f JS |
320 | |
321 | // Repeat the currentSection, either real (Chapter) or simulated (References) | |
322 | extern void OutputCurrentSection(void); | |
6c155d33 JS |
323 | extern void OutputCurrentSectionToString(wxChar *buf); |
324 | extern void OutputChunkToString(TexChunk *chunk, wxChar *buf); | |
9a29912f JS |
325 | |
326 | // Called by Tex2Any to simulate a section | |
b63b07a8 | 327 | extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true); |
9a29912f JS |
328 | |
329 | /* | |
330 | * Local to Tex2Any library | |
331 | * | |
332 | */ | |
5c66e5b2 | 333 | |
6c155d33 | 334 | extern wxChar *currentArgData; |
4fe30bce | 335 | extern bool haveArgData; // If true, we're simulating the data. |
6c155d33 | 336 | void StartSimulateArgument(wxChar *data); |
9a29912f JS |
337 | void EndSimulateArgument(void); |
338 | ||
339 | /* | |
340 | * Client-defined | |
341 | * | |
342 | */ | |
343 | ||
344 | // Called on start/end of macro examination | |
345 | void OnMacro(int macroId, int no_args, bool start); | |
346 | ||
347 | // Called on start/end of argument examination. | |
4fe30bce | 348 | // Return true at the start of an argument to traverse |
9a29912f JS |
349 | // (output) the argument. |
350 | bool OnArgument(int macroId, int arg_no, bool start); | |
351 | ||
352 | // Default: library-defined | |
353 | void DefaultOnMacro(int macroId, int no_args, bool start); | |
354 | ||
355 | // Default: library-defined | |
356 | bool DefaultOnArgument(int macroId, int arg_no, bool start); | |
357 | ||
358 | // Called on error | |
1693108c | 359 | void OnError(const wxString& msg); |
9a29912f JS |
360 | |
361 | // Called for information | |
1693108c | 362 | void OnInform(const wxString& msg); |
9a29912f JS |
363 | |
364 | // Special yield wrapper | |
b63b07a8 | 365 | void Tex2RTFYield(bool force = false); |
9a29912f JS |
366 | |
367 | /* | |
368 | * Useful utilities | |
369 | * | |
370 | */ | |
371 | ||
372 | // Look for \label macro, use this ref name if found or | |
373 | // make up a topic name otherwise. | |
6c155d33 | 374 | wxChar *FindTopicName(TexChunk *chunk); |
9a29912f | 375 | // Force the current topic to be this (e.g. force 'references' label). |
6c155d33 | 376 | void ForceTopicName(const wxChar *name); |
9a29912f JS |
377 | void ResetTopicCounter(void); |
378 | ||
379 | // Parse unit eg. 14, 12pt, 34cm and return value in points. | |
1693108c | 380 | int ParseUnitArgument(const wxChar *unitArg); |
9a29912f JS |
381 | |
382 | // Set small, large, normal etc. point sizes for reference size | |
383 | void SetFontSizes(int pointSize); | |
384 | ||
385 | /* | |
386 | * Strip off any extension (dot something) from end of file, | |
387 | * IF one exists. Inserts zero into buffer. | |
388 | * | |
389 | */ | |
5c66e5b2 | 390 | |
6c155d33 | 391 | void StripExtension(wxChar *buffer); |
9a29912f JS |
392 | |
393 | /* | |
394 | * Reference structure | |
395 | * | |
396 | */ | |
397 | ||
398 | class TexRef: public wxObject | |
399 | { | |
400 | public: | |
6c155d33 JS |
401 | wxChar *refLabel; // Reference label |
402 | wxChar *refFile; // Reference filename (can be NULL) | |
403 | wxChar *sectionNumber; // Section or figure number (as a string) | |
404 | wxChar *sectionName; // name e.g. 'section' | |
405 | TexRef(const wxChar *label, const wxChar *file, const wxChar *section, const wxChar *sectionN = NULL); | |
d3c7fc99 | 406 | virtual ~TexRef(void); |
9a29912f JS |
407 | }; |
408 | ||
9a29912f JS |
409 | /* |
410 | * Add a reference | |
411 | * | |
412 | */ | |
5c66e5b2 | 413 | |
6c155d33 | 414 | void AddTexRef(wxChar *name, wxChar *file = NULL, wxChar *sectionName = NULL, |
9a29912f JS |
415 | int chapter = 0, int section = 0, int subsection = 0, int subsubsection = 0); |
416 | ||
417 | /* | |
418 | * Read and write reference file (.ref), to resolve refs for second pass. | |
419 | * | |
420 | */ | |
6c155d33 JS |
421 | void WriteTexReferences(wxChar *filename); |
422 | void ReadTexReferences(wxChar *filename); | |
9a29912f JS |
423 | |
424 | /* | |
425 | * Bibliography stuff | |
426 | * | |
427 | */ | |
428 | ||
429 | class BibEntry: public wxObject | |
430 | { | |
431 | public: | |
6c155d33 | 432 | wxChar *key; |
9a29912f JS |
433 | |
434 | /* | |
435 | * book, inbook, article, phdthesis, inproceedings, techreport | |
436 | */ | |
6c155d33 | 437 | wxChar *type; |
9a29912f JS |
438 | |
439 | /* | |
440 | * Possible fields | |
441 | * | |
442 | */ | |
6c155d33 JS |
443 | wxChar *editor; |
444 | wxChar *title; | |
445 | wxChar *booktitle; | |
446 | wxChar *author; | |
447 | wxChar *journal; | |
448 | wxChar *volume; | |
449 | wxChar *number; | |
450 | wxChar *year; | |
451 | wxChar *month; | |
452 | wxChar *pages; | |
453 | wxChar *chapter; | |
454 | wxChar *publisher; | |
455 | wxChar *address; | |
456 | wxChar *institution; | |
457 | wxChar *organization; | |
458 | wxChar *comment; | |
9a29912f JS |
459 | |
460 | inline BibEntry(void) | |
461 | { | |
462 | key = NULL; | |
463 | type = NULL; | |
464 | editor = NULL; | |
465 | title = NULL; | |
466 | booktitle = NULL; | |
467 | author = NULL; | |
468 | journal = NULL; | |
469 | volume = NULL; | |
470 | number = NULL; | |
471 | chapter = NULL; | |
472 | year = NULL; | |
473 | month = NULL; | |
474 | pages = NULL; | |
475 | publisher = NULL; | |
476 | address = NULL; | |
477 | institution = NULL; | |
478 | organization = NULL; | |
479 | comment = NULL; | |
480 | } | |
481 | }; | |
482 | ||
483 | extern wxList BibList; | |
484 | extern wxStringList CitationList; | |
485 | ||
1693108c | 486 | bool ReadBib(const wxChar *filename); |
9a29912f JS |
487 | void OutputBib(void); |
488 | void ResolveBibReferences(void); | |
1693108c VZ |
489 | void AddCitation(const wxChar *citeKey); |
490 | TexRef *FindReference(const wxChar *key); | |
9a29912f JS |
491 | |
492 | /* | |
493 | * Ability to customize, or at least suppress unknown macro errors | |
494 | * | |
495 | */ | |
496 | ||
497 | extern wxList CustomMacroList; | |
498 | ||
499 | #define CUSTOM_MACRO_IGNORE 0 | |
500 | #define CUSTOM_MACRO_OUTPUT 1 | |
501 | #define CUSTOM_MACRO_MARK 2 | |
502 | ||
503 | class CustomMacro: public wxObject | |
504 | { | |
9c9691ba WS |
505 | public: |
506 | wxChar *macroName; | |
507 | wxChar *macroBody; | |
508 | int noArgs; | |
509 | inline CustomMacro(const wxChar *name, int args, wxChar *body) | |
510 | { | |
511 | noArgs = args; | |
512 | macroName = wxStrcpy(new wxChar[wxStrlen(name) + 1], name); | |
513 | if (body) | |
514 | macroBody = wxStrcpy(new wxChar[wxStrlen(body) + 1], body); | |
515 | else | |
516 | macroBody = NULL; | |
517 | } | |
d3c7fc99 | 518 | virtual ~CustomMacro(); |
9a29912f JS |
519 | }; |
520 | ||
9c9691ba | 521 | bool ReadCustomMacros(const wxString& filename); |
9a29912f | 522 | void ShowCustomMacros(void); |
6c155d33 JS |
523 | CustomMacro *FindCustomMacro(wxChar *name); |
524 | wxChar *ParseMultifieldString(wxChar *s, int *pos); | |
9a29912f JS |
525 | |
526 | /* | |
527 | * Colour table stuff | |
528 | * | |
529 | */ | |
530 | ||
531 | class ColourTableEntry: public wxObject | |
532 | { | |
533 | public: | |
6c155d33 | 534 | wxChar *name; |
9a29912f JS |
535 | unsigned int red; |
536 | unsigned int green; | |
537 | unsigned int blue; | |
538 | ||
6c155d33 | 539 | ColourTableEntry(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); |
d3c7fc99 | 540 | virtual ~ColourTableEntry(void); |
9a29912f JS |
541 | }; |
542 | ||
543 | extern wxList ColourTable; | |
6c155d33 JS |
544 | extern void AddColour(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b); |
545 | extern int FindColourPosition(wxChar *theName); | |
9a29912f | 546 | // Converts e.g. "red" -> "#FF0000" |
6c155d33 | 547 | extern bool FindColourHTMLString(wxChar *theName, wxChar *buf); |
9a29912f JS |
548 | extern void InitialiseColourTable(void); |
549 | ||
550 | #define ltABSTRACT 1 | |
551 | #define ltADDCONTENTSLINE 2 | |
552 | #define ltADDTOCOUNTER 3 | |
553 | #define ltALPH1 4 | |
554 | #define ltALPH2 5 | |
555 | #define ltAPPENDIX 6 | |
556 | #define ltARABIC 7 | |
557 | #define ltARRAY 8 | |
558 | #define ltAUTHOR 9 | |
559 | ||
560 | #define ltBACKSLASH 30 | |
561 | #define ltBASELINESKIP 31 | |
562 | #define ltBF 32 | |
563 | #define ltBIBITEM 33 | |
564 | #define ltBIBLIOGRAPHYSTYLE 34 | |
565 | #define ltBIBLIOGRAPHY 35 | |
566 | #define ltBOXIT 36 | |
567 | #define ltBACKSLASHRAW 37 | |
568 | #define ltBACKGROUND 38 | |
569 | #define ltBACKGROUNDCOLOUR 39 | |
570 | #define ltBACKGROUNDIMAGE 40 | |
571 | #define ltBRCLEAR 41 | |
572 | ||
573 | #define ltCAPTIONSTAR 50 | |
574 | #define ltCAPTION 51 | |
575 | #define ltCDOTS 52 | |
576 | #define ltCENTERLINE 53 | |
577 | #define ltCENTERING 54 | |
578 | #define ltCENTER 55 | |
579 | #define ltCEXTRACT 56 | |
580 | #define ltCHAPTERHEADING 57 | |
581 | #define ltCHAPTERSTAR 58 | |
582 | #define ltCHAPTER 59 | |
583 | #define ltCINSERT 60 | |
584 | #define ltCITE 61 | |
585 | #define ltCLASS 62 | |
586 | #define ltCLEARDOUBLEPAGE 63 | |
587 | #define ltCLEARPAGE 64 | |
588 | #define ltCLINE 65 | |
589 | #define ltCLIPSFUNC 66 | |
590 | #define ltCOLUMNSEP 67 | |
591 | #define ltCOMMENT 68 | |
592 | #define ltCOPYRIGHT 69 | |
593 | #define ltCPARAM 70 | |
594 | ||
595 | #define ltCHEAD 71 | |
596 | #define ltCFOOT 72 | |
597 | ||
598 | #define ltCHAPTERHEADINGSTAR 73 | |
599 | ||
600 | #define ltDATE 90 | |
601 | #define ltDESCRIPTION 91 | |
602 | #define ltDESTRUCT 92 | |
603 | #define ltDOCUMENTSTYLE 93 | |
604 | #define ltDOCUMENT 94 | |
605 | #define ltDOUBLESPACE 95 | |
606 | #define ltDEFINECOLOUR 96 | |
607 | #define ltDEFINECOLOR 97 | |
608 | ||
609 | #define ltEM 120 | |
610 | #define ltENUMERATE 121 | |
611 | #define ltEQUATION 122 | |
612 | #define ltEVENSIDEMARGIN 123 | |
613 | ||
614 | #define ltFBOX 150 | |
615 | #define ltFIGURE 151 | |
616 | #define ltFLUSHLEFT 152 | |
617 | #define ltFLUSHRIGHT 153 | |
618 | #define ltFOOTHEIGHT 154 | |
619 | #define ltFOOTNOTE 155 | |
620 | #define ltFOOTSKIP 156 | |
621 | #define ltFRAMEBOX 157 | |
622 | #define ltFUNCTIONSECTION 158 | |
623 | #define ltFUNC 159 | |
624 | #define ltFIGURESTAR 160 | |
625 | #define ltFOOTNOTESIZE 161 | |
626 | #define ltFOOTNOTEPOPUP 162 | |
627 | #define ltFANCYPLAIN 163 | |
628 | #define ltFCOL 164 | |
629 | #define ltBCOL 165 | |
630 | #define ltFOLLOWEDLINKCOLOUR 166 | |
631 | ||
632 | #define ltGLOSSARY 180 | |
633 | #define ltGLOSS 181 | |
634 | ||
635 | #define ltHEADHEIGHT 200 | |
636 | #define ltHELPGLOSSARY 201 | |
637 | #define ltHELPIGNORE 202 | |
638 | #define ltHELPONLY 203 | |
639 | #define ltHELPINPUT 204 | |
640 | #define ltHELPFONTFAMILY 205 | |
641 | #define ltHELPFONTSIZE 206 | |
642 | #define ltHELPREFN 207 | |
643 | #define ltHELPREF 208 | |
644 | #define ltHFILL 209 | |
645 | #define ltHLINE 210 | |
646 | #define ltHRULE 211 | |
647 | #define ltHSPACESTAR 212 | |
648 | #define ltHSPACE 213 | |
649 | #define ltHSKIPSTAR 214 | |
650 | #define ltHSKIP 215 | |
651 | #define lthuge 216 | |
652 | #define ltHuge 217 | |
653 | #define ltHUGE 218 | |
654 | #define ltHTMLIGNORE 219 | |
655 | #define ltHTMLONLY 220 | |
656 | ||
657 | #define ltINCLUDEONLY 240 | |
658 | #define ltINCLUDE 241 | |
659 | #define ltINDEX 242 | |
660 | #define ltINPUT 243 | |
661 | #define ltITEMIZE 244 | |
662 | #define ltITEM 245 | |
663 | #define ltIMAGE 246 | |
664 | #define ltIT 247 | |
665 | #define ltITEMSEP 248 | |
666 | #define ltINDENTED 249 | |
667 | #define ltIMAGEMAP 250 | |
668 | #define ltIMAGER 251 | |
669 | #define ltIMAGEL 252 | |
670 | #define ltINSERTATLEVEL 253 | |
671 | ||
672 | #define ltKILL 260 | |
673 | ||
674 | #define ltLABEL 280 | |
675 | #define ltlarge 281 | |
676 | #define ltLarge 282 | |
677 | #define ltLARGE 283 | |
678 | #define ltLATEX 284 | |
679 | #define ltLBOX 285 | |
680 | #define ltLDOTS 286 | |
681 | #define ltLINEBREAK 287 | |
682 | #define ltLISTOFFIGURES 288 | |
683 | #define ltLISTOFTABLES 289 | |
684 | #define ltLHEAD 290 | |
685 | #define ltLFOOT 291 | |
686 | #define ltLATEXIGNORE 292 | |
687 | #define ltLATEXONLY 293 | |
688 | #define ltLOWERCASE 294 | |
689 | #define ltLBRACERAW 295 | |
690 | #define ltLINKCOLOUR 296 | |
691 | ||
692 | #define ltMAKEGLOSSARY 300 | |
693 | #define ltMAKEINDEX 301 | |
694 | #define ltMAKETITLE 302 | |
695 | #define ltMARKRIGHT 303 | |
696 | #define ltMARKBOTH 304 | |
697 | #define ltMARGINPARWIDTH 305 | |
698 | #define ltMARGINPAR 306 | |
699 | #define ltMARGINPARODD 307 | |
700 | #define ltMARGINPAREVEN 308 | |
701 | #define ltMBOX 309 | |
702 | #define ltMEMBERSECTION 310 | |
703 | #define ltMEMBER 311 | |
704 | #define ltMULTICOLUMN 312 | |
705 | #define ltMARGINPARSEP 313 | |
706 | ||
707 | #define ltNEWCOUNTER 330 | |
708 | #define ltNEWLINE 331 | |
709 | #define ltNEWPAGE 332 | |
710 | #define ltNOCITE 333 | |
711 | #define ltNOINDENT 334 | |
712 | #define ltNOLINEBREAK 335 | |
713 | #define ltNOPAGEBREAK 336 | |
714 | #define ltNORMALSIZE 337 | |
715 | #define ltNORMALBOX 338 | |
716 | #define ltNORMALBOXD 339 | |
717 | #define ltNUMBEREDBIBITEM 340 | |
718 | ||
719 | #define ltONECOLUMN 360 | |
720 | #define ltODDSIDEMARGIN 361 | |
721 | ||
722 | #define ltPAGEBREAK 380 | |
723 | #define ltPAGEREF 381 | |
724 | #define ltPAGESTYLE 382 | |
725 | #define ltPAGENUMBERING 383 | |
726 | #define ltPARAGRAPHSTAR 384 | |
727 | #define ltPARAGRAPH 385 | |
728 | #define ltPARAM 386 | |
729 | #define ltPARINDENT 387 | |
730 | #define ltPARSKIP 388 | |
731 | #define ltPARTSTAR 389 | |
732 | #define ltPART 390 | |
733 | #define ltPAR 391 | |
734 | #define ltPFUNC 392 | |
735 | #define ltPICTURE 393 | |
736 | #define ltPOPREF 394 | |
737 | #define ltPOUNDS 395 | |
738 | #define ltPRINTINDEX 396 | |
739 | #define ltPSBOXTO 397 | |
740 | #define ltPSBOX 398 | |
741 | #define ltPOPREFONLY 399 | |
742 | ||
743 | #define ltQUOTE 420 | |
744 | #define ltQUOTATION 421 | |
745 | ||
746 | #define ltRAGGEDBOTTOM 440 | |
747 | #define ltRAGGEDLEFT 441 | |
748 | #define ltRAGGEDRIGHT 442 | |
749 | #define ltREF 443 | |
750 | #define ltRM 444 | |
751 | #define ltROMAN 445 | |
752 | #define ltROMAN2 446 | |
753 | #define ltRTFSP 447 | |
754 | #define ltRULE 448 | |
755 | #define ltRULEDROW 449 | |
756 | #define ltDRULED 450 | |
757 | #define ltRHEAD 451 | |
758 | #define ltRFOOT 452 | |
759 | #define ltROW 453 | |
760 | #define ltRTFIGNORE 454 | |
761 | #define ltRTFONLY 455 | |
762 | #define ltRBRACERAW 456 | |
763 | #define ltREGISTERED 457 | |
764 | ||
765 | #define ltSC 470 | |
766 | #define ltSECTIONHEADING 471 | |
767 | #define ltSECTIONSTAR 472 | |
768 | #define ltSECTION 473 | |
769 | #define ltSETCOUNTER 474 | |
770 | #define ltSF 475 | |
771 | #define ltSHORTCITE 476 | |
772 | #define ltSINGLESPACE 477 | |
773 | #define ltSLOPPYPAR 478 | |
774 | #define ltSLOPPY 479 | |
775 | #define ltSL 480 | |
776 | #define ltSMALL 481 | |
777 | #define ltSUBITEM 482 | |
778 | #define ltSUBPARAGRAPHSTAR 483 | |
779 | #define ltSUBPARAGRAPH 484 | |
780 | #define ltSPECIAL 485 | |
781 | #define ltSUBSECTIONSTAR 486 | |
782 | #define ltSUBSECTION 487 | |
783 | #define ltSUBSUBSECTIONSTAR 488 | |
784 | #define ltSUBSUBSECTION 489 | |
785 | #define ltSCRIPTSIZE 490 | |
786 | #define ltSETHEADER 491 | |
787 | #define ltSETFOOTER 492 | |
788 | #define ltSIZEDBOX 493 | |
789 | #define ltSIZEDBOXD 494 | |
790 | #define ltSECTIONHEADINGSTAR 495 | |
791 | #define ltSS 496 | |
792 | #define ltSETHOTSPOTCOLOUR 497 | |
793 | #define ltSETHOTSPOTCOLOR 498 | |
794 | #define ltSETHOTSPOTUNDERLINE 499 | |
795 | #define ltSETTRANSPARENCY 500 | |
796 | ||
797 | #define ltTABBING 510 | |
798 | #define ltTABLEOFCONTENTS 511 | |
799 | #define ltTABLE 512 | |
800 | #define ltTABULAR 513 | |
801 | #define ltTAB 514 | |
802 | #define ltTEX 515 | |
803 | #define ltTEXTWIDTH 516 | |
804 | #define ltTEXTHEIGHT 517 | |
805 | #define ltTHEBIBLIOGRAPHY 518 | |
806 | #define ltTITLEPAGE 519 | |
807 | #define ltTITLE 520 | |
808 | #define ltTINY 521 | |
809 | #define ltTODAY 522 | |
810 | #define ltTOPMARGIN 523 | |
811 | #define ltTOPSKIP 524 | |
812 | #define ltTT 525 | |
813 | #define ltTYPEIN 526 | |
814 | #define ltTYPEOUT 527 | |
815 | #define ltTWOCOLUMN 528 | |
816 | #define ltTHEPAGE 529 | |
817 | #define ltTHECHAPTER 530 | |
818 | #define ltTHESECTION 531 | |
819 | #define ltTHISPAGESTYLE 532 | |
820 | ||
821 | #define ltTWOCOLWIDTHA 533 | |
822 | #define ltTWOCOLWIDTHB 534 | |
823 | #define ltTWOCOLSPACING 535 | |
824 | #define ltTWOCOLITEM 536 | |
825 | #define ltTWOCOLITEMRULED 537 | |
826 | #define ltTWOCOLLIST 538 | |
827 | #define ltTEXTCOLOUR 539 | |
828 | ||
829 | #define ltUNDERLINE 550 | |
830 | #define ltURLREF 551 | |
831 | #define ltUPPERCASE 552 | |
832 | #define ltUSEPACKAGE 553 | |
5c66e5b2 | 833 | |
9a29912f JS |
834 | #define ltVDOTS 570 |
835 | #define ltVERBATIMINPUT 571 | |
836 | #define ltVERBATIM 572 | |
837 | #define ltVERB 573 | |
838 | #define ltVERSE 574 | |
839 | #define ltVFILL 575 | |
840 | #define ltVLINE 576 | |
841 | #define ltVOID 577 | |
842 | #define ltVRULE 578 | |
843 | #define ltVSPACESTAR 579 | |
844 | #define ltVSKIPSTAR 580 | |
845 | #define ltVSPACE 581 | |
846 | #define ltVSKIP 582 | |
847 | #define ltVERBSTAR 583 | |
848 | ||
849 | #define ltWXCLIPS 600 | |
850 | #define ltWINHELPIGNORE 601 | |
851 | #define ltWINHELPONLY 602 | |
852 | ||
853 | #define ltXLPIGNORE 603 | |
854 | #define ltXLPONLY 604 | |
855 | ||
856 | #define ltSPACE 620 | |
857 | #define ltBACKSLASHCHAR 621 | |
858 | #define ltPIPE 622 | |
859 | #define ltFORWARDSLASH 623 | |
860 | #define ltUNDERSCORE 624 | |
861 | #define ltAMPERSAND 625 | |
862 | #define ltPERCENT 626 | |
863 | #define ltDOLLAR 627 | |
864 | #define ltHASH 628 | |
865 | #define ltLPARENTH 629 | |
866 | #define ltRPARENTH 630 | |
867 | #define ltLBRACE 631 | |
868 | #define ltRBRACE 632 | |
869 | #define ltEQUALS 633 | |
870 | #define ltRANGLEBRA 634 | |
871 | #define ltLANGLEBRA 635 | |
872 | #define ltPLUS 636 | |
873 | #define ltDASH 637 | |
874 | #define ltSINGLEQUOTE 638 | |
875 | #define ltBACKQUOTE 639 | |
876 | #define ltTILDE 640 | |
877 | #define ltAT_SYMBOL 641 | |
878 | ||
879 | // Characters, not macros but with special Latex significance | |
880 | #define ltSPECIALDOLLAR 660 | |
881 | #define ltSPECIALDOUBLEDOLLAR 661 | |
882 | #define ltSPECIALTILDE 662 | |
883 | #define ltSPECIALHASH 663 | |
884 | #define ltSPECIALAMPERSAND 664 | |
885 | #define ltSUPERTABULAR 665 | |
886 | ||
887 | // Accents | |
888 | #define ltACCENT_GRAVE 700 | |
889 | #define ltACCENT_ACUTE 701 | |
890 | #define ltACCENT_CARET 702 | |
891 | #define ltACCENT_UMLAUT 703 | |
892 | #define ltACCENT_TILDE 704 | |
893 | #define ltACCENT_DOT 705 | |
894 | #define ltACCENT_CADILLA 706 | |
895 | ||
896 | // Symbols | |
897 | #define ltALPHA 800 | |
898 | #define ltBETA 801 | |
899 | #define ltGAMMA 802 | |
900 | #define ltDELTA 803 | |
901 | #define ltEPSILON 804 | |
902 | #define ltVAREPSILON 805 | |
903 | #define ltZETA 806 | |
904 | #define ltETA 807 | |
905 | #define ltTHETA 808 | |
906 | #define ltVARTHETA 809 | |
907 | #define ltIOTA 810 | |
908 | #define ltKAPPA 811 | |
909 | #define ltLAMBDA 812 | |
910 | #define ltMU 813 | |
911 | #define ltNU 814 | |
912 | #define ltXI 815 | |
913 | #define ltPI 816 | |
914 | #define ltVARPI 817 | |
915 | #define ltRHO 818 | |
916 | #define ltVARRHO 819 | |
917 | #define ltSIGMA 820 | |
918 | #define ltVARSIGMA 821 | |
919 | #define ltTAU 822 | |
920 | #define ltUPSILON 823 | |
921 | #define ltPHI 824 | |
922 | #define ltVARPHI 825 | |
923 | #define ltCHI 826 | |
924 | #define ltPSI 827 | |
925 | #define ltOMEGA 828 | |
926 | ||
927 | #define ltCAP_GAMMA 830 | |
928 | #define ltCAP_DELTA 831 | |
929 | #define ltCAP_THETA 832 | |
930 | #define ltCAP_LAMBDA 833 | |
931 | #define ltCAP_XI 834 | |
932 | #define ltCAP_PI 835 | |
933 | #define ltCAP_SIGMA 836 | |
934 | #define ltCAP_UPSILON 837 | |
935 | #define ltCAP_PHI 838 | |
936 | #define ltCAP_PSI 839 | |
937 | #define ltCAP_OMEGA 840 | |
938 | ||
939 | // Binary operation symbols | |
940 | #define ltLE 850 | |
941 | #define ltLEQ 851 | |
942 | #define ltLL 852 | |
943 | #define ltSUBSET 853 | |
944 | #define ltSUBSETEQ 854 | |
945 | #define ltSQSUBSET 855 | |
946 | #define ltSQSUBSETEQ 856 | |
947 | #define ltIN 857 | |
948 | #define ltVDASH 858 | |
949 | #define ltMODELS 859 | |
950 | #define ltGE 860 | |
951 | #define ltGEQ 861 | |
952 | #define ltGG 862 | |
953 | #define ltSUPSET 863 | |
954 | #define ltSUPSETEQ 864 | |
955 | #define ltSQSUPSET 865 | |
956 | #define ltSQSUPSETEQ 866 | |
957 | #define ltNI 867 | |
958 | #define ltDASHV 868 | |
959 | #define ltPERP 869 | |
960 | #define ltNEQ 870 | |
961 | #define ltDOTEQ 871 | |
962 | #define ltAPPROX 872 | |
963 | #define ltCONG 873 | |
964 | #define ltEQUIV 874 | |
965 | #define ltPROPTO 875 | |
966 | #define ltPREC 876 | |
967 | #define ltPRECEQ 877 | |
968 | #define ltPARALLEL 878 | |
969 | #define ltSIM 879 | |
970 | #define ltSIMEQ 880 | |
971 | #define ltASYMP 881 | |
972 | #define ltSMILE 882 | |
973 | #define ltFROWN 883 | |
974 | #define ltBOWTIE 884 | |
975 | #define ltSUCC 885 | |
976 | #define ltSUCCEQ 886 | |
977 | #define ltMID 887 | |
978 | ||
979 | // Negated relation symbols (selected) | |
980 | #define ltNOTEQ 890 | |
981 | #define ltNOTIN 891 | |
982 | #define ltNOTSUBSET 892 | |
983 | ||
984 | // Arrows | |
985 | #define ltLEFTARROW 900 | |
986 | #define ltLEFTARROW2 901 | |
987 | #define ltRIGHTARROW 902 | |
988 | #define ltRIGHTARROW2 903 | |
989 | #define ltLEFTRIGHTARROW 904 | |
990 | #define ltLEFTRIGHTARROW2 905 | |
991 | #define ltUPARROW 906 | |
992 | #define ltUPARROW2 907 | |
993 | #define ltDOWNARROW 908 | |
994 | #define ltDOWNARROW2 909 | |
995 | ||
996 | // Miscellaneous symbols | |
997 | #define ltALEPH 1000 | |
998 | #define ltWP 1001 | |
999 | #define ltRE 1002 | |
1000 | #define ltIM 1003 | |
1001 | #define ltEMPTYSET 1004 | |
1002 | #define ltNABLA 1005 | |
1003 | #define ltSURD 1006 | |
1004 | #define ltPARTIAL 1007 | |
1005 | #define ltBOT 1008 | |
1006 | #define ltFORALL 1009 | |
1007 | #define ltEXISTS 1010 | |
1008 | #define ltNEG 1011 | |
1009 | #define ltSHARP 1012 | |
1010 | #define ltANGLE 1013 | |
1011 | #define ltTRIANGLE 1014 | |
1012 | #define ltCLUBSUIT 1015 | |
1013 | #define ltDIAMONDSUIT 1016 | |
1014 | #define ltHEARTSUIT 1017 | |
1015 | #define ltSPADESUIT 1018 | |
1016 | #define ltINFTY 1019 | |
1017 | ||
1018 | // Binary operation symbols | |
1019 | #define ltPM 1030 | |
1020 | #define ltMP 1031 | |
1021 | #define ltTIMES 1032 | |
1022 | #define ltDIV 1033 | |
1023 | #define ltCDOT 1034 | |
1024 | #define ltAST 1035 | |
1025 | #define ltSTAR 1036 | |
1026 | #define ltCAP 1037 | |
1027 | #define ltCUP 1038 | |
1028 | #define ltVEE 1039 | |
1029 | #define ltWEDGE 1040 | |
1030 | #define ltCIRC 1041 | |
1031 | #define ltBULLET 1042 | |
1032 | #define ltDIAMOND 1043 | |
1033 | #define ltOSLASH 1044 | |
1034 | #define ltBOX 1045 | |
1035 | #define ltDIAMOND2 1046 | |
1036 | #define ltBIGTRIANGLEDOWN 1047 | |
1037 | #define ltOPLUS 1048 | |
1038 | #define ltOTIMES 1049 | |
1039 | ||
1040 | // Latex2e commands | |
1041 | #define ltRMFAMILY 1200 | |
1042 | #define ltSFFAMILY 1201 | |
1043 | #define ltTTFAMILY 1202 | |
1044 | #define ltBFSERIES 1203 | |
1045 | #define ltITSHAPE 1204 | |
1046 | #define ltSLSHAPE 1205 | |
1047 | #define ltSCSHAPE 1206 | |
1048 | ||
1049 | #define ltMDSERIES 1207 | |
1050 | #define ltUPSHAPE 1208 | |
1051 | ||
1052 | #define ltTEXTRM 1209 | |
1053 | #define ltTEXTSF 1210 | |
1054 | #define ltTEXTTT 1211 | |
1055 | #define ltTEXTBF 1212 | |
1056 | #define ltTEXTIT 1213 | |
1057 | #define ltTEXTSL 1214 | |
1058 | #define ltTEXTSC 1215 | |
1059 | #define ltEMPH 1216 | |
1060 | ||
1061 | #define ltDOCUMENTCLASS 1217 | |
1062 | ||
1063 | // Space macros | |
1064 | #define ltSMALLSPACE1 1250 | |
1065 | #define ltSMALLSPACE2 1251 | |
1066 | ||
1067 | // Pseudo-macros | |
1068 | #define ltTOPLEVEL 15000 | |
1069 | #define ltCUSTOM_MACRO 15001 | |
1070 | #define ltSOLO_BLOCK 15002 |