rotate(cs.rotate),
align_special(cs.align_special),
p_width(cs.p_width),
- inset(dynamic_cast<InsetTableCell *>(cs.inset->clone()))
+ inset(static_cast<InsetTableCell *>(cs.inset->clone()))
{
}
}
} else if (row == 0) {
for (col_type c = 0; c < ncols(); ++c) {
- for ( ; c < ncols() && !topline[c]; ++c) {}
-
- col_type offset = 0;
- for (col_type j = 0 ; j < c; ++j)
- if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
- ++offset;
-
- //babel makes the "-" character an active one, so we have to suppress this here
- //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
- if (lang == "slovak" || lang == "czech")
- os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline")
- << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
- else
- os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
-
- col_type cstart = c;
- for ( ; c < ncols() && topline[c]; ++c) {}
-
- for (col_type j = cstart ; j < c ; ++j)
- if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
- ++offset;
-
- os << c + offset << "} ";
+ if (topline[c]) {
+ col_type offset = 0;
+ for (col_type j = 0 ; j < c; ++j)
+ if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+ ++offset;
+
+ //babel makes the "-" character an active one, so we have to suppress this here
+ //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+ if (lang == "slovak" || lang == "czech")
+ os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline")
+ << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
+ else
+ os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
+
+ col_type cstart = c;
+ for ( ; c < ncols() && topline[c]; ++c) {}
+
+ for (col_type j = cstart ; j < c ; ++j)
+ if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+ ++offset;
+
+ os << c + offset << "} ";
+ }
}
}
os << "\n";
os << "\\hline ";
} else {
for (col_type c = 0; c < ncols(); ++c) {
- for ( ; c < ncols() && !bottomline[c]; ++c) {}
-
- col_type offset = 0;
- for (col_type j = 0 ; j < c; ++j)
- if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
- ++offset;
-
- //babel makes the "-" character an active one, so we have to suppress this here
- //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
- if (lang == "slovak" || lang == "czech")
- os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline")
- << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
- else
- os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
-
- col_type cstart = c;
- for ( ; c < ncols() && bottomline[c]; ++c) {}
-
- for (col_type j = cstart ; j < c ; ++j)
- if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
- ++offset;
-
- os << c + offset << "} ";
+ if (bottomline[c]) {
+ col_type offset = 0;
+ for (col_type j = 0 ; j < c; ++j)
+ if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+ ++offset;
+
+ //babel makes the "-" character an active one, so we have to suppress this here
+ //see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+ if (lang == "slovak" || lang == "czech")
+ os << "\\expandafter" << (use_booktabs ? "\\cmidrule" : "\\cline")
+ << "\\expandafter{\\expandafter" << c + 1 + offset << "\\string-";
+ else
+ os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 + offset << '-';
+
+ col_type cstart = c;
+ for ( ; c < ncols() && bottomline[c]; ++c) {}
+
+ for (col_type j = cstart ; j < c ; ++j)
+ if (column_info[j].alignment == LYX_ALIGN_DECIMAL)
+ ++offset;
+
+ os << c + offset << "} ";
+ }
}
}
os << "\n";
os << from_ascii(getPWidth(cell).asLatexString());
else
// we need to set a default value
- // needs to be discussed
os << "*";
os << "}{";
} // end if ismultirow
// Cache the Inset position.
bv->coordCache().insets().add(cell(idx).get(), cx, cy);
cell(idx)->draw(pi, cx, cy);
- drawCellLines(pi.pain, nx, y, r, idx, pi.change_);
+ drawCellLines(pi, nx, y, r, idx);
nx += tabular.cellWidth(idx);
pi.selected = original_selection_state;
}
}
-void InsetTabular::drawCellLines(Painter & pain, int x, int y,
- row_type row, idx_type cell, Change const & change) const
+void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
+ row_type row, idx_type cell) const
{
y -= tabular.rowAscent(row);
int const w = tabular.cellWidth(cell);
int const h = tabular.cellHeight(cell);
- Color linecolor = change.changed() ? change.color() : Color_tabularline;
- Color gridcolor = change.changed() ? change.color() : Color_tabularonoffline;
+ Color const linecolor = pi.textColor(Color_tabularline);
+ Color const gridcolor = pi.textColor(Color_tabularonoffline);
// Top
bool drawline = tabular.topLine(cell)
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
- pain.line(x, y, x + w, y,
+ pi.pain.line(x, y, x + w, y,
drawline ? linecolor : gridcolor,
drawline ? Painter::line_solid : Painter::line_onoffdash);
// Bottom
drawline = tabular.bottomLine(cell);
- pain.line(x, y + h, x + w, y + h,
+ pi.pain.line(x, y + h, x + w, y + h,
drawline ? linecolor : gridcolor,
drawline ? Painter::line_solid : Painter::line_onoffdash);
col_type const col = tabular.cellColumn(cell);
drawline = tabular.leftLine(cell)
|| (col > 0 && tabular.rightLine(tabular.cellIndex(row, col - 1)));
- pain.line(x, y, x, y + h,
+ pi.pain.line(x, y, x, y + h,
drawline ? linecolor : gridcolor,
drawline ? Painter::line_solid : Painter::line_onoffdash);
drawline = tabular.rightLine(cell)
|| (col + 1 < tabular.ncols()
&& tabular.leftLine(tabular.cellIndex(row, col + 1)));
- pain.line(x + w, y, x + w, y + h,
+ pi.pain.line(x + w, y, x + w, y + h,
drawline ? linecolor : gridcolor,
drawline ? Painter::line_solid : Painter::line_onoffdash);
}
case LFUN_CHAR_RIGHT_SELECT:
case LFUN_CHAR_RIGHT:
case LFUN_CHAR_LEFT_SELECT:
- case LFUN_CHAR_LEFT: {
+ case LFUN_CHAR_LEFT:
+ case LFUN_WORD_FORWARD:
+ case LFUN_WORD_FORWARD_SELECT:
+ case LFUN_WORD_BACKWARD:
+ case LFUN_WORD_BACKWARD_SELECT:
+ case LFUN_WORD_RIGHT:
+ case LFUN_WORD_RIGHT_SELECT:
+ case LFUN_WORD_LEFT:
+ case LFUN_WORD_LEFT_SELECT: {
// determine whether we move to next or previous cell, where to enter
// the new cell from, and which command to "finish" (i.e., exit the
// inset) with:
FuncCode finish_lfun;
if (act == LFUN_CHAR_FORWARD
- || act == LFUN_CHAR_FORWARD_SELECT) {
+ || act == LFUN_CHAR_FORWARD_SELECT
+ || act == LFUN_WORD_FORWARD
+ || act == LFUN_WORD_FORWARD_SELECT) {
next_cell = true;
finish_lfun = LFUN_FINISHED_FORWARD;
}
else if (act == LFUN_CHAR_BACKWARD
- || act == LFUN_CHAR_BACKWARD_SELECT) {
+ || act == LFUN_CHAR_BACKWARD_SELECT
+ || act == LFUN_WORD_BACKWARD
+ || act == LFUN_WORD_BACKWARD_SELECT) {
next_cell = false;
finish_lfun = LFUN_FINISHED_BACKWARD;
}
// table's direction.
else {
bool const right = act == LFUN_CHAR_RIGHT
- || act == LFUN_CHAR_RIGHT_SELECT;
+ || act == LFUN_CHAR_RIGHT_SELECT
+ || act == LFUN_WORD_RIGHT
+ || act == LFUN_WORD_RIGHT_SELECT;
next_cell = isRightToLeft(cur) != right;
if (lyxrc.visual_cursor)
finish_lfun = right ? LFUN_FINISHED_RIGHT : LFUN_FINISHED_LEFT;
}
- bool const select = act == LFUN_CHAR_FORWARD_SELECT ||
- act == LFUN_CHAR_BACKWARD_SELECT ||
- act == LFUN_CHAR_RIGHT_SELECT ||
- act == LFUN_CHAR_LEFT_SELECT;
+ bool const select = act == LFUN_CHAR_FORWARD_SELECT
+ || act == LFUN_CHAR_BACKWARD_SELECT
+ || act == LFUN_CHAR_RIGHT_SELECT
+ || act == LFUN_CHAR_LEFT_SELECT
+ || act == LFUN_WORD_FORWARD_SELECT
+ || act == LFUN_WORD_RIGHT_SELECT
+ || act == LFUN_WORD_BACKWARD_SELECT
+ || act == LFUN_WORD_LEFT_SELECT;
// If we have a multicell selection or we're
// not doing some LFUN_*_SELECT thing anyway...
break;
case Tabular::SET_LONGTABULAR:
+ // setting as longtable is not allowed when table is inside a float
+ if (cur.innerInsetOfType(FLOAT_CODE) != 0
+ || cur.innerInsetOfType(WRAP_CODE) != 0)
+ status.setEnabled(false);
status.setOnOff(tabular.is_long_tabular);
break;