1998-06-29 08:44:36 -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
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
# pragma interface "wxlparser.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
|
# define NULL 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
enum wxLayoutExportType
|
|
|
|
|
{
|
|
|
|
|
WXLO_EXPORT_TEXT,
|
|
|
|
|
WXLO_EXPORT_HTML,
|
1999-03-29 04:56:44 -05:00
|
|
|
|
WXLO_EXPORT_OBJECT,
|
|
|
|
|
// this can be caused by empty lines:
|
|
|
|
|
WXLO_EXPORT_EMPTYLINE
|
1998-06-29 08:44:36 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum wxLayoutExportMode
|
|
|
|
|
{
|
1999-02-08 10:20:38 -05:00
|
|
|
|
WXLO_EXPORT_AS_TEXT = 0x00,
|
|
|
|
|
WXLO_EXPORT_AS_TEXT_AND_COMMANDS = 0x01,
|
|
|
|
|
WXLO_EXPORT_AS_HTML = 0x02,
|
|
|
|
|
WXLO_EXPORT_AS_OBJECTS = 0x03,
|
1999-03-29 04:56:44 -05:00
|
|
|
|
|
|
|
|
|
// non 0:
|
|
|
|
|
WXLO_EXPORT_WITH_CRLF = 0x10,
|
|
|
|
|
WXLO_EXPORT_WITH_LF_ONLY = 0x20
|
1998-06-29 08:44:36 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wxLayoutExportObject
|
|
|
|
|
{
|
|
|
|
|
wxLayoutExportType type;
|
|
|
|
|
union
|
|
|
|
|
{
|
1999-03-07 16:38:50 -05:00
|
|
|
|
wxString *text;
|
|
|
|
|
wxLayoutObject *object;
|
1998-06-29 08:44:36 -04:00
|
|
|
|
}content;
|
|
|
|
|
~wxLayoutExportObject()
|
|
|
|
|
{
|
|
|
|
|
if(type == WXLO_EXPORT_TEXT || type == WXLO_EXPORT_HTML)
|
|
|
|
|
delete content.text;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
1999-03-07 16:38:50 -05:00
|
|
|
|
struct wxLayoutExportStatus
|
|
|
|
|
{
|
|
|
|
|
wxLayoutExportStatus(wxLayoutList *list)
|
|
|
|
|
{
|
|
|
|
|
list->GetDefaults()->GetStyle(&m_si);
|
|
|
|
|
m_line = list->GetFirstLine();
|
|
|
|
|
m_iterator = m_line->GetFirstObject();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wxLayoutLine * m_line;
|
|
|
|
|
wxLOiterator m_iterator;
|
|
|
|
|
wxLayoutStyleInfo m_si;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
1999-02-08 10:20:38 -05:00
|
|
|
|
#ifdef OS_WIN
|
1998-06-29 08:44:36 -04:00
|
|
|
|
/// import text into a wxLayoutList (including linefeeds):
|
1999-03-14 16:22:10 -05:00
|
|
|
|
void wxLayoutImportText(wxLayoutList *list, wxString const &str,
|
1999-02-08 10:20:38 -05:00
|
|
|
|
int withflag = WXLO_EXPORT_WITH_CRLF);
|
1998-06-29 08:44:36 -04:00
|
|
|
|
|
1999-03-07 18:31:46 -05:00
|
|
|
|
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
1999-03-29 04:56:44 -05:00
|
|
|
|
int mode = WXLO_EXPORT_AS_TEXT,
|
|
|
|
|
int flags = WXLO_EXPORT_WITH_CRLF);
|
1999-02-08 10:20:38 -05:00
|
|
|
|
#else
|
|
|
|
|
/// import text into a wxLayoutList (including linefeeds):
|
1999-03-14 16:22:10 -05:00
|
|
|
|
void wxLayoutImportText(wxLayoutList *list, wxString const &str,
|
1999-02-08 10:20:38 -05:00
|
|
|
|
int withflag = WXLO_EXPORT_WITH_LF_ONLY);
|
1998-06-29 08:44:36 -04:00
|
|
|
|
|
1999-03-29 04:56:44 -05:00
|
|
|
|
/// export text in a given format
|
1999-03-07 16:38:50 -05:00
|
|
|
|
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
1999-03-29 04:56:44 -05:00
|
|
|
|
int mode = WXLO_EXPORT_AS_TEXT,
|
|
|
|
|
int flags = WXLO_EXPORT_WITH_LF_ONLY
|
1999-03-07 16:38:50 -05:00
|
|
|
|
);
|
1999-02-08 10:20:38 -05:00
|
|
|
|
#endif
|
1998-06-29 08:44:36 -04:00
|
|
|
|
|
|
|
|
|
#endif //WXLPARSER_H
|