]> git.lyx.org Git - lyx.git/blob - src/lyxrow.h
move BoostFormat and boost-inst
[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         Row(Paragraph * pa, lyx::pos_type po);
28         ///
29         void par(Paragraph * p);
30         ///
31         Paragraph * par();
32         ///
33         Paragraph * par() const;
34         ///
35         void pos(lyx::pos_type p);
36         ///
37         lyx::pos_type pos() const;
38         ///
39         void fill(int f);
40         ///
41         int fill() const;
42         ///
43         void height(unsigned short h);
44         ///
45         unsigned short height() const;
46         ///
47         void width(unsigned int w);
48         ///
49         unsigned int width() const;
50         ///
51         void ascent_of_text(unsigned short a);
52         ///
53         unsigned short ascent_of_text() const;
54         ///
55         void top_of_text(unsigned int top);
56         ///
57         unsigned int top_of_text() const;
58         ///
59         void baseline(unsigned int b);
60         ///
61         unsigned int baseline() const;
62         ///
63         void next(Row * r);
64         ///
65         Row * next() const;
66         ///
67         void previous(Row * r);
68         ///
69         Row * previous() const;
70
71         /// return true if this row is the start of a paragraph
72         bool isParStart() const;
73
74         /// return true if this  row is the end of a paragraph
75         bool isParEnd() const;
76
77         /// return the position of the last character in this row
78         lyx::pos_type lastPos() const;
79         /// return the position of the last normal, printable character in this row
80         lyx::pos_type lastPrintablePos() const;
81
82         /**
83          * Returns the number of separators.
84          * The separator on the very last column doesnt count.
85          */
86         int numberOfSeparators() const;
87
88         /**
89          * Returns the number of hfills. It works like a LaTeX \hfill:
90          * the hfills at the beginning and at the end are ignored.
91          * This is much more useful than not to ignore!
92          */
93         int numberOfHfills() const;
94
95         /// Returns the number of hfills in the manual label. See numberOfHfills().
96         int numberOfLabelHfills() const;
97
98         /**
99          * Returns true if a expansion is needed at the given position.
100          * Rules are given by LaTeX
101          */
102         bool hfillExpansion(lyx::pos_type pos) const;
103
104 private:
105         ///
106         Paragraph * par_;
107         ///
108         lyx::pos_type pos_;
109         /** what is missing to a full row can be negative.
110           Needed for hfills, flushright, block etc. */
111         mutable int fill_;
112         ///
113         unsigned short height_;
114         ///
115         unsigned int width_;
116         /// ascent from baseline including prelude space
117         unsigned short ascent_of_text_;
118         /// the top of the real text in the row
119         unsigned int top_of_text_;
120         ///
121         unsigned int baseline_;
122         ///
123         Row * next_;
124         ///
125         Row * previous_;
126 };
127
128 #endif