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 GUICLIPBOARD_H
15 #define GUICLIPBOARD_H
17 #include "frontends/Clipboard.h"
21 #include <QStringList>
28 class QMacPasteboardMimeGraphics;
31 * \class CacheMimeData
33 * This class is used in order to query the clipboard only once on
34 * startup and once each time the contents of the clipboard changes.
36 class CacheMimeData : public QMimeData
40 // LyX calls "on_dataChanged" on startup, so it is not necessary to
41 // query the clipboard here.
45 /// reads the clipboard and updates the cached_formats_
47 /// returns the cached list of formats supported by the object
48 QStringList formats() const override { return cached_formats_; }
49 /// reads the clipboard and returns the data
50 QByteArray data(QString const & mimeType) const;
53 /// the cached list of formats supported by the object
54 QStringList cached_formats_;
59 * The Qt version of the Clipboard.
61 class GuiClipboard: public QObject, public Clipboard
67 /** Clipboard overloaded methods
70 std::string const getAsLyX() const override;
71 support::FileName getAsGraphics(Cursor const & cur, GraphicsType type) const override;
72 docstring const getAsText(TextType type) const override;
73 void put(std::string const & text) const override;
74 void put(std::string const & lyx, docstring const & html, docstring const & text) override;
75 bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const override;
76 bool hasTextContents(TextType type = AnyTextType) const override;
77 bool isInternal() const override;
78 bool hasInternal() const override;
79 bool empty() const override;
82 support::FileName getPastedGraphicsFileName(Cursor const & cur,
83 Clipboard::GraphicsType & type) const;
85 void setFindBuffer(docstring const & text) override;
88 void on_dataChanged();
89 void on_findChanged();
93 bool plaintext_clipboard_empty_;
94 bool has_text_contents_;
95 bool has_graphics_contents_;
96 /// the cached mime data used to describe the information
97 /// that can be stored in the clipboard
99 /// checksum for internal clipboard data (used on Mac)
100 std::uint32_t checksum;
103 QString const lyxMimeType();
104 QString const pdfMimeType();
105 QString const emfMimeType();
106 QString const wmfMimeType();
108 } // namespace frontend
111 #endif // GUICLIPBOARD_H