}
-string
-LyXText::getStringToIndex(BufferView * bview)
+string LyXText::getStringToIndex(BufferView * bview)
{
string idxstring;
return idxstring;
}
-Paragraph::size_type
-LyXText::beginningOfMainBody(Buffer const * buf,
+
+Paragraph::size_type LyXText::beginningOfMainBody(Buffer const * buf,
Paragraph const * par) const
{
if (textclasslist.Style(buf->params.textclass,
bool pagebreak_top, bool pagebreak_bottom,
VSpace const & space_top,
VSpace const & space_bottom,
- Spacing const & spacing,
+ Spacing const & spacing,
LyXAlignment align,
string labelwidthstring,
bool noindent)
int pos = selection.end.pos();
CutAndPaste::cutSelection(selection.start.par(), &endpar,
selection.start.pos(), pos,
- bview->buffer()->params.textclass, doclear,
- realcut);
+ bview->buffer()->params.textclass,
+ doclear, realcut);
selection.end.pos(pos);
} else {
endpar = selection.end.par();
int pos = selection.end.pos();
CutAndPaste::cutSelection(selection.start.par(), &endpar,
selection.start.pos(), pos,
- bview->buffer()->params.textclass, doclear,
- realcut);
+ bview->buffer()->params.textclass,
+ doclear, realcut);
cursor.par(endpar);
selection.end.par(endpar);
selection.end.pos(pos);
void LyXText::checkParagraph(BufferView * bview, Paragraph * par,
- Paragraph::size_type pos)
+ Paragraph::size_type pos)
{
LyXCursor tmpcursor;
// check the special right address boxes
if (textclasslist.Style(bview->buffer()->params.textclass,
par->getLayout()).margintype
- == MARGIN_RIGHT_ADDRESS_BOX) {
+ == MARGIN_RIGHT_ADDRESS_BOX)
+ {
tmpcursor.par(par);
tmpcursor.row(row);
tmpcursor.y(y);
{
// first check the current paragraph
int pos = cursor.par()->getPositionOfInset(inset);
- if (pos != -1){
+ if (pos != -1) {
checkParagraph(bview, cursor.par(), pos);
return true;
}
Paragraph * par = firstParagraph();
do {
pos = par->getPositionOfInset(inset);
- if (pos != -1){
+ if (pos != -1) {
checkParagraph(bview, par, pos);
return true;
}
Row * row = getRowNearY(y);
bool bound = false;
- int const column = getColumnNearX(bview, row, x, bound);
+ Paragraph::size_type const column = getColumnNearX(bview, row, x,
+ bound);
cur.par(row->par());
cur.pos(row->pos() + column);
old_cursor.par()->getLayout())).keepempty)
return;
- LyXCursor tmpcursor;
-
- if (old_cursor.par() != cursor.par()) {
- if ((old_cursor.par()->size() == 0
- || (old_cursor.par()->size() == 1
- && old_cursor.par()->isLineSeparator(0)))) {
- // ok, we will delete anything
-
- // make sure that you do not delete any environments
- status(bview, LyXText::NEED_MORE_REFRESH);
- deleted = true;
+ // only do our magic if we changed paragraph
+ if (old_cursor.par() == cursor.par())
+ return;
+
+ if ((old_cursor.par()->size() == 0
+ || (old_cursor.par()->size() == 1
+ && old_cursor.par()->isLineSeparator(0)))) {
+ // ok, we will delete anything
+ LyXCursor tmpcursor;
+
+ // make sure that you do not delete any environments
+ status(bview, LyXText::NEED_MORE_REFRESH);
+ deleted = true;
- if (old_cursor.row()->previous()) {
- refresh_row = old_cursor.row()->previous();
- refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height();
- tmpcursor = cursor;
- cursor = old_cursor; // that undo can restore the right cursor position
- Paragraph * endpar = old_cursor.par()->next();
- if (endpar && endpar->getDepth()) {
- while (endpar && endpar->getDepth()) {
- endpar = endpar->next();
- }
+ if (old_cursor.row()->previous()) {
+ refresh_row = old_cursor.row()->previous();
+ refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height();
+ tmpcursor = cursor;
+ cursor = old_cursor; // that undo can restore the right cursor position
+ Paragraph * endpar = old_cursor.par()->next();
+ if (endpar && endpar->getDepth()) {
+ while (endpar && endpar->getDepth()) {
+ endpar = endpar->next();
}
- setUndo(bview, Undo::DELETE,
- old_cursor.par(),
- endpar);
- cursor = tmpcursor;
+ }
+ setUndo(bview, Undo::DELETE, old_cursor.par(), endpar);
+ cursor = tmpcursor;
// delete old row
- removeRow(old_cursor.row());
- if (ownerParagraph() == old_cursor.par()) {
- ownerParagraph(ownerParagraph()->next());
- }
+ removeRow(old_cursor.row());
+ if (ownerParagraph() == old_cursor.par()) {
+ ownerParagraph(ownerParagraph()->next());
+ }
// delete old par
- delete old_cursor.par();
+ delete old_cursor.par();
- /* Breakagain the next par. Needed
- * because of the parindent that
- * can occur or dissappear. The
- * next row can change its height,
- * if there is another layout before */
- if (refresh_row->next()) {
- breakAgain(bview, refresh_row->next());
- updateCounters(bview, refresh_row);
- }
- setHeightOfRow(bview, refresh_row);
- } else {
- refresh_row = old_cursor.row()->next();
- refresh_y = old_cursor.y() - old_cursor.row()->baseline();
+ /* Breakagain the next par. Needed because of
+ * the parindent that can occur or dissappear.
+ * The next row can change its height, if
+ * there is another layout before */
+ if (refresh_row->next()) {
+ breakAgain(bview, refresh_row->next());
+ updateCounters(bview, refresh_row);
+ }
+ setHeightOfRow(bview, refresh_row);
+ } else {
+ refresh_row = old_cursor.row()->next();
+ refresh_y = old_cursor.y() - old_cursor.row()->baseline();
- tmpcursor = cursor;
- cursor = old_cursor; // that undo can restore the right cursor position
- Paragraph * endpar = old_cursor.par()->next();
- if (endpar && endpar->getDepth()) {
- while (endpar && endpar->getDepth()) {
- endpar = endpar->next();
- }
- }
- setUndo(bview, Undo::DELETE,
- old_cursor.par(),
- endpar);
- cursor = tmpcursor;
-
- // delete old row
- removeRow(old_cursor.row());
- // delete old par
- if (ownerParagraph() == old_cursor.par()) {
- ownerParagraph(ownerParagraph()->next());
+ tmpcursor = cursor;
+ cursor = old_cursor; // that undo can restore the right cursor position
+ Paragraph * endpar = old_cursor.par()->next();
+ if (endpar && endpar->getDepth()) {
+ while (endpar && endpar->getDepth()) {
+ endpar = endpar->next();
}
+ }
+ setUndo(bview, Undo::DELETE, old_cursor.par(), endpar);
+ cursor = tmpcursor;
+
+ // delete old row
+ removeRow(old_cursor.row());
+ // delete old par
+ if (ownerParagraph() == old_cursor.par()) {
+ ownerParagraph(ownerParagraph()->next());
+ }
- delete old_cursor.par();
+ delete old_cursor.par();
- /* Breakagain the next par. Needed
- because of the parindent that can
- occur or dissappear.
- The next row can change its height,
- if there is another layout before
- */
- if (refresh_row) {
- breakAgain(bview, refresh_row);
- updateCounters(bview, refresh_row->previous());
- }
+ /* Breakagain the next par. Needed because of
+ the parindent that can occur or dissappear.
+ The next row can change its height, if
+ there is another layout before */
+ if (refresh_row) {
+ breakAgain(bview, refresh_row);
+ updateCounters(bview, refresh_row->previous());
}
+ }
- // correct cursor y
-
- setCursorIntern(bview, cursor.par(), cursor.pos());
+ // correct cursor y
+ setCursorIntern(bview, cursor.par(), cursor.pos());
- if (selection.cursor.par() == old_cursor.par()
- && selection.cursor.pos() == selection.cursor.pos()) {
- // correct selection
- selection.cursor = cursor;
- }
+ if (selection.cursor.par() == old_cursor.par()
+ && selection.cursor.pos() == selection.cursor.pos()) {
+ // correct selection
+ selection.cursor = cursor;
}
- if (!deleted) {
- if (old_cursor.par()->stripLeadingSpaces(bview->buffer()->params.textclass)) {
- redoParagraphs(bview, old_cursor, old_cursor.par()->next());
- // correct cursor y
- setCursorIntern(bview, cursor.par(), cursor.pos());
- selection.cursor = cursor;
- }
+ }
+ if (!deleted) {
+ if (old_cursor.par()->stripLeadingSpaces(bview->buffer()->params.textclass)) {
+ redoParagraphs(bview, old_cursor,
+ old_cursor.par()->next());
+ // correct cursor y
+ setCursorIntern(bview, cursor.par(), cursor.pos());
+ selection.cursor = cursor;
}
}
}
}
-Paragraph * LyXText::ownerParagraph(Paragraph * p) const
+void LyXText::ownerParagraph(Paragraph * p) const
{
if (inset_owner) {
inset_owner->paragraph(p);
} else {
bv_owner->buffer()->paragraph = p;
}
- return 0;
}
-Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const
+
+void LyXText::ownerParagraph(int id, Paragraph * p) const
{
Paragraph * op = bv_owner->buffer()->getParFromID(id);
if (op && op->inInset()) {
bv_owner->buffer()->paragraph = p;
}
}
- return 0;
}