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
|
|
|
|
|
2004-09-26 14:19:47 +00:00
|
|
|
#include <boost/signal.hpp>
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace lyx {
|
2006-11-26 21:30:39 +00:00
|
|
|
|
|
|
|
namespace support { class FileName; }
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace graphics {
|
2002-06-10 07:57:39 +00:00
|
|
|
|
2007-11-21 23:31:12 +00:00
|
|
|
class Converter {
|
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
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
Converter(support::FileName const & from_file, std::string const & to_file_base,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & from_format, std::string const & to_format);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2007-11-21 23:47:47 +00:00
|
|
|
/// Needed for the pimpl
|
2002-06-28 11:22:56 +00:00
|
|
|
~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
|
|
|
*/
|
2006-11-26 21:30:39 +00:00
|
|
|
support::FileName const & convertedFile() const;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
private:
|
2007-11-21 23:31:12 +00:00
|
|
|
/// noncopyable
|
|
|
|
Converter(Converter const &);
|
|
|
|
void operator=(Converter const &);
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
class Impl;
|
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
2007-11-21 23:47:47 +00:00
|
|
|
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
|