]> git.lyx.org Git - features.git/commitdiff
Try to fix a problem noted by Dov. There are design problems that prevent a really...
authorRichard Heck <rgheck@comcast.net>
Mon, 21 Jul 2008 02:07:54 +0000 (02:07 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 21 Jul 2008 02:07:54 +0000 (02:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25752 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index e14c5562d877387a40f3115d0821b3d48cee1404..4b2ac51268fecf70a99de622f6216b8089d18afd 100644 (file)
@@ -760,6 +760,7 @@ void Tabular::updateIndexes()
                                continue;
                        rowofcell[i] = row;
                        columnofcell[i] = column;
+                       setFixedWidth(row, column);
                        ++i;
                }
 }
@@ -994,6 +995,18 @@ void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
 }
 
 
+bool Tabular::setFixedWidth(row_type r, col_type c)
+{
+       if (!column_info[c].p_width.zero() ||
+                               (cell_info[r][c].multicolumn != CELL_NORMAL && 
+                               !cell_info[r][c].p_width.zero())) {
+               cell_info[r][c].inset->toggleFixedWidth(true);
+               return true;
+       }
+       return false;
+}
+
+
 bool Tabular::setMColumnPWidth(Cursor & cur, idx_type cell,
                Length const & width)
 {
@@ -1404,6 +1417,7 @@ void Tabular::read(Lexer & lex)
                        getTokenValue(line, "rotate", cell_info[i][j].rotate);
                        getTokenValue(line, "usebox", cell_info[i][j].usebox);
                        getTokenValue(line, "width", cell_info[i][j].p_width);
+                       setFixedWidth(i,j);
                        getTokenValue(line, "special", cell_info[i][j].align_special);
                        l_getline(is, line);
                        if (prefixIs(line, "\\begin_inset")) {
index 84bec94c969f70af701f1e2ed98806fd00a81777..60664a49ff8fb0ee00010fb3c2c8166b82ea530c 100644 (file)
@@ -575,6 +575,8 @@ public:
                  col_type columns_arg);
        ///
        void updateIndexes();
+       ///
+       bool setFixedWidth(row_type r, col_type c);
        /// return true of update is needed
        bool updateColumnWidths();
        ///
@@ -654,6 +656,29 @@ private:
        InsetTableCell();
        /// unimplemented
        void operator=(InsetTableCell const &);
+       // FIXME
+       // This boolean is supposed to track whether the cell has had its
+       // width explicitly set. We need to know this to determine whether
+       // layout changes and paragraph customization are allowed---that is,
+       // we need it in forcePlainLayout() and allowParagraphCustomization(). 
+       // Unfortunately, that information is not readily available in 
+       // InsetTableCell. In the case of multicolumn cells, it is present
+       // in CellData, and so would be available here if CellData were to
+       // become a member of InsetTableCell. But in the other case, it isn't
+       // even available there, but is held in Tabular::ColumnData.
+       // So, the present solution uses this boolean to track the information
+       // we need to track, and tries to keep it updated. This is not ideal,
+       // but the other solutions are no better. These are:
+       // (i)  Keep a pointer in InsetTableCell to the table;
+       // (ii) Find the table by iterating over the Buffer's insets.
+       // Solution (i) raises the problem of updating the pointer when an 
+       // InsetTableCell is copied, and we'd therefore need a copy constructor
+       // in InsetTabular and then in Tabular, which seems messy, given how 
+       // complicated those classes are. Solution (ii) involves a lot of 
+       // iterating, since this information is needed quite often, and so may
+       // be quite slow.
+       // So, well, if someone can do better, please do!
+       // --rgh
        ///
        bool isFixedWidth;
 };