public bool Paste(bool run = true)
{
if (Clipboard.ContainsData("DiagramDocument"))
{
if (run)
{
var buf = Clipboard.GetData("DiagramDocument") as byte[];
if (buf != null)
PasteAndSelect(new MemoryStream(buf), VectorT.Zero);
}
return true;
}
else if (Clipboard.ContainsText())
{
if (run)
{
var text = Clipboard.GetText();
DoOrUndo act = null;
if (_focusShape != null && (act = _focusShape.AppendTextAction(text)) != null)
_doc.UndoStack.Do(act, true);
else
{
var textBox = new TextBox(new BoundingBox<Coord>(0, 0, 300, 200))
{
Text = text,
TextJustify = LLTextShape.JustifyMiddleCenter,
BoxType = BoxType.Borderless,
Style = BoxStyle
};
_doc.AddShape(textBox);
}
}
return true;
}
return false;
}