2002-08-23 09:05:32 +00:00
|
|
|
// -*- C++ -*-
|
2002-08-24 20:25:17 +00:00
|
|
|
/**
|
2010-06-04 22:44:58 +00:00
|
|
|
* \file InsetArgument.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-23 09:05:32 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Martin Vermeer
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-24 20:25:17 +00:00
|
|
|
*/
|
2002-08-23 09:05:32 +00:00
|
|
|
|
2012-11-19 13:21:02 +00:00
|
|
|
#ifndef INSETARGUMENT_H
|
|
|
|
#define INSETARGUMENT_H
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
#include "InsetCollapsible.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
2002-08-26 11:27:37 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
/**
|
2010-06-04 22:44:58 +00:00
|
|
|
* InsetArgument. Used to insert a short version of sectioning header etc.
|
2002-08-24 20:25:17 +00:00
|
|
|
* automatically, or other optional LaTeX arguments
|
|
|
|
*/
|
2017-10-16 08:12:21 +00:00
|
|
|
class InsetArgument : public InsetCollapsible
|
2008-03-05 00:21:05 +00:00
|
|
|
{
|
2002-08-23 09:05:32 +00:00
|
|
|
public:
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
2012-11-19 13:21:02 +00:00
|
|
|
InsetArgument(Buffer *, std::string const &);
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2017-05-12 21:13:38 +00:00
|
|
|
///
|
|
|
|
InsetArgument const * asInsetArgument() const { return this; }
|
|
|
|
|
2010-06-04 21:50:08 +00:00
|
|
|
/// Outputting the parameter of a LaTeX command
|
2016-09-23 23:12:38 +00:00
|
|
|
void latexArgument(otexstream & os, OutputParams const & runparams_in,
|
|
|
|
docstring const & ldelim, docstring const & rdelim,
|
|
|
|
docstring const & presetarg) const;
|
2012-11-19 13:21:02 +00:00
|
|
|
|
|
|
|
std::string name() const { return name_; }
|
2011-10-29 15:34:06 +00:00
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2009-04-22 20:55:13 +00:00
|
|
|
///
|
|
|
|
bool hasSettings() const { return false; }
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2010-06-04 22:44:58 +00:00
|
|
|
InsetCode lyxCode() const { return ARG_CODE; }
|
2007-11-15 15:40:01 +00:00
|
|
|
///
|
2011-03-28 22:33:04 +00:00
|
|
|
docstring layoutName() const { return from_ascii("Argument"); }
|
2012-11-19 13:21:02 +00:00
|
|
|
/// Update the label string of this inset
|
2020-03-06 12:23:01 +00:00
|
|
|
void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false);
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
|
|
|
void latex(otexstream &, OutputParams const &) const { }
|
|
|
|
///
|
2013-04-08 09:09:45 +00:00
|
|
|
int plaintext(odocstringstream &, OutputParams const &, size_t) const { return 0; }
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const { return; }
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2019-05-09 23:35:40 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const
|
2012-11-19 13:21:02 +00:00
|
|
|
{ return docstring(); }
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2012-11-19 13:21:02 +00:00
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
bool neverIndent() const { return true; }
|
2012-11-23 13:44:45 +00:00
|
|
|
///
|
|
|
|
std::string contextMenuName() const;
|
2012-11-28 18:02:07 +00:00
|
|
|
///
|
|
|
|
bool isPassThru() const { return pass_thru_; }
|
2013-05-27 09:29:15 +00:00
|
|
|
///
|
2019-06-02 14:33:06 +00:00
|
|
|
bool isFreeSpacing() const { return free_spacing_; }
|
|
|
|
///
|
2017-12-29 10:51:24 +00:00
|
|
|
bool isTocCaption() const { return is_toc_caption_; }
|
|
|
|
///
|
2013-05-27 09:29:15 +00:00
|
|
|
bool resetFontEdit() const { return false; }
|
2011-10-29 15:34:06 +00:00
|
|
|
//@}
|
2017-10-16 08:12:21 +00:00
|
|
|
/// \name Public functions inherited from InsetCollapsible class
|
2012-11-19 13:21:02 +00:00
|
|
|
//@{
|
|
|
|
///
|
2012-11-26 08:10:14 +00:00
|
|
|
InsetLayout::InsetDecoration decoration() const;
|
|
|
|
///
|
|
|
|
FontInfo getFont() const;
|
|
|
|
///
|
|
|
|
FontInfo getLabelfont() const;
|
|
|
|
///
|
2016-07-30 03:36:48 +00:00
|
|
|
ColorCode labelColor() const;
|
|
|
|
///
|
2012-11-19 13:21:02 +00:00
|
|
|
void setButtonLabel();
|
|
|
|
//@}
|
2017-01-08 18:17:57 +00:00
|
|
|
///
|
|
|
|
void addToToc(DocIterator const & dit, bool output_active,
|
2017-01-13 10:06:48 +00:00
|
|
|
UpdateType utype, TocBackend & backend) const; //override
|
2012-11-19 13:21:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
docstring toolTip(BufferView const & bv, int, int) const;
|
|
|
|
///
|
2017-09-15 14:21:05 +00:00
|
|
|
void fixParagraphLanguage(Language const *);
|
|
|
|
///
|
2012-11-19 13:21:02 +00:00
|
|
|
std::string name_;
|
|
|
|
///
|
|
|
|
docstring labelstring_;
|
|
|
|
///
|
|
|
|
docstring tooltip_;
|
2012-11-26 08:10:14 +00:00
|
|
|
///
|
|
|
|
FontInfo font_;
|
|
|
|
///
|
|
|
|
FontInfo labelfont_;
|
|
|
|
///
|
|
|
|
std::string decoration_;
|
2016-10-21 08:39:55 +00:00
|
|
|
/// Are we in a pass-thru context?
|
|
|
|
bool pass_thru_context_;
|
|
|
|
/// Is the argument itself have an explicitly pass-thru?
|
|
|
|
bool pass_thru_local_;
|
|
|
|
/// Effective pass-thru setting (inherited or local)
|
2012-11-28 18:02:07 +00:00
|
|
|
bool pass_thru_;
|
2015-05-08 07:32:31 +00:00
|
|
|
///
|
2019-06-02 14:33:06 +00:00
|
|
|
bool free_spacing_;
|
|
|
|
///
|
2015-05-08 07:32:31 +00:00
|
|
|
docstring pass_thru_chars_;
|
2017-12-29 10:51:24 +00:00
|
|
|
/// Does this argument provide content for the TOC?
|
|
|
|
bool is_toc_caption_;
|
2017-01-08 18:17:57 +00:00
|
|
|
/// The type of Toc this is the caption of, empty otherwise.
|
|
|
|
std::string caption_of_toc_;
|
2019-04-18 09:35:03 +00:00
|
|
|
/// Specific line break macro
|
|
|
|
std::string newline_cmd_;
|
2011-10-29 15:34:06 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// \name Protected functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
2012-11-23 13:44:45 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
|
|
|
///
|
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
2010-06-04 22:44:58 +00:00
|
|
|
Inset * clone() const { return new InsetArgument(*this); }
|
2016-12-27 11:06:54 +00:00
|
|
|
/// Is the content of this inset part of the immediate (visible) text sequence?
|
|
|
|
bool isPartOfTextSequence() const { return false; }
|
2011-10-29 15:34:06 +00:00
|
|
|
//@}
|
2002-08-23 09:05:32 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2012-11-19 13:21:02 +00:00
|
|
|
#endif // INSETARGUMENT_H
|