]> git.lyx.org Git - lyx.git/blob - src/texrow.h
8db0533603f5f5e8d13a6841eb937ea5ea86d9e0
[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() {
28                 count = 0;
29                 lastpar = 0;
30                 lastpos = -1;
31         }
32
33         /// Clears structure
34         void reset();
35
36         /// Define what paragraph and position the next row will represent
37         void start(LyXParagraph * par, int pos);
38
39         /// Insert node when line is completed
40         void newline();
41
42         /// Returns paragraph id and position from a row number
43         void getIdFromRow(int row, int & id, int & pos);
44
45         /// Appends another TexRow
46         TexRow & operator+= (TexRow const &);
47
48         /// Returns the number of rows in this texrow
49         int rows() { return count; }
50
51 private:
52         /// Linked list of items
53         struct RowItem {
54                 ///
55                 RowItem() {
56                         id = -1;
57                         pos = -1;
58                         rownumber = 0;
59                 }
60
61                 ///
62                 int id;
63                 ///
64                 int pos;
65                 ///
66                 int rownumber;
67         };
68         ///
69         unsigned int count;
70         ///
71         typedef std::list<RowItem> RowList;
72         ///
73         RowList rowlist;
74         /// Last paragraph
75         LyXParagraph * lastpar;
76         /// Last position
77         int lastpos;
78         
79 };
80 #endif