2 /* This file is part of
3 * =================================================
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich.
7 * Copyright 1995-2000 The LyX Team.
9 * ================================================= */
12 #pragma implementation
16 #include "ImageLoader.h"
17 #include "frontends/support/LyXImage.h"
19 #include "support/filetools.h"
23 ImageLoader::ImageLoader()
28 ImageLoader::~ImageLoader()
34 ImageLoader::freeImage()
40 bool ImageLoader::isImageFormatOK(string const & /*filename*/) const
45 void ImageLoader::setImage(LyXImage * image)
50 LyXImage * ImageLoader::getImage()
52 LyXImage * tmp = image_;
57 ImageLoader::FormatList const
58 ImageLoader::loadableFormats() const
64 ImageLoader::loadImage(string const & filename)
66 // Make sure file exists and is readable.
67 if (! IsFileReadable(filename)) {
68 lyxerr << "No XPM file found." << endl;
72 // Verify that the file format is correct.
73 if (! isImageFormatOK(filename)) {
74 lyxerr << "File format incorrect." << endl;
75 return ImageFormatUnknown;
80 return runImageLoader(filename);