#include "support/debug.h"
#include "support/docstream.h"
#include "support/gettext.h"
+#include "support/lassert.h"
#include "support/limited_stack.h"
#include "support/lstrings.h"
if (ref->getParam("reference") == oldname)
ref->setParam("reference", newname);
} else if (itt->lyxCode() == MATH_REF_CODE) {
- InsetMathHull * mi = itt->asInsetMath()->asHullInset();
+ InsetMathRef * mi = itt->asInsetMath()->asRefInset();
// this is necessary to prevent an uninitialized
// buffer when the RefInset is in a MathBox.
// FIXME audit setBuffer calls
mi->setBuffer(const_cast<Buffer &>(buffer));
- if (mi->asRefInset()->getTarget() == oldname)
- mi->asRefInset()->changeTarget(newname);
+ if (mi->getTarget() == oldname)
+ mi->changeTarget(newname);
}
}
}
if (ref.getParam("reference") == oldname)
ref.setParam("reference", newname);
} else if (itt->lyxCode() == MATH_REF_CODE) {
- InsetMathHull & mi =
- static_cast<InsetMathHull &>(*itt);
+ InsetMathRef * mi = itt->asInsetMath()->asRefInset();
// this is necessary to prevent an uninitialized
// buffer when the RefInset is in a MathBox.
// FIXME audit setBuffer calls
- mi.setBuffer(const_cast<Buffer &>(buffer));
- if (mi.asRefInset()->getTarget() == oldname)
- mi.asRefInset()->changeTarget(newname);
+ mi->setBuffer(const_cast<Buffer &>(buffer));
+ if (mi->getTarget() == oldname)
+ mi->changeTarget(newname);
}
}
break;
cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
else
cur.text()->insertStringAsLines(cur, text, cur.current_font);
+ cur.setSelection();
+}
+
+
+void pasteSimpleText(Cursor & cur, bool asParagraphs)
+{
+ docstring text;
+ // Use internal clipboard if it is the most recent one
+ if (theClipboard().isInternal()) {
+ if (!checkPastePossible(0))
+ return;
+
+ ParagraphList const & pars = theCuts[0].first;
+ ParagraphList::const_iterator it = pars.begin();
+ for (; it != pars.end(); ++it) {
+ if (it != pars.begin())
+ text += "\n";
+ text += (*it).asString();
+ }
+ asParagraphs = false;
+ } else {
+ // Then try plain text
+ text = theClipboard().getAsText();
+ }
+
+ if (text.empty())
+ return;
+
+ cur.recordUndo();
+ cutSelection(cur, true, false);
+ if (asParagraphs)
+ cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
+ else
+ cur.text()->insertStringAsLines(cur, text, cur.current_font);
}