More updates to the Debian packaging for wxPython, unicode and
[wxWidgets.git] / utils / tex2rtf / src / tex2rtf.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tex2any.h
3 // Purpose: tex2RTF conversion header
4 // Author: Julian Smart
5 // Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
6 // Created: 7.9.93
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/app.h"
13
14 #ifndef NO_GUI
15 #include "wx/frame.h"
16 #include "wx/textctrl.h"
17
18 #ifdef __WXMSW__
19 #include "wx/dde.h"
20 #endif
21
22 #endif
23
24 // Define a new application type
25 class MyApp: public
26 #ifndef NO_GUI
27 wxApp
28 #else
29 wxAppConsole
30 #endif
31 { public:
32 bool OnInit();
33 #ifdef NO_GUI
34 int OnRun() { return EXIT_SUCCESS; }
35 #else
36 int OnExit();
37 #endif
38 };
39
40 #ifndef NO_GUI
41
42 // Define a new frame type
43 class MyFrame: public wxFrame
44 { public:
45 wxTextCtrl *textWindow;
46 MyFrame(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
47 void OnMenuCommand(int id);
48
49 void OnCloseWindow(wxCloseEvent& event);
50 void OnExit(wxCommandEvent& event);
51 void OnGo(wxCommandEvent& event);
52 void OnSetInput(wxCommandEvent& event);
53 void OnSetOutput(wxCommandEvent& event);
54 void OnSaveFile(wxCommandEvent& event);
55 void OnViewOutput(wxCommandEvent& event);
56 void OnViewLatex(wxCommandEvent& event);
57 void OnLoadMacros(wxCommandEvent& event);
58 void OnShowMacros(wxCommandEvent& event);
59 void OnModeRTF(wxCommandEvent& event);
60 void OnModeWinHelp(wxCommandEvent& event);
61 void OnModeHTML(wxCommandEvent& event);
62 void OnModeXLP(wxCommandEvent& event);
63 void OnOptionsCurleyBrace(wxCommandEvent& event);
64 void OnOptionsSyntaxChecking(wxCommandEvent& event);
65 void OnHelp(wxCommandEvent& event);
66 void OnAbout(wxCommandEvent& event);
67
68 DECLARE_EVENT_TABLE()
69 };
70
71 #ifdef __WXMSW__
72
73 class Tex2RTFConnection: public wxDDEConnection
74 {
75 public:
76 Tex2RTFConnection(wxChar *buf, int size);
77 ~Tex2RTFConnection(void);
78 bool OnExecute(const wxString& topic, wxChar *data, int size, wxIPCFormat format);
79 wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
80 };
81
82 class Tex2RTFServer: public wxDDEServer
83 {
84 public:
85 wxConnectionBase *OnAcceptConnection(const wxString& topic);
86 };
87
88 #endif // __WXMSW__
89
90 #endif // NO_GUI
91
92 /*
93 * Itemize/enumerate structure: put on a stack for
94 * getting the indentation right
95 *
96 */
97
98 #define LATEX_ENUMERATE 1
99 #define LATEX_ITEMIZE 2
100 #define LATEX_DESCRIPTION 3
101 #define LATEX_TWOCOL 5
102 #define LATEX_INDENT 6
103
104 class ItemizeStruc: public wxObject
105 {
106 public:
107 int listType;
108 int currentItem;
109 int indentation;
110 int labelIndentation;
111 inline ItemizeStruc(int lType, int indent = 0, int labIndent = 0)
112 { listType = lType; currentItem = 0;
113 indentation = indent; labelIndentation = labIndent; }
114 };
115
116 // ID for the menu quit command
117 #define TEX_QUIT 1
118 #define TEX_GO 2
119
120 #define TEX_SET_INPUT 3
121 #define TEX_SET_OUTPUT 4
122
123 #define TEX_VIEW_LATEX 5
124 #define TEX_VIEW_OUTPUT 6
125
126 #define TEX_VIEW_CUSTOM_MACROS 7
127 #define TEX_LOAD_CUSTOM_MACROS 8
128
129 #define TEX_MODE_RTF 9
130 #define TEX_MODE_WINHELP 10
131 #define TEX_MODE_HTML 11
132 #define TEX_MODE_XLP 12
133
134 #define TEX_OPTIONS_CURELY_BRACE 13
135 #define TEX_OPTIONS_SYNTAX_CHECKING 14
136
137 #define TEX_HELP 15
138 #define TEX_ABOUT 16
139 #define TEX_SAVE_FILE 17
140
141 extern TexChunk *currentMember;
142 extern bool startedSections;
143 extern wxChar *contentsString;
144 extern bool suppressNameDecoration;
145 extern wxList itemizeStack;
146
147 extern FILE *Contents;
148 extern FILE *Chapters;
149 extern FILE *Sections;
150 extern FILE *Subsections;
151 extern FILE *Subsubsections;
152
153 extern wxChar *InputFile;
154 extern wxChar *OutputFile;
155 extern wxChar *MacroFile;
156
157 extern wxChar *FileRoot;
158 extern wxChar *ContentsName; // Contents page from last time around
159 extern wxChar *TmpContentsName; // Current contents page
160 extern wxChar *TmpFrameContentsName; // Current frame contents page
161 extern wxChar *WinHelpContentsFileName; // WinHelp .cnt file
162 extern wxChar *RefName; // Reference file name
163 extern wxChar *bulletFile;
164
165 #ifndef NO_GUI
166 void ChooseOutputFile(bool force = false);
167 void ChooseInputFile(bool force = false);
168 #endif
169
170 void RTFOnMacro(int macroId, int no_args, bool start);
171 bool RTFOnArgument(int macroId, int arg_no, bool start);
172
173 void HTMLOnMacro(int macroId, int no_args, bool start);
174 bool HTMLOnArgument(int macroId, int arg_no, bool start);
175
176 void XLPOnMacro(int macroId, int no_args, bool start);
177 bool XLPOnArgument(int macroId, int arg_no, bool start);
178
179 bool RTFGo(void);
180 bool HTMLGo(void);
181 bool XLPGo(void);
182
183 #define ltHARDY 10000