-int Row::numberOfHfills() const
-{
- pos_type const last = lastPos();
- pos_type first = pos();
-
- // hfill *DO* count at the beginning of paragraphs!
- if (first) {
- while (first <= last && par()->isHfill(first)) {
- ++first;
- }
- }
-
- first = max(first, par()->beginningOfBody());
-
- int n = 0;
-
- // last, because the end is ignored!
- for (pos_type p = first; p <= last; ++p) {
- if (par()->isHfill(p))
- ++n;
- }
- return n;
-}
-
-
-int Row::numberOfLabelHfills() const
-{
- pos_type last = lastPos();
- pos_type first = pos();
-
- // hfill *DO* count at the beginning of paragraphs!
- if (first) {
- while (first < last && par()->isHfill(first))
- ++first;
- }
-
- last = min(last, par()->beginningOfBody());
- int n = 0;
-
- // last, because the end is ignored!
- for (pos_type p = first; p < last; ++p) {
- if (par()->isHfill(p))
- ++n;
- }
- return n;
-}
-
-
-bool Row::hfillExpansion(pos_type pos) const
-{
- if (!par()->isHfill(pos))
- return false;
-
- // at the end of a row it does not count
- // unless another hfill exists on the line
- if (pos >= lastPos()) {
- pos_type i = this->pos();
- while (i < pos && !par()->isHfill(i)) {
- ++i;
- }
- if (i == pos) {
- return false;
- }
- }
-
- // at the beginning of a row it does not count, if it is not
- // the first row of a paragaph
- if (isParStart())
- return true;
-
- // in some labels it does not count
- if (par()->layout()->margintype != MARGIN_MANUAL
- && pos < par()->beginningOfBody())
- return false;
-
- // if there is anything between the first char of the row and
- // the sepcified position that is not a newline and not a hfill,
- // the hfill will count, otherwise not
- pos_type i = this->pos();
- while (i < pos && (par()->isNewline(i)
- || par()->isHfill(i)))
- ++i;
-
- return i != pos;
-}