* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author unknown
+ * \author Matthias Ettrich
+ * \author Lars Gullik Bjønnes
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*
* Metrics for an on-screen text row.
*/
#include "support/types.h"
-class Paragraph;
-
-///
+/**
+ * An on-screen row of text. A paragraph is broken into a
+ * RowList for display. Each Row contains position pointers
+ * into the first and last character positions of that row.
+ */
class Row {
public:
///
Row();
-
///
- void par(Paragraph * p);
- ///
- Paragraph * par();
- ///
- Paragraph * par() const;
+ Row(lyx::pos_type pos);
///
void pos(lyx::pos_type p);
///
lyx::pos_type pos() const;
///
- void fill(int f);
- ///
- int fill() const;
- ///
- void height(unsigned short h);
+ void endpos(lyx::pos_type p);
///
- unsigned short height() const;
+ lyx::pos_type endpos() const;
///
- void width(unsigned int w);
+ int height() const { return ascent_ + descent_; }
///
- unsigned int width() const;
+ void width(int w);
///
- void ascent_of_text(unsigned short a);
+ int width() const;
///
- unsigned short ascent_of_text() const;
+ void ascent(int b);
///
- void top_of_text(unsigned int top);
+ int ascent() const;
///
- unsigned int top_of_text() const;
+ void descent(int b) { descent_ = b; }
///
- void baseline(unsigned int b);
- ///
- unsigned int baseline() const;
- ///
- void next(Row * r);
- ///
- Row * next() const;
- ///
- void previous(Row * r);
- ///
- Row * previous() const;
-
- /// return true if this row is the start of a paragraph
- bool isParStart() const;
-
- /// return true if this row is the end of a paragraph
- bool isParEnd() const;
-
- /// return the position of the last character in this row
- lyx::pos_type lastPos() const;
- /// return the position of the last normal, printable character in this row
- lyx::pos_type lastPrintablePos() const;
-
- /**
- * Returns the number of separators.
- * The separator on the very last column doesnt count.
- */
- int numberOfSeparators() const;
-
- /**
- * Returns the number of hfills. It works like a LaTeX \hfill:
- * the hfills at the beginning and at the end are ignored.
- * This is much more useful than not to ignore!
- */
- int numberOfHfills() const;
-
- /// Returns the number of hfills in the manual label. See numberOfHfills().
- int numberOfLabelHfills() const;
-
- /**
- * Returns true if a expansion is needed at the given position.
- * Rules are given by LaTeX
- */
- bool hfillExpansion(lyx::pos_type pos) const;
+ int descent() const { return descent_; }
+ /// current debugging only
+ void dump(const char * = "") const;
private:
- ///
- Paragraph * par_;
- ///
+ /// first pos covered by this row
lyx::pos_type pos_;
- /** what is missing to a full row can be negative.
- Needed for hfills, flushright, block etc. */
- mutable int fill_;
+ /// one behind last pos covered by this row
+ lyx::pos_type end_;
///
- unsigned short height_;
+ int ascent_;
///
- unsigned int width_;
- /// ascent from baseline including prelude space
- unsigned short ascent_of_text_;
- /// the top of the real text in the row
- unsigned int top_of_text_;
+ int descent_;
///
- unsigned int baseline_;
- ///
- Row * next_;
- ///
- Row * previous_;
+ int width_;
};
+
+class RowMetrics {
+public:
+ RowMetrics();
+ /// width of a separator (i.e. space)
+ double separator;
+ /// width of hfills in the body
+ double hfill;
+ /// width of hfills in the label
+ double label_hfill;
+ /// the x position of the row
+ double x;
+};
+
+
#endif