]> git.lyx.org Git - lyx.git/blobdiff - src/texrow.h
Fixed various "missing features" in the tabular/textinset code.
[lyx.git] / src / texrow.h
index 8d4017e9d3504fb04aa9f90bcde8531ec92efc2d..9111eeb22af647d78fb1061dfdecd1f53185d599 100644 (file)
@@ -5,7 +5,7 @@
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1998 The LyX Team
+ *           Copyright 1995-2000 The LyX Team
  *
  * ====================================================== */
 
@@ -17,7 +17,6 @@
 #endif
 
 #include <list>
-using std::list;
 
 class LyXParagraph;
 
@@ -25,11 +24,7 @@ class LyXParagraph;
 class TexRow {
 public:
        ///
-       TexRow() {
-               count = 0;
-               lastpar = 0;
-               lastpos = -1;
-       }
+       TexRow() : count(0), lastpar(0), lastpos(-1) {}
 
        /// Clears structure
        void reset();
@@ -41,34 +36,60 @@ public:
        void newline();
 
        /// Returns paragraph id and position from a row number
-       void getIdFromRow(int row, int & id, int & pos);
+       bool getIdFromRow(int row, int & id, int & pos) const;
 
        /// Appends another TexRow
        TexRow & operator+= (TexRow const &);
 
-private:
+       /// Returns the number of rows in this texrow
+       int rows() const { return count; }
+
        /// Linked list of items
-       struct RowItem {
+       class RowItem {
+       public:
+               ///
+               RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
                ///
-               RowItem() {
-                       id = -1;
-                       pos = -1;
-                       rownumber = 0;
+               void id(int i) {
+                       id_ = i;
                }
-
                ///
-               int id;
+               int id() const {
+                       return id_;
+               }
+               ///
+               void pos(int p) {
+                       pos_ = p;
+               }
+               ///
+               int pos() const {
+                       return pos_;
+               }
+               ///
+               void rownumber(int r) {
+                       rownumber_ = r;
+               }
+               ///
+               int rownumber() const {
+                       return rownumber_;
+               }
+       private:
+               ///
+               int id_;
                ///
-               int pos;
+               int pos_;
                ///
-               int rownumber;
+               int rownumber_;
        };
        ///
-       unsigned int count;
+       typedef std::list<RowItem> RowList;
+       ///
+       void increasePos(int id, int pos) const;
+private:
        ///
-       typedef list<RowItem> RowList;
+       unsigned int count;
        ///
-       RowList rowlist;
+       mutable RowList rowlist;
        /// Last paragraph
        LyXParagraph * lastpar;
        /// Last position