+ }
+
+ // First try LyX format
+ if (theClipboard().hasLyXContents()) {
+ string lyx = theClipboard().getAsLyX();
+ if (!lyx.empty()) {
+ // For some strange reason gcc 3.2 and 3.3 do not accept
+ // Buffer buffer(string(), false);
+ Buffer buffer("", false);
+ buffer.setUnnamed(true);
+ if (buffer.readString(lyx)) {
+ recordUndo(cur);
+ pasteParagraphList(cur, buffer.paragraphs(),
+ buffer.params().textclass, errorList);
+ cur.setSelection();
+ return;
+ }
+ }
+ }
+
+ // Then try plain text
+ docstring const text = theClipboard().getAsText();
+ if (text.empty())
+ return;
+ recordUndo(cur);
+ if (asParagraphs)
+ cur.text()->insertStringAsParagraphs(cur, text);
+ else
+ cur.text()->insertStringAsLines(cur, text);
+}
+
+
+void pasteSelection(LCursor & cur, ErrorList & errorList)
+{
+ if (selectionBuffer.empty())
+ return;
+ recordUndo(cur);
+ pasteParagraphList(cur, selectionBuffer[0].first,
+ selectionBuffer[0].second, errorList);