]> git.lyx.org Git - lyx.git/blob - src/frontends/Clipboard.h
fix scrolling bug: 3320 and 3652, maybe not perfect
[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         /// \returns true if the system clipboard has been set within LyX
56         /// (document contents, dialogs count as external here).
57         virtual bool isInternal() const = 0;
58         /// Is the clipboard empty?
59         /// \returns true if both the LyX and the plaintext versions of the
60         /// clipboard are empty.
61         virtual bool empty() const = 0;
62 };
63
64 } // namespace frontend
65
66 /// Implementation is in Application.cpp
67 extern frontend::Clipboard & theClipboard();
68
69 } // namespace lyx
70
71
72 #endif // BASE_CLIPBOARD_H