2002-02-27 09:59:52 +00:00
|
|
|
// -*- C++ -*-
|
2002-06-28 11:22:56 +00:00
|
|
|
/**
|
|
|
|
* \file GraphicsConverter.h
|
|
|
|
* Copyright 2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
2002-02-27 09:59:52 +00:00
|
|
|
*
|
2002-07-15 10:19:45 +00:00
|
|
|
* \author Angus Leeming <leeming@lyx.org>
|
2002-02-27 09:59:52 +00:00
|
|
|
*
|
2002-06-28 11:22:56 +00:00
|
|
|
* The controller of a conversion process from file AA of format A to
|
|
|
|
* file BB of format B.
|
|
|
|
* Once finished, the signal finishdConversion is emitted to inform the
|
|
|
|
* instigator where to find file BB.
|
|
|
|
* If the conversion is unsuccessful, then finishedConversion will pass
|
|
|
|
* an empty string.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GRAPHICSCONVERTER_H
|
|
|
|
#define GRAPHICSCONVERTER_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
#include "LString.h"
|
|
|
|
#include <boost/signals/signal1.hpp>
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
#include <boost/utility.hpp>
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
namespace grfx {
|
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?
|
2002-06-28 11:22:56 +00:00
|
|
|
static bool isReachable(string const & from_format_name,
|
|
|
|
string const & to_format_name);
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
/** One Converter per conversion ensures that finishedConversion
|
|
|
|
* is always connected to the expected slot.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
2002-06-28 11:22:56 +00:00
|
|
|
Converter(string const & from_file, string const & to_file_base,
|
|
|
|
string const & from_format, 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.
|
|
|
|
* If the conversion is succesful, then the slot is passed \c true.
|
2002-02-27 09:59:52 +00:00
|
|
|
*/
|
2002-07-17 16:56:42 +00:00
|
|
|
typedef boost::signal1<void, bool>::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
|
|
|
*/
|
2002-06-28 11:22:56 +00:00
|
|
|
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
|
|
|
|
2002-02-27 09:59:52 +00:00
|
|
|
} // namespace grfx
|
|
|
|
|
|
|
|
#endif // GRAPHICSCONVERTER_H
|