Subversion Repositories Scribus

Rev

Rev 3487 | Rev 3688 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3487 craig 1
#include "loadsaveplugin.h"
2
 
3686 craig 3
QValueList<LoadSavePlugin::FormatSupport> LoadSavePlugin::formats;
4
 
3487 craig 5
LoadSavePlugin::LoadSavePlugin()
6
        : ScActionPlugin()
7
{
8
}
9
 
10
LoadSavePlugin::~LoadSavePlugin()
11
{
12
}
3686 craig 13
 
14
bool LoadSavePlugin::saveFile(const QString & /* fileName */,
15
                                                          const LoadSavePlugin::FormatSupport & /* fmt */)
16
{
17
        return false;
18
}
19
 
20
bool LoadSavePlugin::loadFile(const QString & /* fileName */,
21
                                                          const LoadSavePlugin::FormatSupport & /* fmt */)
22
{
23
        return false;
24
}
25
 
26
const QValueList<LoadSavePlugin::FormatSupport> & LoadSavePlugin::supportedFormats()
27
{
28
        return formats;
29
}
30
 
31
void LoadSavePlugin::registerFormat(const LoadSavePlugin::FormatSupport & fmt)
32
{
33
        // Must be no existing format of that name owned by this plugin
34
        Q_ASSERT(findFormat(fmt.internalName, this) == formats.end());
35
        formats.append(fmt);
36
}
37
 
38
void LoadSavePlugin::unregisterFormat(const QCString & name)
39
{
40
        QValueList<LoadSavePlugin::FormatSupport>::iterator it(findFormat(name, this));
41
        Q_ASSERT(it != formats.end());
42
        formats.remove(it);
43
}
44
 
45
void LoadSavePlugin::unregisterAll()
46
{
47
        QValueList<LoadSavePlugin::FormatSupport>::iterator it(formats.begin());
48
        QValueList<LoadSavePlugin::FormatSupport>::iterator itEnd(formats.end());
49
        for ( ; it != itEnd; ++it )
50
        {
51
                if ((*it).plug == this)
52
                        formats.remove(it);
53
        }
54
}
55
 
56
QValueList<LoadSavePlugin::FormatSupport>::iterator
57
LoadSavePlugin::findFormat(const QCString & name,
58
                                                   LoadSavePlugin* plug,
59
                                                   QValueList<LoadSavePlugin::FormatSupport>::iterator it)
60
{
61
        QValueList<LoadSavePlugin::FormatSupport>::iterator itEnd(formats.end());
62
        for ( ; it != itEnd ; ++it )
63
        {
64
                if ( ((*it).internalName == name) && ((plug == 0) || (plug == (*it).plug)) )
65
                        return it;
66
        }
67
        return itEnd;
68
}