X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2FClipboard.h;h=af617f5aecc4af11ac5889a35a83f6ea7ac947d5;hb=9da29ac7884158580a01f068952adef73ae11883;hp=3381475cbce95123d80cfcd6c2a3c0f02966135a;hpb=31334d39348282d4586eb82b9bb5e91f03018542;p=lyx.git diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h index 3381475cbc..af617f5aec 100644 --- a/src/frontends/Clipboard.h +++ b/src/frontends/Clipboard.h @@ -14,7 +14,9 @@ #ifndef BASE_CLIPBOARD_H #define BASE_CLIPBOARD_H -#include "support/docstring.h" +#include "Cursor.h" + +#include "support/strfwd.h" namespace lyx { namespace frontend { @@ -27,6 +29,25 @@ class Clipboard public: virtual ~Clipboard() {} + enum GraphicsType { + PdfGraphicsType, + PngGraphicsType, + JpegGraphicsType, + LinkBackGraphicsType, + EmfGraphicsType, + WmfGraphicsType, + AnyGraphicsType + }; + + enum TextType { + AnyTextType, + LyXOrPlainTextType, + PlainTextType, + HtmlTextType, + LaTeXTextType, + LyXTextType, + }; + /** * Get the system clipboard contents. The format is as written in * .lyx files (may even be an older version than ours if it comes @@ -36,8 +57,11 @@ public: * clipboard. */ virtual std::string const getAsLyX() const = 0; - /// Get the contents of the window system clipboard in plain text format. - virtual docstring const getAsText() const = 0; + /// Get the contents of the window system clipboard in any text format except LyxTextType. + virtual docstring const getAsText(TextType type) const = 0; + /// Get the contents of the window system clipboard as graphics file. + virtual support::FileName getAsGraphics(Cursor const & cur, GraphicsType type) const = 0; + /** * Fill the system clipboard. The format of \p lyx is as written in * .lyx files, the format of \p text is plain text. @@ -47,17 +71,25 @@ public: * This should be called when the user requests to cut or copy to * the clipboard. */ - virtual void put(std::string const & lyx, docstring const & text) = 0; + virtual void put(std::string const & lyx, docstring const & html, docstring const & text) = 0; + + /// Put a general string on the system clipboard (not LyX text) + virtual void put(std::string const & text) const = 0; - /// Does the clipboard contain LyX contents? - virtual bool hasLyXContents() const = 0; + /// Does the clipboard contain text contents? + virtual bool hasTextContents(TextType type = AnyTextType) const = 0; + /// Does the clipboard contain graphics contents of a certain type? + virtual bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const = 0; /// state of clipboard. /// \returns true if the system clipboard has been set within LyX /// (document contents, dialogs count as external here). virtual bool isInternal() const = 0; + /// \returns true if the OS has the concept of clipboard ownership, + /// which is crucial for our concept of internal clipboard. + virtual bool hasInternal() const = 0; /// Is the clipboard empty? /// \returns true if both the LyX and the plaintext versions of the - /// clipboard are empty. + /// clipboard are empty, and no supported graphics format is available. virtual bool empty() const = 0; };