Re: [patch] implement multirow support - request for help

2010-02-10 Thread Edwin Leuven

Uwe Stöhr wrote:
You have done some additional simplifications. With your version, 
setting a multicolumn is no longer possible. Can you please have a look?


works fine here


However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered


you mean in the latex output?

- Adding/deleting columns while the cursor is in a table row containing 
a multirow cell is not properly working.


should be fixed in attached


- plain text export needs to be done


also the multirow package need to be loaded when necessary

I propose that I or you put the patch into branch in a few days and we 
continue to fine-tune the remaining issues. The patch is already very 
big and I fear we might loose the track if we work only with patches. 
What do you think?


i won't have time to work on this before the end of next week

note that atm copy/pasting is bonked...

latest iteration attached, maybe create a branch for the time being?

edwin

Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp (revision 33411)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -70,7 +70,6 @@
 using namespace lyx::support;
 
 using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
 
 
 namespace lyx {
@@ -130,6 +129,7 @@
{ Tabular::M_VALIGN_BOTTOM, m-valign-bottom },
{ Tabular::M_VALIGN_MIDDLE, m-valign-middle },
{ Tabular::MULTICOLUMN, multicolumn },
+   { Tabular::MULTIROW, multirow },
{ Tabular::SET_ALL_LINES, set-all-lines },
{ Tabular::UNSET_ALL_LINES, unset-all-lines },
{ Tabular::SET_LONGTABULAR, set-longtabular },
@@ -154,7 +154,8 @@
{ Tabular::SET_LTNEWPAGE, set-ltnewpage },
{ Tabular::TOGGLE_LTCAPTION, toggle-ltcaption },
{ Tabular::SET_SPECIAL_COLUMN, set-special-column },
-   { Tabular::SET_SPECIAL_MULTI, set-special-multi },
+   { Tabular::SET_SPECIAL_MULTICOLUMN, set-special-multicolumn },
+   { Tabular::SET_SPECIAL_MULTIROW, set-special-multirow },
{ Tabular::SET_BOOKTABS, set-booktabs },
{ Tabular::UNSET_BOOKTABS, unset-booktabs },
{ Tabular::SET_TOP_SPACE, set-top-space },
@@ -519,6 +520,7 @@
: cellno(0),
  width(0),
  multicolumn(Tabular::CELL_NORMAL),
+ multirow(Tabular::CELL_NORMAL),
  alignment(LYX_ALIGN_CENTER),
  valignment(LYX_VALIGN_TOP),
  top_line(false),
@@ -537,6 +539,7 @@
: cellno(cs.cellno),
  width(cs.width),
  multicolumn(cs.multicolumn),
+ multirow(cs.multirow),
  alignment(cs.alignment),
  valignment(cs.valignment),
  top_line(cs.top_line),
@@ -562,6 +565,7 @@
std::swap(cellno, rhs.cellno);
std::swap(width, rhs.width);
std::swap(multicolumn, rhs.multicolumn);
+   std::swap(multirow, rhs.multirow);
std::swap(alignment, rhs.alignment);
std::swap(valignment, rhs.valignment);
std::swap(top_line, rhs.top_line);
@@ -657,30 +661,25 @@
 
 void Tabular::appendRow(idx_type const cell)
 {
-   BufferParams const  bp = buffer_-params();
row_type const row = cellRow(cell);
 
-   row_vector::iterator rit = row_info.begin() + row;
-   row_info.insert(rit, RowData());
-   // now set the values of the row before
-   row_info[row] = row_info[row + 1];
+   row_info.insert(row_info.begin() + row + 1, RowData());
+   row_info[row + 1] = row_info[row];
 
-   row_type const nrows = row_info.size();
col_type const ncols = column_info.size();
+   cell_info.insert(cell_info.begin() + row + 1, 
+   cell_vector(ncols, CellData(buffer_)));
+   for (col_type c = 0; c  ncols; ++c) {
+   if (cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW)
+   cell_info[row + 1][c].multirow = CELL_PART_OF_MULTIROW;
+   else
+   cell_info[row + 1][c].multirow = 
cell_info[row][c].multirow;
+   }
+   updateIndexes();
 
-   cell_vvector old(nrows - 1);
-   for (row_type i = 0; i  nrows - 1; ++i)
-   swap(cell_info[i], old[i]);
-
-   cell_info = cell_vvector(nrows, cell_vector(ncols, CellData(buffer_)));
-
-   for (row_type i = 0; i = row; ++i)
-   swap(cell_info[i], old[i]);
-   for (row_type i = row + 2; i  nrows; ++i)
-   swap(cell_info[i], old[i - 1]);
-
-   updateIndexes();
for (col_type c = 0; c  ncols; ++c) {
+   if (isPartOfMultiRow(row, c))
+   continue;
// inherit line settings
idx_type const i = cellIndex(row + 1, c);
idx_type const j = cellIndex(row, c);
@@ -692,7 +691,7 @@
setBottomLine(j, false);
}
// mark track changes
-   if (bp.trackChanges)
+   if 

Re: [patch] implement multirow support - request for help

2010-02-10 Thread Uwe Stöhr

Uwe Stöhr schrieb:


However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered


Sorry again, the horizontal alignment is a special issue that can be 
implemented later. I meant the vertical alignment: Contents of multirow 
cells are always vertically centered.


regards Uwe


Re: [patch] implement multirow support - request for help

2010-02-10 Thread Uwe Stöhr

Hello Edwin,

I put the patch into trunk:
http://www.lyx.org/trac/changeset/33414

I think that this is the best solution for now, because all major parts are working and we aren't 
introducing regressions. I listed the remaining issues here:

http://wiki.lyx.org/Devel/Multirow

The only major problem I currently see, is that setting multicolumns no longer work for me, but it 
works for you as you wrote - this is strange. I'll have a closer look the next days.


 Sorry again, the horizontal alignment is a special issue that can be
 implemented later. I meant the vertical alignment: Contents of multirow
 cells are always vertically centered.

 in terms of display in lyx i made it work with the valign buttons on the
 toolbar, so maybe this needs to be changed.

For multirows only valign_middle is allowed. The valign toolbar buttons need to 
be disabled.

 i won't have time the coming 7 days, so don't hesitate to finish it

I also won't have much time the next week but will use the remaining time to finish the multirow 
feature.


Many thanks for your help with the patch! Finally you wrote the major part of 
the patch.

best regards
Uwe


Re: [patch] implement multirow support - request for help

2010-02-10 Thread Edwin Leuven

Uwe Stöhr wrote:
You have done some additional simplifications. With your version, 
setting a multicolumn is no longer possible. Can you please have a look?


works fine here


However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered


you mean in the latex output?

- Adding/deleting columns while the cursor is in a table row containing 
a multirow cell is not properly working.


should be fixed in attached


- plain text export needs to be done


also the multirow package need to be loaded when necessary

I propose that I or you put the patch into branch in a few days and we 
continue to fine-tune the remaining issues. The patch is already very 
big and I fear we might loose the track if we work only with patches. 
What do you think?


i won't have time to work on this before the end of next week

note that atm copy/pasting is bonked...

latest iteration attached, maybe create a branch for the time being?

edwin

Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp (revision 33411)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -70,7 +70,6 @@
 using namespace lyx::support;
 
 using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
 
 
 namespace lyx {
@@ -130,6 +129,7 @@
{ Tabular::M_VALIGN_BOTTOM, "m-valign-bottom" },
{ Tabular::M_VALIGN_MIDDLE, "m-valign-middle" },
{ Tabular::MULTICOLUMN, "multicolumn" },
+   { Tabular::MULTIROW, "multirow" },
{ Tabular::SET_ALL_LINES, "set-all-lines" },
{ Tabular::UNSET_ALL_LINES, "unset-all-lines" },
{ Tabular::SET_LONGTABULAR, "set-longtabular" },
@@ -154,7 +154,8 @@
{ Tabular::SET_LTNEWPAGE, "set-ltnewpage" },
{ Tabular::TOGGLE_LTCAPTION, "toggle-ltcaption" },
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column" },
-   { Tabular::SET_SPECIAL_MULTI, "set-special-multi" },
+   { Tabular::SET_SPECIAL_MULTICOLUMN, "set-special-multicolumn" },
+   { Tabular::SET_SPECIAL_MULTIROW, "set-special-multirow" },
{ Tabular::SET_BOOKTABS, "set-booktabs" },
{ Tabular::UNSET_BOOKTABS, "unset-booktabs" },
{ Tabular::SET_TOP_SPACE, "set-top-space" },
@@ -519,6 +520,7 @@
: cellno(0),
  width(0),
  multicolumn(Tabular::CELL_NORMAL),
+ multirow(Tabular::CELL_NORMAL),
  alignment(LYX_ALIGN_CENTER),
  valignment(LYX_VALIGN_TOP),
  top_line(false),
@@ -537,6 +539,7 @@
: cellno(cs.cellno),
  width(cs.width),
  multicolumn(cs.multicolumn),
+ multirow(cs.multirow),
  alignment(cs.alignment),
  valignment(cs.valignment),
  top_line(cs.top_line),
@@ -562,6 +565,7 @@
std::swap(cellno, rhs.cellno);
std::swap(width, rhs.width);
std::swap(multicolumn, rhs.multicolumn);
+   std::swap(multirow, rhs.multirow);
std::swap(alignment, rhs.alignment);
std::swap(valignment, rhs.valignment);
std::swap(top_line, rhs.top_line);
@@ -657,30 +661,25 @@
 
 void Tabular::appendRow(idx_type const cell)
 {
-   BufferParams const & bp = buffer_->params();
row_type const row = cellRow(cell);
 
-   row_vector::iterator rit = row_info.begin() + row;
-   row_info.insert(rit, RowData());
-   // now set the values of the row before
-   row_info[row] = row_info[row + 1];
+   row_info.insert(row_info.begin() + row + 1, RowData());
+   row_info[row + 1] = row_info[row];
 
-   row_type const nrows = row_info.size();
col_type const ncols = column_info.size();
+   cell_info.insert(cell_info.begin() + row + 1, 
+   cell_vector(ncols, CellData(buffer_)));
+   for (col_type c = 0; c < ncols; ++c) {
+   if (cell_info[row][c].multirow == CELL_BEGIN_OF_MULTIROW)
+   cell_info[row + 1][c].multirow = CELL_PART_OF_MULTIROW;
+   else
+   cell_info[row + 1][c].multirow = 
cell_info[row][c].multirow;
+   }
+   updateIndexes();
 
-   cell_vvector old(nrows - 1);
-   for (row_type i = 0; i < nrows - 1; ++i)
-   swap(cell_info[i], old[i]);
-
-   cell_info = cell_vvector(nrows, cell_vector(ncols, CellData(buffer_)));
-
-   for (row_type i = 0; i <= row; ++i)
-   swap(cell_info[i], old[i]);
-   for (row_type i = row + 2; i < nrows; ++i)
-   swap(cell_info[i], old[i - 1]);
-
-   updateIndexes();
for (col_type c = 0; c < ncols; ++c) {
+   if (isPartOfMultiRow(row, c))
+   continue;
// inherit line settings
idx_type const i = cellIndex(row + 1, c);
idx_type const j = cellIndex(row, c);
@@ -692,7 +691,7 @@
setBottomLine(j, false);
}
// mark track changes
-   if (bp.trackChanges)
+

Re: [patch] implement multirow support - request for help

2010-02-10 Thread Uwe Stöhr

Uwe Stöhr schrieb:


However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered


Sorry again, the horizontal alignment is a special issue that can be 
implemented later. I meant the vertical alignment: Contents of multirow 
cells are always vertically centered.


regards Uwe


Re: [patch] implement multirow support - request for help

2010-02-10 Thread Uwe Stöhr

Hello Edwin,

I put the patch into trunk:
http://www.lyx.org/trac/changeset/33414

I think that this is the best solution for now, because all major parts are working and we aren't 
introducing regressions. I listed the remaining issues here:

http://wiki.lyx.org/Devel/Multirow

The only major problem I currently see, is that setting multicolumns no longer work for me, but it 
works for you as you wrote - this is strange. I'll have a closer look the next days.


>> Sorry again, the horizontal alignment is a special issue that can be
>> implemented later. I meant the vertical alignment: Contents of multirow
>> cells are always vertically centered.
>
> in terms of display in lyx i made it work with the valign buttons on the
> toolbar, so maybe this needs to be changed.

For multirows only valign_middle is allowed. The valign toolbar buttons need to 
be disabled.

> i won't have time the coming 7 days, so don't hesitate to finish it

I also won't have much time the next week but will use the remaining time to finish the multirow 
feature.


Many thanks for your help with the patch! Finally you wrote the major part of 
the patch.

best regards
Uwe


Re: [patch] implement multirow support - request for help

2010-02-09 Thread Guenter Milde
On 2010-02-09, Uwe Stöhr wrote:

  Attached is what I currently have to support multirows.
 
  There is currently one issue I cannot solve: The metrics and drawing
  of the cells that are part of a multirow is broken. The drawing of
  the first multirow cell is however correct. I failed to figure out
  this problem and therefore ask for help.

 Has anybody had time to have a look at this?

Not me, however, I have a maybe similar problem with another LaTeX
frontend -- Docutils: 

If you download and compile
http://svn.berlios.de/svnroot/repos/docutils/trunk/docutils/test/functional/expected/standalone_rst_latex.tex
you will realize a broken border in the rowspanning tables example on
page 13.

The reason is identified as different table models 

   In the LaTeX `multicol` package, if there are multirow cells, the
   overwritten cells need to be defined as empty cells.

   Docutils (similarily to HTML) uses is the Exchange Table Model (also
   known as CALS tables, see soextblx.dtd_) which defines only the
   remaining cells in a row affected by multirow cells.

   Therefore, visit_entry() is only called for the remaining cells and the
   LaTeX writer needs bookkeeping to write out the required number of extra
   ''s.
   
   .. _soextblx.dtd: http://www.docbook.org/sgml/4.2/soextblx.dtd
   
I don't know whether this is related or not but maybe this can be a
hint.

Günter   



Re: [patch] implement multirow support - request for help

2010-02-09 Thread Edwin Leuven

Uwe Stöhr wrote:

  Attached is what I currently have to support multirows.
 
Has anybody had time to have a look at this?


i started to look at it. drawing seems ok in the attached, but it needs 
more attention wrt lines, latex output and i didn't go over the 
copy/cutting/pasting stuff.
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp (revision 33395)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -70,7 +70,6 @@
 using namespace lyx::support;
 
 using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
 
 
 namespace lyx {
@@ -130,6 +129,7 @@
{ Tabular::M_VALIGN_BOTTOM, m-valign-bottom },
{ Tabular::M_VALIGN_MIDDLE, m-valign-middle },
{ Tabular::MULTICOLUMN, multicolumn },
+   { Tabular::MULTIROW, multirow },
{ Tabular::SET_ALL_LINES, set-all-lines },
{ Tabular::UNSET_ALL_LINES, unset-all-lines },
{ Tabular::SET_LONGTABULAR, set-longtabular },
@@ -154,7 +154,8 @@
{ Tabular::SET_LTNEWPAGE, set-ltnewpage },
{ Tabular::TOGGLE_LTCAPTION, toggle-ltcaption },
{ Tabular::SET_SPECIAL_COLUMN, set-special-column },
-   { Tabular::SET_SPECIAL_MULTI, set-special-multi },
+   { Tabular::SET_SPECIAL_MULTICOLUMN, set-special-multicolumn },
+   { Tabular::SET_SPECIAL_MULTIROW, set-special-multirow },
{ Tabular::SET_BOOKTABS, set-booktabs },
{ Tabular::UNSET_BOOKTABS, unset-booktabs },
{ Tabular::SET_TOP_SPACE, set-top-space },
@@ -519,6 +520,7 @@
: cellno(0),
  width(0),
  multicolumn(Tabular::CELL_NORMAL),
+ multirow(Tabular::CELL_NORMAL),
  alignment(LYX_ALIGN_CENTER),
  valignment(LYX_VALIGN_TOP),
  top_line(false),
@@ -537,6 +539,7 @@
: cellno(cs.cellno),
  width(cs.width),
  multicolumn(cs.multicolumn),
+ multirow(cs.multirow),
  alignment(cs.alignment),
  valignment(cs.valignment),
  top_line(cs.top_line),
@@ -562,6 +565,7 @@
std::swap(cellno, rhs.cellno);
std::swap(width, rhs.width);
std::swap(multicolumn, rhs.multicolumn);
+   std::swap(multirow, rhs.multirow);
std::swap(alignment, rhs.alignment);
std::swap(valignment, rhs.valignment);
std::swap(top_line, rhs.top_line);
@@ -680,7 +684,10 @@
swap(cell_info[i], old[i - 1]);
 
updateIndexes();
+
for (col_type c = 0; c  ncols; ++c) {
+   if (isPartOfMultiRow(row, c))
+   continue;
// inherit line settings
idx_type const i = cellIndex(row + 1, c);
idx_type const j = cellIndex(row, c);
@@ -704,6 +711,15 @@
if (row_info.size() == 1)
return;
 
+   size_t const column_count = column_info.size();
+   for (col_type i = 0; i  column_count; ++i) {
+   // Care about multirow cells
+   if (row + 1  row_info.size() 
+   cell_info[row][i].multirow == CELL_BEGIN_OF_MULTIROW 
+   cell_info[row][i + 1].multirow == CELL_PART_OF_MULTIROW) {
+   cell_info[row][i + 1].multirow = CELL_BEGIN_OF_MULTIROW;
+   }
+   }
row_info.erase(row_info.begin() + row);
cell_info.erase(cell_info.begin() + row);
updateIndexes();
@@ -735,14 +751,10 @@
for (row_type r = 0; r  nrows; ++r) {
cell_info[r].insert(cell_info[r].begin() + c + 1, 
CellData(buffer_));
-#if 0
-// FIXME: This code does not work. It deletes the cell's content and
-// it triggers an assertion if the cursor is at pos  0.
if (cell_info[r][c].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
cell_info[r][c + 1].multicolumn = 
CELL_PART_OF_MULTICOLUMN;
else
cell_info[r][c + 1].multicolumn = 
cell_info[r][c].multicolumn;
-#endif
}
updateIndexes();
for (row_type r = 0; r  nrows; ++r) {
@@ -809,9 +821,13 @@
numberofcells = 0;
for (row_type row = 0; row  nrows; ++row)
for (col_type column = 0; column  ncols; ++column) {
-   if (!isPartOfMultiColumn(row, column))
+   if (!isPartOfMultiColumn(row, column)
+!isPartOfMultiRow(row, column))
++numberofcells;
-   cell_info[row][column].cellno = numberofcells - 1;
+   if (isPartOfMultiRow(row, column))
+   cell_info[row][column].cellno = cell_info[row - 
1][column].cellno;
+   else
+   cell_info[row][column].cellno = numberofcells - 
1;
}
 
rowofcell.resize(numberofcells);
@@ -819,7 +835,8 @@
idx_type i = 0;
for (row_type row = 0; row  nrows; ++row)
 

Re: [patch] implement multirow support - request for help

2010-02-09 Thread Uwe Stöhr

 i started to look at it.

Many thanks!

You have done some additional simplifications. With your version, setting a multicolumn is no longer 
possible. Can you please have a look?


 drawing seems ok in the attached, but it needs more attention wrt lines, 
latex output and
 i didn't go over the copy/cutting/pasting stuff.

I fixed now some remaining \hline issues.

However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered
- Adding/deleting columns while the cursor is in a table row containing a multirow cell is not 
properly working.

- plain text export needs to be done

I propose that I or you put the patch into branch in a few days and we continue to fine-tune the 
remaining issues. The patch is already very big and I fear we might loose the track if we work only 
with patches. What do you think?


regards Uwe


Re: [patch] implement multirow support - request for help

2010-02-09 Thread Uwe Stöhr

Am 10.02.2010 05:32, schrieb Uwe Stöhr:


I fixed now some remaining \hline issues.


Attached is that part of the patch.


I propose that I or you put the patch into branch in a few days...


I meant of course trunk.

regards Uwe
 int Tabular::TeXTopHLine(odocstream  os, row_type row, string const lang) const
 {
 	// we only output complete row lines and the 1st row here, the rest
@@ -1884,6 +1992,13 @@
 	col_type nset = 0;
 	for (col_type c = 0; c  ncols; ++c) {
 		topline.push_back(topLine(cellIndex(row, c)));
+		// If cell is part of a multirow and not the first cell of the
+		// multirow, no line must be drawn.
+		if (row != 0)
+			if (isMultiRow(cellIndex(row, c))) {
+if (isMultiRow(cellIndex(row - 1, c)))
+	topline[c] = false;
+			}
 		if (topline[c])
 			++nset;
 	}
@@ -1935,6 +2050,15 @@
 	for (col_type c = 0; c  ncols; ++c) {
 		bottomline.push_back(bottomLine(cellIndex(row, c)));
 		topline.push_back(!lastrow  topLine(cellIndex(row + 1, c)));
+		// If cell is part of a multirow and not the last or first cell of the
+		// multirow, no line must be drawn.
+		if (!lastrow)
+			if (isMultiRow(cellIndex(row, c))) {
+if (isMultiRow(cellIndex(row + 1, c))) {
+	bottomline[c] = false;
+	topline[c] = false;
+}
+			}
 		nextrowset = topline[c];
 	}
 
@@ -1955,7 +2079,7 @@
 		if (use_booktabs)
 			os  (lastrow ? \\bottomrule : \\midrule);
 		else
-			os  \\hline;
+			os  \\hline ;
 	} else {
 		for (col_type c = 0; c  ncols; ++c) {
 			if (bottomline[c]) {



Re: [patch] implement multirow support - request for help

2010-02-09 Thread Guenter Milde
On 2010-02-09, Uwe Stöhr wrote:

> > Attached is what I currently have to support multirows.
> >
> > There is currently one issue I cannot solve: The metrics and drawing
> > of the cells that are part of a multirow is broken. The drawing of
> > the first multirow cell is however correct. I failed to figure out
> > this problem and therefore ask for help.

> Has anybody had time to have a look at this?

Not me, however, I have a maybe similar problem with another LaTeX
frontend -- Docutils: 

If you download and compile
http://svn.berlios.de/svnroot/repos/docutils/trunk/docutils/test/functional/expected/standalone_rst_latex.tex
you will realize a broken border in the "rowspanning tables" example on
page 13.

The reason is identified as different "table models" 

   In the LaTeX `multicol` package, if there are multirow cells, the
   "overwritten" cells need to be defined as empty cells.

   Docutils (similarily to HTML) uses is the "Exchange Table Model" (also
   known as CALS tables, see soextblx.dtd_) which defines only the
   remaining cells in a row "affected" by multirow cells.

   Therefore, visit_entry() is only called for the remaining cells and the
   LaTeX writer needs bookkeeping to write out the required number of extra
   '&'s.
   
   .. _soextblx.dtd: http://www.docbook.org/sgml/4.2/soextblx.dtd
   
I don't know whether this is related or not but maybe this can be a
hint.

Günter   



Re: [patch] implement multirow support - request for help

2010-02-09 Thread Edwin Leuven

Uwe Stöhr wrote:

 > Attached is what I currently have to support multirows.
 >
Has anybody had time to have a look at this?


i started to look at it. drawing seems ok in the attached, but it needs 
more attention wrt lines, latex output and i didn't go over the 
copy/cutting/pasting stuff.
Index: src/insets/InsetTabular.cpp
===
--- src/insets/InsetTabular.cpp (revision 33395)
+++ src/insets/InsetTabular.cpp (working copy)
@@ -70,7 +70,6 @@
 using namespace lyx::support;
 
 using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
 
 
 namespace lyx {
@@ -130,6 +129,7 @@
{ Tabular::M_VALIGN_BOTTOM, "m-valign-bottom" },
{ Tabular::M_VALIGN_MIDDLE, "m-valign-middle" },
{ Tabular::MULTICOLUMN, "multicolumn" },
+   { Tabular::MULTIROW, "multirow" },
{ Tabular::SET_ALL_LINES, "set-all-lines" },
{ Tabular::UNSET_ALL_LINES, "unset-all-lines" },
{ Tabular::SET_LONGTABULAR, "set-longtabular" },
@@ -154,7 +154,8 @@
{ Tabular::SET_LTNEWPAGE, "set-ltnewpage" },
{ Tabular::TOGGLE_LTCAPTION, "toggle-ltcaption" },
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column" },
-   { Tabular::SET_SPECIAL_MULTI, "set-special-multi" },
+   { Tabular::SET_SPECIAL_MULTICOLUMN, "set-special-multicolumn" },
+   { Tabular::SET_SPECIAL_MULTIROW, "set-special-multirow" },
{ Tabular::SET_BOOKTABS, "set-booktabs" },
{ Tabular::UNSET_BOOKTABS, "unset-booktabs" },
{ Tabular::SET_TOP_SPACE, "set-top-space" },
@@ -519,6 +520,7 @@
: cellno(0),
  width(0),
  multicolumn(Tabular::CELL_NORMAL),
+ multirow(Tabular::CELL_NORMAL),
  alignment(LYX_ALIGN_CENTER),
  valignment(LYX_VALIGN_TOP),
  top_line(false),
@@ -537,6 +539,7 @@
: cellno(cs.cellno),
  width(cs.width),
  multicolumn(cs.multicolumn),
+ multirow(cs.multirow),
  alignment(cs.alignment),
  valignment(cs.valignment),
  top_line(cs.top_line),
@@ -562,6 +565,7 @@
std::swap(cellno, rhs.cellno);
std::swap(width, rhs.width);
std::swap(multicolumn, rhs.multicolumn);
+   std::swap(multirow, rhs.multirow);
std::swap(alignment, rhs.alignment);
std::swap(valignment, rhs.valignment);
std::swap(top_line, rhs.top_line);
@@ -680,7 +684,10 @@
swap(cell_info[i], old[i - 1]);
 
updateIndexes();
+
for (col_type c = 0; c < ncols; ++c) {
+   if (isPartOfMultiRow(row, c))
+   continue;
// inherit line settings
idx_type const i = cellIndex(row + 1, c);
idx_type const j = cellIndex(row, c);
@@ -704,6 +711,15 @@
if (row_info.size() == 1)
return;
 
+   size_t const column_count = column_info.size();
+   for (col_type i = 0; i < column_count; ++i) {
+   // Care about multirow cells
+   if (row + 1 < row_info.size() &&
+   cell_info[row][i].multirow == CELL_BEGIN_OF_MULTIROW &&
+   cell_info[row][i + 1].multirow == CELL_PART_OF_MULTIROW) {
+   cell_info[row][i + 1].multirow = CELL_BEGIN_OF_MULTIROW;
+   }
+   }
row_info.erase(row_info.begin() + row);
cell_info.erase(cell_info.begin() + row);
updateIndexes();
@@ -735,14 +751,10 @@
for (row_type r = 0; r < nrows; ++r) {
cell_info[r].insert(cell_info[r].begin() + c + 1, 
CellData(buffer_));
-#if 0
-// FIXME: This code does not work. It deletes the cell's content and
-// it triggers an assertion if the cursor is at pos > 0.
if (cell_info[r][c].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
cell_info[r][c + 1].multicolumn = 
CELL_PART_OF_MULTICOLUMN;
else
cell_info[r][c + 1].multicolumn = 
cell_info[r][c].multicolumn;
-#endif
}
updateIndexes();
for (row_type r = 0; r < nrows; ++r) {
@@ -809,9 +821,13 @@
numberofcells = 0;
for (row_type row = 0; row < nrows; ++row)
for (col_type column = 0; column < ncols; ++column) {
-   if (!isPartOfMultiColumn(row, column))
+   if (!isPartOfMultiColumn(row, column)
+   && !isPartOfMultiRow(row, column))
++numberofcells;
-   cell_info[row][column].cellno = numberofcells - 1;
+   if (isPartOfMultiRow(row, column))
+   cell_info[row][column].cellno = cell_info[row - 
1][column].cellno;
+   else
+   cell_info[row][column].cellno = numberofcells - 
1;
}
 
rowofcell.resize(numberofcells);
@@ -819,7 +835,8 @@
idx_type i = 0;
   

Re: [patch] implement multirow support - request for help

2010-02-09 Thread Uwe Stöhr

> i started to look at it.

Many thanks!

You have done some additional simplifications. With your version, setting a multicolumn is no longer 
possible. Can you please have a look?


> drawing seems ok in the attached, but it needs more attention wrt lines, 
latex output and
> i didn't go over the copy/cutting/pasting stuff.

I fixed now some remaining \hline issues.

However there are many other minor issues to solve:

- The content of the multirow is not horizontally centered
- Adding/deleting columns while the cursor is in a table row containing a multirow cell is not 
properly working.

- plain text export needs to be done

I propose that I or you put the patch into branch in a few days and we continue to fine-tune the 
remaining issues. The patch is already very big and I fear we might loose the track if we work only 
with patches. What do you think?


regards Uwe


Re: [patch] implement multirow support - request for help

2010-02-09 Thread Uwe Stöhr

Am 10.02.2010 05:32, schrieb Uwe Stöhr:


I fixed now some remaining \hline issues.


Attached is that part of the patch.


I propose that I or you put the patch into branch in a few days...


I meant of course trunk.

regards Uwe
 int Tabular::TeXTopHLine(odocstream & os, row_type row, string const lang) const
 {
 	// we only output complete row lines and the 1st row here, the rest
@@ -1884,6 +1992,13 @@
 	col_type nset = 0;
 	for (col_type c = 0; c < ncols; ++c) {
 		topline.push_back(topLine(cellIndex(row, c)));
+		// If cell is part of a multirow and not the first cell of the
+		// multirow, no line must be drawn.
+		if (row != 0)
+			if (isMultiRow(cellIndex(row, c))) {
+if (isMultiRow(cellIndex(row - 1, c)))
+	topline[c] = false;
+			}
 		if (topline[c])
 			++nset;
 	}
@@ -1935,6 +2050,15 @@
 	for (col_type c = 0; c < ncols; ++c) {
 		bottomline.push_back(bottomLine(cellIndex(row, c)));
 		topline.push_back(!lastrow && topLine(cellIndex(row + 1, c)));
+		// If cell is part of a multirow and not the last or first cell of the
+		// multirow, no line must be drawn.
+		if (!lastrow)
+			if (isMultiRow(cellIndex(row, c))) {
+if (isMultiRow(cellIndex(row + 1, c))) {
+	bottomline[c] = false;
+	topline[c] = false;
+}
+			}
 		nextrowset &= topline[c];
 	}
 
@@ -1955,7 +2079,7 @@
 		if (use_booktabs)
 			os << (lastrow ? "\\bottomrule" : "\\midrule");
 		else
-			os << "\\hline";
+			os << "\\hline ";
 	} else {
 		for (col_type c = 0; c < ncols; ++c) {
 			if (bottomline[c]) {



Re: [patch] implement multirow support - request for help

2010-02-08 Thread Uwe Stöhr

 Attached is what I currently have to support multirows.

 There is currently one issue I cannot solve: The metrics and drawing
 of the cells that are part of a multirow is broken. The drawing of
 the first multirow cell is however correct. I failed to figure out
 this problem and therefore ask for help.

Has anybody had time to have a look at this?
I was quite calm the last weeks because of real live stuff and now want to continue to finish the 
patch. However, I'm still stuck with the metrics issue.


Attached is what I have so far.

thanks in advance and regards
Uwe
Index: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 33372)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1520,6 +1520,7 @@
 tabular-feature_delete-column.png
 tabular-feature_delete-row.png
 tabular-feature_multicolumn.png
+tabular-feature_multirow.png
 tabular-feature_set-all-lines.png
 tabular-feature_set-border-lines.png
 tabular-feature_set-longtabular.png
Index: lib/images/tabular-feature_multirow.png
===
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib\images\tabular-feature_multirow.png
___
Added: svn:mime-type
   + application/octet-stream

Index: lib/Makefile.am
===
--- lib/Makefile.am	(revision 33372)
+++ lib/Makefile.am	(working copy)
@@ -415,6 +415,7 @@
 	images/tabular-feature_delete-column.png \
 	images/tabular-feature_delete-row.png \
 	images/tabular-feature_multicolumn.png \
+	images/tabular-feature_multirow.png \
 	images/tabular-feature_set-all-lines.png \
 	images/tabular-feature_set-longtabular.png \
 	images/tabular-feature_set-rotate-cell.png \
Index: lib/ui/stdtoolbars.inc
===
--- lib/ui/stdtoolbars.inc	(revision 33372)
+++ lib/ui/stdtoolbars.inc	(working copy)
@@ -161,6 +161,7 @@
 		Item Rotate cell tabular-feature toggle-rotate-cell
 		Item Rotate table tabular-feature toggle-rotate-tabular
 		Item Set multi-column tabular-feature multicolumn
+		Item Set multi-row tabular-feature multirow
 	End
 	
 	Toolbar math Math
Index: src/frontends/qt4/GuiTabular.cpp
===
--- src/frontends/qt4/GuiTabular.cpp	(revision 33372)
+++ src/frontends/qt4/GuiTabular.cpp	(working copy)
@@ -96,6 +96,8 @@
 		this, SLOT(vAlign_changed(int)));
 	connect(multicolumnCB, SIGNAL(clicked()),
 		this, SLOT(multicolumn_clicked()));
+	connect(multirowCB, SIGNAL(clicked()),
+		this, SLOT(multirow_clicked()));
 	connect(newpageCB, SIGNAL(clicked()),
 		this, SLOT(ltNewpage_clicked()));
 	connect(headerStatusCB, SIGNAL(clicked()),
@@ -172,6 +174,7 @@
 	bc().addReadOnly(booktabsRB);
 
 	bc().addReadOnly(multicolumnCB);
+	bc().addReadOnly(multirowCB);
 	bc().addReadOnly(rotateCellCB);
 	bc().addReadOnly(rotateTabularCB);
 	bc().addReadOnly(specialAlignmentED);
@@ -396,7 +399,13 @@
 	changed();
 }
 
+void GuiTabular::multirow_clicked()
+{
+	toggleMultiRow();
+	changed();
+}
 
+
 void GuiTabular::rotateTabular()
 {
 	rotateTabular(rotateTabularCB-isChecked());
@@ -654,7 +663,7 @@
 
 Length getMColumnPWidth(Tabular const  t, size_t cell)
 {
-	if (t.isMultiColumn(cell))
+	if (t.isMultiColumn(cell) || t.isMultiRow(cell))
 		return t.cellInfo(cell).p_width;
 	return Length();
 }
@@ -662,7 +671,8 @@
 
 docstring getAlignSpecial(Tabular const  t, size_t cell, int what)
 {
-	if (what == Tabular::SET_SPECIAL_MULTI)
+	if (what == Tabular::SET_SPECIAL_MULTICOLUMN
+		|| what == Tabular::SET_SPECIAL_MULTIROW)
 		return t.cellInfo(cell).align_special;
 	return t.column_info[t.cellColumn(cell)].align_special;
 }
@@ -670,7 +680,6 @@
 }
 
 
-
 void GuiTabular::updateContents()
 {
 	initialiseParams(string());
@@ -684,9 +693,11 @@
 	tabularColumnED-setText(QString::number(col + 1));
 
 	bool const multicol(tabular_.isMultiColumn(cell));
-
 	multicolumnCB-setChecked(multicol);
 
+	bool const multirow(tabular_.isMultiRow(cell));
+	multirowCB-setChecked(multirow);
+
 	rotateCellCB-setChecked(tabular_.getRotateCell(cell));
 	rotateTabularCB-setChecked(tabular_.rotate);
 
@@ -699,8 +710,12 @@
 
 	if (multicol) {
 		special = getAlignSpecial(tabular_, cell,
-			Tabular::SET_SPECIAL_MULTI);
+			Tabular::SET_SPECIAL_MULTICOLUMN);
 		pwidth = getMColumnPWidth(tabular_, cell);
+	} else if (multirow) {
+		special = getAlignSpecial(tabular_, cell,
+			Tabular::SET_SPECIAL_MULTIROW);
+		pwidth = getMColumnPWidth(tabular_, cell);
 	} else {
 		special = getAlignSpecial(tabular_, cell,
 			Tabular::SET_SPECIAL_COLUMN);
@@ -832,7 +847,8 @@
 	vAlignCB-setCurrentIndex(valign);
 
 	hAlignCB-setEnabled(true);
-	vAlignCB-setEnabled(!pwidth.zero());
+	if (!multirow  

Re: [patch] implement multirow support - request for help

2010-02-08 Thread Uwe Stöhr

> Attached is what I currently have to support multirows.
>
> There is currently one issue I cannot solve: The metrics and drawing
> of the cells that are part of a multirow is broken. The drawing of
> the first multirow cell is however correct. I failed to figure out
> this problem and therefore ask for help.

Has anybody had time to have a look at this?
I was quite calm the last weeks because of real live stuff and now want to continue to finish the 
patch. However, I'm still stuck with the metrics issue.


Attached is what I have so far.

thanks in advance and regards
Uwe
Index: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 33372)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1520,6 +1520,7 @@
 tabular-feature_delete-column.png
 tabular-feature_delete-row.png
 tabular-feature_multicolumn.png
+tabular-feature_multirow.png
 tabular-feature_set-all-lines.png
 tabular-feature_set-border-lines.png
 tabular-feature_set-longtabular.png
Index: lib/images/tabular-feature_multirow.png
===
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib\images\tabular-feature_multirow.png
___
Added: svn:mime-type
   + application/octet-stream

Index: lib/Makefile.am
===
--- lib/Makefile.am	(revision 33372)
+++ lib/Makefile.am	(working copy)
@@ -415,6 +415,7 @@
 	images/tabular-feature_delete-column.png \
 	images/tabular-feature_delete-row.png \
 	images/tabular-feature_multicolumn.png \
+	images/tabular-feature_multirow.png \
 	images/tabular-feature_set-all-lines.png \
 	images/tabular-feature_set-longtabular.png \
 	images/tabular-feature_set-rotate-cell.png \
Index: lib/ui/stdtoolbars.inc
===
--- lib/ui/stdtoolbars.inc	(revision 33372)
+++ lib/ui/stdtoolbars.inc	(working copy)
@@ -161,6 +161,7 @@
 		Item "Rotate cell" "tabular-feature toggle-rotate-cell"
 		Item "Rotate table" "tabular-feature toggle-rotate-tabular"
 		Item "Set multi-column" "tabular-feature multicolumn"
+		Item "Set multi-row" "tabular-feature multirow"
 	End
 	
 	Toolbar "math" "Math"
Index: src/frontends/qt4/GuiTabular.cpp
===
--- src/frontends/qt4/GuiTabular.cpp	(revision 33372)
+++ src/frontends/qt4/GuiTabular.cpp	(working copy)
@@ -96,6 +96,8 @@
 		this, SLOT(vAlign_changed(int)));
 	connect(multicolumnCB, SIGNAL(clicked()),
 		this, SLOT(multicolumn_clicked()));
+	connect(multirowCB, SIGNAL(clicked()),
+		this, SLOT(multirow_clicked()));
 	connect(newpageCB, SIGNAL(clicked()),
 		this, SLOT(ltNewpage_clicked()));
 	connect(headerStatusCB, SIGNAL(clicked()),
@@ -172,6 +174,7 @@
 	bc().addReadOnly(booktabsRB);
 
 	bc().addReadOnly(multicolumnCB);
+	bc().addReadOnly(multirowCB);
 	bc().addReadOnly(rotateCellCB);
 	bc().addReadOnly(rotateTabularCB);
 	bc().addReadOnly(specialAlignmentED);
@@ -396,7 +399,13 @@
 	changed();
 }
 
+void GuiTabular::multirow_clicked()
+{
+	toggleMultiRow();
+	changed();
+}
 
+
 void GuiTabular::rotateTabular()
 {
 	rotateTabular(rotateTabularCB->isChecked());
@@ -654,7 +663,7 @@
 
 Length getMColumnPWidth(Tabular const & t, size_t cell)
 {
-	if (t.isMultiColumn(cell))
+	if (t.isMultiColumn(cell) || t.isMultiRow(cell))
 		return t.cellInfo(cell).p_width;
 	return Length();
 }
@@ -662,7 +671,8 @@
 
 docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
 {
-	if (what == Tabular::SET_SPECIAL_MULTI)
+	if (what == Tabular::SET_SPECIAL_MULTICOLUMN
+		|| what == Tabular::SET_SPECIAL_MULTIROW)
 		return t.cellInfo(cell).align_special;
 	return t.column_info[t.cellColumn(cell)].align_special;
 }
@@ -670,7 +680,6 @@
 }
 
 
-
 void GuiTabular::updateContents()
 {
 	initialiseParams(string());
@@ -684,9 +693,11 @@
 	tabularColumnED->setText(QString::number(col + 1));
 
 	bool const multicol(tabular_.isMultiColumn(cell));
-
 	multicolumnCB->setChecked(multicol);
 
+	bool const multirow(tabular_.isMultiRow(cell));
+	multirowCB->setChecked(multirow);
+
 	rotateCellCB->setChecked(tabular_.getRotateCell(cell));
 	rotateTabularCB->setChecked(tabular_.rotate);
 
@@ -699,8 +710,12 @@
 
 	if (multicol) {
 		special = getAlignSpecial(tabular_, cell,
-			Tabular::SET_SPECIAL_MULTI);
+			Tabular::SET_SPECIAL_MULTICOLUMN);
 		pwidth = getMColumnPWidth(tabular_, cell);
+	} else if (multirow) {
+		special = getAlignSpecial(tabular_, cell,
+			Tabular::SET_SPECIAL_MULTIROW);
+		pwidth = getMColumnPWidth(tabular_, cell);
 	} else {
 		special = getAlignSpecial(tabular_, cell,
 			Tabular::SET_SPECIAL_COLUMN);
@@ -832,7 +847,8 @@
 	vAlignCB->setCurrentIndex(valign);
 
 	hAlignCB->setEnabled(true);
-	

[patch] implement multirow support - request for help

2010-01-17 Thread Uwe Stöhr

Attached is what I currently have to support multirows.

There is currently one issue I cannot solve: The metrics and drawing of the cells that are part of a 
multirow is broken. The drawing of the first multirow cell is however correct. I failed to figure 
out this problem and therefore ask for help.


Besides this, the copy/paste mechanism is not yet ready for multirows.
The same applies for the plain text output but I have not yet had a look at 
this.

The UI is also not yet feature-complete. I plan to further add support to set the multirow width and 
the horzontal alignment.


thanks in advance and regards
Uwe
attachment: tabular-feature_multirow.pngIndex: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 33077)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1515,6 +1515,7 @@
 tabular-feature_delete-column.png
 tabular-feature_delete-row.png
 tabular-feature_multicolumn.png
+tabular-feature_multirow.png
 tabular-feature_set-all-lines.png
 tabular-feature_set-border-lines.png
 tabular-feature_set-longtabular.png
Index: lib/images/tabular-feature_multirow.png
===
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib\images\tabular-feature_multirow.png
___
Added: svn:mime-type
   + application/octet-stream

Index: lib/Makefile.am
===
--- lib/Makefile.am	(revision 33077)
+++ lib/Makefile.am	(working copy)
@@ -415,6 +415,7 @@
 	images/tabular-feature_delete-column.png \
 	images/tabular-feature_delete-row.png \
 	images/tabular-feature_multicolumn.png \
+	images/tabular-feature_multirow.png \
 	images/tabular-feature_set-all-lines.png \
 	images/tabular-feature_set-longtabular.png \
 	images/tabular-feature_set-rotate-cell.png \
Index: lib/ui/stdtoolbars.inc
===
--- lib/ui/stdtoolbars.inc	(revision 33077)
+++ lib/ui/stdtoolbars.inc	(working copy)
@@ -151,6 +151,7 @@
 		Item Rotate cell tabular-feature toggle-rotate-cell
 		Item Rotate table tabular-feature toggle-rotate-tabular
 		Item Set multi-column tabular-feature multicolumn
+		Item Set multi-row tabular-feature multirow
 	End
 	
 	Toolbar math Math
Index: src/frontends/qt4/GuiTabular.cpp
===
--- src/frontends/qt4/GuiTabular.cpp	(revision 33077)
+++ src/frontends/qt4/GuiTabular.cpp	(working copy)
@@ -96,6 +96,8 @@
 		this, SLOT(vAlign_changed(int)));
 	connect(multicolumnCB, SIGNAL(clicked()),
 		this, SLOT(multicolumn_clicked()));
+	connect(multirowCB, SIGNAL(clicked()),
+		this, SLOT(multirow_clicked()));
 	connect(newpageCB, SIGNAL(clicked()),
 		this, SLOT(ltNewpage_clicked()));
 	connect(headerStatusCB, SIGNAL(clicked()),
@@ -172,6 +174,7 @@
 	bc().addReadOnly(booktabsRB);
 
 	bc().addReadOnly(multicolumnCB);
+	bc().addReadOnly(multirowCB);
 	bc().addReadOnly(rotateCellCB);
 	bc().addReadOnly(rotateTabularCB);
 	bc().addReadOnly(specialAlignmentED);
@@ -396,7 +399,13 @@
 	changed();
 }
 
+void GuiTabular::multirow_clicked()
+{
+	toggleMultiRow();
+	changed();
+}
 
+
 void GuiTabular::rotateTabular()
 {
 	rotateTabular(rotateTabularCB-isChecked());
@@ -654,7 +663,7 @@
 
 Length getMColumnPWidth(Tabular const  t, size_t cell)
 {
-	if (t.isMultiColumn(cell))
+	if (t.isMultiColumn(cell) || t.isMultiRow(cell))
 		return t.cellInfo(cell).p_width;
 	return Length();
 }
@@ -662,7 +671,8 @@
 
 docstring getAlignSpecial(Tabular const  t, size_t cell, int what)
 {
-	if (what == Tabular::SET_SPECIAL_MULTI)
+	if (what == Tabular::SET_SPECIAL_MULTICOLUMN
+		|| what == Tabular::SET_SPECIAL_MULTIROW)
 		return t.cellInfo(cell).align_special;
 	return t.column_info[t.cellColumn(cell)].align_special;
 }
@@ -670,7 +680,6 @@
 }
 
 
-
 void GuiTabular::updateContents()
 {
 	initialiseParams(string());
@@ -684,9 +693,11 @@
 	tabularColumnED-setText(QString::number(col + 1));
 
 	bool const multicol(tabular_.isMultiColumn(cell));
-
 	multicolumnCB-setChecked(multicol);
 
+	bool const multirow(tabular_.isMultiRow(cell));
+	multirowCB-setChecked(multirow);
+
 	rotateCellCB-setChecked(tabular_.getRotateCell(cell));
 	rotateTabularCB-setChecked(tabular_.rotate);
 
@@ -699,8 +710,12 @@
 
 	if (multicol) {
 		special = getAlignSpecial(tabular_, cell,
-			Tabular::SET_SPECIAL_MULTI);
+			Tabular::SET_SPECIAL_MULTICOLUMN);
 		pwidth = getMColumnPWidth(tabular_, cell);
+	} else if (multirow) {
+		special = getAlignSpecial(tabular_, cell,
+			Tabular::SET_SPECIAL_MULTIROW);
+		pwidth = getMColumnPWidth(tabular_, cell);
 	} else {
 		special = getAlignSpecial(tabular_, cell,
 			Tabular::SET_SPECIAL_COLUMN);
@@ -832,7 +847,8 @@
 	vAlignCB-setCurrentIndex(valign);
 

[patch] implement multirow support - request for help

2010-01-17 Thread Uwe Stöhr

Attached is what I currently have to support multirows.

There is currently one issue I cannot solve: The metrics and drawing of the cells that are part of a 
multirow is broken. The drawing of the first multirow cell is however correct. I failed to figure 
out this problem and therefore ask for help.


Besides this, the copy/paste mechanism is not yet ready for multirows.
The same applies for the plain text output but I have not yet had a look at 
this.

The UI is also not yet feature-complete. I plan to further add support to set the multirow width and 
the horzontal alignment.


thanks in advance and regards
Uwe
<>Index: development/scons/scons_manifest.py
===
--- development/scons/scons_manifest.py	(revision 33077)
+++ development/scons/scons_manifest.py	(working copy)
@@ -1515,6 +1515,7 @@
 tabular-feature_delete-column.png
 tabular-feature_delete-row.png
 tabular-feature_multicolumn.png
+tabular-feature_multirow.png
 tabular-feature_set-all-lines.png
 tabular-feature_set-border-lines.png
 tabular-feature_set-longtabular.png
Index: lib/images/tabular-feature_multirow.png
===
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib\images\tabular-feature_multirow.png
___
Added: svn:mime-type
   + application/octet-stream

Index: lib/Makefile.am
===
--- lib/Makefile.am	(revision 33077)
+++ lib/Makefile.am	(working copy)
@@ -415,6 +415,7 @@
 	images/tabular-feature_delete-column.png \
 	images/tabular-feature_delete-row.png \
 	images/tabular-feature_multicolumn.png \
+	images/tabular-feature_multirow.png \
 	images/tabular-feature_set-all-lines.png \
 	images/tabular-feature_set-longtabular.png \
 	images/tabular-feature_set-rotate-cell.png \
Index: lib/ui/stdtoolbars.inc
===
--- lib/ui/stdtoolbars.inc	(revision 33077)
+++ lib/ui/stdtoolbars.inc	(working copy)
@@ -151,6 +151,7 @@
 		Item "Rotate cell" "tabular-feature toggle-rotate-cell"
 		Item "Rotate table" "tabular-feature toggle-rotate-tabular"
 		Item "Set multi-column" "tabular-feature multicolumn"
+		Item "Set multi-row" "tabular-feature multirow"
 	End
 	
 	Toolbar "math" "Math"
Index: src/frontends/qt4/GuiTabular.cpp
===
--- src/frontends/qt4/GuiTabular.cpp	(revision 33077)
+++ src/frontends/qt4/GuiTabular.cpp	(working copy)
@@ -96,6 +96,8 @@
 		this, SLOT(vAlign_changed(int)));
 	connect(multicolumnCB, SIGNAL(clicked()),
 		this, SLOT(multicolumn_clicked()));
+	connect(multirowCB, SIGNAL(clicked()),
+		this, SLOT(multirow_clicked()));
 	connect(newpageCB, SIGNAL(clicked()),
 		this, SLOT(ltNewpage_clicked()));
 	connect(headerStatusCB, SIGNAL(clicked()),
@@ -172,6 +174,7 @@
 	bc().addReadOnly(booktabsRB);
 
 	bc().addReadOnly(multicolumnCB);
+	bc().addReadOnly(multirowCB);
 	bc().addReadOnly(rotateCellCB);
 	bc().addReadOnly(rotateTabularCB);
 	bc().addReadOnly(specialAlignmentED);
@@ -396,7 +399,13 @@
 	changed();
 }
 
+void GuiTabular::multirow_clicked()
+{
+	toggleMultiRow();
+	changed();
+}
 
+
 void GuiTabular::rotateTabular()
 {
 	rotateTabular(rotateTabularCB->isChecked());
@@ -654,7 +663,7 @@
 
 Length getMColumnPWidth(Tabular const & t, size_t cell)
 {
-	if (t.isMultiColumn(cell))
+	if (t.isMultiColumn(cell) || t.isMultiRow(cell))
 		return t.cellInfo(cell).p_width;
 	return Length();
 }
@@ -662,7 +671,8 @@
 
 docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
 {
-	if (what == Tabular::SET_SPECIAL_MULTI)
+	if (what == Tabular::SET_SPECIAL_MULTICOLUMN
+		|| what == Tabular::SET_SPECIAL_MULTIROW)
 		return t.cellInfo(cell).align_special;
 	return t.column_info[t.cellColumn(cell)].align_special;
 }
@@ -670,7 +680,6 @@
 }
 
 
-
 void GuiTabular::updateContents()
 {
 	initialiseParams(string());
@@ -684,9 +693,11 @@
 	tabularColumnED->setText(QString::number(col + 1));
 
 	bool const multicol(tabular_.isMultiColumn(cell));
-
 	multicolumnCB->setChecked(multicol);
 
+	bool const multirow(tabular_.isMultiRow(cell));
+	multirowCB->setChecked(multirow);
+
 	rotateCellCB->setChecked(tabular_.getRotateCell(cell));
 	rotateTabularCB->setChecked(tabular_.rotate);
 
@@ -699,8 +710,12 @@
 
 	if (multicol) {
 		special = getAlignSpecial(tabular_, cell,
-			Tabular::SET_SPECIAL_MULTI);
+			Tabular::SET_SPECIAL_MULTICOLUMN);
 		pwidth = getMColumnPWidth(tabular_, cell);
+	} else if (multirow) {
+		special = getAlignSpecial(tabular_, cell,
+			Tabular::SET_SPECIAL_MULTIROW);
+		pwidth = getMColumnPWidth(tabular_, cell);
 	} else {
 		special = getAlignSpecial(tabular_, cell,
 			Tabular::SET_SPECIAL_COLUMN);
@@ -832,7 +847,8 @@
 	vAlignCB->setCurrentIndex(valign);