1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995 Matthias Ettrich
|
1999-11-04 01:40:20 +00:00
|
|
|
* Copyright (C) 1996-1999 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
|
|
|
|
|
|
|
|
#include "lyxinset.h"
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
// Created by Alejandro 970222
|
|
|
|
/** Used to insert a LaTeX command automatically
|
|
|
|
*
|
|
|
|
* Similar to InsetLaTeX but having control of the basic structure of a
|
|
|
|
* LaTeX command: \name[options]{contents}.
|
|
|
|
*/
|
|
|
|
class InsetCommand: public Inset {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
InsetCommand();
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
InsetCommand(string const & name, string const & arg = string(),
|
|
|
|
string const & opt = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int Ascent(LyXFont const & font) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int Descent(LyXFont const & font) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int Width(LyXFont const & font) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void Write(FILE * file);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Parse the command.
|
1999-11-04 01:40:20 +00:00
|
|
|
void scanCommand(string const & cmd);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Will not be used when lyxf3
|
1999-11-04 01:40:20 +00:00
|
|
|
void Read(LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
virtual int Latex(FILE * file, signed char fragile);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
virtual int Latex(string & file, signed char fragile);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
virtual int Linuxdoc(string & file);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
virtual int DocBook(string & file);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
InsetCommand * Clone() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const
|
|
|
|
{
|
|
|
|
return Inset::NO_CODE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Get the label that appears at screen.
|
|
|
|
|
|
|
|
I thought it was enough to eliminate the argument to avoid
|
|
|
|
confusion with lyxinset::getLabel(int), but I've seen that
|
|
|
|
it wasn't. I hope you never confuse again both methods. (ale)
|
|
|
|
*/
|
1999-10-02 16:21:10 +00:00
|
|
|
virtual string getScreenLabel() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
return getCommand();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Build the complete LaTeX command
|
1999-10-02 16:21:10 +00:00
|
|
|
string getCommand() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & getCmdName() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
return command;
|
|
|
|
}
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & getOptions() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & getContents() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
return contents;
|
|
|
|
}
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
void setCmdName(string const & n) {
|
1999-09-27 18:44:28 +00:00
|
|
|
command = n;
|
|
|
|
}
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
void setOptions(string const & o) {
|
1999-09-27 18:44:28 +00:00
|
|
|
options = o;
|
|
|
|
}
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
virtual void setContents(string const & c) {
|
1999-09-27 18:44:28 +00:00
|
|
|
contents = c;
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string command;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string options;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string contents;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|