/////////////////////////////////////////////////////////////////////////////
-// Name: mod_list.cpp
+// Name: m_list.cpp
// Purpose: wxHtml module for lists
// Author: Vaclav Slavik
// RCS-ID: $Id$
#pragma implementation
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#include "wx/defs.h"
-#if wxUSE_HTML
+#if wxUSE_HTML && wxUSE_STREAMS
#ifdef __BORDLANDC__
#pragma hdrstop
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
#include "wx/html/htmlcell.h"
-FORCE_LINK_ME(mod_list)
+FORCE_LINK_ME(m_list)
//-----------------------------------------------------------------------------
wxHtmlListmarkCell::wxHtmlListmarkCell(wxDC* dc, const wxColour& clr) : wxHtmlCell(), m_Brush(clr, wxSOLID)
{
- m_Width = dc -> GetCharWidth();
- m_Height = dc -> GetCharHeight();
+ m_Width = dc->GetCharWidth();
+ m_Height = dc->GetCharHeight();
m_Descent = 0;
}
wxHtmlContainerCell *c;
// List Item:
- if (tag.GetName() == "LI") {
- if (!tag.IsEnding()) {
- m_WParser -> CloseContainer();
- m_WParser -> CloseContainer();
-
- c = m_WParser -> OpenContainer();
- c -> SetWidthFloat(2 * m_WParser -> GetCharWidth(), wxHTML_UNITS_PIXELS);
- c -> SetAlignHor(wxHTML_ALIGN_RIGHT);
+ if (tag.GetName() == wxT("LI"))
+ {
+ if (!tag.IsEnding())
+ {
+ m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
+ // this is to prevent indetation in <li><p> case
+ m_WParser->CloseContainer();
+ m_WParser->CloseContainer();
+
+ c = m_WParser->OpenContainer();
+ c->SetWidthFloat(2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
+ c->SetAlignHor(wxHTML_ALIGN_RIGHT);
if (m_Numbering == 0)
- c -> InsertCell(new wxHtmlListmarkCell(m_WParser -> GetDC(), m_WParser -> GetActualColor()));
- else {
+ c->InsertCell(new wxHtmlListmarkCell(m_WParser->GetDC(), m_WParser->GetActualColor()));
+ else
+ {
wxString mark;
- mark.Printf("%i.", m_Numbering);
- c -> InsertCell(new wxHtmlWordCell(mark, *(m_WParser -> GetDC())));
+ mark.Printf(wxT("%i."), m_Numbering);
+ c->InsertCell(new wxHtmlWordCell(mark, *(m_WParser->GetDC())));
}
- m_WParser -> CloseContainer();
+ m_WParser->CloseContainer();
- c = m_WParser -> OpenContainer();
- c -> SetIndent(m_WParser -> GetCharWidth() / 4, wxHTML_INDENT_LEFT);
- c -> SetWidthFloat(-2 * m_WParser -> GetCharWidth(), wxHTML_UNITS_PIXELS);
+ c = m_WParser->OpenContainer();
+ c->SetIndent(m_WParser->GetCharWidth() / 4, wxHTML_INDENT_LEFT);
+ c->SetWidthFloat(-2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
- m_WParser -> OpenContainer();
+ m_WParser->OpenContainer();
if (m_Numbering != 0) m_Numbering++;
}
}
// Begin of List (not-numbered): "UL", "OL"
- else {
+ else
+ {
int oldnum = m_Numbering;
- if (tag.GetName() == "UL") m_Numbering = 0;
+ if (tag.GetName() == wxT("UL")) m_Numbering = 0;
else m_Numbering = 1;
- c = m_WParser -> GetContainer();
- if (c -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
- c = m_WParser -> GetContainer();
+ c = m_WParser->GetContainer();
+ if (c->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ c = m_WParser->GetContainer();
}
- c -> SetAlignHor(wxHTML_ALIGN_LEFT);
- c -> SetIndent(2 * m_WParser -> GetCharWidth(), wxHTML_INDENT_LEFT);
- m_WParser -> OpenContainer() -> SetAlignVer(wxHTML_ALIGN_TOP);
+ c->SetAlignHor(wxHTML_ALIGN_LEFT);
+ c->SetIndent(2 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
+ m_WParser->OpenContainer()->SetAlignVer(wxHTML_ALIGN_TOP);
- m_WParser -> OpenContainer();
- m_WParser -> OpenContainer();
+ m_WParser->OpenContainer();
+ m_WParser->OpenContainer();
ParseInner(tag);
- m_WParser -> CloseContainer();
- m_WParser -> CloseContainer();
- m_WParser -> CloseContainer();
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
+ // this is to prevent indetation in <li><p> case
+ m_WParser->CloseContainer();
+
+ m_WParser->CloseContainer();
+ m_WParser->CloseContainer();
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
m_Numbering = oldnum;
return TRUE;