1999-06-07 05:57:14 -04:00
|
|
|
|
/*-*- c++ -*-********************************************************
|
|
|
|
|
* wxlparser.h : parsers, import/export for wxLayoutList *
|
|
|
|
|
* *
|
|
|
|
|
* (C) 1998 by Karsten Ball<EFBFBD>der (Ballueder@usa.net) *
|
|
|
|
|
* *
|
|
|
|
|
* $Id$
|
|
|
|
|
*******************************************************************/
|
|
|
|
|
#ifndef WXLPARSER_H
|
|
|
|
|
# define WXLPARSER_H
|
|
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
|
# define NULL 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
enum wxLayoutExportType
|
|
|
|
|
{
|
|
|
|
|
WXLO_EXPORT_TEXT,
|
|
|
|
|
WXLO_EXPORT_HTML,
|
|
|
|
|
WXLO_EXPORT_OBJECT,
|
|
|
|
|
// this can be caused by empty lines:
|
|
|
|
|
WXLO_EXPORT_EMPTYLINE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum wxLayoutExportMode
|
|
|
|
|
{
|
|
|
|
|
WXLO_EXPORT_AS_TEXT = 0x00,
|
|
|
|
|
WXLO_EXPORT_AS_TEXT_AND_COMMANDS = 0x01,
|
|
|
|
|
WXLO_EXPORT_AS_HTML = 0x02,
|
|
|
|
|
WXLO_EXPORT_AS_OBJECTS = 0x03,
|
|
|
|
|
|
|
|
|
|
// non 0:
|
|
|
|
|
WXLO_EXPORT_WITH_CRLF = 0x10,
|
|
|
|
|
WXLO_EXPORT_WITH_LF_ONLY = 0x20
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wxLayoutExportObject
|
|
|
|
|
{
|
|
|
|
|
wxLayoutExportType type;
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
wxString *text;
|
|
|
|
|
wxLayoutObject *object;
|
|
|
|
|
}content;
|
|
|
|
|
~wxLayoutExportObject()
|
|
|
|
|
{
|
|
|
|
|
if(type == WXLO_EXPORT_TEXT || type == WXLO_EXPORT_HTML)
|
|
|
|
|
delete content.text;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wxLayoutExportStatus
|
|
|
|
|
{
|
|
|
|
|
wxLayoutExportStatus(wxLayoutList *list);
|
|
|
|
|
wxLayoutLine * m_line;
|
|
|
|
|
wxLOiterator m_iterator;
|
|
|
|
|
wxLayoutStyleInfo m_si;
|
1999-12-01 13:05:54 -05:00
|
|
|
|
bool m_FirstTime;
|
1999-06-07 05:57:14 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef OS_WIN
|
1999-12-01 13:05:54 -05:00
|
|
|
|
# define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_CRLF
|
1999-06-07 05:57:14 -04:00
|
|
|
|
#else // Unix
|
1999-12-01 13:05:54 -05:00
|
|
|
|
# define WXLO_DEFAULT_EXPORT_MODE WXLO_EXPORT_WITH_LF_ONLY
|
1999-06-07 05:57:14 -04:00
|
|
|
|
#endif // Win/Unix
|
|
|
|
|
|
|
|
|
|
/// import text into a wxLayoutList (including linefeeds):
|
|
|
|
|
void wxLayoutImportText(wxLayoutList *list, wxString const &str);
|
|
|
|
|
|
|
|
|
|
/// export text in a given format
|
|
|
|
|
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
|
|
|
|
int mode = WXLO_EXPORT_AS_TEXT,
|
|
|
|
|
int flags = WXLO_DEFAULT_EXPORT_MODE);
|
|
|
|
|
|
|
|
|
|
#endif //WXLPARSER_H
|