3 * \file ParagraphMetrics.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
8 * \author Lars Gullik Bjønnes
10 * \author André Pönitz
11 * \author Jürgen Vigna
12 * \author Abdelrazak Younes
14 * Full author contact details are available in file CREDITS.
17 #ifndef PARAGRAPH_METRICS_H
18 #define PARAGRAPH_METRICS_H
20 #include "paragraph.h"
27 /// Helper class for Paragraph Metrics.
28 class ParagraphMetrics {
30 /// Default constructor (only here for STL containers).
31 ParagraphMetrics(): par_(0) {};
32 /// The only useful constructor.
33 ParagraphMetrics(Paragraph const & par);
35 Row & getRow(pos_type pos, bool boundary);
37 Row const & getRow(pos_type pos, bool boundary) const;
39 size_t pos2row(pos_type pos) const;
41 /// BufferView::redoParagraph updates this
42 Dimension const & dim() const { return dim_; }
43 Dimension & dim() { return dim_; }
44 /// total height of paragraph
45 unsigned int height() const { return dim_.height(); }
46 /// total width of paragraph, may differ from workwidth
47 unsigned int width() const { return dim_.width(); }
48 /// ascend of paragraph above baseline
49 unsigned int ascent() const { return dim_.ascent(); }
50 /// descend of paragraph below baseline
51 unsigned int descent() const { return dim_.descent(); }
52 /// LyXText updates the rows using this access point
53 RowList & rows() { return rows_; }
54 /// The painter and others use this
55 RowList const & rows() const { return rows_; }
57 RowSignature & rowSignature() const { return rowSignature_; }
59 int rightMargin(Buffer const & buffer) const;
61 /// dump some information to lyxerr
66 mutable RowList rows_;
68 mutable RowSignature rowSignature_;
69 /// cached dimensions of paragraph
72 Paragraph const * par_;
77 #endif // PARAGRAPH_METRICS_H