1 /* This file is part of
2 * =================================================
4 * LyX, The Document Processor
5 * Copyright 1995 Matthias Ettrich.
6 * Copyright 1995-2001 The LyX Team.
8 * ================================================= */
11 #pragma implementation
15 #include "ImageLoader.h"
16 #include "frontends/support/LyXImage.h"
18 #include "support/filetools.h"
22 ImageLoader::ImageLoader()
27 ImageLoader::~ImageLoader()
33 ImageLoader::freeImage()
39 bool ImageLoader::isImageFormatOK(string const & /*filename*/) const
44 void ImageLoader::setImage(LyXImage * image)
49 LyXImage * ImageLoader::getImage()
51 LyXImage * tmp = image_;
56 ImageLoader::FormatList const
57 ImageLoader::loadableFormats() const
63 ImageLoader::loadImage(string const & filename)
65 // Make sure file exists and is readable.
66 if (! IsFileReadable(filename)) {
67 lyxerr << "No XPM file found." << endl;
71 // Verify that the file format is correct.
72 if (! isImageFormatOK(filename)) {
73 lyxerr << "File format incorrect." << endl;
74 return ImageFormatUnknown;
79 return runImageLoader(filename);