? isTableItem
? plugins/monitorprofile
Index: pluginmanager.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/pluginmanager.cpp,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 pluginmanager.cpp
--- pluginmanager.cpp	9 Jun 2005 00:07:01 -0000	1.1.2.14
+++ pluginmanager.cpp	30 Jun 2005 17:01:26 -0000
@@ -1,7 +1,8 @@
 #include "pluginmanager.h"
 #include "pluginmanager.moc"
-#include <dlfcn.h>
+
 #include <qdir.h>
+
 #include "scribus.h"
 #include "scribusapp.h"
 #include "menumanager.h"
@@ -119,8 +120,7 @@
 
 void PluginManager::callDLL(int pluginID)
 {
-	void *mo;
-	const char *error;
+	QLibrary *qlib;
 	struct PluginData pda;
 	pda = pluginMap[pluginID];
 	typedef void (*sdem)(QWidget *d, ScribusApp *plug);
@@ -129,79 +129,72 @@
 	if (pda.type != 4 && pda.type !=5)
 	{
 		plugDir += pda.pluginFile;
-		mo = dlopen(plugDir, RTLD_LAZY | RTLD_GLOBAL);
-		if (!mo)
-		{
-			qDebug( tr("Cannot find plugin"), "plugin manager");
-			return;
-		}
+		qlib = new QLibrary(plugDir);
 	}
 	else
-		mo = pda.index;
-	dlerror();
-	demo = (sdem)dlsym(mo, "run");
-	if ((error = dlerror()) != NULL)
+		qlib = pda.index;
+
+	demo = (sdem) qlib->resolve("run");
+	if ( !demo )
 	{
-		qDebug( tr(QString("Cannot find symbol (%1)").arg(error)), "plugin manager");
-		dlclose(mo);
+		qDebug( tr(QString("Cannot find symbol (%1) or plugin missing").arg("run")), "plugin manager");
+		delete qlib;
 		return;
 	}
 	(*demo)(ScApp, ScApp);
 	// FIXME: how is the menu organized? (*demo)(ScApp->scrActions[pluginMap[pluginID].actName], ScApp);
 	if (pda.type != 4 && pda.type != 5)
-		dlclose(mo);
+	{
+		pda.index = NULL;
+		delete qlib;
+	}
 	if (ScApp->HaveDoc)
 		ScApp->view->DrawNew();
 }
 
 QString PluginManager::callDLLForNewLanguage(int pluginID)
 {
-	void *mo;
-	const char *error;
+	QLibrary *qlib;
+	bool qdel = false;
 	struct PluginData pda;
 	pda = pluginMap[pluginID];
 	typedef QString (*sdem)();
 	typedef void (*sdem0)();
-	sdem demo;
-	sdem0 demo0;
+	sdem demo = NULL;
+	sdem0 demo0 = NULL;
 	QString plugDir = ScPaths::instance().pluginDir();
+	
 	if (pda.type != 4 && pda.type !=5)
 	{
 		plugDir += pda.pluginFile;
-		mo = dlopen(plugDir, RTLD_LAZY | RTLD_GLOBAL);
-		if (!mo)
-		{
-			qDebug( tr("Cannot find plugin"), "plugin manager");
-			return QString::null;
-		}
+		qlib = new QLibrary(plugDir);
+		qdel = true;
 	}
 	else
-		mo = pda.index;
-	dlerror();
-	// Grab the menu string from the plugin again
-	demo = (sdem)dlsym(mo, "name");
-	if ((error = dlerror()) != NULL)
+		qlib = pda.index;
+
+	demo = (sdem) qlib->resolve("name");
+	if ( !demo)
 	{
-		qDebug( tr(QString("Cannot find symbol (%1)").arg(error)), "plugin manager");
-		//dlclose(mo);
+		qDebug( tr(QString("Cannot find symbol (%1) or plugin missing").arg("name")), "plugin manager");
+		if( qdel ) delete(qlib);
 		return QString::null;
 	}
 	QString retVal=(*demo)();	
 	//If scripter, get it to update its scrActions.
 	if (pluginID==8)
 	{
-		dlerror();
-		demo0 = (sdem0)dlsym(mo, "languageChange");
-		if ((error = dlerror()) != NULL)
+		demo0 = (sdem0) qlib->resolve("languageChange");
+		if ( !demo0 )
 		{
-			dlclose(mo);
-			return false;
+			if( qdel ) delete qlib;
+			return QString::null;
 		}
 		(*demo0)();
 	}
 
 	if (pda.type != 4 && pda.type != 5)
-		dlclose(mo);
+		delete qlib;
 	return retVal;
 }
 
