]> git.saurik.com Git - wxWidgets.git/blob - samples/richedit/wxlparser.h
Added OS/2's wxDisplay implementation to list of files to be compiled.
[wxWidgets.git] / samples / richedit / wxlparser.h
1 /*-*- c++ -*-********************************************************
2 * wxlparser.h : parsers, import/export for wxLayoutList *
3 * *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * *
6 * $Id$
7 *******************************************************************/
8 #ifndef WXLPARSER_H
9 # define WXLPARSER_H
10
11 #ifndef NULL
12 # define NULL 0
13 #endif
14
15 enum wxLayoutExportType
16 {
17 WXLO_EXPORT_TEXT,
18 WXLO_EXPORT_HTML,
19 WXLO_EXPORT_OBJECT,
20 // this can be caused by empty lines:
21 WXLO_EXPORT_EMPTYLINE
22 };
23
24 enum wxLayoutExportMode
25 {
26 WXLO_EXPORT_AS_TEXT = 0x00,
27 WXLO_EXPORT_AS_TEXT_AND_COMMANDS = 0x01,
28 WXLO_EXPORT_AS_HTML = 0x02,
29 WXLO_EXPORT_AS_OBJECTS = 0x03,
30
31 // non 0:
32 WXLO_EXPORT_WITH_CRLF = 0x10,
33 WXLO_EXPORT_WITH_LF_ONLY = 0x20
34 };
35
36 struct wxLayoutExportObject
37 {
38 wxLayoutExportType type;
39 union
40 {
41 wxString *text;
42 wxLayoutObject *object;
43 }content;
44 ~wxLayoutExportObject()
45 {
46 if(type == WXLO_EXPORT_TEXT || type == WXLO_EXPORT_HTML)
47 delete content.text;
48 }
49 };
50
51
52 struct wxLayoutExportStatus
53 {
54 wxLayoutExportStatus(wxLayoutList *list);
55 wxLayoutLine * m_line;
56 wxLOiterator m_iterator;
57 wxLayoutStyleInfo m_si;
58 bool m_FirstTime;
59 };
60
61 #ifdef OS_WIN
62 # define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_CRLF
63 #else // Unix
64 # define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_LF_ONLY
65 #endif // Win/Unix
66
67 /// import text into a wxLayoutList (including linefeeds):
68 void wxLayoutImportText(wxLayoutList *list, wxString const &str);
69
70 /// export text in a given format
71 wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
72 int mode = WXLO_EXPORT_AS_TEXT,
73 int flags = WXLO_DEFAULT_EXPORT_MODE);
74
75 #endif //WXLPARSER_H