1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-02-14 00:41:44 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file Row.h
|
2003-02-14 00:41:44 +00:00
|
|
|
|
* 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-04-01 16:55:48 +00:00
|
|
|
|
* \author Matthias Ettrich
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +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
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#ifndef ROW_H
|
|
|
|
|
#define ROW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-11-26 16:42:04 +00:00
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
2007-08-28 09:21:48 +00:00
|
|
|
|
#include "Dimension.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2005-01-31 16:29:48 +00:00
|
|
|
|
/**
|
2005-04-26 11:12:20 +00:00
|
|
|
|
* An on-screen row of text. A paragraph is broken into a
|
2005-01-31 16:29:48 +00:00
|
|
|
|
* RowList for display. Each Row contains position pointers
|
|
|
|
|
* into the first and last character positions of that row.
|
|
|
|
|
*/
|
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();
|
2003-03-29 23:11:20 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Row(pos_type pos);
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2007-08-29 21:03:41 +00:00
|
|
|
|
bool changed() const { return changed_; }
|
|
|
|
|
///
|
2007-08-29 23:06:14 +00:00
|
|
|
|
void setChanged(bool c) { changed_ = c; }
|
|
|
|
|
///
|
2007-11-17 11:27:03 +00:00
|
|
|
|
void setCrc(size_type crc) const;
|
2007-09-05 13:04:05 +00:00
|
|
|
|
///
|
|
|
|
|
void setSelection(pos_type sel_beg, pos_type sel_end);
|
|
|
|
|
|
2007-08-29 21:03:41 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void pos(pos_type p);
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2007-08-29 21:03:41 +00:00
|
|
|
|
pos_type pos() const { return pos_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void endpos(pos_type p);
|
2003-08-22 07:49:57 +00:00
|
|
|
|
///
|
2007-08-29 21:03:41 +00:00
|
|
|
|
pos_type endpos() const { return end_; }
|
|
|
|
|
///
|
|
|
|
|
void setDimension(Dimension const & dim);
|
2003-08-22 07:49:57 +00:00
|
|
|
|
///
|
2007-08-28 09:21:48 +00:00
|
|
|
|
Dimension const & dimension() const { return dim_; }
|
|
|
|
|
///
|
|
|
|
|
int height() const { return dim_.height(); }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2007-08-28 09:21:48 +00:00
|
|
|
|
int width() const { return dim_.wid; }
|
2000-06-26 15:10:49 +00:00
|
|
|
|
///
|
2007-08-28 09:21:48 +00:00
|
|
|
|
int ascent() const { return dim_.asc; }
|
2000-06-08 23:16:16 +00:00
|
|
|
|
///
|
2007-08-28 09:21:48 +00:00
|
|
|
|
int descent() const { return dim_.des; }
|
2007-08-29 21:03:41 +00:00
|
|
|
|
|
2003-08-01 14:12:04 +00:00
|
|
|
|
/// current debugging only
|
2007-09-16 10:36:57 +00:00
|
|
|
|
void dump(char const * = "") const;
|
2004-03-01 12:23:17 +00:00
|
|
|
|
|
|
|
|
|
/// 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;
|
2007-09-05 13:04:05 +00:00
|
|
|
|
///
|
|
|
|
|
pos_type sel_beg;
|
|
|
|
|
///
|
|
|
|
|
pos_type sel_end;
|
2007-08-28 15:47:53 +00:00
|
|
|
|
private:
|
2007-08-29 21:03:41 +00:00
|
|
|
|
/// has the Row appearance changed since last drawing?
|
2007-11-17 11:27:03 +00:00
|
|
|
|
mutable bool changed_;
|
2007-08-29 21:03:41 +00:00
|
|
|
|
/// CRC of row contents.
|
2007-11-17 11:27:03 +00:00
|
|
|
|
mutable size_type crc_;
|
2007-08-28 15:47:53 +00:00
|
|
|
|
/// first pos covered by this row
|
|
|
|
|
pos_type pos_;
|
|
|
|
|
/// one behind last pos covered by this row
|
|
|
|
|
pos_type end_;
|
|
|
|
|
/// Row dimension.
|
|
|
|
|
Dimension dim_;
|
|
|
|
|
};
|
2004-03-01 12:23:17 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|