]> git.lyx.org Git - lyx.git/blob - src/lyxrow.C
d387cd65bcaf80b97b2124fed40363120ffae4fe
[lyx.git] / src / lyxrow.C
1 /**
2  * \file lyxrow.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  *
8  * Full author contact details are available in file CREDITS
9  *
10  * Metrics for an on-screen text row.
11  */
12
13 #include <config.h>
14
15 #include "lyxrow.h"
16 #include "paragraph.h"
17 #include "layout.h"
18 #include "lyxlayout.h"
19 #include "debug.h"
20
21 using lyx::pos_type;
22
23 using std::max;
24 using std::min;
25
26 Row::Row()
27         : pos_(0), fill_(0), height_(0), width_(0), y_(0),
28           ascent_of_text_(0), baseline_(0)
29 {}
30
31
32 Row::Row(ParagraphList::iterator pit, pos_type po)
33         : pit_(pit), pos_(po), fill_(0), height_(0), width_(0), y_(0),
34           ascent_of_text_(0), baseline_(0)
35 {}
36
37
38 void Row::y(unsigned int newy)
39 {
40         y_ = newy;
41 }
42
43
44 unsigned int Row::y() const
45 {
46         return y_;
47 }
48
49
50 ParagraphList::iterator Row::par()
51 {
52         return pit_;
53 }
54
55
56 ParagraphList::iterator Row::par() const
57 {
58         return pit_;
59 }
60
61
62 unsigned short Row::height() const
63 {
64         return height_;
65 }
66
67
68 void Row::par(ParagraphList::iterator pit)
69 {
70         pit_ = pit;
71 }
72
73
74 void Row::pos(pos_type p)
75 {
76         pos_ = p;
77 }
78
79
80 pos_type Row::pos() const
81 {
82         return pos_;
83 }
84
85
86 void Row::fill(int f)
87 {
88         fill_ = f;
89 }
90
91
92 int Row::fill() const
93 {
94         return fill_;
95 }
96
97
98 void Row::height(unsigned short h)
99 {
100         height_ = h;
101 }
102
103
104 void Row::width(unsigned int w)
105 {
106         width_ = w;
107 }
108
109
110 unsigned int Row::width() const
111 {
112         return width_;
113 }
114
115
116 void Row::ascent_of_text(unsigned short a)
117 {
118         ascent_of_text_ = a;
119 }
120
121
122 unsigned short Row::ascent_of_text() const
123 {
124         return ascent_of_text_;
125 }
126
127
128 void Row::top_of_text(unsigned int top)
129 {
130         top_of_text_ = top;
131 }
132
133
134 unsigned int Row::top_of_text() const
135 {
136         return top_of_text_;
137 }
138
139
140 void Row::baseline(unsigned int b)
141 {
142         baseline_ = b;
143 }
144
145
146 unsigned int Row::baseline() const
147 {
148         return baseline_;
149 }
150
151
152 bool Row::isParStart() const
153 {
154         return !pos();
155 }
156
157
158 void Row::dump(const char * s) const
159 {
160         lyxerr << s << " pos: " << pos_ << " width: " << width_
161                 << " height: " << height_
162                 << " fill: " << fill_
163                 << " ascent_of_text: " << ascent_of_text_
164                 << " top_of_text: " << top_of_text_
165                 << " y: " << y_ << "\n";
166 }
167