summaryrefslogtreecommitdiffstats
path: root/scribus/plugins/fileloader/oldscribusformat/oldscribusformat.cpp
blob: d8a6b06c30ad2ce91eb69072506c3b893bff53b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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;
}