# pragma implementation "wxlparser.h"
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#define BASE_SIZE 12
-inline static bool IsEndOfLine(const char *p)
+inline static bool IsEndOfLine(const wxChar *p)
{
// the end of line is either just '\n' or "\r\n" - we understand both (even
// though the second is used only under DOS/Windows) to be able to import
// we change the string only temporarily inside this function
// VZ: I still don't like it... the string data may be shared...
- char * cptr = (char *)str.c_str(); // const_cast
- const char * begin = cptr;
- char backup;
+ wxChar * cptr = (wxChar *)str.c_str(); // const_cast
+ const wxChar * begin = cptr;
+ wxUnusedVar(begin);
+ wxChar backup;
for(;;)
{
static
wxString wxLayoutExportCmdAsHTML(wxLayoutObjectCmd const & cmd,
- wxLayoutStyleInfo *styleInfo)
+ wxLayoutStyleInfo *styleInfo,
+ bool firstTime)
{
- static char buffer[20];
+ static wxChar buffer[20];
wxString html;
wxLayoutStyleInfo *si = cmd.GetStyle();
int size, sizecount;
- html += "<font ";
+ html += _T("<font ");
if(si->m_fg_valid)
{
- html +="color=";
- sprintf(buffer,"\"#%02X%02X%02X\"", si->m_fg.Red(),si->m_fg.Green(),si->m_fg.Blue());
+ html += _T("color=");
+ wxSprintf(buffer,_T("\"#%02X%02X%02X\""), si->m_fg.Red(),si->m_fg.Green(),si->m_fg.Blue());
html += buffer;
}
if(si->m_bg_valid)
{
- html += " bgcolor=";
- sprintf(buffer,"\"#%02X%02X%02X\"", si->m_bg.Red(),si->m_bg.Green(),si->m_bg.Blue());
+ html += _T(" bgcolor=");
+ wxSprintf(buffer,_T("\"#%02X%02X%02X\""), si->m_bg.Red(),si->m_bg.Green(),si->m_bg.Blue());
html += buffer;
}
{
case wxSWISS:
case wxMODERN:
- html += " face=\"Arial,Helvetica\""; break;
+ html += _T(" face=\"Arial,Helvetica\""); break;
case wxROMAN:
- html += " face=\"Times New Roman, Times\""; break;
+ html += _T(" face=\"Times New Roman, Times\""); break;
case wxTELETYPE:
- html += " face=\"Courier New, Courier\""; break;
+ html += _T(" face=\"Courier New, Courier\""); break;
default:
;
}
sizecount --;
size = (size*10)/12;
}
- html += "size=";
- sprintf(buffer,"%+1d", sizecount);
+ html += _T("size=");
+ wxSprintf(buffer,_T("%+1d"), sizecount);
html += buffer;
- html +=">";
+ html += _T(">");
- if(styleInfo != NULL)
- html ="</font>"+html; // terminate any previous font command
+ if(styleInfo != NULL && ! firstTime)
+ html = _T("</font>")+html; // terminate any previous font command
if((si->weight == wxBOLD) && ( (!styleInfo) || (styleInfo->weight != wxBOLD)))
- html += "<b>";
+ html += _T("<b>");
else
if(si->weight != wxBOLD && ( styleInfo && (styleInfo->weight == wxBOLD)))
- html += "</b>";
+ html += _T("</b>");
if(si->style == wxSLANT)
si->style = wxITALIC; // the same for html
if((si->style == wxITALIC) && ( (!styleInfo) || (styleInfo->style != wxITALIC)))
- html += "<i>";
+ html += _T("<i>");
else
if(si->style != wxITALIC && ( styleInfo && (styleInfo->style == wxITALIC)))
- html += "</i>";
+ html += _T("</i>");
if(si->underline && ( (!styleInfo) || ! styleInfo->underline))
- html += "<u>";
+ html += _T("<u>");
else if(si->underline == false && ( styleInfo && styleInfo->underline))
- html += "</u>";
+ html += _T("</u>");
*styleInfo = *si; // update last style info
m_si = list->GetDefaultStyleInfo();
m_line = list->GetFirstLine();
m_iterator = m_line->GetFirstObject();
+ m_FirstTime = true;
}
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
int mode, int flags)
{
+ wxLayoutObjectList::iterator nulled(NULL);
wxASSERT(status);
- wxLayoutExportObject * export;
+ wxLayoutExportObject * exp;
- if(status->m_iterator == NULLIT) // end of line
+ if(status->m_iterator == nulled) // end of line
{
if(!status->m_line || status->m_line->GetNextLine() == NULL)
// reached end of list
return NULL;
}
- export = new wxLayoutExportObject();
+ exp = new wxLayoutExportObject();
wxLayoutObjectType type;
- if(status->m_iterator != NULLIT)
+ if(status->m_iterator != nulled)
{
type = (** status->m_iterator).GetType();
if( mode == WXLO_EXPORT_AS_OBJECTS || ! WXLO_IS_TEXT(type)) // simple case
{
- export->type = WXLO_EXPORT_OBJECT;
- export->content.object = *status->m_iterator;
+ exp->type = WXLO_EXPORT_OBJECT;
+ exp->content.object = *status->m_iterator;
status->m_iterator++;
- return export;
+ return exp;
}
}
else
- { // iterator == NULLIT
+ { // iterator == nulled
if(mode == WXLO_EXPORT_AS_OBJECTS)
{
- export->type = WXLO_EXPORT_EMPTYLINE;
- export->content.object = NULL; //empty line
+ exp->type = WXLO_EXPORT_EMPTYLINE;
+ exp->content.object = NULL; //empty line
status->m_line = status->m_line->GetNextLine();
if(status->m_line)
status->m_iterator = status->m_line->GetFirstObject();
- return export;
+ return exp;
}
else
type = WXLO_TYPE_TEXT;
}
+ wxUnusedVar(type);
wxString *str = new wxString();
// text must be concatenated
for(;;)
{
- while(status->m_iterator == NULLIT)
+ while(status->m_iterator == nulled)
{
- if(flags & WXLO_EXPORT_AS_HTML)
- *str += "<br>";
+ if(mode & WXLO_EXPORT_AS_HTML)
+ *str += _T("<br>");
if(flags & WXLO_EXPORT_WITH_CRLF)
- *str += "\r\n";
+ *str += _T("\r\n");
else
*str += '\n';
break;
case WXLO_TYPE_CMD:
if(mode == WXLO_EXPORT_AS_HTML)
- *str += wxLayoutExportCmdAsHTML(*(wxLayoutObjectCmd const
- *)*status->m_iterator, & status->m_si);
+ *str += wxLayoutExportCmdAsHTML(
+ *(wxLayoutObjectCmd const *)*status->m_iterator,
+ & status->m_si, status->m_FirstTime);
+ status->m_FirstTime = false;
break;
default: // ignore icons
;
}
status->m_iterator++;
}
-
- export->type = (mode == WXLO_EXPORT_AS_HTML)
+ exp->type = (mode == WXLO_EXPORT_AS_HTML)
? WXLO_EXPORT_HTML : WXLO_EXPORT_TEXT;
- export->content.text = str;
- return export;
+ exp->content.text = str;
+ return exp;
}