1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetTOC.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.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_TOC_H
|
|
|
|
#define INSET_TOC_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCommand.h"
|
2003-09-04 01:18:42 +00:00
|
|
|
|
2016-01-08 19:06:50 +00:00
|
|
|
#include "Toc.h"
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2013-03-27 21:16:34 +00:00
|
|
|
class Paragraph;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2003-12-10 09:45:32 +00:00
|
|
|
/// Used to insert table of contents and similar lists
|
2012-04-16 19:40:59 +00:00
|
|
|
/// at present, supports only \tableofcontents and \listoflistings.
|
|
|
|
/// Other such commands, such as \listoffigures, are supported
|
2010-01-01 02:08:22 +00:00
|
|
|
/// by InsetFloatList.
|
2000-08-04 13:12:30 +00:00
|
|
|
class InsetTOC : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 16:10:34 +00:00
|
|
|
InsetTOC(Buffer * buf, InsetCommandParams const &);
|
2010-10-27 21:35:13 +00:00
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2007-10-16 16:48:21 +00:00
|
|
|
InsetCode lyxCode() const { return TOC_CODE; }
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2012-04-16 19:40:59 +00:00
|
|
|
docstring layoutName() const;
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
DisplayType display() const { return AlignCenter; }
|
2003-10-22 10:22:09 +00:00
|
|
|
///
|
2012-04-16 19:40:59 +00:00
|
|
|
virtual void validate(LaTeXFeatures &) const;
|
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2001-01-11 14:55:36 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2009-12-10 18:30:48 +00:00
|
|
|
docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
|
2010-12-17 13:12:43 +00:00
|
|
|
///
|
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2012-02-15 09:42:13 +00:00
|
|
|
///
|
2016-02-02 16:17:10 +00:00
|
|
|
bool clickable(BufferView const &, int, int) const { return true; }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
2009-12-10 18:30:48 +00:00
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2009-12-10 18:30:48 +00:00
|
|
|
static std::string defaultCommand() { return "tableofcontents"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2012-04-16 19:40:59 +00:00
|
|
|
static bool isCompatibleCommand(std::string const & cmd);
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
private:
|
2013-03-27 20:58:44 +00:00
|
|
|
///
|
2015-05-12 16:52:36 +00:00
|
|
|
void makeTOCWithDepth(XHTMLStream & xs, Toc const & toc, const OutputParams & op) const;
|
2013-03-27 20:58:44 +00:00
|
|
|
///
|
2015-05-12 16:52:36 +00:00
|
|
|
void makeTOCNoDepth(XHTMLStream & xs, Toc const & toc, const OutputParams & op) const;
|
2013-03-27 21:16:34 +00:00
|
|
|
///
|
|
|
|
void makeTOCEntry(XHTMLStream & xs, Paragraph const & par, OutputParams const & op) const;
|
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
Inset * clone() const { return new InsetTOC(*this); }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
docstring screenLabel() const;
|
|
|
|
//@}
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|