1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of*
|
2002-03-21 17:09:55 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2000-02-10 17:53:36 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_LATEXCOMMAND_H
|
|
|
|
#define INSET_LATEXCOMMAND_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
#include "insetbutton.h"
|
2002-07-04 13:54:28 +00:00
|
|
|
#include "insetcommandparams.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/signal0.hpp>
|
2000-10-02 00:55:02 +00:00
|
|
|
#include <boost/utility.hpp>
|
2000-08-01 17:33:32 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// Created by Alejandro 970222
|
|
|
|
/** Used to insert a LaTeX command automatically
|
|
|
|
*
|
|
|
|
* Similar to InsetLaTeX but having control of the basic structure of a
|
2002-03-21 17:09:55 +00:00
|
|
|
* LaTeX command: \name[options]{contents}.
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2000-07-27 08:55:59 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-04-17 14:17:11 +00:00
|
|
|
class InsetCommand : public InsetButton, boost::noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
explicit
|
2001-07-06 15:57:54 +00:00
|
|
|
InsetCommand(InsetCommandParams const &, bool same_id = false);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2001-02-19 16:01:31 +00:00
|
|
|
virtual ~InsetCommand() { hideDialog(); }
|
2000-08-01 17:33:32 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void write(Buffer const *, std::ostream & os) const
|
2002-02-16 15:59:55 +00:00
|
|
|
{ p_.write(os); }
|
2000-07-13 09:38:34 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
virtual void read(Buffer const *, LyXLex & lex)
|
2002-02-16 15:59:55 +00:00
|
|
|
{ p_.read(lex); }
|
2000-08-04 13:12:30 +00:00
|
|
|
/// Can remove one InsetBibKey is modified
|
2002-02-16 15:59:55 +00:00
|
|
|
void scanCommand(string const & c) { p_.scanCommand(c); };
|
2002-03-21 17:09:55 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
virtual int latex(Buffer const *, std::ostream &,
|
2000-04-19 01:42:55 +00:00
|
|
|
bool fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
virtual int linuxdoc(Buffer const *, std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual int docbook(Buffer const *, std::ostream &, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset::Code lyxCode() const { return Inset::NO_CODE; }
|
2002-03-21 17:09:55 +00:00
|
|
|
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getCommand() const { return p_.getCommand(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
string const & getCmdName() const { return p_.getCmdName(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
string const & getOptions() const { return p_.getOptions(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
string const & getContents() const { return p_.getContents(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
void setCmdName(string const & n) { p_.setCmdName(n); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
void setOptions(string const & o) { p_.setOptions(o); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
void setContents(string const & c) { p_.setContents(c); }
|
2000-06-07 08:53:40 +00:00
|
|
|
///
|
2000-07-27 08:55:59 +00:00
|
|
|
InsetCommandParams const & params() const { return p_; }
|
|
|
|
///
|
|
|
|
void setParams(InsetCommandParams const &);
|
2000-08-01 17:33:32 +00:00
|
|
|
///
|
2002-05-29 16:21:03 +00:00
|
|
|
boost::signal0<void> hideDialog;
|
2002-02-27 15:19:21 +00:00
|
|
|
|
2000-06-07 08:53:40 +00:00
|
|
|
private:
|
2000-07-27 08:55:59 +00:00
|
|
|
///
|
|
|
|
InsetCommandParams p_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|