]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
cosmetic fix
[lyx.git] / src / tabular.C
index 7d1d3a58052bc230a879ab54536b626ea63d003d..19804ffc790891b1d90c2a0bf74258dc339fb271 100644 (file)
@@ -1074,7 +1074,7 @@ int LyXTabular::getLastCellInRow(int row) const
 void LyXTabular::calculate_width_of_column(int column)
 {
        int maximum = 0;
-       for (int i = 0; i < rows_; ++i) 
+       for (int i = 0; i < rows_; ++i)
                maximum = max(cell_info[i][column].width_of_cell, maximum);
        column_info[column].width_of_column = maximum;
 }
@@ -2201,6 +2201,47 @@ int LyXTabular::latex(Buffer const * buf, ostream & os,
 }
 
 
+int LyXTabular::linuxdoc(Buffer const * buf, ostream & os) const
+{
+       os << "<tabular ca=\"";
+       for (int i = 0; i < columns_; ++i) {
+               switch (column_info[i].alignment) {
+               case LYX_ALIGN_LEFT:
+                       os << 'l';
+                       break;
+               case LYX_ALIGN_RIGHT:
+                       os << 'r';
+                       break;
+               default:
+                       os << 'c';
+                       break;
+               }
+       }
+       os << "\">\n";
+       int cell = 0;
+       int ret = 0;
+       for (int i = 0; i < rows_; ++i) {
+               for (int j = 0; j < columns_; ++j) {
+                       if (isPartOfMultiColumn(i, j))
+                               continue;
+                       InsetText & inset = getCellInset(cell);
+       
+                       ret += inset.linuxdoc(buf, os);
+
+                       if (isLastCellInRow(cell)) {
+                               os << "@\n";
+                               ++ret;
+                       } else {
+                               os << "|";
+                       }
+                       ++cell;
+               }
+       }
+       os << "</tabular>\n";
+       return ret;
+}
+
+
 int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const
 {
        int ret = 0;
@@ -2557,7 +2598,7 @@ InsetText & LyXTabular::getCellInset(int row, int column) const
 }
 
 
-int LyXTabular::getCellFromInset(Inset const * inset, int maybe_cell) const
+int LyXTabular::getCellFromInset(InsetOld const * inset, int maybe_cell) const
 {
        // is this inset part of the tabular?
        if (!inset || inset->owner() != owner_) {