X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2FClipboard.h;h=3381475cbce95123d80cfcd6c2a3c0f02966135a;hb=e54ae72e5fac6f750c3f7972c74bb42b57f3a049;hp=ca046429fee49adfca2610cb42c8dcf8590faf8c;hpb=d8ae51dbe178d6b10a56c747cfd399a4dbba8117;p=lyx.git diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h index ca046429fe..3381475cbc 100644 --- a/src/frontends/Clipboard.h +++ b/src/frontends/Clipboard.h @@ -14,7 +14,7 @@ #ifndef BASE_CLIPBOARD_H #define BASE_CLIPBOARD_H -#include +#include "support/docstring.h" namespace lyx { namespace frontend { @@ -27,15 +27,46 @@ class Clipboard public: virtual ~Clipboard() {} - /// a selection exists - virtual void haveSelection(bool) = 0; - /// get the X clipboard contents - virtual std::string const get() const = 0; - /// fill the clipboard - virtual void put(std::string const &) = 0; + /** + * Get the system clipboard contents. The format is as written in + * .lyx files (may even be an older version than ours if it comes + * from an older LyX). + * Does not convert plain text to LyX if only plain text is available. + * This should be called when the user requests to paste from the + * 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; + /** + * Fill the system clipboard. The format of \p lyx is as written in + * .lyx files, the format of \p text is plain text. + * We put the clipboard contents in LyX format and plain text into + * the system clipboard if supported, so that it is useful for other + * applications as well as other instances of LyX. + * 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; + + /// Does the clipboard contain LyX contents? + virtual bool hasLyXContents() 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; + /// Is the clipboard empty? + /// \returns true if both the LyX and the plaintext versions of the + /// clipboard are empty. + virtual bool empty() const = 0; }; } // namespace frontend + +/// Implementation is in Application.cpp +extern frontend::Clipboard & theClipboard(); + } // namespace lyx + #endif // BASE_CLIPBOARD_H