Re: Table workaround


Subject: Re: Table workaround
From: Mike Nordell (tamlin@algonet.se)
Date: Tue Dec 19 2000 - 22:47:16 CST


Assuming a Table has a fixed number of columns, but each column can
have different width compared to its "sibling" cell above/below it,
would the following be a starting point?

// this class encapsulates the beahviour of a table at the data-level
class Table
{
 class Cell
 {
  text_holder (strux?)
  ...
  // since each cell can have different width from its
  // "sibling" above/below, we need the following data member.
  UT_uint32 m_width;
 };
 class Line
 {
  std::list<Cell> m_cells;
 };
 std::list<Line> m_lines;
};

// this class takes care of the layout of a table.
class TableLayouter
{
 TableLayouter(const Table& table)
 : m_table(table)
 { }
 void doLayout(whatever_data_type_it_is& blockLayout)
 {
  for line: lines in table
  {
   layout_line = new fp_Line(line);
   for cell: cells in line
   {
    pLine->add(cell)
    ...
   }
   layout_line->layout();
   blockLayout.addLine(layout_line);
  }
  blockLayout.layout();
 }

 const Table& m_table;
};

/Mike - please don't cc



This archive was generated by hypermail 2b25 : Tue Dec 19 2000 - 22:45:31 CST