]> git.lyx.org Git - features.git/blob - src/lyxrow_funcs.C
move everything into namespace lyx
[features.git] / src / lyxrow_funcs.C
1 /**
2  * \file lyxrow_funcs.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "lyxrow_funcs.h"
15 #include "debug.h"
16 #include "lyxlayout.h"
17 #include "lyxrow.h"
18 #include "paragraph.h"
19
20
21 namespace lyx {
22
23
24 bool hfillExpansion(Paragraph const & par, Row const & row, pos_type pos)
25 {
26         if (!par.isHfill(pos))
27                 return false;
28
29         // at the end of a row it does not count
30         // unless another hfill exists on the line
31         if (pos >= row.endpos()) {
32                 for (pos_type i = row.pos(); i < pos && !par.isHfill(i); ++i)
33                         return false;
34         }
35
36         // at the beginning of a row it does not count, if it is not
37         // the first row of a paragaph
38         if (row.pos() == 0)
39                 return true;
40
41         // in some labels it does not count
42         if (par.layout()->margintype != MARGIN_MANUAL
43             && pos < par.beginOfBody())
44                 return false;
45
46         // if there is anything between the first char of the row and
47         // the specified position that is not a newline and not a hfill,
48         // the hfill will count, otherwise not
49         pos_type i = row.pos();
50         while (i < pos && (par.isNewline(i) || par.isHfill(i)))
51                 ++i;
52
53         return i != pos;
54 }
55
56
57 } // namespace lyx