int LyXText::top_y() const
{
- if (anchor_row_ == rowlist_.end() )
+ if (anchor_row_ == rowlist_.end())
return 0;
return anchor_row_->y() + anchor_row_offset_;
}
-int LyXText::workWidth(Inset * inset) const
+int LyXText::workWidth(Inset const * inset) const
{
- Paragraph * par = inset->parOwner();
- lyx::Assert(par);
+ ParagraphList::iterator par = std::find(ownerParagraphs().begin(),
+ ownerParagraphs().end(),
+ *inset->parOwner());
+ //lyx::Assert(par);
pos_type pos = par->getPositionOfInset(inset);
lyx::Assert(pos != -1);
};
-pos_type
-LyXText::rowBreakPoint(Row const & row) const
+pos_type LyXText::rowBreakPoint(Row const & row) const
{
ParagraphList::iterator pit = row.par();
// or the end of the par, then choose the possible break
// nearest that.
- int const left = leftMargin(const_cast<Row&>(row));
+ int const left = leftMargin(row);
int x = left;
// pixel width since last breakpoint
LyXLayout_ptr const & layout = cursor.par()->layout();
// this is only allowed, if the current paragraph is not empty or caption
- // and if it has not the keepempty flag aktive
- if (cursor.par()->empty()
- && layout->labeltype != LABEL_SENSITIVE
- && !layout->keepempty)
+ // and if it has not the keepempty flag active
+ if (cursor.par()->empty() && !cursor.par()->allowEmpty()
+ && layout->labeltype != LABEL_SENSITIVE)
return;
setUndo(bv(), Undo::FINISH, cursor.par());
// breakParagraph call should return a bool if it inserts the
// paragraph before or behind and we should react on that one
// but we can fix this in 1.3.0 (Jug 20020509)
- bool const isempty = (layout->keepempty && cursor.par()->empty());
+ bool const isempty = (cursor.par()->allowEmpty() && cursor.par()->empty());
::breakParagraph(bv()->buffer()->params, paragraphs, cursor.par(), cursor.pos(),
keep_layout);
false, cursor.boundary());
// cursor MUST be in row now.
- if (boost::next(row) != rows().end() &&
- boost::next(row)->par() == row->par())
- need_break_row = boost::next(row);
+ RowList::iterator next_row = boost::next(row);
+ if (next_row != rows().end() &&
+ next_row->par() == row->par())
+ need_break_row = next_row;
else
need_break_row = rows().end();
if (c == Paragraph::META_INSET || row->fill() < 0) {
postPaint(y);
breakAgainOneRow(row);
+
+ RowList::iterator next_row = boost::next(row);
+
// will the cursor be in another row now?
if (lastPos(*this, row) <= cursor.pos() + 1 &&
- boost::next(row) != rows().end()) {
- if (boost::next(row) != rows().end() &&
- boost::next(row)->par() == row->par())
+ next_row != rows().end()) {
+ if (next_row != rows().end() &&
+ next_row->par() == row->par()) {
// this should always be true
++row;
+ }
+
breakAgainOneRow(row);
}
current_font = rawtmpfont;
!= cursor.boundary())
setCursor(cursor.par(), cursor.pos(), false,
!cursor.boundary());
- if (boost::next(row) != rows().end() &&
- boost::next(row)->par() == row->par())
- need_break_row = boost::next(row);
+
+ next_row = boost::next(row);
+
+ if (next_row != rows().end() &&
+ next_row->par() == row->par())
+ need_break_row = next_row;
else
need_break_row = rows().end();
} else {