Back to index

scribus-ng  1.3.4.dfsg+svn20071115
oldscribusformat.cpp
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 #include "oldscribusformat.h"
00008 #include "oldscribusformat.moc"
00009 #include "oldscribusformatimpl.h"
00010 
00011 #include "scconfig.h"
00012 
00013 // See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods
00014 // do. That documentatation is not duplicated here.
00015 // Please don't implement the functionality of your plugin here; do that
00016 // in oldscribusformatimpl.h and oldscribusformatimpl.cpp .
00017 
00018 OldScribusFormat::OldScribusFormat() :
00019        LoadSavePlugin()
00020 {
00021        // Set action info in languageChange, so we only have to do
00022        // it in one place. This includes registering file formats.
00023        languageChange();
00024 }
00025 
00026 OldScribusFormat::~OldScribusFormat()
00027 {
00028        unregisterAll();
00029 };
00030 
00031 void OldScribusFormat::languageChange()
00032 {
00033        //(Re)register file formats.
00034        unregisterAll();
00035        registerFormats();
00036 }
00037 
00038 const QString OldScribusFormat::fullTrName() const
00039 {
00040        return QObject::tr("Old .sla format support");
00041 }
00042 
00043 const ScActionPlugin::AboutData* OldScribusFormat::getAboutData() const
00044 {
00045        AboutData* about = new AboutData;
00046        Q_CHECK_PTR(about);
00047        return about;
00048 }
00049 
00050 void OldScribusFormat::deleteAboutData(const AboutData* about) const
00051 {
00052        Q_ASSERT(about);
00053        delete about;
00054 }
00055 
00056 void OldScribusFormat::registerFormats()
00057 {
00058        FileFormat fmt(this);
00059        fmt.trName = tr("Scribus Document");
00060        fmt.formatId = 0;
00061        fmt.load = true;
00062        fmt.save = true;
00063        fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
00064        fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", false);
00065        fmt.mimeTypes = QStringList();
00066        fmt.mimeTypes.append("application/x-scribus");
00067        fmt.priority = 64;
00068        registerFormat(fmt);
00069        FileFormat fmt2(this);
00070        fmt2.trName = tr("Scribus 1.2.x Document");
00071        fmt2.formatId = 0;
00072        fmt2.load = true;
00073        fmt2.save = false;
00074        fmt2.filter = fmt.filter;
00075        fmt2.nameMatch = fmt.nameMatch;
00076        fmt2.mimeTypes.append("application/x-scribus");
00077        fmt2.priority = 63;
00078        registerFormat(fmt2);
00079 }
00080 
00081 bool OldScribusFormat::fileSupported(QIODevice* /* file */) const
00082 {
00083        return true;
00084 }
00085 
00086 bool OldScribusFormat::loadFile(const QString & /* fileName */, const FileFormat & /* fmt */, int /* flags */, int /* index */)
00087 {
00088        return false;
00089 }
00090 
00091 bool OldScribusFormat::saveFile(const QString & /* fileName */, const FileFormat & /* fmt */)
00092 {
00093        return false;
00094 }
00095 
00096 // Low level plugin API
00097 int oldscribusformat_getPluginAPIVersion()
00098 {
00099        return PLUGIN_API_VERSION;
00100 }
00101 
00102 ScPlugin* oldscribusformat_getPlugin()
00103 {
00104        OldScribusFormat* plug = new OldScribusFormat();
00105        Q_CHECK_PTR(plug);
00106        return plug;
00107 }
00108 
00109 void oldscribusformat_freePlugin(ScPlugin* plugin)
00110 {
00111        OldScribusFormat* plug = dynamic_cast<OldScribusFormat*>(plugin);
00112        Q_ASSERT(plug);
00113        delete plug;
00114 }