1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2003-02-14 00:41:44 +00:00
|
|
|
/**
|
|
|
|
* \file lyxrow.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
* \author unknown
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
* Metrics for an on-screen text row.
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef LYXROW_H
|
|
|
|
#define LYXROW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-11-26 16:42:04 +00:00
|
|
|
#include "support/types.h"
|
|
|
|
|
|
|
|
class Paragraph;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
class Row {
|
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
Row();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
void par(Paragraph * p);
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * par();
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * par() const;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
void pos(lyx::pos_type p);
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos() const;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
void fill(int f);
|
|
|
|
///
|
|
|
|
int fill() const;
|
|
|
|
///
|
|
|
|
void height(unsigned short h);
|
|
|
|
///
|
|
|
|
unsigned short height() const;
|
|
|
|
///
|
2000-06-26 15:10:49 +00:00
|
|
|
void width(unsigned int w);
|
|
|
|
///
|
|
|
|
unsigned int width() const;
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
void ascent_of_text(unsigned short a);
|
|
|
|
///
|
|
|
|
unsigned short ascent_of_text() const;
|
|
|
|
///
|
2003-02-08 19:18:01 +00:00
|
|
|
void top_of_text(unsigned int top);
|
|
|
|
///
|
|
|
|
unsigned int top_of_text() const;
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
void baseline(unsigned int b);
|
|
|
|
///
|
|
|
|
unsigned int baseline() const;
|
|
|
|
///
|
|
|
|
void next(Row * r);
|
|
|
|
///
|
|
|
|
Row * next() const;
|
|
|
|
///
|
|
|
|
void previous(Row * r);
|
|
|
|
///
|
|
|
|
Row * previous() const;
|
2003-02-14 00:41:44 +00:00
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
/// 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;
|
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
/// 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;
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of separators.
|
|
|
|
* The separator on the very last column doesnt count.
|
|
|
|
*/
|
|
|
|
int numberOfSeparators() const;
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
/**
|
2003-02-14 00:41:44 +00:00
|
|
|
* 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;
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
private:
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * par_;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
lyx::pos_type pos_;
|
1999-09-27 18:44:28 +00:00
|
|
|
/** what is missing to a full row can be negative.
|
|
|
|
Needed for hfills, flushright, block etc. */
|
2000-06-08 23:16:16 +00:00
|
|
|
mutable int fill_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
unsigned short height_;
|
2000-04-26 13:57:28 +00:00
|
|
|
///
|
2000-06-26 15:10:49 +00:00
|
|
|
unsigned int width_;
|
2003-02-08 19:18:01 +00:00
|
|
|
/// ascent from baseline including prelude space
|
2000-06-08 23:16:16 +00:00
|
|
|
unsigned short ascent_of_text_;
|
2003-02-08 19:18:01 +00:00
|
|
|
/// the top of the real text in the row
|
|
|
|
unsigned int top_of_text_;
|
2000-04-26 13:57:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
unsigned int baseline_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
Row * next_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
Row * previous_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2001-04-04 20:20:42 +00:00
|
|
|
|
|
|
|
inline
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * Row::par()
|
2001-04-04 20:20:42 +00:00
|
|
|
{
|
|
|
|
return par_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * Row::par() const
|
2001-04-04 20:20:42 +00:00
|
|
|
{
|
|
|
|
return par_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
unsigned short Row::height() const
|
|
|
|
{
|
|
|
|
return height_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
Row * Row::next() const
|
|
|
|
{
|
|
|
|
return next_;
|
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|