2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file lyxrow_funcs.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-04-01 16:55:48 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "lyxrow_funcs.h"
|
2003-08-22 07:49:57 +00:00
|
|
|
|
#include "debug.h"
|
2003-09-06 12:36:58 +00:00
|
|
|
|
#include "lyxlayout.h"
|
|
|
|
|
#include "lyxrow.h"
|
|
|
|
|
#include "paragraph.h"
|
2003-08-22 07:49:57 +00:00
|
|
|
|
|
2003-04-01 16:55:48 +00:00
|
|
|
|
using lyx::pos_type;
|
2003-08-14 08:34:13 +00:00
|
|
|
|
|
2003-04-01 16:55:48 +00:00
|
|
|
|
|
2003-10-17 10:31:47 +00:00
|
|
|
|
bool hfillExpansion(Paragraph const & par, Row const & row, pos_type pos)
|
2003-04-01 16:55:48 +00:00
|
|
|
|
{
|
2003-08-15 08:03:54 +00:00
|
|
|
|
if (!par.isHfill(pos))
|
2003-04-01 16:55:48 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// at the end of a row it does not count
|
|
|
|
|
// unless another hfill exists on the line
|
2003-10-22 16:30:57 +00:00
|
|
|
|
if (pos >= row.endpos()) {
|
2003-10-17 10:31:47 +00:00
|
|
|
|
for (pos_type i = row.pos(); i < pos && !par.isHfill(i); ++i)
|
2003-04-01 16:55:48 +00:00
|
|
|
|
return false;
|
2003-10-20 11:41:21 +00:00
|
|
|
|
}
|
2003-04-01 16:55:48 +00:00
|
|
|
|
|
|
|
|
|
// at the beginning of a row it does not count, if it is not
|
|
|
|
|
// the first row of a paragaph
|
2003-10-22 16:30:57 +00:00
|
|
|
|
if (row.pos() == 0)
|
2003-04-01 16:55:48 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// in some labels it does not count
|
2003-08-15 08:03:54 +00:00
|
|
|
|
if (par.layout()->margintype != MARGIN_MANUAL
|
2003-11-13 13:43:44 +00:00
|
|
|
|
&& pos < par.beginOfBody())
|
2003-04-01 16:55:48 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// if there is anything between the first char of the row and
|
|
|
|
|
// the specified position that is not a newline and not a hfill,
|
|
|
|
|
// the hfill will count, otherwise not
|
2003-10-17 10:31:47 +00:00
|
|
|
|
pos_type i = row.pos();
|
2003-08-15 08:03:54 +00:00
|
|
|
|
while (i < pos && (par.isNewline(i) || par.isHfill(i)))
|
2003-04-01 16:55:48 +00:00
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
return i != pos;
|
|
|
|
|
}
|