summaryrefslogtreecommitdiffstats
path: root/scribus/plugins/fileloader/oldscribusformat
diff options
context:
space:
mode:
authorcraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-01-01 11:40:09 +0000
committercraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-01-01 11:40:09 +0000
commit7ed83b6c6666eb8b6b104c211ae7e52907350372 (patch)
tree4430b556abac0ad660a0aacf1887d77f85d8be02 /scribus/plugins/fileloader/oldscribusformat
Branch 1.3.5 tree to 1.4.x tree, goodbye 1.3.x
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17163 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/plugins/fileloader/oldscribusformat')
-rw-r--r--scribus/plugins/fileloader/oldscribusformat/CMakeLists.txt29
-rw-r--r--scribus/plugins/fileloader/oldscribusformat/oldscribusformat.cpp114
-rw-r--r--scribus/plugins/fileloader/oldscribusformat/oldscribusformat.h42
-rw-r--r--scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.cpp25
-rw-r--r--scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.h23
5 files changed, 233 insertions, 0 deletions
diff --git a/scribus/plugins/fileloader/oldscribusformat/CMakeLists.txt b/scribus/plugins/fileloader/oldscribusformat/CMakeLists.txt
new file mode 100644
index 0000000..7992923
--- /dev/null
+++ b/scribus/plugins/fileloader/oldscribusformat/CMakeLists.txt
@@ -0,0 +1,29 @@
+INCLUDE_DIRECTORIES(
+${CMAKE_SOURCE_DIR}
+${CMAKE_SOURCE_DIR}/scribus
+)
+
+SET(OLDSCRFORMAT_FL_PLUGIN_MOC_CLASSES
+oldscribusformat.h
+oldscribusformatimpl.h
+)
+
+SET(OLDSCRFORMAT_FL_PLUGIN_SOURCES
+oldscribusformat.cpp
+oldscribusformatimpl.cpp
+)
+
+SET(SCRIBUS_OLDSCRFORMAT_FL_PLUGIN "oldscribusformat")
+
+SCRIBUS_QT_WRAP_CPP(OLDSCRFORMAT_FL_PLUGIN_MOC_SOURCES ${OLDSCRFORMAT_FL_PLUGIN_MOC_CLASSES})
+
+ADD_LIBRARY(${SCRIBUS_OLDSCRFORMAT_FL_PLUGIN} MODULE ${OLDSCRFORMAT_FL_PLUGIN_SOURCES} ${OLDSCRFORMAT_FL_PLUGIN_MOC_SOURCES})
+TARGET_LINK_LIBRARIES(${SCRIBUS_OLDSCRFORMAT_FL_PLUGIN} ${PLUGIN_LIBRARIES})
+
+INSTALL(TARGETS ${SCRIBUS_OLDSCRFORMAT_FL_PLUGIN}
+ LIBRARY
+ DESTINATION ${PLUGINDIR}
+ PERMISSIONS ${PLUGIN_PERMISSIONS}
+)
+
+# SET_TARGET_PROPERTIES(${SCRIBUS_FONTPREVIEW_PLUGIN} PROPERTIES VERSION "0.0.0")
diff --git a/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.cpp b/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.cpp
new file mode 100644
index 0000000..d8a6b06
--- /dev/null
+++ b/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.cpp
@@ -0,0 +1,114 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include "oldscribusformat.h"
+//#include "oldscribusformat.moc"
+#include "oldscribusformatimpl.h"
+
+#include "scconfig.h"
+
+// See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods
+// do. That documentatation is not duplicated here.
+// Please don't implement the functionality of your plugin here; do that
+// in oldscribusformatimpl.h and oldscribusformatimpl.cpp .
+
+OldScribusFormat::OldScribusFormat() :
+ LoadSavePlugin()
+{
+ // Set action info in languageChange, so we only have to do
+ // it in one place. This includes registering file formats.
+ languageChange();
+}
+
+OldScribusFormat::~OldScribusFormat()
+{
+ unregisterAll();
+};
+
+void OldScribusFormat::languageChange()
+{
+ //(Re)register file formats.
+ unregisterAll();
+ registerFormats();
+}
+
+const QString OldScribusFormat::fullTrName() const
+{
+ return QObject::tr("Old .sla format support");
+}
+
+const ScActionPlugin::AboutData* OldScribusFormat::getAboutData() const
+{
+ AboutData* about = new AboutData;
+ Q_CHECK_PTR(about);
+ return about;
+}
+
+void OldScribusFormat::deleteAboutData(const AboutData* about) const
+{
+ Q_ASSERT(about);
+ delete about;
+}
+
+void OldScribusFormat::registerFormats()
+{
+ FileFormat fmt(this);
+ fmt.trName = tr("Scribus Document");
+ fmt.formatId = 0;
+ fmt.load = true;
+ fmt.save = true;
+ fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
+ fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", false);
+ fmt.mimeTypes = QStringList();
+ fmt.mimeTypes.append("application/x-scribus");
+ fmt.priority = 64;
+ registerFormat(fmt);
+ FileFormat fmt2(this);
+ fmt2.trName = tr("Scribus 1.2.x Document");
+ fmt2.formatId = 0;
+ fmt2.load = true;
+ fmt2.save = false;
+ fmt2.filter = fmt.filter;
+ fmt2.nameMatch = fmt.nameMatch;
+ fmt2.mimeTypes.append("application/x-scribus");
+ fmt2.priority = 63;
+ registerFormat(fmt2);
+}
+
+bool OldScribusFormat::fileSupported(QIODevice* /* file */) const
+{
+ return true;
+}
+
+bool OldScribusFormat::loadFile(const QString & /* fileName */, const FileFormat & /* fmt */, int /* flags */, int /* index */)
+{
+ return false;
+}
+
+bool OldScribusFormat::saveFile(const QString & /* fileName */, const FileFormat & /* fmt */)
+{
+ return false;
+}
+
+// Low level plugin API
+int oldscribusformat_getPluginAPIVersion()
+{
+ return PLUGIN_API_VERSION;
+}
+
+ScPlugin* oldscribusformat_getPlugin()
+{
+ OldScribusFormat* plug = new OldScribusFormat();
+ Q_CHECK_PTR(plug);
+ return plug;
+}
+
+void oldscribusformat_freePlugin(ScPlugin* plugin)
+{
+ OldScribusFormat* plug = dynamic_cast<OldScribusFormat*>(plugin);
+ Q_ASSERT(plug);
+ delete plug;
+}
diff --git a/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.h b/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.h
new file mode 100644
index 0000000..fe34e0c
--- /dev/null
+++ b/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.h
@@ -0,0 +1,42 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef OLDSCRIBUSFORMAT_H
+#define OLDSCRIBUSFORMAT_H
+
+#include "pluginapi.h"
+#include "loadsaveplugin.h"
+
+class PLUGIN_API OldScribusFormat : public LoadSavePlugin
+{
+ Q_OBJECT
+
+ public:
+ // Standard plugin implementation
+ OldScribusFormat();
+ virtual ~OldScribusFormat();
+ virtual const QString fullTrName() const;
+ virtual const AboutData* getAboutData() const;
+ virtual void deleteAboutData(const AboutData* about) const;
+ virtual void languageChange();
+ virtual bool fileSupported(QIODevice* file) const;
+
+ virtual bool loadFile(const QString & fileName, const FileFormat & fmt, int flags, int index = 0);
+ virtual bool saveFile(const QString & fileName, const FileFormat & fmt);
+ virtual void addToMainWindowMenu(ScribusMainWindow *) {};
+
+ // Special features - .sla page extraction support
+ bool loadPage(int pageNumber, bool Mpage);
+
+ private:
+ void registerFormats();
+};
+
+extern "C" PLUGIN_API int oldscribusformat_getPluginAPIVersion();
+extern "C" PLUGIN_API ScPlugin* oldscribusformat_getPlugin();
+extern "C" PLUGIN_API void oldscribusformat_freePlugin(ScPlugin* plugin);
+
+#endif
diff --git a/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.cpp b/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.cpp
new file mode 100644
index 0000000..c50e127
--- /dev/null
+++ b/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.cpp
@@ -0,0 +1,25 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include "oldscribusformatimpl.h"
+//#include "oldscribusformatimpl.moc"
+#include "scribus.h"
+
+#include <QString>
+#include <QMessageBox>
+
+// Initialize members here, if any
+OldScribusFormatImpl::OldScribusFormatImpl() : QObject(0, "OldScribusFormatImpl")
+{
+}
+
+// This method is connected to the "import page" entry in the UI
+// For now, we just call back into Scribus
+bool OldScribusFormatImpl::run(const QString & )
+{
+ ScMW->slotPageImport();
+ return true;
+}
diff --git a/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.h b/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.h
new file mode 100644
index 0000000..9ff7d47
--- /dev/null
+++ b/scribus/plugins/fileloader/oldscribusformat/oldscribusformatimpl.h
@@ -0,0 +1,23 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef OLDSCRIBUSFORMATIMPL_H
+#define OLDSCRIBUSFORMATIMPL_H
+
+#include <QObject>
+
+class QString;
+
+class OldScribusFormatImpl : public QObject
+{
+ Q_OBJECT
+ public:
+ OldScribusFormatImpl();
+ ~OldScribusFormatImpl() {};
+ bool run(const QString & target);
+};
+
+#endif