Subversion Repositories Scribus

Rev

Rev 3688 | Rev 3696 | 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
 
3693 craig 14
// STATIC method - return a list of all existing formats
15
const QValueList<LoadSavePlugin::FormatSupport> & LoadSavePlugin::supportedFormats()
16
{
17
        return formats;
18
}
19
 
3686 craig 20
bool LoadSavePlugin::saveFile(const QString & /* fileName */,
21
                                                          const LoadSavePlugin::FormatSupport & /* fmt */)
22
{
23
        return false;
24
}
25
 
26
bool LoadSavePlugin::loadFile(const QString & /* fileName */,
27
                                                          const LoadSavePlugin::FormatSupport & /* fmt */)
28
{
29
        return false;
30
}
31
 
32
void LoadSavePlugin::registerFormat(const LoadSavePlugin::FormatSupport & fmt)
33
{
34
        // Must be no existing format of that name owned by this plugin
35
        Q_ASSERT(findFormat(fmt.internalName, this) == formats.end());
36
        formats.append(fmt);
37
}
38
 
39
void LoadSavePlugin::unregisterFormat(const QCString & name)
40
{
41
        QValueList<LoadSavePlugin::FormatSupport>::iterator it(findFormat(name, this));
42
        Q_ASSERT(it != formats.end());
43
        formats.remove(it);
44
}
45
 
46
void LoadSavePlugin::unregisterAll()
47
{
48
        QValueList<LoadSavePlugin::FormatSupport>::iterator it(formats.begin());
49
        QValueList<LoadSavePlugin::FormatSupport>::iterator itEnd(formats.end());
3693 craig 50
        while (it != itEnd)
3686 craig 51
        {
52
                if ((*it).plug == this)
3693 craig 53
                        it = formats.remove(it);
54
                else
55
                        ++it;
3686 craig 56
        }
57
}
58
 
59
QValueList<LoadSavePlugin::FormatSupport>::iterator
60
LoadSavePlugin::findFormat(const QCString & name,
61
                                                   LoadSavePlugin* plug,
62
                                                   QValueList<LoadSavePlugin::FormatSupport>::iterator it)
63
{
64
        QValueList<LoadSavePlugin::FormatSupport>::iterator itEnd(formats.end());
65
        for ( ; it != itEnd ; ++it )
66
        {
67
                if ( ((*it).internalName == name) && ((plug == 0) || (plug == (*it).plug)) )
68
                        return it;
69
        }
70
        return itEnd;
71
}