+2001-10-24 Juergen Vigna <jug@sad.it>
+
+ * tabular-old.C (ReadOld): below variable changes reflected.
+
+ * tabular.[Ch]: added ltType struct for longtable header/footer
+ defines and changed all instances where they are used. Added
+ future support for double top/bottom rows.
+
2001-10-24 José Matos <jamatos@fep.up.pt>
* buffer.h (docbookHandleCaption):
+2001-10-24 Juergen Vigna <jug@sad.it>
+
+ * FormTabular.C: changed calls for footer/headers of longtabulars.
+
2001-10-23 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* forms/form_tabular.fd: Add value choices
setEnabled(longtable_options_->radio_lt_newpage, enable);
if (enable) {
- int dummy;
+ LyXTabular::ltType dummyltt;
fl_set_button(longtable_options_->radio_lt_firsthead,
- tabular->GetRowOfLTFirstHead(cell, dummy));
+ tabular->GetRowOfLTFirstHead(row-1, dummyltt));
fl_set_button(longtable_options_->radio_lt_head,
- tabular->GetRowOfLTHead(cell, dummy));
+ tabular->GetRowOfLTHead(row-1, dummyltt));
fl_set_button(longtable_options_->radio_lt_foot,
- tabular->GetRowOfLTFoot(cell, dummy));
+ tabular->GetRowOfLTFoot(row-1, dummyltt));
fl_set_button(longtable_options_->radio_lt_lastfoot,
- tabular->GetRowOfLTLastFoot(cell, dummy));
+ tabular->GetRowOfLTLastFoot(row-1, dummyltt));
fl_set_button(longtable_options_->radio_lt_newpage,
- tabular->GetLTNewPage(cell));
+ tabular->GetLTNewPage(cell));
} else {
fl_set_button(longtable_options_->radio_lt_firsthead,0);
fl_set_button(longtable_options_->radio_lt_head,0);
string special;;
int cell = inset_->getActCell();
+ int row = tabular->row_of_cell(cell);
+
if (actCell_ != cell) {
update();
fl_set_object_label(dialog_->text_warning,
if (enable) {
num = LyXTabular::SET_LONGTABULAR;
- int dummy;
+ LyXTabular::ltType dummyltt;
fl_set_button(longtable_options_->radio_lt_firsthead,
- tabular->GetRowOfLTFirstHead(cell, dummy));
+ tabular->GetRowOfLTFirstHead(row, dummyltt));
fl_set_button(longtable_options_->radio_lt_head,
- tabular->GetRowOfLTHead(cell, dummy));
+ tabular->GetRowOfLTHead(row, dummyltt));
fl_set_button(longtable_options_->radio_lt_foot,
- tabular->GetRowOfLTFoot(cell, dummy));
+ tabular->GetRowOfLTFoot(row, dummyltt));
fl_set_button(longtable_options_->radio_lt_lastfoot,
- tabular->GetRowOfLTLastFoot(cell, dummy));
+ tabular->GetRowOfLTLastFoot(row, dummyltt));
fl_set_button(longtable_options_->radio_lt_firsthead,
tabular->GetLTNewPage(cell));
} else {
num = LyXTabular::SET_USEBOX;
special = "2";
} else if (ob == longtable_options_->radio_lt_firsthead) {
- num = LyXTabular::SET_LTFIRSTHEAD;
+ if (fl_get_button(ob))
+ num = LyXTabular::SET_LTFIRSTHEAD;
+ else
+ num = LyXTabular::UNSET_LTFIRSTHEAD;
} else if (ob == longtable_options_->radio_lt_head) {
- num = LyXTabular::SET_LTHEAD;
+ if (fl_get_button(ob))
+ num = LyXTabular::SET_LTHEAD;
+ else
+ num = LyXTabular::UNSET_LTHEAD;
} else if (ob == longtable_options_->radio_lt_foot) {
- num = LyXTabular::SET_LTFOOT;
+ if (fl_get_button(ob))
+ num = LyXTabular::SET_LTFOOT;
+ else
+ num = LyXTabular::UNSET_LTFOOT;
} else if (ob == longtable_options_->radio_lt_lastfoot) {
- num = LyXTabular::SET_LTLASTFOOT;
+ if (fl_get_button(ob))
+ num = LyXTabular::SET_LTLASTFOOT;
+ else
+ num = LyXTabular::UNSET_LTLASTFOOT;
} else if (ob == longtable_options_->radio_lt_newpage) {
num = LyXTabular::SET_LTNEWPAGE;
} else if (ob == column_options_->input_special_alignment) {
+2001-10-24 Juergen Vigna <jug@sad.it>
+
+ * insettabular.C: use new ltType struct for setting longtable
+ header and footers also new UNSET enums.
+
2001-10-24 José Matos <jamatos@fep.up.pt>
* insettabular.C (linuxdoc): Now exports the ascii's table version.
bv->text->cursor.par(),
bv->text->cursor.par()->next());
- int row = tabular->row_of_cell(actcell);
+ LyXTabular::ltType ltt;
+ int row = ltt.row = tabular->row_of_cell(actcell);
int column = tabular->column_of_cell(actcell);
bool flag = true;
-
+
switch (feature) {
case LyXTabular::SET_PWIDTH:
{
tabular->GetCellNumber(i, j), val);
break;
}
+ case LyXTabular::UNSET_LTFIRSTHEAD:
+ ltt.row = 0;
case LyXTabular::SET_LTFIRSTHEAD:
- tabular->SetLTHead(actcell, true);
+ tabular->SetLTHead(ltt, true);
break;
+ case LyXTabular::UNSET_LTHEAD:
+ ltt.row = 0;
case LyXTabular::SET_LTHEAD:
- tabular->SetLTHead(actcell, false);
+ tabular->SetLTHead(ltt, false);
break;
+ case LyXTabular::UNSET_LTFOOT:
+ ltt.row = 0;
case LyXTabular::SET_LTFOOT:
- tabular->SetLTFoot(actcell, false);
+ tabular->SetLTFoot(ltt, false);
break;
+ case LyXTabular::UNSET_LTLASTFOOT:
+ ltt.row = 0;
case LyXTabular::SET_LTLASTFOOT:
- tabular->SetLTFoot(actcell, true);
+ tabular->SetLTFoot(ltt, true);
break;
case LyXTabular::SET_LTNEWPAGE:
{
int sel_row_start;
int sel_row_end;
int dummy;
+ LyXTabular::ltType dummyltt;
bool flag = true;
if (hasSelection()) {
status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTFIRSTHEAD:
- if (tabular->GetRowOfLTHead(actcell, dummy))
+ if (tabular->GetRowOfLTHead(actcell, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTHEAD:
- if (tabular->GetRowOfLTHead(actcell, dummy))
+ if (tabular->GetRowOfLTHead(actcell, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTFOOT:
- if (tabular->GetRowOfLTFoot(actcell, dummy))
+ if (tabular->GetRowOfLTFoot(actcell, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTLASTFOOT:
- if (tabular->GetRowOfLTFoot(actcell, dummy))
+ if (tabular->GetRowOfLTFoot(actcell, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
return;
}
getTokenValue(line, "islongtable", is_long_tabular);
- getTokenValue(line, "endhead", endhead);
- getTokenValue(line, "endfirsthead", endfirsthead);
- getTokenValue(line, "endfoot", endfoot);
- getTokenValue(line, "endlastfoot", endlastfoot);
+ getTokenValue(line, "endhead", endhead.row);
+ getTokenValue(line, "endfirsthead", endfirsthead.row);
+ getTokenValue(line, "endfoot", endfoot.row);
+ getTokenValue(line, "endlastfoot", endlastfoot.row);
for (int i = 0; i < rows_; ++i) {
l_getline(is, line);
}
+LyXTabular::lttype::lttype()
+{
+ row = 0;
+ topDL = false;
+ bottomDL = false;
+}
+
+
/* konstruktor */
LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
{
set_row_column_number_info();
is_long_tabular = false;
rotate = false;
- endhead = 0;
- endfirsthead = 0;
- endfoot = 0;
- endlastfoot = 0;
+ endhead.row = 0;
+ endfirsthead.row = 0;
+ endfoot.row = 0;
+ endlastfoot.row = 0;
}
os << "<features"
<< write_attribute("rotate", tostr(rotate))
<< write_attribute("islongtable", tostr(is_long_tabular))
- << write_attribute("endhead", endhead)
- << write_attribute("endfirsthead", endfirsthead)
- << write_attribute("endfoot", endfoot)
- << write_attribute("endlastfoot", endlastfoot)
+ << write_attribute("endhead", endhead.row)
+ << write_attribute("endfirsthead", endfirsthead.row)
+ << write_attribute("endfoot", endfoot.row)
+ << write_attribute("endlastfoot", endlastfoot.row)
<< ">\n";
for (int j = 0; j < columns_; ++j) {
os << "<column"
}
getTokenValue(line, "rotate", rotate);
getTokenValue(line, "islongtable", is_long_tabular);
- getTokenValue(line, "endhead", endhead);
- getTokenValue(line, "endfirsthead", endfirsthead);
- getTokenValue(line, "endfoot", endfoot);
- getTokenValue(line, "endlastfoot", endlastfoot);
-
+ getTokenValue(line, "endhead", endhead.row);
+ getTokenValue(line, "endfirsthead", endfirsthead.row);
+ getTokenValue(line, "endfoot", endfoot.row);
+ getTokenValue(line, "endlastfoot", endlastfoot.row);
+ endhead.row = abs(endhead.row);
+ endfirsthead.row = abs(endfirsthead.row);
+ endfoot.row = abs(endfoot.row);
+ endlastfoot.row = abs(endlastfoot.row);
for (int j = 0; j < columns_; ++j) {
l_getline(is,line);
if (!prefixIs(line,"<column")) {
cont_row_info = vector<int>(rows_arg);
SetLongTabular(is_long_tabular_arg);
SetRotateTabular(rotate_arg);
- endhead = a + 1;
- endfirsthead = b + 1;
- endfoot = c + 1;
- endlastfoot = d + 1;
+ endhead.row = a + 1;
+ endfirsthead.row = b + 1;
+ endfoot.row = c + 1;
+ endlastfoot.row = d + 1;
for (i = 0; i < rows_; ++i) {
a = b = c = d = e = f = g = 0;
is >> a >> b >> c >> d;
return UseParbox(cell);
}
-
-void LyXTabular::SetLTHead(int cell, bool first)
+bool LyXTabular::checkLTType(int row, ltType const & ltt) const
{
- int const row = row_of_cell(cell);
- int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
+ if (!ltt.row || (ltt.row > rows_))
+ return false;
+ return (row == (ltt.row - 1));
+}
+
+void LyXTabular::SetLTHead(ltType const & hd, bool first)
+{
if (first) {
- if (endfirsthead == val)
- endfirsthead = 0;
- else
- endfirsthead = val;
+ endfirsthead = hd;
} else {
- if (endhead == val)
- endhead = 0;
- else
- endhead = val;
+ endhead = hd;
}
}
-bool LyXTabular::GetRowOfLTHead(int cell, int & row) const
+bool LyXTabular::GetRowOfLTHead(int row, ltType & hd) const
{
- row = endhead;
- if (abs(endhead) > rows_)
- return false;
- return (row_of_cell(cell) == abs(endhead) - 1);
+ hd = endhead;
+ return checkLTType(row, hd);
}
-bool LyXTabular::GetRowOfLTFirstHead(int cell, int & row) const
+bool LyXTabular::GetRowOfLTFirstHead(int row, ltType & hd) const
{
- row = endfirsthead;
- if (abs(endfirsthead) > rows_)
- return false;
- return (row_of_cell(cell) == abs(endfirsthead) - 1);
+ hd = endfirsthead;
+ return checkLTType(row, hd);
}
-void LyXTabular::SetLTFoot(int cell, bool last)
+void LyXTabular::SetLTFoot(ltType const & fd, bool last)
{
- int const row = row_of_cell(cell);
- int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
-
if (last) {
- if (endlastfoot == val)
- endlastfoot = 0;
- else
- endlastfoot = val;
+ endlastfoot = fd;
} else {
- if (endfoot == val)
- endfoot = 0;
- else
- endfoot = val;
+ endfoot = fd;
}
}
-bool LyXTabular::GetRowOfLTFoot(int cell, int & row) const
+bool LyXTabular::GetRowOfLTFoot(int row, ltType & fd) const
{
- row = endfoot;
- if ((endfoot + 1) > rows_)
- return false;
- return (row_of_cell(cell) == abs(endfoot) - 1);
+ fd = endfoot;
+ return checkLTType(row, fd);
}
-bool LyXTabular::GetRowOfLTLastFoot(int cell, int & row) const
+bool LyXTabular::GetRowOfLTLastFoot(int row, ltType & fd) const
{
- row = endlastfoot;
- if (abs(endlastfoot) > rows_)
- return false;
- return (row_of_cell(cell) == (abs(endlastfoot)-1));
+ fd = endlastfoot;
+ return checkLTType(row, fd);
}
for (int i = 0; i < rows_; ++i) {
ret += TeXTopHLine(os, i);
- int bret = ret;
- if (IsLongTabular()) {
- if ((endhead < 0) && (i == (abs(endhead)-1))) {
- os << "\\endhead\n";
- ++ret;
- }
- if ((endfirsthead < 0) && (i == (abs(endfirsthead)-1))) {
- os << "\\endfirsthead\n";
- ++ret;
- }
- if ((endfoot < 0) && (i == (abs(endfoot)-1))) {
- os << "\\endfoot\n";
- ++ret;
- }
- if ((endlastfoot < 0) && (i == (abs(endlastfoot)-1))) {
- os << "\\endlastfoot\n";
- ++ret;
- }
- }
+#warning Implement top double lines for LT Header/Footers
+#if 0
if (ret > bret) {
ret += TeXBottomHLine(os, i-1);
ret += TeXTopHLine(os, i);
}
+#endif
for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(i,j))
continue;
}
os << "\\\\\n";
ret += TeXBottomHLine(os, i);
- bret = ret;
if (IsLongTabular()) {
- if ((endhead > 0) && (i == (endhead - 1))) {
+ if (i == (endhead.row - 1)) {
+ if (endhead.bottomDL)
+ ret += TeXBottomHLine(os, i);
os << "\\endhead\n";
++ret;
}
- if ((endfirsthead > 0) && (i == (endfirsthead - 1))) {
+ if (i == (endfirsthead.row - 1)) {
+ if (endfirsthead.bottomDL)
+ ret += TeXBottomHLine(os, i);
os << "\\endfirsthead\n";
++ret;
}
- if ((endfoot > 0) && (i == (endfoot - 1))) {
+ if (i == (endfoot.row - 1)) {
+ if (endfoot.bottomDL)
+ ret += TeXBottomHLine(os, i);
os << "\\endfoot\n";
++ret;
}
- if ((endlastfoot > 0) && (i == (endlastfoot - 1))) {
+ if (i == (endlastfoot.row - 1)) {
+ if (endlastfoot.bottomDL)
+ ret += TeXBottomHLine(os, i);
os << "\\endlastfoot\n";
++ret;
}
-// if (ret > bret)
-// ret += TeXBottomHLine(os, i);
if (row_info[i].newpage) {
os << "\\newpage\n";
++ret;
if ( IsLongTabular() ) {
// Header
- if( endhead || endfirsthead ) {
+ if( endhead.row || endfirsthead.row ) {
os << "<thead>\n";
- if( endfirsthead ) {
- docbookRow( buf, os, abs( endfirsthead) - 1);
+ if( endfirsthead.row ) {
+ docbookRow( buf, os, endfirsthead.row - 1);
}
- if( endhead && abs( endhead) != abs( endfirsthead)) {
- docbookRow( buf, os, abs( endhead) - 1);
+ if( endhead.row && endhead.row != endfirsthead.row) {
+ docbookRow(buf, os, endhead.row - 1);
}
os << "</thead>\n";
}
// Footer
- if( endfoot || endlastfoot ) {
+ if( endfoot.row || endlastfoot.row ) {
os << "<tfoot>\n";
- if( endfoot ) {
- docbookRow( buf, os, abs( endfoot) - 1);
+ if( endfoot.row ) {
+ docbookRow( buf, os, endfoot.row - 1);
}
- if( endlastfoot && abs( endlastfoot) != endfoot) {
- docbookRow( buf, os, abs( endlastfoot) - 1);
+ if( endlastfoot.row && endlastfoot.row != endfoot.row) {
+ docbookRow( buf, os, endlastfoot.row - 1);
}
os << "</tfoot>\n";
}
os << "<tbody>\n";
for (int i = 0; i < rows_; ++i) {
if(!IsLongTabular() || (
- i != abs(endhead) - 1 && i != abs(endfirsthead) - 1 &&
- i != abs(endfoot) - 1 && i != abs(endlastfoot) - 1)) {
+ i != endhead.row - 1 && i != endfirsthead.row - 1 &&
+ i != endfoot.row - 1 && i != endlastfoot.row - 1)) {
docbookRow( buf, os, i);
}
}
SET_USEBOX,
///
SET_LTHEAD,
+ UNSET_LTHEAD,
///
SET_LTFIRSTHEAD,
+ UNSET_LTFIRSTHEAD,
///
SET_LTFOOT,
+ UNSET_LTFOOT,
///
SET_LTLASTFOOT,
+ UNSET_LTLASTFOOT,
///
SET_LTNEWPAGE,
///
BOX_MINIPAGE = 2
};
+ struct lttype {
+ // constructor
+ lttype();
+ // row of the header/footer type end definition
+ int row;
+ // double borders on top
+ bool topDL;
+ // double borders on bottom
+ bool bottomDL;
+ };
+ ///
+ typedef struct lttype ltType;
+
/* konstruktor */
///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
//
// Long Tabular Options
///
- void SetLTHead(int cell, bool first);
+ bool checkLTType(int row, ltType const &) const;
+ ///
+ void SetLTHead(ltType const &, bool first);
///
- bool GetRowOfLTHead(int cell, int & row) const;
+ bool GetRowOfLTHead(int row, ltType &) const;
///
- bool GetRowOfLTFirstHead(int cell, int & row) const;
+ bool GetRowOfLTFirstHead(int row, ltType &) const;
///
- void SetLTFoot(int cell, bool last);
+ void SetLTFoot(ltType const &, bool last);
///
- bool GetRowOfLTFoot(int cell, int & row) const;
+ bool GetRowOfLTFoot(int row, ltType &) const;
///
- bool GetRowOfLTLastFoot(int cell, int & row) const;
+ bool GetRowOfLTLastFoot(int row, ltType &) const;
///
void SetLTNewPage(int cell, bool what);
///
///
bool is_long_tabular;
/// row of endhead
- int endhead;
+ ltType endhead;
/// row of endfirsthead
- int endfirsthead;
+ ltType endfirsthead;
/// row of endfoot
- int endfoot;
+ ltType endfoot;
/// row of endlastfoot
- int endlastfoot;
+ ltType endlastfoot;
///
InsetTabular * owner_;