4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
14 #ifndef BASE_CLIPBOARD_H
15 #define BASE_CLIPBOARD_H
17 #include "support/strfwd.h"
23 namespace support { class FileName; }
28 * A Clipboard class manages the clipboard.
33 virtual ~Clipboard() {}
55 * Get the system clipboard contents. The format is as written in
56 * .lyx files (may even be an older version than ours if it comes
58 * Does not convert plain text to LyX if only plain text is available.
59 * This should be called when the user requests to paste from the
62 virtual std::string const getAsLyX() const = 0;
63 /// Get the contents of the window system clipboard in any text format except LyxTextType.
64 virtual docstring const getAsText(TextType type) const = 0;
65 /// Get the contents of the window system clipboard as graphics file.
66 virtual support::FileName getAsGraphics(Cursor const & cur, GraphicsType type) const = 0;
68 virtual docstring const & getFindBuffer() { return find_buffer_; }
71 * Fill the system clipboard. The format of \p lyx is as written in
72 * .lyx files, the format of \p text is plain text.
73 * We put the clipboard contents in LyX format and plain text into
74 * the system clipboard if supported, so that it is useful for other
75 * applications as well as other instances of LyX.
76 * This should be called when the user requests to cut or copy to
79 virtual void put(std::string const & lyx, docstring const & html, docstring const & text) = 0;
81 /// Put a general string on the system clipboard (not LyX text)
82 virtual void put(std::string const & text) const = 0;
84 virtual void setFindBuffer(docstring const & text) { find_buffer_ = text;}
86 /// Does the clipboard contain text contents?
87 virtual bool hasTextContents(TextType type = AnyTextType) const = 0;
88 /// Does the clipboard contain graphics contents of a certain type?
89 virtual bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const = 0;
90 /// state of clipboard.
91 /// \returns true if the system clipboard has been set within LyX
92 /// (document contents, dialogs count as external here).
93 virtual bool isInternal() const = 0;
94 /// \returns true if the OS has the concept of clipboard ownership,
95 /// which is crucial for our concept of internal clipboard.
96 virtual bool hasInternal() const = 0;
97 /// Is the clipboard empty?
98 /// \returns true if both the LyX and the plaintext versions of the
99 /// clipboard are empty, and no supported graphics format is available.
100 virtual bool empty() const = 0;
103 docstring find_buffer_;
106 } // namespace frontend
108 /// Implementation is in Application.cpp
109 extern frontend::Clipboard & theClipboard();
114 #endif // BASE_CLIPBOARD_H