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 InsetIndex.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_INDEX_H
|
|
|
|
#define INSET_INDEX_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
#include "InsetCollapsable.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCommand.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2009-04-16 07:29:01 +00:00
|
|
|
class InsetIndexParams {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
explicit InsetIndexParams(docstring const & b = docstring())
|
|
|
|
: index(b) {}
|
|
|
|
///
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
|
|
|
docstring index;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
/** Used to insert index labels
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2007-10-03 13:38:19 +00:00
|
|
|
class InsetIndex : public InsetCollapsable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetIndex(Buffer *, InsetIndexParams const &);
|
2009-04-17 09:22:44 +00:00
|
|
|
///
|
|
|
|
static std::string params2string(InsetIndexParams const &);
|
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetIndexParams &);
|
2008-03-05 00:21:05 +00:00
|
|
|
private:
|
2000-07-07 07:46:37 +00:00
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const;
|
2000-07-07 07:46:37 +00:00
|
|
|
///
|
2007-10-16 16:48:21 +00:00
|
|
|
InsetCode lyxCode() const { return INDEX_CODE; }
|
2001-11-02 16:11:19 +00:00
|
|
|
///
|
2011-03-28 22:33:04 +00:00
|
|
|
docstring layoutName() const { return from_ascii("Index"); }
|
2007-10-03 13:38:19 +00:00
|
|
|
///
|
2009-07-13 06:46:52 +00:00
|
|
|
ColorCode labelColor() const;
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2007-10-03 13:38:19 +00:00
|
|
|
///
|
2009-04-16 07:29:01 +00:00
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
2009-11-19 22:03:15 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2008-04-26 14:24:28 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2009-04-16 07:29:01 +00:00
|
|
|
///
|
2009-04-17 09:22:44 +00:00
|
|
|
bool showInsetDialog(BufferView *) const;
|
|
|
|
///
|
2009-04-16 07:29:01 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
|
|
|
///
|
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2007-10-03 13:38:19 +00:00
|
|
|
/// should paragraph indendation be omitted in any case?
|
2008-02-27 20:43:16 +00:00
|
|
|
bool neverIndent() const { return true; }
|
2008-02-13 13:19:39 +00:00
|
|
|
///
|
2015-09-27 06:05:00 +00:00
|
|
|
void addToToc(DocIterator const & di, bool output_active,
|
2017-01-13 10:06:48 +00:00
|
|
|
UpdateType utype, TocBackend & backend) const;
|
2007-10-03 13:38:19 +00:00
|
|
|
///
|
2009-04-16 07:29:01 +00:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
2010-01-17 14:47:45 +00:00
|
|
|
///
|
|
|
|
docstring const buttonLabel(BufferView const & bv) const;
|
2009-04-16 07:29:01 +00:00
|
|
|
/// Updates needed features for this inset.
|
|
|
|
void validate(LaTeXFeatures & features) const;
|
|
|
|
///
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenuName() const;
|
2009-04-16 07:29:01 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
Inset * clone() const { return new InsetIndex(*this); }
|
2016-12-27 11:06:54 +00:00
|
|
|
/// Is the content of this inset part of the immediate text sequence?
|
|
|
|
bool isPartOfTextSequence() const { return false; }
|
2009-04-16 07:29:01 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
friend class InsetIndexParams;
|
|
|
|
///
|
|
|
|
InsetIndexParams params_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-08-04 13:12:30 +00:00
|
|
|
class InsetPrintIndex : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 16:10:34 +00:00
|
|
|
InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
|
2008-03-05 00:21:05 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
InsetCode lyxCode() const { return INDEX_PRINT_CODE; }
|
2009-04-16 07:29:01 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
///
|
2009-11-21 23:28:20 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-04-16 07:29:01 +00:00
|
|
|
///
|
2009-04-17 14:29:32 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
2009-04-16 07:29:01 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
|
|
|
///
|
2017-01-30 06:44:55 +00:00
|
|
|
void updateBuffer(ParIterator const & it, UpdateType);
|
|
|
|
///
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenuName() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Updates needed features for this inset.
|
2001-06-28 10:25:20 +00:00
|
|
|
void validate(LaTeXFeatures & features) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
DisplayType display() const { return AlignCenter; }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
2003-10-22 10:22:09 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
|
|
|
///
|
|
|
|
static std::string defaultCommand() { return "printindex"; }
|
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & s);
|
|
|
|
//@}
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
Inset * clone() const { return new InsetPrintIndex(*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
|