@@ -225,10 +218,9 @@
 	}
 }
 
-bool PluginManager::DLLname(QString name, QString *pluginName, PluginType *type, void **index, int *idNr, QString *actName, QString *actKeySequence, QString *actMenu, QString *actMenuAfterName, bool *actEnabledOnStartup, bool loadPlugin)
+bool PluginManager::DLLname(QString name, QString *pluginName, PluginType *type, QLibrary **index, int *idNr, QString *actName, QString *actKeySequence, QString *actMenu, QString *actMenuAfterName, bool *actEnabledOnStartup, bool loadPlugin)
 {
-	void *mo;
-	const char *error;
+	QLibrary *mo;
 	typedef QString (*sdem0)();
 	typedef PluginType (*sdem1)();
 	typedef void (*sdem2)(QWidget *d, ScribusApp *plug);
@@ -242,75 +234,67 @@
 	QString plugName = ScPaths::instance().pluginDir();
 	plugName += name;
 
-	mo = dlopen(plugName, RTLD_LAZY | RTLD_GLOBAL);
-	if (!mo)
-	{
-		qDebug( tr(QString("Error: %1").arg(dlerror())), "plugin manager");
-		return false;
-	}
-	dlerror();
-	demo = (sdem0)dlsym(mo, "name");
-	if ((error = dlerror()) != NULL)
+	mo = new QLibrary(plugName);
+	demo = (sdem0) mo->resolve("name");
+	if ( !demo )
 	{
-		dlclose(mo);
+		delete mo;
 		return false;
 	}
 	*pluginName = (*demo)();
-	dlerror();
-	demo1 = (sdem1)dlsym(mo, "type");
-	if ((error = dlerror()) != NULL)
+
+	demo1 = (sdem1) mo->resolve("type");
+	if ( !demo1 )
 	{
-		dlclose(mo);
+		delete mo;
 		return false;
 	}
 	*type = (*demo1)();
 	*index = mo;
-	plugID = (sdemID)dlsym(mo, "ID");
-	if ((error = dlerror()) != NULL)
+
+	plugID = (sdemID) mo->resolve("ID");
+	if( !plugID )
 	{
-		dlclose(mo);
+		delete mo;
 		return false;
 	}
 	*idNr = (*plugID)();
+
 	//ScrAction based plugins
 	if (*type == Persistent || *type == Standard || *type == Import)
 	{
-		demo = (sdem0)dlsym(mo, "actionName");
-		if ((error = dlerror()) != NULL)
+		demo = (sdem0) mo->resolve("actionName");
+		if ( !demo )
 		{
-			dlclose(mo);
+			delete (mo);
 			return false;
 		}
 		*actName = (*demo)();
-		dlerror();
-		demo = (sdem0)dlsym(mo, "actionKeySequence");
-		if ((error = dlerror()) != NULL)
+		demo = (sdem0) mo->resolve("actionKeySequence");
+		if ( !demo )
 		{
-			dlclose(mo);
+			delete (mo);
 			return false;
 		}
 		*actKeySequence = (*demo)();
-		dlerror();
-		demo = (sdem0)dlsym(mo, "actionMenu");
-		if ((error = dlerror()) != NULL)
+		demo = (sdem0) mo->resolve("actionMenu");
+		if ( !demo )
 		{
-			dlclose(mo);
+			delete mo;
 			return false;
 		}
 		*actMenu = (*demo)();
-		dlerror();
-		demo = (sdem0)dlsym(mo, "actionMenuAfterName");
-		if ((error = dlerror()) != NULL)
+		demo = (sdem0) mo->resolve("actionMenuAfterName");
+		if ( !demo )
 		{
-			dlclose(mo);
+			delete mo;
 			return false;
 		}
 		*actMenuAfterName = (*demo)();
-		dlerror();
-		demo3 = (sdem3)dlsym(mo, "actionEnabledOnStartup");
-		if ((error = dlerror()) != NULL)
+		demo3 = (sdem3) mo->resolve("actionEnabledOnStartup");
+		if ( !demo3 )
 		{
-			dlclose(mo);
+			delete mo;
 			return false;
 		}
 		*actEnabledOnStartup = (*demo3)();
@@ -324,16 +308,15 @@
 		*actEnabledOnStartup = false;
 	}
 	if (*type != Persistent && *type!= Type5)
-		dlclose(mo);
+		delete mo;
 	else
 	{
 		if (loadPlugin)
 		{
-			dlerror();
-			demo2 = (sdem2)dlsym(mo, "initPlug");
-			if ((error = dlerror()) != NULL)
+			demo2 = (sdem2) mo->resolve("initPlug");
+			if ( demo2 == NULL)
 			{
-				dlclose(mo);
+				delete mo;
 				return false;
 			}
 			(*demo2)(ScApp, ScApp);
@@ -352,21 +335,17 @@
 
 void PluginManager::finalizePlug(int pluginID)
 {
-	const char *error;
 	struct PluginData pda;
 	typedef void (*sdem2)();
 	sdem2 demo2;
 	PluginData plug = pluginMap[pluginID];
 	if (plug.type == Persistent || plug.type == Type5)
 	{
-		dlerror();
-		demo2 = (sdem2)dlsym(plug.index, "cleanUpPlug");
-		if ((error = dlerror()) != NULL)
-		{
-			dlclose(plug.index);
-		}
-		else
+		QLibrary* qlib = plug.index;
+		demo2 = (sdem2) qlib->resolve("cleanUpPlug");
+		if ( demo2 )
 			(*demo2)();
+		delete(plug.index);
 	}
 }
 
@@ -403,6 +382,8 @@
 
 	//return "dylib";
 	return "so";
+#elif defined(_WIN32) || defined(_WIN64)
+	return "dll";
 #else
 	// Generic *NIX
 	return "so";
Index: pluginmanager.h
===================================================================
RCS file: /cvs/Scribus/scribus/Attic/pluginmanager.h,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 pluginmanager.h
--- pluginmanager.h	22 May 2005 20:41:25 -0000	1.1.2.9
+++ pluginmanager.h	30 Jun 2005 17:01:26 -0000
@@ -3,7 +3,7 @@
 
 #include <qobject.h>
 #include <qstring.h>
-#include <qmap.h>
+#include <qlibrary.h>
 #include "scribus.h"
 
 /**
@@ -48,7 +48,7 @@
 	{
 		QString pluginFile;// Datei;
 		QString name;
-		void *index; //Zeiger;
+		QLibrary *index; //Zeiger;
 		PluginType type;
 		int menuID;
 		QString actName;
@@ -76,7 +76,7 @@
 	/*! unused/obsolete */
 	void callDLLbyMenu(int pluginID);
 	/*! \brief Reads available info and fills PluginData structure */
-	bool DLLname(QString name, QString *pluginName, PluginType *type, void **index, int *idNr, QString *actName, QString *actKeySequence, QString *actMenu, QString *actMenuAfterName, bool *actEnabledOnStartup, bool loadPlugin);
+	bool DLLname(QString name, QString *pluginName, PluginType *type, QLibrary **index, int *idNr, QString *actName, QString *actKeySequence, QString *actMenu, QString *actMenuAfterName, bool *actEnabledOnStartup, bool loadPlugin);
 	/*! \brief Shutdowns all plugins. Called at scribus quit */
 	void finalizePlugs();
 	/*! \brief Shutdowns one plugin.
Index: scribus.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/scribus.cpp,v
retrieving revision 1.228.2.394
diff -u -r1.228.2.394 scribus.cpp
--- scribus.cpp	30 Jun 2005 16:06:10 -0000	1.228.2.394
+++ scribus.cpp	30 Jun 2005 17:01:29 -0000
@@ -33,13 +33,19 @@
 #include <cstdio>
 #include <cstdlib>
 #include <cmath>
+
+#ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+
 #include <iostream>
 #include <signal.h>
 #include <string>
 
-
 #include "scribusapp.h"
 #include "scribus.h"
 #include "scribus.moc"
@@ -5479,7 +5485,7 @@
 		}
 		else
 			retw = false;
-		delete dd;
+		delete dd; // Not Windows friendly, should be something like dd->destroyInstance();
 		closePSDriver();
 	}
 	fileWatcher->start();
@@ -8638,6 +8644,8 @@
 	raise();
 }
 
+#ifdef HAVE_DLFCN_H
+
 PSLib* ScribusApp::getPSDriver(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf)
 {
 	const char *error;
@@ -8662,9 +8670,34 @@
 	return dia;
 }
 
+#else
+
+PSLib* ScribusApp::getPSDriver(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf)
+{
+	typedef PSLib* (*sdem)(bool psart, SCFonts &AllFonts, QMap<QString,QFont> DocFonts, ColorList DocColors, bool pdf);
+	sdem pfunc;
+	QString pfad = QString("%1/libs/libpostscript.%3").arg(ScPaths::instance().libDir()).arg(PluginManager::platformDllExtension());
+	PSDriver = new QLibrary(pfad);
+	pfunc = (sdem) PSDriver->resolve("Run");
+	if ( !pfunc )
+	{
+		std::cout << "Cannot find symbol or driver missing" << endl;
+		delete PSDriver;
+		return NULL;
+	}
+	PSLib *dia = (*pfunc)(psart, AllFonts, DocFonts, DocColors, pdf);
+	return dia;
+}
+
+#endif
+
 void ScribusApp::closePSDriver()
 {
+#ifdef HAVE_DLFCN_H
 	dlclose(PSDriver);
+#else
+	delete PSDriver;
+#endif
 }
 
 bool ScribusApp::DoSaveAsEps(QString fn)
@@ -8686,7 +8719,7 @@
 			dd->CreatePS(doc, view, pageNs, false, tr("All"), true, false, false, true, Prefs.GCRMode, false);
 		else
 			return_value = false;
-		delete dd;
+		delete dd; // Not Windows friendly, should be something like dd->destroyInstance();
 		closePSDriver();
 		qApp->setOverrideCursor(QCursor(arrowCursor), true);
 	}
@@ -8763,6 +8796,8 @@
 	}
 }
 
+#ifdef HAVE_DLFCN_H
+
 bool ScribusApp::getPDFDriver(QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs)
 {
 	bool ret = false;
@@ -8793,6 +8828,33 @@
 	return ret;
 }
 
+#else
+
+bool ScribusApp::getPDFDriver(QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs)
+{
+	bool ret = false;
+	QLibrary *PDFDriver;
+	typedef bool (*sdem)(ScribusApp *plug, QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2);
+	sdem pfunc;
+	QString pfad = QString("%1/libs/libpdf.%3").arg(ScPaths::instance().libDir()).arg(PluginManager::platformDllExtension());
+	PDFDriver = new QLibrary(pfad);
+	pfunc = (sdem) PDFDriver->resolve("Run");
+	if ( !pfunc )
+	{
+		std::cout << "Cannot find symbol or driver missing" << endl;
+		delete PDFDriver;
+		return false;
+	}
+	fileWatcher->forceScan();
+	fileWatcher->stop();
+	ret = (*pfunc)(this, fn, nam, Components, pageNs, thumbs, mainWindowProgressBar);
+	delete PDFDriver;
+	fileWatcher->start();
+	return ret;
+}
+
+#endif
+
 void ScribusApp::SaveAsPDF()
 {
 	if (doc->checkerProfiles[doc->curCheckProfile].autoCheck)
Index: scribus.h
===================================================================
RCS file: /cvs/Scribus/scribus/scribus.h,v
retrieving revision 1.60.2.111
diff -u -r1.60.2.111 scribus.h
--- scribus.h	26 Jun 2005 11:06:39 -0000	1.60.2.111
+++ scribus.h	30 Jun 2005 17:01:29 -0000
@@ -50,6 +50,18 @@
 #include <qclipboard.h>
 #include <qprocess.h>
 
+#ifdef _MSC_VER
+ #if (_MSC_VER >= 1200)
+  #include "win-config.h"
+ #endif
+#else
+ #include "config.h"
+#endif
+
+#ifndef HAVE_DLFCN_H
+#include <qlibrary.h>
+#endif
+
 // application specific includes
 #include "scribusview.h"
 #include "scribusdoc.h"
@@ -545,7 +557,11 @@
 	void addNewPages(int wo, int where, int numPages, QString based1 = tr("Normal"), QString based2 = tr("Normal"));
 	QMap<int,QString> FontID;
 	int HaveGS;
+#ifdef HAVE_DLFCN_H
 	void *PSDriver;
+#else
+	QLibrary *PSDriver;
+#endif
 	int DocNr;
 	QStringList RecentDocs;
 	UndoManager *undoManager;
