Subversion Repositories Scribus

Rev

Rev 5715 | Rev 5865 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5715 tsoots 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
#ifndef SCGTPLUGIN_H
9
#define SCGTPLUGIN_H
10
 
11
#include "scribusapi.h"
12
#include "scplugin.h"
13
 
14
#include <qfiledialog.h>
15
 
16
class QString;
17
class QCheckBox;
18
class QStringList;
19
class QDir;
20
 
21
/**
22
  @brief Super class for all text importer plugins.
23
  @sa ScPlugin
24
  @date 2006-06-05
25
  @author Riku Leino <riku@scribus.info>
26
  @note KK2006
27
 */
28
class SCRIBUS_API ScGTPlugin : public ScPlugin
29
{
30
public:
31
        ScGTPlugin();
5753 jghali 32
        ~ScGTPlugin() {};
5715 tsoots 33
 
34
        /**
35
          @brief Returns the file format's name that this plugin can import or QString::null
36
          @brief if this plugin doesn't handle files.
37
          @return file format's name or QString::null if this plugin doesn't handle files
38
         */
39
        virtual QString fileFormatName() const = 0;
40
 
41
        /**
42
          @brief Returns file extensions this plugin can handle or an empty list if
43
          @brief this plugin is a text/style formatter plugin.
44
          @return file extensions this plugin can handle
45
         */
46
        virtual QStringList fileExtensions() const = 0;
47
 
48
        /**
49
          @brief Run the plugin and import from the file <code>filename</code>
50
 
51
          This function is ment to be overriden by all file format plugins.
52
          Once the file decoding and text and style has been sorted out use the
53
          function forward() to pass the text and it's style forward to a text frame
54
          or to another plugin.
55
          @sa forward()
56
          @param filename name of the file that is wanted to be imported
57
          @param encoding encoding as selected by a user in the import file dialog
58
         */
59
        virtual void run(const QString &filename, const QString &encoding = QString::null) {};
60
 
61
        /**
62
          @brief Run the plugin and do the magic with the <code>text</code> and
63
          @brief <code>style</code>.
64
 
65
          This function is ment to be overriden by all text and style handler plugins.
66
          @param text text to work with
67
         */
68
        virtual void run(const QString &text /*, insert style stuff here */) {};
69
 
70
};
71
 
72
/***************************************************************************************/
73
/***************************************************************************************/
74
 
75
/**
76
  @brief Manages the import process.
77
 
78
  All ScGTPlugins must be registered to the ScGTPluginManager with the function
79
  registerGTPlugin(). Only registered plugins will be used.
80
  @date 2006-06-05
81
  @author Riku Leino <riku@scribus.info>
82
  @note KK2006
83
 */
84
class SCRIBUS_API ScGTPluginManager {
85
public:
86
        static ScGTPluginManager* instance(); // singleton
87
        static void deleteInstance();
88
 
89
        void registerGTPlugin(ScGTPlugin *plugin);
90
        void unRegisterGTPlugin(ScGTPlugin *plugin);
91
 
92
        /** @brief Run the Get Text importer. Attached to the Get Text action */
93
        void run();
94
 
95
private:
96
        static ScGTPluginManager *instance_;
97
 
98
        QPtrList<ScGTPlugin> plugins_;
99
 
100
        ScGTPluginManager();
101
        ~ScGTPluginManager();
102
 
103
        QString fileFilter();
104
 
105
        /** @brief User has requested options which will be launched from here */
106
        void options();
107
};
108
 
109
/***************************************************************************************/
110
/***************************************************************************************/
111
 
112
class SCRIBUS_API ScGTFileDialog : public QFileDialog {
113
public:
114
        ScGTFileDialog(const QString & dirName,
115
                       const QString & filters,
116
                       QWidget * parent = 0, const char * name = 0);
117
        ~ScGTFileDialog();
118
 
119
        bool showOptions() const;
120
 
121
private:
122
        QCheckBox *showOptionsBox_;
123
        void customize();
124
};
125
 
126
/***************************************************************************************/
127
/***************************************************************************************/
128
 
129
class SCRIBUS_API ScGTOptions {
130
 
131
};
132
 
133
/***************************************************************************************/
134
/***************************************************************************************/
135
 
136
class SCRIBUS_API ScGTOptionsWindow {
137
 
138
};
139
 
140
#endif