Scribus
Open source desktop publishing at your fingertips
scmimedata.h
1 /*
2  For general Scribus (>=1.3.2) copyright and licensing information please refer
3  to the COPYING file provided with the program. Following this notice may exist
4  a copyright and/or license notice that predates the release of Scribus 1.3.2
5  for which a new license (GPL+exception) is in place.
6  */
7 /***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 
16 
17 
18 #ifndef SCMIMEDATA_H
19 #define SCMIMEDATA_H
20 
21 #include <QByteArray>
22 #include <QMimeData>
23 #include <QString>
24 #include <QStringList>
25 #include <QVariant>
26 
27 #include "scribusapi.h"
28 
29 class SCRIBUS_API ScMimeData
30 {
31 public:
32  static const QString ScribusElemMimeType;
33  static const QString ScribusFragmentMimeType;
34  static const QString ScribusTextMimeType;
35 
36  static bool clipboardHasScribusData(void);
37  static bool clipboardHasScribusElem(void);
38  static bool clipboardHasScribusFragment(void);
39  static bool clipboardHasScribusText(void);
40  static bool clipboardHasPlainText(void);
41  static bool clipboardHasKnownData(void);
42  static QString clipboardKnownDataExt(void);
43  static QByteArray clipboardKnownDataData(void);
44 
45  static QString clipboardScribusElem(void);
46  static QByteArray clipboardScribusFragment(void);
47  static QByteArray clipboardScribusText(void);
48 };
49 
50 class SCRIBUS_API ScFragmentMimeData : public QMimeData
51 {
52 public:
53  ScFragmentMimeData(void) : QMimeData() {};
54 
55  void setScribusFragment(const QByteArray& fragment) { setData(ScMimeData::ScribusFragmentMimeType, fragment); }
56  QByteArray scribusFragment(void) { return data(ScMimeData::ScribusFragmentMimeType); }
57 };
58 
59 class SCRIBUS_API ScElemMimeData : public QMimeData
60 {
61 protected:
62  QString m_scribusElemData;
63  QStringList m_formats;
64 
65  virtual QVariant retrieveData ( const QString & mimeType, QVariant::Type type ) const;
66 
67 public:
68  ScElemMimeData(void);
69 
70  virtual QStringList formats() const { return m_formats; }
71  virtual bool hasFormat ( const QString & mimeType ) const;
72 
73  void setScribusElem(const QString& elem) { m_scribusElemData = elem; }
74  const QString& scribusElem(void) const { return m_scribusElemData; }
75 };
76 
77 class SCRIBUS_API ScTextMimeData : public QMimeData
78 {
79 public:
80  ScTextMimeData(void) : QMimeData() {};
81 
82  void setScribusText(const QByteArray& scText) { setData(ScMimeData::ScribusTextMimeType, scText); }
83  QByteArray scribusText(void) { return data(ScMimeData::ScribusFragmentMimeType); }
84 };
85 
86 #endif
Definition: scmimedata.h:50
Definition: scmimedata.h:77
Definition: scmimedata.h:59
Definition: scmimedata.h:29