]> git.lyx.org Git - lyx.git/blobdiff - src/table.C
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / table.C
index f2aba980110dada284e7a006b130c8ae4857625a..bd6ff67a1d2d83b9e7546bcfa4bb83b98b720692 100644 (file)
@@ -15,6 +15,7 @@
 #include "table.h"
 #include "vspace.h"
 #include "layout.h"
+#include "support/lstrings.h"
 
 #ifdef __GNUG__
 #pragma implementation
@@ -600,7 +601,8 @@ bool LyXTable::SetPWidth(int cell, string width)
         cellinfo_of_cell(fvcell)->p_width = width;
     } else {
         column_info[column_of_cell(fvcell)].p_width = width;
-        SetAlignment(cell,LYX_ALIGN_LEFT);
+       if (!width.empty()) // do this only if there is a width
+               SetAlignment(cell,LYX_ALIGN_LEFT);
     }
     return true;
 }
@@ -1010,9 +1012,9 @@ int LyXTable::TexEndOfCell(string& file, int cell)
             for (i=0; i < NumberOfCellsInRow(fcell); i++){
                 if (BottomLine(fcell+i)){
                    file += "\\cline{";
-                   file += column_of_cell(fcell+i)+1;
+                   file += tostr(column_of_cell(fcell+i)+1);
                    file += '-';
-                   file += right_column_of_cell(fcell+i)+1;
+                   file += tostr(right_column_of_cell(fcell+i)+1);
                    file += "} ";
                     tmp = 1;
                 }
@@ -1083,9 +1085,9 @@ int LyXTable::TexEndOfCell(string& file, int cell)
                     for (i=0; i < NumberOfCellsInRow(fcell); i++){
                         if (TopLine(fcell+i)){
                            file += "\\cline{";
-                           file += column_of_cell(fcell+i)+1;
+                           file += tostr(column_of_cell(fcell+i)+1);
                            file += '-';
-                           file += right_column_of_cell(fcell+i)+1;
+                           file += tostr(right_column_of_cell(fcell+i)+1);
                            file += "} ";
                             tmp = 1;
                         }
@@ -1151,14 +1153,14 @@ int LyXTable::TexEndOfCell(string& file, int cell)
                     for (i=0; i < NumberOfCellsInRow(fcell); i++){
                         if (BottomLine(fcell+i)){
                             file += "\\cline{";
-                            file += column_of_cell(fcell+i)+1;
+                            file += tostr(column_of_cell(fcell+i)+1);
                             file += '-';
-                            file += right_column_of_cell(fcell+i)+1;
+                            file += tostr(right_column_of_cell(fcell+i)+1);
                             file += "} ";
                             hline1 += "\\cline{";
-                            hline1 += column_of_cell(fcell+i)+1;
+                            hline1 += tostr(column_of_cell(fcell+i)+1);
                             hline1 += '-';
-                            hline1 += right_column_of_cell(fcell+i)+1;
+                            hline1 += tostr(right_column_of_cell(fcell+i)+1);
                             hline1 += "} ";
                             tmp = 1;
                         }
@@ -1209,15 +1211,15 @@ int LyXTable::TexEndOfCell(string& file, int cell)
                             if (TopLine(fcell+i)){
                                 if (print_hline) {
                                    file += "\\cline{";
-                                   file += column_of_cell(fcell+i)+1;
+                                   file += tostr(column_of_cell(fcell+i)+1);
                                    file += '-';
-                                   file += right_column_of_cell(fcell+i)+1;
+                                   file += tostr(right_column_of_cell(fcell+i)+1);
                                    file += "} ";
                                }
                                 hline2 += "\\cline{";
-                                hline2 += column_of_cell(fcell+i)+1;
+                                hline2 += tostr(column_of_cell(fcell+i)+1);
                                 hline2 += '-';
-                                hline2 += right_column_of_cell(fcell+i)+1;
+                                hline2 += tostr(right_column_of_cell(fcell+i)+1);
                                 hline2 += "} ";
                                 tmp = 1;
                             }
@@ -1279,7 +1281,7 @@ int LyXTable::TexEndOfCell(string& file, int cell)
         }
         if (nvcell < numberofcells && IsMultiColumn(nvcell)) {
             file += "\\multicolumn{";
-           file += cells_in_multicolumn(nvcell);
+           file += tostr(cells_in_multicolumn(nvcell));
            file += "}{";
             if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
                 file += cellinfo_of_cell(cell+1)->align_special;
@@ -1535,7 +1537,7 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
             else
                 file += "<TGROUP ";
             file += "COLS='";
-            file += columns;
+            file += tostr(columns);
             file += "' COLSEP='1' ROWSEP='1'>";
            addNewlineAndDepth(file,++depth);
             ret++;
@@ -1543,9 +1545,9 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
                 file += "<COLSPEC ALIGN='";
                file += getDocBookAlign(i, true);
                file += "' COLNAME='col";
-                file += i+1;
+                file += tostr(i+1);
                 file += "' COLNUM='";
-                file += i+1;
+                file += tostr(i+1);
                file += "' COLSEP='";
                if (i == (columns-1)) {
                     file += '1';
@@ -1606,7 +1608,7 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
            file += "'";
            if (IsMultiColumn(0)) {
                file += " NAMEST='col1' NAMEEND='col";
-               file += cells_in_multicolumn(0);
+               file += tostr(cells_in_multicolumn(0));
                file += "'";
            }
             file += ">";
@@ -1638,10 +1640,10 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
                 file += "' VALIGN='middle'";
                if (IsMultiColumn(cell+1)) {
                    file += " NAMEST='col";
-                   file += column_of_cell(cell+1) + 1;
+                   file += tostr(column_of_cell(cell+1) + 1);
                    file += "' NAMEEND='col";
-                   file += column_of_cell(cell+1) +
-                       cells_in_multicolumn(cell+1);
+                   file += tostr(column_of_cell(cell+1) +
+                       cells_in_multicolumn(cell+1));
                    file += "'";
                }
                file += ">";
@@ -1807,10 +1809,10 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
                 file += "' VALIGN='middle'";
                if (IsMultiColumn(cell+1)) {
                    file += " NAMEST='col";
-                   file += column_of_cell(cell+1) + 1;
+                   file += tostr(column_of_cell(cell+1) + 1);
                    file += "' NAMEEND='col";
-                   file += column_of_cell(cell+1) +
-                       cells_in_multicolumn(cell+1);
+                   file += tostr(column_of_cell(cell+1) +
+                       cells_in_multicolumn(cell+1));
                    file += "'";
                }
                file += ">";