]> git.lyx.org Git - lyx.git/blob - src/frontends/Clipboard.h
deddf5b0c98e72e914528b7907a94652af86d332
[lyx.git] / src / frontends / Clipboard.h
1 // -*- C++ -*-
2 /**
3  * \file Clipboard.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef BASE_CLIPBOARD_H
15 #define BASE_CLIPBOARD_H
16
17 #include "support/docstring.h"
18
19 namespace lyx {
20 namespace frontend {
21
22 /**
23  * A Clipboard class manages the clipboard.
24  */
25 class Clipboard
26 {
27 public:
28         virtual ~Clipboard() {}
29
30         /**
31          * Get the system clipboard contents. The format is as written in
32          * .lyx files (may even be an older version than ours if it comes
33          * from an older LyX).
34          * Does not convert plain text to LyX if only plain text is available.
35          * This should be called when the user requests to paste from the
36          * clipboard.
37          */
38         virtual std::string const getAsLyX() const = 0;
39         /// Get the contents of the window system clipboard in plain text format.
40         virtual docstring const getAsText() const = 0;
41         /**
42          * Fill the system clipboard. The format of \p lyx is as written in
43          * .lyx files, the format of \p text is plain text.
44          * We put the clipboard contents in LyX format and plain text into
45          * the system clipboard if supported, so that it is useful for other
46          * applications as well as other instances of LyX.
47          * This should be called when the user requests to cut or copy to
48          * the clipboard.
49          */
50         virtual void put(std::string const & lyx, docstring const & text) = 0;
51
52         /// Does the clipboard contain LyX contents?
53         virtual bool hasLyXContents() const = 0;
54         /// state of clipboard.
55         /// \retval true if the system clipboard has been set within LyX.
56         virtual bool isInternal() const = 0;
57         /// Is the clipboard empty?
58         virtual bool empty() const = 0;
59 };
60
61 } // namespace frontend
62
63 /// Implementation is in Application.C
64 extern frontend::Clipboard & theClipboard();
65
66 } // namespace lyx
67
68
69 #endif // BASE_CLIPBOARD_H