+ if (flag)
+ resetPos(bv->painter());
+ bv->owner()->getToolbar()->combox->select(cursor.par->GetLayout()+1);
+}
+
+
+bool InsetText::cutSelection()
+{
+ if (!hasSelection())
+ return false;
+
+ CutAndPaste cap;
+
+ LyXParagraph * endpar = par;
+ int start, end;
+ if (selection_start_cursor.pos > selection_end_cursor.pos) {
+ start = selection_end_cursor.pos;
+ end = selection_start_cursor.pos;
+ } else {
+ start = selection_start_cursor.pos;
+ end = selection_end_cursor.pos;
+ }
+
+ return cap.cutSelection(par, &endpar, start, end,buffer->params.textclass);
+}
+
+
+bool InsetText::copySelection()
+{
+ if (!hasSelection())
+ return false;
+
+ CutAndPaste cap;
+
+ int start, end;
+ if (selection_start_cursor.pos > selection_end_cursor.pos) {
+ start = selection_end_cursor.pos;
+ end = selection_start_cursor.pos;
+ } else {
+ start = selection_start_cursor.pos;
+ end = selection_end_cursor.pos;
+ }
+ return cap.copySelection(par, par, start, end, buffer->params.textclass);
+}
+
+
+bool InsetText::pasteSelection()
+{
+ CutAndPaste cap;
+
+ if (cap.nrOfParagraphs() > 1) {
+ WriteAlert(_("Impossible operation"),
+ _("Cannot include more than one paragraph!"),
+ _("Sorry."));
+ return false;
+ }
+ LyXParagraph *endpar;
+ LyXParagraph *actpar = par;
+
+ return cap.pasteSelection(&actpar, &endpar, cursor.pos,
+ buffer->params.textclass);
+}
+
+
+bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
+ int button)
+{
+ if (par->GetChar(cursor.pos) == LyXParagraph::META_INSET) {
+ UpdatableInset * inset =
+ static_cast<UpdatableInset*>(par->GetInset(cursor.pos));
+ LyXFont font = GetFont(par, cursor.pos);
+ if (x < 0)
+ x = inset->width(bv->painter(), font);
+ if (y < 0)
+ y = inset->descent(bv->painter(), font);
+ inset_x = cursor.x - top_x + drawTextXOffset;
+ inset_y = cursor.y + drawTextYOffset;
+ inset->Edit(bv, x-inset_x, y-inset_y, button);
+ if (!the_locking_inset)
+ return false;
+ UpdateLocal(bv, true);
+ return true;
+ }
+ return false;
+}
+
+
+int InsetText::getMaxTextWidth(Painter & pain, UpdatableInset const * inset,
+ int x) const
+{
+ return getMaxWidth(pain, inset) - x;
+}
+
+void InsetText::SetParagraphData(LyXParagraph *p)
+{
+ if (par)
+ delete par;
+ par = p->Clone();
+ par->SetInsetOwner(this);
+ init_inset = true;