]> git.lyx.org Git - lyx.git/blob - src/lyxrow.h
(Alfredo) strip BufferView out of the graphics code.
[lyx.git] / src / lyxrow.h
1 // -*- C++ -*-
2 /**
3  * \file lyxrow.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  *
9  * Full author contact details are available in file CREDITS
10  *
11  * Metrics for an on-screen text row.
12  */
13
14 #ifndef LYXROW_H
15 #define LYXROW_H
16
17 #include "support/types.h"
18
19 class Paragraph;
20
21 ///
22 class Row {
23 public:
24         ///
25         Row();
26
27         ///
28         void par(Paragraph * p);
29         ///
30         Paragraph * par();
31         ///
32         Paragraph * par() const;
33         ///
34         void pos(lyx::pos_type p);
35         ///
36         lyx::pos_type pos() const;
37         ///
38         void fill(int f);
39         ///
40         int fill() const;
41         ///
42         void height(unsigned short h);
43         ///
44         unsigned short height() const;
45         ///
46         void width(unsigned int w);
47         ///
48         unsigned int width() const;
49         ///
50         void ascent_of_text(unsigned short a);
51         ///
52         unsigned short ascent_of_text() const;
53         ///
54         void top_of_text(unsigned int top);
55         ///
56         unsigned int top_of_text() const;
57         ///
58         void baseline(unsigned int b);
59         ///
60         unsigned int baseline() const;
61         ///
62         void next(Row * r);
63         ///
64         Row * next() const;
65         ///
66         void previous(Row * r);
67         ///
68         Row * previous() const;
69
70         /// return the position of the last character in this row
71         lyx::pos_type lastPos() const;
72         /// return the position of the last normal, printable character in this row
73         lyx::pos_type lastPrintablePos() const;
74         
75         /**
76          * Returns the number of separators.
77          * The separator on the very last column doesnt count.
78          */
79         int numberOfSeparators() const;
80
81         /** 
82          * Returns the number of hfills. It works like a LaTeX \hfill:
83          * the hfills at the beginning and at the end are ignored.
84          * This is much more useful than not to ignore!
85          */
86         int numberOfHfills() const;
87
88         /// Returns the number of hfills in the manual label. See numberOfHfills().
89         int numberOfLabelHfills() const;
90
91         /**
92          * Returns true if a expansion is needed at the given position.
93          * Rules are given by LaTeX
94          */
95         bool hfillExpansion(lyx::pos_type pos) const;
96
97 private:
98         ///
99         Paragraph * par_;
100         ///
101         lyx::pos_type pos_;
102         /** what is missing to a full row can be negative.
103           Needed for hfills, flushright, block etc. */
104         mutable int fill_;
105         ///
106         unsigned short height_;
107         ///
108         unsigned int width_;
109         /// ascent from baseline including prelude space
110         unsigned short ascent_of_text_;
111         /// the top of the real text in the row
112         unsigned int top_of_text_;
113         ///
114         unsigned int baseline_;
115         ///
116         Row * next_;
117         ///
118         Row * previous_;
119 };
120
121
122 inline
123 Paragraph * Row::par()
124 {
125         return par_;
126 }
127
128
129 inline
130 Paragraph * Row::par() const
131 {
132         return par_;
133 }
134
135
136 inline
137 unsigned short Row::height() const
138 {
139         return height_;
140 }
141
142
143 inline
144 Row * Row::next() const
145 {
146         return next_;
147 }
148
149 #endif