1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LyXView.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-06-12 02:54:19 +00:00
|
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef LYXVIEW_H
|
|
|
|
|
#define LYXVIEW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
|
#include "frontends/Delegates.h"
|
2007-11-12 23:23:19 +00:00
|
|
|
|
#include "support/strfwd.h"
|
2007-08-23 16:31:58 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
namespace support { class FileName; }
|
|
|
|
|
|
2001-07-03 15:19:04 +00:00
|
|
|
|
class Buffer;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
class BufferView;
|
2007-08-14 09:54:59 +00:00
|
|
|
|
class FuncRequest;
|
|
|
|
|
class Inset;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* LyXView - main LyX window
|
|
|
|
|
*
|
|
|
|
|
* This class represents the main LyX window and provides
|
|
|
|
|
* accessor functions to its content.
|
|
|
|
|
*
|
|
|
|
|
* The eventual intention is that LyX will support a number
|
|
|
|
|
* of containing LyXViews. Currently a lot of code still
|
|
|
|
|
* relies on there being a single top-level view.
|
|
|
|
|
*
|
|
|
|
|
* Additionally we would like to support multiple views
|
|
|
|
|
* in a single LyXView.
|
|
|
|
|
*/
|
2007-11-12 22:35:43 +00:00
|
|
|
|
class LyXView
|
|
|
|
|
: public GuiBufferViewDelegate, public GuiBufferDelegate
|
2007-10-02 18:27:20 +00:00
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2007-11-12 23:23:19 +00:00
|
|
|
|
LyXView(int id) : id_(id) {}
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2007-11-13 09:52:28 +00:00
|
|
|
|
virtual ~LyXView() {}
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2007-09-16 10:36:57 +00:00
|
|
|
|
int id() const { return id_; }
|
2007-09-19 21:28:11 +00:00
|
|
|
|
///
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void close() = 0;
|
2006-09-29 23:10:17 +00:00
|
|
|
|
|
2003-02-14 14:49:51 +00:00
|
|
|
|
/// show busy cursor
|
2007-10-23 21:41:17 +00:00
|
|
|
|
virtual void setBusy(bool) = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
//@{ generic accessor functions
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the current buffer view.
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual BufferView * view() = 0;
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the buffer currently shown in this window
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer * buffer() = 0;
|
|
|
|
|
virtual Buffer const * buffer() const = 0;
|
|
|
|
|
/// set a buffer to the current workarea.
|
|
|
|
|
virtual void setBuffer(Buffer * b) = 0; ///< \c Buffer to set.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-08-23 12:21:47 +00:00
|
|
|
|
///
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual bool isToolbarVisible(std::string const & id) = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
2007-06-19 14:56:52 +00:00
|
|
|
|
/// load a buffer into the current workarea.
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
|
|
|
|
bool tolastfiles = true) = 0; ///< append to the "Open recent" menu?
|
2006-07-13 16:37:55 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// updates the possible layouts selectable
|
2007-11-10 00:21:42 +00:00
|
|
|
|
virtual void updateLayoutChoice(bool force) = 0;
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// update the toolbar
|
2007-10-01 20:45:50 +00:00
|
|
|
|
virtual void updateToolbars() = 0;
|
2006-07-13 16:37:55 +00:00
|
|
|
|
/// update the status bar
|
|
|
|
|
virtual void updateStatusBar() = 0;
|
2002-06-12 11:34:13 +00:00
|
|
|
|
/// display a message in the view
|
2006-10-21 00:16:43 +00:00
|
|
|
|
virtual void message(docstring const &) = 0;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
/// dispatch to current BufferView
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual void dispatch(FuncRequest const & cmd) = 0;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2003-10-14 21:30:23 +00:00
|
|
|
|
/** redraw \c inset in all the BufferViews in which it is currently
|
|
|
|
|
* visible. If successful return a pointer to the owning Buffer.
|
|
|
|
|
*/
|
2007-11-12 23:23:19 +00:00
|
|
|
|
virtual Buffer const * updateInset(Inset const *) = 0;
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
/// returns true if this view has the focus.
|
2004-11-16 10:46:23 +00:00
|
|
|
|
virtual bool hasFocus() const = 0;
|
|
|
|
|
|
2007-11-13 09:52:28 +00:00
|
|
|
|
///
|
|
|
|
|
virtual void restartCursor() = 0;
|
2007-10-02 18:27:20 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GuiBufferDelegate
|
|
|
|
|
//
|
2007-11-13 09:52:28 +00:00
|
|
|
|
virtual void errors(std::string const &) = 0;
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2007-11-18 00:01:14 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// This View's Dialogs
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/// Hide all visible dialogs
|
|
|
|
|
virtual void hideAll() const = 0;
|
|
|
|
|
|
|
|
|
|
/** \param name == "bibtex", "citation" etc; an identifier used to
|
|
|
|
|
launch a particular dialog.
|
|
|
|
|
\param data is a string representation of the Inset contents.
|
|
|
|
|
It is often little more than the output from Inset::write.
|
|
|
|
|
It is passed to, and parsed by, the frontend dialog.
|
|
|
|
|
Several of these dialogs do not need any data,
|
|
|
|
|
so it defaults to string().
|
|
|
|
|
\param inset ownership is _not_ passed to the frontend dialog.
|
|
|
|
|
It is stored internally and used by the kernel to ascertain
|
|
|
|
|
what to do with the FuncRequest dispatched from the frontend
|
|
|
|
|
dialog on 'Apply'; should it be used to create a new inset at
|
|
|
|
|
the current cursor position or modify an existing, 'open' inset?
|
|
|
|
|
*/
|
|
|
|
|
virtual void showDialog(std::string const & name,
|
2007-11-18 00:39:15 +00:00
|
|
|
|
std::string const & data, Inset * inset = 0) = 0;
|
2007-11-18 00:01:14 +00:00
|
|
|
|
|
|
|
|
|
/** \param name == "citation", "bibtex" etc; an identifier used
|
|
|
|
|
to update the contents of a particular dialog with \param data.
|
|
|
|
|
See the comments to 'show', above.
|
|
|
|
|
*/
|
|
|
|
|
virtual void updateDialog(std::string const & name, std::string const & data) = 0;
|
|
|
|
|
|
|
|
|
|
/// Is the dialog currently visible?
|
|
|
|
|
virtual bool isDialogVisible(std::string const & name) const = 0;
|
|
|
|
|
|
|
|
|
|
/** All Dialogs of the given \param name will be closed if they are
|
|
|
|
|
connected to the given \param inset.
|
|
|
|
|
*/
|
|
|
|
|
virtual void hideDialog(std::string const & name, Inset * inset) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual void disconnectDialog(std::string const & name) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual Inset * getOpenInset(std::string const & name) const = 0;
|
|
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
|
private:
|
2007-11-12 22:35:43 +00:00
|
|
|
|
/// noncopyable
|
|
|
|
|
LyXView(LyXView const &);
|
|
|
|
|
void operator=(LyXView const &);
|
|
|
|
|
|
2007-11-12 23:37:34 +00:00
|
|
|
|
///
|
2006-10-23 16:29:24 +00:00
|
|
|
|
int id_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#endif // LYXVIEW_H
|