lyx_mirror/src/graphics/Previews.h
Angus Leeming 0d4d71dfe6 Finish the migration from namespace grfx to lyx::graphics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7334 a592a061-630c-0410-9148-cb99ea01b6c8
2003-07-21 21:30:57 +00:00

74 lines
1.8 KiB
C++

// -*- C++ -*-
/**
* \file Previews.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*
* lyx::graphics::Previews is a singleton class that stores the
* lyx::graphics::PreviewLoader for each buffer requiring one.
*/
#ifndef PREVIEWS_H
#define PREVIEWS_H
#include "LString.h"
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
class Buffer;
namespace lyx {
namespace graphics {
class PreviewLoader;
class Previews : boost::noncopyable {
public:
/// a wrapper for lyxrc.preview
static bool activated();
/// This is a singleton class. Get the instance.
static Previews & get();
/** Returns the PreviewLoader for this buffer.
* Used by individual insets to update their own preview.
* We assert that (buffer != 0) but do not pass a Buffer &
* so that insets do not need to #include buffer.h
*/
PreviewLoader & loader(Buffer const * buffer) const;
/** Called from the Buffer d-tor.
* If (buffer == 0), does nothing.
*/
void removeLoader(Buffer const * buffer) const;
/** For a particular buffer, initiate the generation of previews
* for each and every snippetof LaTeX that's of interest with
* a single forked process.
* If (buffer == 0), does nothing.
*/
void generateBufferPreviews(Buffer const & buffer) const;
private:
/** Make the c-tor, d-tor private so we can control how many objects
* are instantiated.
*/
Previews();
///
~Previews();
/// Use the Pimpl idiom to hide the internals.
class Impl;
/// The pointer never changes although *pimpl_'s contents may.
boost::scoped_ptr<Impl> const pimpl_;
};
} // namespace graphics
} // namespace lyx
#endif // PREVIEWS_H