}
-bool Paragraph::hfillExpansion(Row const & row, pos_type pos) const
-{
- if (!isHfill(pos))
- return false;
-
- BOOST_ASSERT(pos >= row.pos() && pos < row.endpos());
-
- // expand at the end of a row only if there is another hfill on the same row
- if (pos == row.endpos() - 1) {
- for (pos_type i = row.pos(); i < pos; i++) {
- if (isHfill(i))
- return true;
- }
- return false;
- }
-
- // expand at the beginning of a row only if it is the first row of a paragraph
- if (pos == row.pos()) {
- return pos == 0;
- }
-
- // do not expand in some labels
- if (layout()->margintype != MARGIN_MANUAL && pos < beginOfBody())
- return false;
-
- // if there is anything between the first char of the row and
- // the specified position that is neither a newline nor an hfill,
- // the hfill will be expanded, otherwise it won't
- for (pos_type i = row.pos(); i < pos; i++) {
- if (!isNewline(i) && !isHfill(i))
- return true;
- }
- return false;
-}
-
-
int Paragraph::checkBiblio(bool track_changes)
{
//FIXME From JS:
#define PARAGRAPH_H
#include "Changes.h"
-#include "Dimension.h"
#include "InsetList.h"
#include "lyxlayout_ptr_fwd.h"
-#include "Row.h"
#include "insets/Inset.h" // only for Inset::Code
ParagraphParameters & params();
///
ParagraphParameters const & params() const;
- ///
- bool hfillExpansion(Row const & row, pos_type pos) const;
/// Check if we are in a Biblio environment and insert or
/// delete InsetBibitems as necessary.
}
+bool ParagraphMetrics::hfillExpansion(Row const & row, pos_type pos) const
+{
+ if (!par_->isHfill(pos))
+ return false;
+
+ BOOST_ASSERT(pos >= row.pos() && pos < row.endpos());
+
+ // expand at the end of a row only if there is another hfill on the same row
+ if (pos == row.endpos() - 1) {
+ for (pos_type i = row.pos(); i < pos; i++) {
+ if (par_->isHfill(i))
+ return true;
+ }
+ return false;
+ }
+
+ // expand at the beginning of a row only if it is the first row of a paragraph
+ if (pos == row.pos()) {
+ return pos == 0;
+ }
+
+ // do not expand in some labels
+ if (par_->layout()->margintype != MARGIN_MANUAL && pos < par_->beginOfBody())
+ return false;
+
+ // if there is anything between the first char of the row and
+ // the specified position that is neither a newline nor an hfill,
+ // the hfill will be expanded, otherwise it won't
+ for (pos_type i = row.pos(); i < pos; i++) {
+ if (!par_->isNewline(i) && !par_->isHfill(i))
+ return true;
+ }
+ return false;
+}
+
} // namespace lyx
#ifndef PARAGRAPH_METRICS_H
#define PARAGRAPH_METRICS_H
+#include "Dimension.h"
#include "Paragraph.h"
+#include "Row.h"
namespace lyx {
/// dump some information to lyxerr
void dump() const;
+
+ ///
+ bool hfillExpansion(Row const & row, pos_type pos) const;
+
///
void computeRowSignature(Row &, BufferParams const & bparams);
x += pm.singleWidth(pos, font);
- if (par.hfillExpansion(row, pos))
+ if (pm.hfillExpansion(row, pos))
x += (pos >= body_pos) ? row.hfill : row.label_hfill;
else if (par.isSeparator(pos) && pos >= body_pos)
x += row.separator;
int const xo = main_text_? 0 : bv_->coordCache().get(text_, pit).x_;
x -= xo;
Paragraph const & par = text_->getPar(pit);
+ ParagraphMetrics const & pm = par_metrics_[pit];
Bidi bidi;
bidi.computeTables(par, buffer, row);
tmpx -= singleWidth(pit, body_pos - 1);
}
- if (par.hfillExpansion(row, c)) {
+ if (pm.hfillExpansion(row, c)) {
tmpx += singleWidth(pit, c);
if (c >= body_pos)
tmpx += row.hfill;
// Re-enable screen drawing for future use of the painter.
pi.pain.setDrawingEnabled(true);
- LYXERR(Debug::PAINTING) << "." << endl;
+ //LYXERR(Debug::PAINTING) << "." << endl;
}
pi_.pain.line(int(x_), y1, int(x_), y0, Color::added_space);
- if (par_.hfillExpansion(row_, pos)) {
+ if (pm_.hfillExpansion(row_, pos)) {
int const y2 = (y0 + y1) / 2;
if (pos >= body_pos) {