2003-02-14 00:41:44 +00:00
|
|
|
/**
|
|
|
|
* \file lyxrow.C
|
|
|
|
* 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
|
2000-06-08 23:16:16 +00:00
|
|
|
*
|
2003-02-14 00:41:44 +00:00
|
|
|
* Metrics for an on-screen text row.
|
|
|
|
*/
|
2000-06-08 23:16:16 +00:00
|
|
|
|
2000-06-15 15:54:05 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
#include "lyxrow.h"
|
2003-02-14 00:41:44 +00:00
|
|
|
#include "paragraph.h"
|
|
|
|
#include "layout.h"
|
|
|
|
#include "lyxlayout.h"
|
2000-06-08 23:16:16 +00:00
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
using lyx::pos_type;
|
|
|
|
|
|
|
|
using std::max;
|
|
|
|
using std::min;
|
2000-06-08 23:16:16 +00:00
|
|
|
|
|
|
|
Row::Row()
|
2003-04-12 23:03:05 +00:00
|
|
|
: pos_(0), fill_(0), height_(0), width_(0), y_(0),
|
2003-04-01 16:55:48 +00:00
|
|
|
ascent_of_text_(0), baseline_(0)
|
2000-06-08 23:16:16 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-04-02 23:01:39 +00:00
|
|
|
Row::Row(ParagraphList::iterator pit, pos_type po)
|
2003-04-12 23:03:05 +00:00
|
|
|
: pit_(pit), pos_(po), fill_(0), height_(0), width_(0), y_(0),
|
2003-04-01 16:55:48 +00:00
|
|
|
ascent_of_text_(0), baseline_(0)
|
2003-03-29 23:11:20 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-04-12 23:03:05 +00:00
|
|
|
void Row::y(unsigned int newy)
|
|
|
|
{
|
|
|
|
y_ = newy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int Row::y() const
|
|
|
|
{
|
|
|
|
return y_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-02 23:01:39 +00:00
|
|
|
ParagraphList::iterator Row::par()
|
2003-03-21 14:20:48 +00:00
|
|
|
{
|
2003-04-02 23:01:39 +00:00
|
|
|
return pit_;
|
2003-03-21 14:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-02 23:01:39 +00:00
|
|
|
ParagraphList::iterator Row::par() const
|
2003-03-21 14:20:48 +00:00
|
|
|
{
|
2003-04-02 23:01:39 +00:00
|
|
|
return pit_;
|
2003-03-21 14:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short Row::height() const
|
|
|
|
{
|
|
|
|
return height_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-02 23:01:39 +00:00
|
|
|
void Row::par(ParagraphList::iterator pit)
|
2000-06-08 23:16:16 +00:00
|
|
|
{
|
2003-04-02 23:01:39 +00:00
|
|
|
pit_ = pit;
|
2000-06-08 23:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
void Row::pos(pos_type p)
|
2000-06-08 23:16:16 +00:00
|
|
|
{
|
|
|
|
pos_ = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-14 00:41:44 +00:00
|
|
|
pos_type Row::pos() const
|
2000-06-08 23:16:16 +00:00
|
|
|
{
|
|
|
|
return pos_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Row::fill(int f)
|
|
|
|
{
|
|
|
|
fill_ = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Row::fill() const
|
|
|
|
{
|
|
|
|
return fill_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Row::height(unsigned short h)
|
|
|
|
{
|
|
|
|
height_ = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-26 15:10:49 +00:00
|
|
|
void Row::width(unsigned int w)
|
|
|
|
{
|
|
|
|
width_ = w;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int Row::width() const
|
|
|
|
{
|
|
|
|
return width_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
void Row::ascent_of_text(unsigned short a)
|
|
|
|
{
|
|
|
|
ascent_of_text_ = a;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned short Row::ascent_of_text() const
|
|
|
|
{
|
|
|
|
return ascent_of_text_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
void Row::top_of_text(unsigned int top)
|
|
|
|
{
|
|
|
|
top_of_text_ = top;
|
|
|
|
}
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
unsigned int Row::top_of_text() const
|
|
|
|
{
|
|
|
|
return top_of_text_;
|
|
|
|
}
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
void Row::baseline(unsigned int b)
|
|
|
|
{
|
|
|
|
baseline_ = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int Row::baseline() const
|
|
|
|
{
|
|
|
|
return baseline_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-26 17:04:10 +00:00
|
|
|
bool Row::isParStart() const
|
|
|
|
{
|
|
|
|
return !pos();
|
|
|
|
}
|