Scribus
Open source desktop publishing at your fingertips
pluginmanager.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 #ifndef _PLUGIN_MANAGER_
8 #define _PLUGIN_MANAGER_
9 
10 #include <QObject>
11 #include <QString>
12 #include <QMap>
13 
14 class QEvent;
15 
16 #include "scribusapi.h"
17 
18 class ScribusDoc;
19 class ScribusMainWindow;
20 class ScPlugin;
21 class ScActionPlugin;
22 class ScPersistentPlugin;
23 class PrefsContext;
24 class StoryEditor;
25 
35 class SCRIBUS_API PluginManager : public QObject
36 {
37 
38  Q_OBJECT
39 
40 public:
41 
42  PluginManager();
43  ~PluginManager();
44 
48  static void* loadDLL( QString plugin );
49  static void* resolveSym( void* plugin, const char* sym );
50  static void unloadDLL( void* plugin );
51 
60  void initPlugs();
61 
65  bool setupPluginActions(ScribusMainWindow*);
66 
70  bool setupPluginActions(StoryEditor *sew);
71 
74  void enableOnlyStartupPluginActions(ScribusMainWindow*);
77  void enablePluginActionsForSelection(ScribusMainWindow*);
78 
85  bool DLLexists(QString pluginName, bool includeDisabled = false) const;
86 
93  ScPlugin* getPlugin(const QString & pluginName, bool includeDisabled) const;
94 
96  void cleanupPlugins();
97 
99  void savePreferences();
100 
102  static QString platformDllExtension();
103 
105  static int platformDllSearchFlags();
106 
110  static PluginManager & instance();
111 
114  const QString getPluginPath(const QString & pluginName) const;
115 
118  bool & enableOnStartup(const QString & pluginName);
119 
121  bool enabled(const QString & pluginName);
122 
137  QStringList pluginNames(bool includeDisabled = false,
138  const char* inherits = 0) const;
139 
140  virtual void changeEvent(QEvent *e);
141 
142 public slots:
143 
144  void languageChange();
145 
146 protected:
147 
166  struct PluginData
167  {
168  QString pluginFile; // Datei;
169  QString pluginName;
170  void* pluginDLL;
171  ScPlugin* plugin;
172  bool enableOnStartup;
173  bool enabled;
174  };
175 
185  int initPlugin(const QString fileName);
186 
188  bool loadPlugin(PluginData & pluginData);
189 
191  static QString getPluginName(QString fileName);
192 
196  void enablePlugin(PluginData &);
197 
201  void disablePlugin(PluginData & pda);
202 
204  QString callDLLForNewLanguage(const PluginData & pluginData);
205 
211  void finalizePlug(PluginData & pluginData);
212 
215 
217  typedef QMap<QString,PluginData> PluginMap;
218 
222  PluginMap pluginMap;
223 };
224 
225 #endif
A plug-in that performs a single action.
Definition: scplugin.h:248
PrefsContext * prefs
Configuration structure.
Definition: pluginmanager.h:214
Abstract super class for all Scribus plug-ins.
Definition: scplugin.h:90
PluginData is structure for plugin related informations.
Definition: pluginmanager.h:166
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
PluginMap pluginMap
Plugin mapping. Each plugin has its record key() -> PluginData.
Definition: pluginmanager.h:222
QMap< QString, PluginData > PluginMap
Mapping of plugin names to plugin info structures.
Definition: pluginmanager.h:217
Definition: storyeditor.h:377
the Document Class
Definition: scribusdoc.h:90
PluginManager handles plugin loading, unloading, and running.
Definition: pluginmanager.h:35
A plug-in that is resident for the lifetime of the app.
Definition: scplugin.h:454
Definition: prefscontext.h:40