]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_tables.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/m_tables.cpp
3 // Purpose: wxHtml module for tables
4 // Author: Vaclav Slavik
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
16 #if wxUSE_HTML && wxUSE_STREAMS
19 #include "wx/wxcrtvararg.h"
22 #include "wx/html/forcelnk.h"
23 #include "wx/html/m_templ.h"
25 #include "wx/html/htmlcell.h"
27 FORCE_LINK_ME(m_tables
)
30 #define TABLE_BORDER_CLR_1 wxColour(0xC5, 0xC2, 0xC5)
31 #define TABLE_BORDER_CLR_2 wxColour(0x62, 0x61, 0x62)
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
42 // width of the column either in pixels or percents
43 // ('width' is the number, 'units' determines its meaning)
44 int minWidth
, maxWidth
;
45 // minimal/maximal column width. This is needed by HTML 4.0
46 // layouting algorithm and can be determined by trying to
47 // layout table cells with width=1 and width=infinity
48 int leftpos
, pixwidth
, maxrealwidth
;
49 // temporary (depends on actual width of table)
61 wxHtmlContainerCell
*cont
;
63 int minheight
, valign
;
69 class wxHtmlTableCell
: public wxHtmlContainerCell
72 /* These are real attributes: */
74 // should we draw borders or not?
76 // number of columns; rows
77 int m_NumCols
, m_NumRows
;
78 // array of column information
79 colStruct
*m_ColsInfo
;
80 // 2D array of all cells in the table : m_CellInfo[row][column]
81 cellStruct
**m_CellInfo
;
82 // spaces between cells
84 // cells internal indentation
88 /* ...and these are valid only when parsing the table: */
90 // number of actual column (ranging from 0..m_NumCols)
91 int m_ActualCol
, m_ActualRow
;
93 // default values (for table and row):
94 wxColour m_tBkg
, m_rBkg
;
95 wxString m_tValign
, m_rValign
;
101 wxHtmlTableCell(wxHtmlContainerCell
*parent
, const wxHtmlTag
& tag
, double pixel_scale
= 1.0);
102 virtual ~wxHtmlTableCell();
104 virtual void RemoveExtraSpacing(bool top
, bool bottom
);
106 virtual void Layout(int w
);
108 void AddRow(const wxHtmlTag
& tag
);
109 void AddCell(wxHtmlContainerCell
*cell
, const wxHtmlTag
& tag
);
112 // Reallocates memory to given number of cols/rows
113 // and changes m_NumCols/m_NumRows value to reflect this change
114 // NOTE! You CAN'T change m_NumCols/m_NumRows before calling this!!
115 void ReallocCols(int cols
);
116 void ReallocRows(int rows
);
118 // Computes minimal and maximal widths of columns. Needs to be called
119 // only once, before first Layout().
120 void ComputeMinMaxWidths();
122 DECLARE_NO_COPY_CLASS(wxHtmlTableCell
)
127 wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell
*parent
, const wxHtmlTag
& tag
, double pixel_scale
)
128 : wxHtmlContainerCell(parent
)
130 m_PixelScale
= pixel_scale
;
132 (tag
.HasParam(wxT("BORDER")) && tag
.GetParam(wxT("BORDER")) != wxT("0"));
134 m_NumCols
= m_NumRows
= 0;
136 m_ActualCol
= m_ActualRow
= -1;
139 if (tag
.HasParam(wxT("BGCOLOR")))
141 tag
.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg
);
143 SetBackgroundColour(m_tBkg
);
145 if (tag
.HasParam(wxT("VALIGN")))
146 m_tValign
= tag
.GetParam(wxT("VALIGN"));
148 m_tValign
= wxEmptyString
;
149 if (!tag
.GetParamAsInt(wxT("CELLSPACING"), &m_Spacing
))
151 if (!tag
.GetParamAsInt(wxT("CELLPADDING"), &m_Padding
))
153 m_Spacing
= (int)(m_PixelScale
* (double)m_Spacing
);
154 m_Padding
= (int)(m_PixelScale
* (double)m_Padding
);
157 SetBorder(TABLE_BORDER_CLR_1
, TABLE_BORDER_CLR_2
);
162 wxHtmlTableCell::~wxHtmlTableCell()
164 if (m_ColsInfo
) free(m_ColsInfo
);
167 for (int i
= 0; i
< m_NumRows
; i
++)
174 void wxHtmlTableCell::RemoveExtraSpacing(bool WXUNUSED(top
),
175 bool WXUNUSED(bottom
))
177 // Don't remove any spacing in the table -- it's always desirable,
178 // because it's part of table's definition.
179 // (If wxHtmlContainerCell::RemoveExtraSpacing() was applied to tables,
180 // then upper left cell of a table would be positioned above other cells
181 // if the table was the first element on the page.)
184 void wxHtmlTableCell::ReallocCols(int cols
)
188 for (i
= 0; i
< m_NumRows
; i
++)
190 m_CellInfo
[i
] = (cellStruct
*) realloc(m_CellInfo
[i
], sizeof(cellStruct
) * cols
);
191 for (j
= m_NumCols
; j
< cols
; j
++)
192 m_CellInfo
[i
][j
].flag
= cellFree
;
195 m_ColsInfo
= (colStruct
*) realloc(m_ColsInfo
, sizeof(colStruct
) * cols
);
196 for (j
= m_NumCols
; j
< cols
; j
++)
198 m_ColsInfo
[j
].width
= 0;
199 m_ColsInfo
[j
].units
= wxHTML_UNITS_PERCENT
;
200 m_ColsInfo
[j
].minWidth
= m_ColsInfo
[j
].maxWidth
= -1;
208 void wxHtmlTableCell::ReallocRows(int rows
)
210 m_CellInfo
= (cellStruct
**) realloc(m_CellInfo
, sizeof(cellStruct
*) * rows
);
211 for (int row
= m_NumRows
; row
< rows
; row
++)
214 m_CellInfo
[row
] = NULL
;
217 m_CellInfo
[row
] = (cellStruct
*) malloc(sizeof(cellStruct
) * m_NumCols
);
218 for (int col
= 0; col
< m_NumCols
; col
++)
219 m_CellInfo
[row
][col
].flag
= cellFree
;
226 void wxHtmlTableCell::AddRow(const wxHtmlTag
& tag
)
229 // VS: real allocation of row entry is done in AddCell in order
230 // to correctly handle empty rows (i.e. "<tr></tr>")
231 // m_ActualCol == -1 indicates that AddCell has to allocate new row.
235 if (tag
.HasParam(wxT("BGCOLOR")))
236 tag
.GetParamAsColour(wxT("BGCOLOR"), &m_rBkg
);
237 if (tag
.HasParam(wxT("VALIGN")))
238 m_rValign
= tag
.GetParam(wxT("VALIGN"));
240 m_rValign
= m_tValign
;
245 void wxHtmlTableCell::AddCell(wxHtmlContainerCell
*cell
, const wxHtmlTag
& tag
)
247 // Is this cell in new row?
248 // VS: we can't do it in AddRow, see my comment there
249 if (m_ActualCol
== -1)
251 if (m_ActualRow
+ 1 > m_NumRows
- 1)
252 ReallocRows(m_ActualRow
+ 2);
260 } while ((m_ActualCol
< m_NumCols
) &&
261 (m_CellInfo
[m_ActualRow
][m_ActualCol
].flag
!= cellFree
));
263 if (m_ActualCol
> m_NumCols
- 1)
264 ReallocCols(m_ActualCol
+ 1);
266 int r
= m_ActualRow
, c
= m_ActualCol
;
268 m_CellInfo
[r
][c
].cont
= cell
;
269 m_CellInfo
[r
][c
].colspan
= 1;
270 m_CellInfo
[r
][c
].rowspan
= 1;
271 m_CellInfo
[r
][c
].flag
= cellUsed
;
272 m_CellInfo
[r
][c
].minheight
= 0;
273 m_CellInfo
[r
][c
].valign
= wxHTML_ALIGN_TOP
;
275 /* scan for parameters: */
279 if (tag
.HasParam(wxT("WIDTH")))
281 wxString wd
= tag
.GetParam(wxT("WIDTH"));
283 if (wd
[wd
.length()-1] == wxT('%'))
285 wxSscanf(wd
.c_str(), wxT("%i%%"), &m_ColsInfo
[c
].width
);
286 m_ColsInfo
[c
].units
= wxHTML_UNITS_PERCENT
;
290 wxSscanf(wd
.c_str(), wxT("%i"), &m_ColsInfo
[c
].width
);
291 m_ColsInfo
[c
].width
= (int)(m_PixelScale
* (double)m_ColsInfo
[c
].width
);
292 m_ColsInfo
[c
].units
= wxHTML_UNITS_PIXELS
;
300 tag
.GetParamAsInt(wxT("COLSPAN"), &m_CellInfo
[r
][c
].colspan
);
301 tag
.GetParamAsInt(wxT("ROWSPAN"), &m_CellInfo
[r
][c
].rowspan
);
303 // VS: the standard says this about col/rowspan:
304 // "This attribute specifies the number of rows spanned by the
305 // current cell. The default value of this attribute is one ("1").
306 // The value zero ("0") means that the cell spans all rows from the
307 // current row to the last row of the table." All mainstream
308 // browsers act as if 0==1, though, and so does wxHTML.
309 if (m_CellInfo
[r
][c
].colspan
< 1)
310 m_CellInfo
[r
][c
].colspan
= 1;
311 if (m_CellInfo
[r
][c
].rowspan
< 1)
312 m_CellInfo
[r
][c
].rowspan
= 1;
314 if ((m_CellInfo
[r
][c
].colspan
> 1) || (m_CellInfo
[r
][c
].rowspan
> 1))
318 if (r
+ m_CellInfo
[r
][c
].rowspan
> m_NumRows
)
319 ReallocRows(r
+ m_CellInfo
[r
][c
].rowspan
);
320 if (c
+ m_CellInfo
[r
][c
].colspan
> m_NumCols
)
321 ReallocCols(c
+ m_CellInfo
[r
][c
].colspan
);
322 for (i
= r
; i
< r
+ m_CellInfo
[r
][c
].rowspan
; i
++)
323 for (j
= c
; j
< c
+ m_CellInfo
[r
][c
].colspan
; j
++)
324 m_CellInfo
[i
][j
].flag
= cellSpan
;
325 m_CellInfo
[r
][c
].flag
= cellUsed
;
331 wxColour bk
= m_rBkg
;
332 if (tag
.HasParam(wxT("BGCOLOR")))
333 tag
.GetParamAsColour(wxT("BGCOLOR"), &bk
);
335 cell
->SetBackgroundColour(bk
);
338 cell
->SetBorder(TABLE_BORDER_CLR_2
, TABLE_BORDER_CLR_1
);
340 // vertical alignment:
343 if (tag
.HasParam(wxT("VALIGN")))
344 valign
= tag
.GetParam(wxT("VALIGN"));
348 if (valign
== wxT("TOP"))
349 m_CellInfo
[r
][c
].valign
= wxHTML_ALIGN_TOP
;
350 else if (valign
== wxT("BOTTOM"))
351 m_CellInfo
[r
][c
].valign
= wxHTML_ALIGN_BOTTOM
;
352 else m_CellInfo
[r
][c
].valign
= wxHTML_ALIGN_CENTER
;
356 if (tag
.HasParam(wxT("NOWRAP")))
357 m_CellInfo
[r
][c
].nowrap
= true;
359 m_CellInfo
[r
][c
].nowrap
= false;
361 cell
->SetIndent(m_Padding
, wxHTML_INDENT_ALL
, wxHTML_UNITS_PIXELS
);
364 void wxHtmlTableCell::ComputeMinMaxWidths()
366 if (m_NumCols
== 0 || m_ColsInfo
[0].minWidth
!= wxDefaultCoord
) return;
370 for (int c
= 0; c
< m_NumCols
; c
++)
372 for (int r
= 0; r
< m_NumRows
; r
++)
374 cellStruct
& cell
= m_CellInfo
[r
][c
];
375 if (cell
.flag
== cellUsed
)
377 cell
.cont
->Layout(2*m_Padding
+ 1);
378 int maxWidth
= cell
.cont
->GetMaxTotalWidth();
379 int width
= cell
.nowrap
?maxWidth
:cell
.cont
->GetWidth();
380 width
-= (cell
.colspan
-1) * m_Spacing
;
381 maxWidth
-= (cell
.colspan
-1) * m_Spacing
;
382 // HTML 4.0 says it is acceptable to distribute min/max
383 width
/= cell
.colspan
;
384 maxWidth
/= cell
.colspan
;
385 for (int j
= 0; j
< cell
.colspan
; j
++) {
386 if (width
> m_ColsInfo
[c
+j
].minWidth
)
387 m_ColsInfo
[c
+j
].minWidth
= width
;
388 if (maxWidth
> m_ColsInfo
[c
+j
].maxWidth
)
389 m_ColsInfo
[c
+j
].maxWidth
= maxWidth
;
393 // Calculate maximum table width, required for nested tables
394 if (m_ColsInfo
[c
].units
== wxHTML_UNITS_PIXELS
)
395 m_MaxTotalWidth
+= wxMax(m_ColsInfo
[c
].width
, m_ColsInfo
[c
].minWidth
);
396 else if ((m_ColsInfo
[c
].units
== wxHTML_UNITS_PERCENT
) && (m_ColsInfo
[c
].width
!= 0))
397 percentage
+= m_ColsInfo
[c
].width
;
399 m_MaxTotalWidth
+= m_ColsInfo
[c
].maxWidth
;
402 if (percentage
>= 100)
404 // Table would have infinite length
405 // Make it ridiculous large
406 m_MaxTotalWidth
= 0xFFFFFF;
409 m_MaxTotalWidth
= m_MaxTotalWidth
* 100 / (100 - percentage
);
411 m_MaxTotalWidth
+= (m_NumCols
+ 1) * m_Spacing
;
414 void wxHtmlTableCell::Layout(int w
)
416 ComputeMinMaxWidths();
418 wxHtmlCell::Layout(w
);
426 if (m_WidthFloatUnits
== wxHTML_UNITS_PERCENT
)
428 if (m_WidthFloat
< 0)
430 if (m_WidthFloat
< -100)
432 m_Width
= (100 + m_WidthFloat
) * w
/ 100;
436 if (m_WidthFloat
> 100)
438 m_Width
= m_WidthFloat
* w
/ 100;
443 if (m_WidthFloat
< 0) m_Width
= w
+ m_WidthFloat
;
444 else m_Width
= m_WidthFloat
;
454 /* 1. setup columns widths:
456 The algorithm tries to keep the table size less than w if possible.
459 int wpix
= m_Width
- (m_NumCols
+ 1) * m_Spacing
;
462 // 1a. setup fixed-width columns:
463 for (i
= 0; i
< m_NumCols
; i
++)
464 if (m_ColsInfo
[i
].units
== wxHTML_UNITS_PIXELS
)
466 m_ColsInfo
[i
].pixwidth
= wxMax(m_ColsInfo
[i
].width
,
467 m_ColsInfo
[i
].minWidth
);
468 wpix
-= m_ColsInfo
[i
].pixwidth
;
471 // 1b. Calculate maximum possible width if line wrapping would be disabled
472 // Recalculate total width if m_WidthFloat is zero to keep tables as small
475 for (i
= 0; i
< m_NumCols
; i
++)
476 if (m_ColsInfo
[i
].width
== 0)
478 maxWidth
+= m_ColsInfo
[i
].maxWidth
;
483 // Recalculate table width since no table width was initially given
484 int newWidth
= m_Width
- wpix
+ maxWidth
;
486 // Make sure that floating-width columns will have the right size.
487 // Calculate sum of all floating-width columns
489 for (i
= 0; i
< m_NumCols
; i
++)
490 if ((m_ColsInfo
[i
].units
== wxHTML_UNITS_PERCENT
) && (m_ColsInfo
[i
].width
!= 0))
491 percentage
+= m_ColsInfo
[i
].width
;
493 if (percentage
>= 100)
496 newWidth
= newWidth
* 100 / (100 - percentage
);
498 newWidth
= wxMin(newWidth
, w
- (m_NumCols
+ 1) * m_Spacing
);
499 wpix
-= m_Width
- newWidth
;
504 // 1c. setup floating-width columns:
506 for (i
= 0; i
< m_NumCols
; i
++)
507 if ((m_ColsInfo
[i
].units
== wxHTML_UNITS_PERCENT
) && (m_ColsInfo
[i
].width
!= 0))
509 m_ColsInfo
[i
].pixwidth
= wxMin(m_ColsInfo
[i
].width
, 100) * wpix
/ 100;
511 // Make sure to leave enough space for the other columns
513 for (j
= 0; j
< m_NumCols
; j
++)
515 if ((m_ColsInfo
[j
].units
== wxHTML_UNITS_PERCENT
&& j
> i
) ||
516 !m_ColsInfo
[j
].width
)
517 minRequired
+= m_ColsInfo
[j
].minWidth
;
519 m_ColsInfo
[i
].pixwidth
= wxMax(wxMin(wtemp
- minRequired
, m_ColsInfo
[i
].pixwidth
), m_ColsInfo
[i
].minWidth
);
521 wtemp
-= m_ColsInfo
[i
].pixwidth
;
525 // 1d. setup default columns (no width specification supplied):
526 // The algorithm assigns calculates the maximum possible width if line
527 // wrapping would be disabled and assigns column width as a fraction
528 // based upon the maximum width of a column
529 // FIXME: I'm not sure if this algorithm is conform to HTML standard,
530 // though it seems to be much better than the old one
532 for (i
= j
= 0; i
< m_NumCols
; i
++)
533 if (m_ColsInfo
[i
].width
== 0) j
++;
538 for (i
= 0; i
< m_NumCols
; i
++)
539 if (m_ColsInfo
[i
].width
== 0)
541 // Assign with, make sure not to drop below minWidth
543 m_ColsInfo
[i
].pixwidth
= (int)(wpix
* (m_ColsInfo
[i
].maxWidth
/ (float)maxWidth
) + 0.5);
545 m_ColsInfo
[i
].pixwidth
= wpix
/ j
;
547 // Make sure to leave enough space for the other columns
550 for (r
= i
+ 1; r
< m_NumCols
; r
++)
552 if (!m_ColsInfo
[r
].width
)
553 minRequired
+= m_ColsInfo
[r
].minWidth
;
555 m_ColsInfo
[i
].pixwidth
= wxMax(wxMin(wpix
- minRequired
, m_ColsInfo
[i
].pixwidth
), m_ColsInfo
[i
].minWidth
);
559 if (m_ColsInfo
[i
].pixwidth
> (wpix
* (m_ColsInfo
[i
].maxWidth
/ (float)maxWidth
) + 0.5))
561 int diff
= (int)(m_ColsInfo
[i
].pixwidth
- (wpix
* m_ColsInfo
[i
].maxWidth
/ (float)maxWidth
+ 0.5));
562 maxWidth
+= diff
- m_ColsInfo
[i
].maxWidth
;
565 maxWidth
-= m_ColsInfo
[i
].maxWidth
;
567 wpix
-= m_ColsInfo
[i
].pixwidth
;
571 /* 2. compute positions of columns: */
573 int wpos
= m_Spacing
;
574 for (int i
= 0; i
< m_NumCols
; i
++)
576 m_ColsInfo
[i
].leftpos
= wpos
;
577 wpos
+= m_ColsInfo
[i
].pixwidth
+ m_Spacing
;
580 // add the remaining space to the last column
581 if (m_NumCols
> 0 && wpos
< m_Width
)
582 m_ColsInfo
[m_NumCols
-1].pixwidth
+= m_Width
- wpos
;
585 /* 3. sub-layout all cells: */
587 int *ypos
= new int[m_NumRows
+ 1];
591 wxHtmlContainerCell
*actcell
;
594 for (actrow
= 1; actrow
<= m_NumRows
; actrow
++) ypos
[actrow
] = -1;
595 for (actrow
= 0; actrow
< m_NumRows
; actrow
++)
597 if (ypos
[actrow
] == -1) ypos
[actrow
] = ypos
[actrow
-1];
598 // 3a. sub-layout and detect max height:
600 for (actcol
= 0; actcol
< m_NumCols
; actcol
++) {
601 if (m_CellInfo
[actrow
][actcol
].flag
!= cellUsed
) continue;
602 actcell
= m_CellInfo
[actrow
][actcol
].cont
;
604 for (int i
= actcol
; i
< m_CellInfo
[actrow
][actcol
].colspan
+ actcol
; i
++)
605 fullwid
+= m_ColsInfo
[i
].pixwidth
;
606 fullwid
+= (m_CellInfo
[actrow
][actcol
].colspan
- 1) * m_Spacing
;
607 actcell
->SetMinHeight(m_CellInfo
[actrow
][actcol
].minheight
, m_CellInfo
[actrow
][actcol
].valign
);
608 actcell
->Layout(fullwid
);
610 if (ypos
[actrow
] + actcell
->GetHeight() + m_CellInfo
[actrow
][actcol
].rowspan
* m_Spacing
> ypos
[actrow
+ m_CellInfo
[actrow
][actcol
].rowspan
])
611 ypos
[actrow
+ m_CellInfo
[actrow
][actcol
].rowspan
] =
612 ypos
[actrow
] + actcell
->GetHeight() + m_CellInfo
[actrow
][actcol
].rowspan
* m_Spacing
;
616 for (actrow
= 0; actrow
< m_NumRows
; actrow
++)
618 // 3b. place cells in row & let'em all have same height:
620 for (actcol
= 0; actcol
< m_NumCols
; actcol
++)
622 if (m_CellInfo
[actrow
][actcol
].flag
!= cellUsed
) continue;
623 actcell
= m_CellInfo
[actrow
][actcol
].cont
;
624 actcell
->SetMinHeight(
625 ypos
[actrow
+ m_CellInfo
[actrow
][actcol
].rowspan
] - ypos
[actrow
] - m_Spacing
,
626 m_CellInfo
[actrow
][actcol
].valign
);
628 for (int i
= actcol
; i
< m_CellInfo
[actrow
][actcol
].colspan
+ actcol
; i
++)
629 fullwid
+= m_ColsInfo
[i
].pixwidth
;
630 fullwid
+= (m_CellInfo
[actrow
][actcol
].colspan
- 1) * m_Spacing
;
631 actcell
->Layout(fullwid
);
632 actcell
->SetPos(m_ColsInfo
[actcol
].leftpos
, ypos
[actrow
]);
635 m_Height
= ypos
[m_NumRows
];
639 /* 4. adjust table's width if it was too small: */
642 int twidth
= m_ColsInfo
[m_NumCols
-1].leftpos
+
643 m_ColsInfo
[m_NumCols
-1].pixwidth
+ m_Spacing
;
644 if (twidth
> m_Width
)
654 //-----------------------------------------------------------------------------
655 // The tables handler:
656 //-----------------------------------------------------------------------------
659 TAG_HANDLER_BEGIN(TABLE
, "TABLE,TR,TD,TH")
662 wxHtmlTableCell
* m_Table
;
663 wxString m_tAlign
, m_rAlign
;
665 TAG_HANDLER_CONSTR(TABLE
)
668 m_tAlign
= m_rAlign
= wxEmptyString
;
672 TAG_HANDLER_PROC(tag
)
674 wxHtmlContainerCell
*c
;
676 // new table started, backup upper-level table (if any) and create new:
677 if (tag
.GetName() == wxT("TABLE"))
679 wxHtmlTableCell
*oldt
= m_Table
;
680 wxHtmlContainerCell
*oldcont
;
682 oldcont
= c
= m_WParser
->OpenContainer();
684 m_Table
= new wxHtmlTableCell(c
, tag
, m_WParser
->GetPixelScale());
688 if (tag
.HasParam(wxT("WIDTH")))
690 wxString wd
= tag
.GetParam(wxT("WIDTH"));
692 if (wd
[wd
.length()-1] == wxT('%'))
695 wxSscanf(wd
.c_str(), wxT("%i%%"), &width
);
696 m_Table
->SetWidthFloat(width
, wxHTML_UNITS_PERCENT
);
701 wxSscanf(wd
.c_str(), wxT("%i"), &width
);
702 m_Table
->SetWidthFloat((int)(m_WParser
->GetPixelScale() * width
), wxHTML_UNITS_PIXELS
);
706 m_Table
->SetWidthFloat(0, wxHTML_UNITS_PIXELS
);
708 int oldAlign
= m_WParser
->GetAlign();
709 m_tAlign
= wxEmptyString
;
710 if (tag
.HasParam(wxT("ALIGN")))
711 m_tAlign
= tag
.GetParam(wxT("ALIGN"));
715 m_WParser
->SetAlign(oldAlign
);
716 m_WParser
->SetContainer(oldcont
);
717 m_WParser
->CloseContainer();
727 if (tag
.GetName() == wxT("TR"))
729 m_Table
->AddRow(tag
);
731 if (tag
.HasParam(wxT("ALIGN")))
732 m_rAlign
= tag
.GetParam(wxT("ALIGN"));
738 c
= m_WParser
->SetContainer(new wxHtmlContainerCell(m_Table
));
739 m_Table
->AddCell(c
, tag
);
741 m_WParser
->OpenContainer();
743 if (tag
.GetName() == wxT("TH")) /*header style*/
744 m_WParser
->SetAlign(wxHTML_ALIGN_CENTER
);
746 m_WParser
->SetAlign(wxHTML_ALIGN_LEFT
);
751 if (tag
.HasParam(wxT("ALIGN")))
752 als
= tag
.GetParam(wxT("ALIGN"));
754 if (als
== wxT("RIGHT"))
755 m_WParser
->SetAlign(wxHTML_ALIGN_RIGHT
);
756 else if (als
== wxT("LEFT"))
757 m_WParser
->SetAlign(wxHTML_ALIGN_LEFT
);
758 else if (als
== wxT("CENTER"))
759 m_WParser
->SetAlign(wxHTML_ALIGN_CENTER
);
761 m_WParser
->OpenContainer();
767 TAG_HANDLER_END(TABLE
)
773 TAGS_MODULE_BEGIN(Tables
)
775 TAGS_MODULE_ADD(TABLE
)
777 TAGS_MODULE_END(Tables
)