X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.cpp;h=f657d57cbde9d0a876bc52c623142cb96964902f;hb=6b651f2ad9f698c01993dcc6e340682c279f1c55;hp=d470a294f9cc3b83ae3dcb0168c5045032c0f4d0;hpb=9abb7db46800e554f57e865a3e768602ffd9d6f1;p=lyx.git diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index d470a294f9..f657d57cbd 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -38,6 +38,8 @@ #include "Undo.h" #include "insets/InsetFlex.h" +#include "insets/InsetGraphics.h" +#include "insets/InsetGraphicsParams.h" #include "insets/InsetTabular.h" #include "mathed/MathData.h" @@ -60,6 +62,7 @@ using namespace std; using namespace lyx::support; +using lyx::frontend::Clipboard; namespace lyx { @@ -734,7 +737,7 @@ void pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index) } -void pasteClipboard(Cursor & cur, ErrorList & errorList, bool asParagraphs) +void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs) { // Use internal clipboard if it is the most recent one if (theClipboard().isInternal()) { @@ -772,6 +775,26 @@ void pasteClipboard(Cursor & cur, ErrorList & errorList, bool asParagraphs) } +void pasteClipboardGraphics(Cursor & cur, ErrorList & errorList, + Clipboard::GraphicsType preferedType) +{ + BOOST_ASSERT(theClipboard().hasGraphicsContents(preferedType)); + + // get picture from clipboard + FileName filename = theClipboard().getAsGraphics(cur, preferedType); + if (filename.empty()) + return; + + // create inset for graphic + InsetGraphics * inset = new InsetGraphics; + InsetGraphicsParams params; + params.filename = EmbeddedFile(filename.absFilename(), cur.buffer().filePath()); + inset->setParams(params); + cur.recordUndo(); + cur.insert(inset); +} + + void pasteSelection(Cursor & cur, ErrorList & errorList) { if (selectionBuffer.empty())