]> git.saurik.com Git - wxWidgets.git/blob - src/html/m_span.cpp
Fix another crash when conversion fails in Unix PostScript code.
[wxWidgets.git] / src / html / m_span.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/m_span.cpp
3 // Purpose: wxHtml module for span handling
4 // Author: Nigel Paton
5 // Copyright: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #include "wx/wxprec.h"
10
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14
15 #if wxUSE_HTML
16
17 #include "wx/html/forcelnk.h"
18 #include "wx/html/m_templ.h"
19 #include "wx/fontenum.h"
20 #include "wx/tokenzr.h"
21 #include "wx/html/styleparams.h"
22
23 FORCE_LINK_ME(m_span)
24
25
26 TAG_HANDLER_BEGIN(SPAN, "SPAN" )
27
28 TAG_HANDLER_VARS
29 wxArrayString m_Faces;
30
31 TAG_HANDLER_CONSTR(SPAN) { }
32
33 TAG_HANDLER_PROC(tag)
34 {
35 wxColour oldclr = m_WParser->GetActualColor();
36 wxColour oldbackclr = m_WParser->GetActualBackgroundColor();
37 int oldbackmode = m_WParser->GetActualBackgroundMode();
38 int oldsize = m_WParser->GetFontSize();
39 int oldbold = m_WParser->GetFontBold();
40 int olditalic = m_WParser->GetFontItalic();
41 int oldunderlined = m_WParser->GetFontUnderlined();
42 wxString oldfontface = m_WParser->GetFontFace();
43
44 // Load any style parameters
45 wxHtmlStyleParams styleParams(tag);
46
47 ApplyStyle(styleParams);
48
49 ParseInner(tag);
50
51 m_WParser->SetFontSize(oldsize);
52 m_WParser->SetFontBold(oldbold);
53 m_WParser->SetFontUnderlined(oldunderlined);
54 m_WParser->SetFontFace(oldfontface);
55 m_WParser->SetFontItalic(olditalic);
56 m_WParser->GetContainer()->InsertCell(
57 new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
58
59 if (oldclr != m_WParser->GetActualColor())
60 {
61 m_WParser->SetActualColor(oldclr);
62 m_WParser->GetContainer()->InsertCell(
63 new wxHtmlColourCell(oldclr));
64 }
65
66 if (oldbackmode != m_WParser->GetActualBackgroundMode() ||
67 oldbackclr != m_WParser->GetActualBackgroundColor())
68 {
69 m_WParser->SetActualBackgroundMode(oldbackmode);
70 m_WParser->SetActualBackgroundColor(oldbackclr);
71 m_WParser->GetContainer()->InsertCell(
72 new wxHtmlColourCell(oldbackclr, oldbackmode == wxTRANSPARENT ? wxHTML_CLR_TRANSPARENT_BACKGROUND : wxHTML_CLR_BACKGROUND));
73 }
74
75 return true;
76 }
77
78 TAG_HANDLER_END(SPAN)
79
80
81 TAGS_MODULE_BEGIN(Spans)
82
83 TAGS_MODULE_ADD(SPAN)
84
85 TAGS_MODULE_END(Spans)
86
87 #endif // wxUSE_HTML