]> git.lyx.org Git - lyx.git/blob - src/lyxrow.h
Minimal fix needed to give Qt a label dialog again.
[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 true if this row is the start of a paragraph
71         bool isParStart() const;
72
73         /// return true if this  row is the end of a paragraph
74         bool isParEnd() const;
75
76         /// return the position of the last character in this row
77         lyx::pos_type lastPos() const;
78         /// return the position of the last normal, printable character in this row
79         lyx::pos_type lastPrintablePos() const;
80
81         /**
82          * Returns the number of separators.
83          * The separator on the very last column doesnt count.
84          */
85         int numberOfSeparators() const;
86
87         /**
88          * Returns the number of hfills. It works like a LaTeX \hfill:
89          * the hfills at the beginning and at the end are ignored.
90          * This is much more useful than not to ignore!
91          */
92         int numberOfHfills() const;
93
94         /// Returns the number of hfills in the manual label. See numberOfHfills().
95         int numberOfLabelHfills() const;
96
97         /**
98          * Returns true if a expansion is needed at the given position.
99          * Rules are given by LaTeX
100          */
101         bool hfillExpansion(lyx::pos_type pos) const;
102
103 private:
104         ///
105         Paragraph * par_;
106         ///
107         lyx::pos_type pos_;
108         /** what is missing to a full row can be negative.
109           Needed for hfills, flushright, block etc. */
110         mutable int fill_;
111         ///
112         unsigned short height_;
113         ///
114         unsigned int width_;
115         /// ascent from baseline including prelude space
116         unsigned short ascent_of_text_;
117         /// the top of the real text in the row
118         unsigned int top_of_text_;
119         ///
120         unsigned int baseline_;
121         ///
122         Row * next_;
123         ///
124         Row * previous_;
125 };
126
127
128 inline
129 Paragraph * Row::par()
130 {
131         return par_;
132 }
133
134
135 inline
136 Paragraph * Row::par() const
137 {
138         return par_;
139 }
140
141
142 inline
143 unsigned short Row::height() const
144 {
145         return height_;
146 }
147
148
149 inline
150 Row * Row::next() const
151 {
152         return next_;
153 }
154
155 #endif