]> git.lyx.org Git - lyx.git/blob - src/texrow.h
2013ff1a2ca44a7b09dffa5c7e48ef5a80bacfce
[lyx.git] / src / texrow.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team
9  *
10  * ====================================================== */
11
12 #ifndef TEXROW_H
13 #define TEXROW_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <list>
20
21 class LyXParagraph;
22
23 // Controls correspondance between paragraphs and the generated LaTeX file
24 class TexRow {
25 public:
26         ///
27         TexRow() : count(0), lastpar(0), lastpos(-1) {}
28
29         /// Clears structure
30         void reset();
31
32         /// Define what paragraph and position the next row will represent
33         void start(LyXParagraph * par, int pos);
34
35         /// Insert node when line is completed
36         void newline();
37
38         /// Returns paragraph id and position from a row number
39         void getIdFromRow(int row, int & id, int & pos);
40
41         /// Appends another TexRow
42         TexRow & operator+= (TexRow const &);
43
44         /// Returns the number of rows in this texrow
45         int rows() const { return count; }
46
47 private:
48         /// Linked list of items
49         class RowItem {
50         public:
51                 ///
52                 RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
53                 ///
54                 void id(int i) {
55                         id_ = i;
56                 }
57                 ///
58                 int id() const {
59                         return id_;
60                 }
61                 ///
62                 void pos(int p) {
63                         pos_ = p;
64                 }
65                 ///
66                 int pos() const {
67                         return pos_;
68                 }
69                 ///
70                 void rownumber(int r) {
71                         rownumber_ = r;
72                 }
73                 ///
74                 int rownumber() const {
75                         return rownumber_;
76                 }
77         private:
78                 ///
79                 int id_;
80                 ///
81                 int pos_;
82                 ///
83                 int rownumber_;
84         };
85         ///
86         unsigned int count;
87         ///
88         typedef std::list<RowItem> RowList;
89         ///
90         RowList rowlist;
91         /// Last paragraph
92         LyXParagraph * lastpar;
93         /// Last position
94         int lastpos;
95         
96 };
97 #endif