]> git.lyx.org Git - lyx.git/blob - src/texrow.h
Dekel's lyxrc.example; Angus's FormDocument; John's build-listerrors; POTFILES.in...
[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         bool getIdFromRow(int row, int & id, int & pos) const;
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         /// Linked list of items
48         class RowItem {
49         public:
50                 ///
51                 RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
52                 ///
53                 void id(int i) {
54                         id_ = i;
55                 }
56                 ///
57                 int id() const {
58                         return id_;
59                 }
60                 ///
61                 void pos(int p) {
62                         pos_ = p;
63                 }
64                 ///
65                 int pos() const {
66                         return pos_;
67                 }
68                 ///
69                 void rownumber(int r) {
70                         rownumber_ = r;
71                 }
72                 ///
73                 int rownumber() const {
74                         return rownumber_;
75                 }
76         private:
77                 ///
78                 int id_;
79                 ///
80                 int pos_;
81                 ///
82                 int rownumber_;
83         };
84         ///
85         typedef std::list<RowItem> RowList;
86         ///
87         void increasePos(int id, int pos) const;
88 private:
89         ///
90         unsigned int count;
91         ///
92         mutable RowList rowlist;
93         /// Last paragraph
94         LyXParagraph * lastpar;
95         /// Last position
96         int lastpos;
97         
98 };
99 #endif