2002-02-27 09:59:52 +00:00
|
|
|
// -*- C++ -*-
|
2002-06-28 11:22:56 +00:00
|
|
|
/**
|
2003-08-23 00:17:00 +00:00
|
|
|
* \file GraphicsConverter.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-02-27 09:59:52 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 11:31:30 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-02-27 09:59:52 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* The controller of a conversion process from file AA of format A to
|
|
|
|
* file BB of format B.
|
|
|
|
* Once finished, a signal is emitted to inform any listeners (connected
|
|
|
|
* through the connect() method).
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GRAPHICSCONVERTER_H
|
|
|
|
#define GRAPHICSCONVERTER_H
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2004-09-26 14:19:47 +00:00
|
|
|
#include <boost/signal.hpp>
|
2002-06-28 11:22:56 +00:00
|
|
|
#include <boost/utility.hpp>
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace graphics {
|
2002-06-10 07:57:39 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
class Converter : boost::noncopyable {
|
2002-02-27 09:59:52 +00:00
|
|
|
public:
|
|
|
|
/// Can the conversion be performed?
|
2003-10-06 15:43:21 +00:00
|
|
|
static bool isReachable(std::string const & from_format_name,
|
|
|
|
std::string const & to_format_name);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-07-17 17:16:15 +00:00
|
|
|
/** One Converter per conversion ensures that the (hidden) signal
|
2002-06-28 11:22:56 +00:00
|
|
|
* is always connected to the expected slot.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
Converter(std::string const & from_file, std::string const & to_file_base,
|
|
|
|
std::string const & from_format, std::string const & to_format);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
|
|
|
|
~Converter();
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/// We are explicit about when we begin the conversion process.
|
2002-07-17 16:56:42 +00:00
|
|
|
void startConversion() const;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-07-17 16:56:42 +00:00
|
|
|
/** Connect and you'll be informed when the conversion process has
|
|
|
|
* finished.
|
2002-07-17 17:16:15 +00:00
|
|
|
* If the conversion is succesful, then the listener is passed \c true.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
2004-09-26 14:19:47 +00:00
|
|
|
typedef boost::signal<void(bool)> sig_type;
|
|
|
|
typedef sig_type::slot_type slot_type;
|
2002-02-27 09:59:52 +00:00
|
|
|
///
|
2002-07-17 16:56:42 +00:00
|
|
|
boost::signals::connection connect(slot_type const &) const;
|
|
|
|
|
|
|
|
/** If the conversion is succesful, this returns the name of the
|
|
|
|
* resulting file.
|
|
|
|
* If conversion fails or has not been completed, however, it
|
|
|
|
* returns an empty string.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & convertedFile() const;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
private:
|
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
class Impl;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
|
|
|
boost::scoped_ptr<Impl> const pimpl_;
|
2002-02-27 09:59:52 +00:00
|
|
|
};
|
2002-07-17 16:56:42 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
|
|
#endif // GRAPHICSCONVERTER_H
|