* de.po: sync with branch.
[lyx.git] / src / frontends / Clipboard.h
blob7235b01013cb738c2b460c4867ae1da67655773c
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.
7 * \author unknown
8 * \author John Levon
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 "Cursor.h"
19 #include "support/FileName.h"
20 #include "support/strfwd.h"
22 using lyx::support::FileName;
24 namespace lyx {
25 namespace frontend {
27 /**
28 * A Clipboard class manages the clipboard.
30 class Clipboard
32 public:
33 virtual ~Clipboard() {}
35 enum GraphicsType {
36 PdfGraphicsType,
37 PngGraphicsType,
38 JpegGraphicsType,
39 LinkBackGraphicsType,
40 EmfGraphicsType,
41 WmfGraphicsType,
42 AnyGraphicsType,
45 /**
46 * Get the system clipboard contents. The format is as written in
47 * .lyx files (may even be an older version than ours if it comes
48 * from an older LyX).
49 * Does not convert plain text to LyX if only plain text is available.
50 * This should be called when the user requests to paste from the
51 * clipboard.
53 virtual std::string const getAsLyX() const = 0;
54 /// Get the contents of the window system clipboard in plain text format.
55 virtual docstring const getAsText() const = 0;
56 /// Get the contents of the window system clipboard as graphics file.
57 virtual FileName getAsGraphics(Cursor const & cur, GraphicsType type) const = 0;
59 /**
60 * Fill the system clipboard. The format of \p lyx is as written in
61 * .lyx files, the format of \p text is plain text.
62 * We put the clipboard contents in LyX format and plain text into
63 * the system clipboard if supported, so that it is useful for other
64 * applications as well as other instances of LyX.
65 * This should be called when the user requests to cut or copy to
66 * the clipboard.
68 virtual void put(std::string const & lyx, docstring const & text) = 0;
70 /// Does the clipboard contain LyX contents?
71 virtual bool hasLyXContents() const = 0;
72 /// Does the clipboard contain text contents?
73 virtual bool hasTextContents() const = 0;
74 /// Does the clipboard contain graphics contents of a certain type?
75 virtual bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const = 0;
76 /// state of clipboard.
77 /// \returns true if the system clipboard has been set within LyX
78 /// (document contents, dialogs count as external here).
79 virtual bool isInternal() const = 0;
80 /// \returns true if the OS has the concept of clipboard ownership,
81 /// which is crucial for our concept of internal clipboard.
82 virtual bool hasInternal() const = 0;
83 /// Is the clipboard empty?
84 /// \returns true if both the LyX and the plaintext versions of the
85 /// clipboard are empty, and no supported graphics format is available.
86 virtual bool empty() const = 0;
89 } // namespace frontend
91 /// Implementation is in Application.cpp
92 extern frontend::Clipboard & theClipboard();
94 } // namespace lyx
97 #endif // BASE_CLIPBOARD_H