InsetTabular.cpp: disallow the following cases:

- a multirow cannot be a multicolumn the same time
- a multirow cannot be the caption of a longtable

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33614 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-03-04 03:27:30 +00:00
parent d65020b293
commit 497d6d13f7

View File

@ -4063,16 +4063,20 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
case Tabular::MULTICOLUMN: case Tabular::MULTICOLUMN:
// If a row is set as longtable caption, it must not be allowed // If a row is set as longtable caption, it must not be allowed
// to unset that this row is a multicolumn. // to unset that this row is a multicolumn.
// don't allow to set a multirow as multicolumn
status.setEnabled(sel_row_start == sel_row_end status.setEnabled(sel_row_start == sel_row_end
&& !tabular.ltCaption(tabular.cellRow(cur.idx()))); && !tabular.ltCaption(tabular.cellRow(cur.idx()))
&& !tabular.isMultiRow(cur.idx()) );
status.setOnOff(tabular.isMultiColumn(cur.idx())); status.setOnOff(tabular.isMultiColumn(cur.idx()));
break; break;
case Tabular::MULTIROW: case Tabular::MULTIROW:
// If a row is set as longtable caption, it must not be allowed // If a row is set as longtable caption, it must not be allowed
// to unset that this row is a multirow. // to unset that this row is a multirow.
// don't allow to set a multicolumn as multirow
status.setEnabled(sel_col_start == sel_col_end status.setEnabled(sel_col_start == sel_col_end
&& !tabular.ltCaption(tabular.cellRow(cur.idx()))); && !tabular.ltCaption(tabular.cellRow(cur.idx()))
&& !tabular.isMultiColumn(cur.idx()) );
status.setOnOff(tabular.isMultiRow(cur.idx())); status.setOnOff(tabular.isMultiRow(cur.idx()));
break; break;
@ -4258,6 +4262,7 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
break; break;
// only one row can be the caption // only one row can be the caption
// and a multirow cannot be set as caption
case Tabular::TOGGLE_LTCAPTION: case Tabular::TOGGLE_LTCAPTION:
status.setEnabled(sel_row_start == sel_row_end status.setEnabled(sel_row_start == sel_row_end
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt) && !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
@ -4265,7 +4270,8 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt) && !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt) && !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
&& (!tabular.haveLTCaption() && (!tabular.haveLTCaption()
|| tabular.ltCaption(sel_row_start))); || tabular.ltCaption(sel_row_start))
&& !tabular.isMultiRow(sel_row_start));
status.setOnOff(tabular.ltCaption(sel_row_start)); status.setOnOff(tabular.ltCaption(sel_row_start));
break; break;