Subversion Repositories Scribus

Rev

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