Back to index

scribus-ng  1.3.4.dfsg+svn20071115
pluginmanager.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef _PLUGIN_MANAGER_
00008 #define _PLUGIN_MANAGER_
00009 
00010 #include <qobject.h>
00011 #include <qstring.h>
00012 #include <qmap.h>
00013 #include <qvaluelist.h>
00014 
00015 #include "scribusapi.h"
00016 
00017 class ScribusDoc;
00018 class ScribusMainWindow;
00019 class ScPlugin;
00020 class ScActionPlugin;
00021 class ScPersistentPlugin;
00022 class PrefsContext;
00023 
00033 class SCRIBUS_API PluginManager : public QObject
00034 {
00035 
00036        Q_OBJECT
00037 
00038 public:
00039 
00040        PluginManager();
00041        ~PluginManager();
00042 
00046        static void* loadDLL( QString plugin );
00047        static void* resolveSym( void* plugin, const char* sym );
00048        static void  unloadDLL( void* plugin );
00049 
00058        void initPlugs();
00059 
00063        bool setupPluginActions(ScribusMainWindow*);
00064 
00065 
00072        bool DLLexists(QCString pluginName, bool includeDisabled = false) const;
00073 
00080        ScPlugin* getPlugin(const QCString & pluginName, bool includeDisabled) const;
00081 
00083        void cleanupPlugins();
00084 
00086        void savePreferences();
00087 
00089        static QCString platformDllExtension();
00090 
00094        static PluginManager & instance();
00095 
00098        const QString & getPluginPath(const QCString pluginName) const;
00099 
00102        bool & enableOnStartup(const QCString pluginName);
00103 
00105        bool enabled(const QCString pluginName);
00106 
00121        QValueList<QCString> pluginNames(bool includeDisabled = false,
00122                                                                 const char* inherits = 0) const;
00123 
00124 public slots:
00125 
00126        void languageChange();
00127 
00128 protected:
00129 
00148        struct PluginData
00149        {
00150               QString pluginFile; // Datei;
00151               QCString pluginName;
00152               void* pluginDLL;
00153               ScPlugin* plugin;
00154               bool enableOnStartup;
00155               bool enabled;
00156        };
00157 
00167        int initPlugin(const QString fileName);
00168 
00170        bool loadPlugin(PluginData & pluginData);
00171 
00173        static QCString getPluginName(QString fileName);
00174 
00178        void enablePlugin(PluginData &);
00179 
00183        void disablePlugin(PluginData & pda);
00184 
00186        QString callDLLForNewLanguage(const PluginData & pluginData);
00187 
00193        void finalizePlug(PluginData & pda);
00194 
00196        PrefsContext* prefs;
00197 
00199        typedef QMap<QCString,PluginData> PluginMap;
00200 
00204        PluginMap pluginMap;
00205 };
00206 
00207 #endif