// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxrow.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Matthias Ettrich
+ * \author Lars Gullik Bjønnes
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
+ * Full author contact details are available in file CREDITS
*
- * ====================================================== */
+ * Metrics for an on-screen text row.
+ */
#ifndef LYXROW_H
#define LYXROW_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
+#include "ParagraphList.h"
#include "support/types.h"
-class Paragraph;
-
///
class Row {
public:
///
Row();
-
///
- void par(Paragraph * p);
+ Row(ParagraphList::iterator pit, lyx::pos_type pos);
///
- Paragraph * par();
+ void par(ParagraphList::iterator pit);
///
- Paragraph * par() const;
+ ParagraphList::iterator par();
+ ///
+ ParagraphList::iterator par() const;
///
void pos(lyx::pos_type p);
///
///
unsigned short ascent_of_text() const;
///
- void baseline(unsigned int b);
+ void top_of_text(unsigned int top);
///
- unsigned int baseline() const;
+ unsigned int top_of_text() const;
///
- void next(Row * r);
- ///
- Row * next() const;
- ///
- void previous(Row * r);
+ void baseline(unsigned int b);
///
- Row * previous() const;
+ unsigned int baseline() const;
+ /// return true if this row is the start of a paragraph
+ bool isParStart() const;
+ /// return the cached y position
+ unsigned int y() const;
+ /// cache the y position
+ void y(unsigned int newy);
private:
///
- Paragraph * par_;
+ ParagraphList::iterator pit_;
///
lyx::pos_type pos_;
- /** what is missing to a full row can be negative.
+ /** what is missing to a full row. Can be negative.
Needed for hfills, flushright, block etc. */
mutable int fill_;
///
unsigned short height_;
///
unsigned int width_;
- ///
+ /// cached y position
+ unsigned int y_;
+ /// 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_;
///
unsigned int baseline_;
- ///
- Row * next_;
- ///
- Row * previous_;
};
-
-inline
-Paragraph * Row::par()
-{
- return par_;
-}
-
-
-inline
-Paragraph * Row::par() const
-{
- return par_;
-}
-
-
-inline
-unsigned short Row::height() const
-{
- return height_;
-}
-
-
-inline
-Row * Row::next() const
-{
- return next_;
-}
-
#endif