#include "IndicesList.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
-#include "MetricsInfo.h"
#include "output_latex.h"
#include "output_xhtml.h"
#include "sgml.h"
#include "frontends/alert.h"
#include <ostream>
+#include <algorithm>
using namespace std;
using namespace lyx::support;
subst(spart2, from_ascii("\\"), docstring());
os << ppart;
os << '@';
+ i += count_char(ppart, '\n');
}
docstring const tpart = *it;
os << tpart;
+ i += count_char(tpart, '\n');
if (it2 < levels_plain.end())
++it2;
}
// write the bit that followed "|"
- if (!cmd.empty())
+ if (!cmd.empty()) {
os << "|" << cmd;
+ i += count_char(cmd, '\n');
+ }
os << '}';
return i;
}
// our own interior paragraph, which doesn't get printed
std::string const magic = paragraphs().front().magicLabel();
std::string const attr = "id='" + magic + "'";
- xs << CompTag("a", attr);
+ xs << html::CompTag("a", attr);
return docstring();
}
void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY: {
if (cmd.getArg(0) == "changetype") {
InsetIndexParams params;
InsetIndex::string2params(to_utf8(cmd.argument()), params);
params_.index = params.index;
+ // what we really want here is a TOC update, but that means
+ // a full buffer update
+ cur.forceBufferUpdate();
break;
}
bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY:
if (cmd.getArg(0) == "changetype") {
&& !params_.index.empty()
&& params_.index != "idx")
features.require("splitidx");
+ InsetCollapsable::validate(features);
}
///////////////////////////////////////////////////////////////////////
InsetPrintIndex::InsetPrintIndex(Buffer * buf, InsetCommandParams const & p)
- : InsetCommand(buf, p, "index_print")
+ : InsetCommand(buf, p)
{}
void InsetPrintIndex::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY: {
if (cmd.argument() == from_ascii("toggle-subindex")) {
}
InsetCommandParams p(INDEX_PRINT_CODE);
// FIXME UNICODE
- InsetCommand::string2params("index_print",
- to_utf8(cmd.argument()), p);
+ InsetCommand::string2params(to_utf8(cmd.argument()), p);
if (p.getCmdName().empty()) {
- cur.noUpdate();
+ cur.noScreenUpdate();
break;
}
setParams(p);
bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & status) const
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY: {
if (cmd.argument() == from_ascii("toggle-subindex")) {
} if (cmd.getArg(0) == "index_print"
&& cmd.getArg(1) == "CommandInset") {
InsetCommandParams p(INDEX_PRINT_CODE);
- InsetCommand::string2params("index_print",
- to_utf8(cmd.argument()), p);
+ InsetCommand::string2params(to_utf8(cmd.argument()), p);
if (suffixIs(p.getCmdName(), '*')) {
status.setEnabled(true);
status.setOnOff(false);
}
-int InsetPrintIndex::latex(odocstream & os, OutputParams const &) const
+int InsetPrintIndex::latex(odocstream & os, OutputParams const & runparams_in) const
{
if (!buffer().masterBuffer()->params().use_indices) {
if (getParam("type") == from_ascii("idx"))
os << "\\printindex{}";
return 0;
}
- os << getCommand();
+ OutputParams runparams = runparams_in;
+ os << getCommand(runparams);
return 0;
}
odocstringstream ods;
XHTMLStream xs(ods);
- xs << StartTag("div", "class='index'");
- xs << StartTag(lay.htmltag(), lay.htmlattr())
+ xs << html::StartTag("div", "class='index'");
+ xs << html::StartTag(lay.htmltag(), lay.htmlattr())
<< _("Index")
- << EndTag(lay.htmltag());
- xs << StartTag("ul", "class='main'");
+ << html::EndTag(lay.htmltag());
+ xs << html::StartTag("ul", "class='main'");
Font const dummy;
vector<IndexEntry>::const_iterator eit = entries.begin();
// close last entry or entries, depending.
if (level == 3) {
// close this sub-sub-entry
- xs << EndTag("li");
+ xs << html::EndTag("li");
xs.cr();
// is this another sub-sub-entry within the same sub-entry?
if (!eit->same_sub(last)) {
// close this level
- xs << EndTag("ul");
+ xs << html::EndTag("ul");
xs.cr();
level = 2;
}
// sub-entry. In that case, we do not want to close anything.
if (level == 2 && !eit->same_sub(last)) {
// close sub-entry
- xs << EndTag("li");
+ xs << html::EndTag("li");
xs.cr();
// is this another sub-entry with the same main entry?
if (!eit->same_main(last)) {
// close this level
- xs << EndTag("ul");
+ xs << html::EndTag("ul");
xs.cr();
level = 1;
}
// close the entry.
if (level == 1 && !eit->same_main(last)) {
// close entry
- xs << EndTag("li");
+ xs << html::EndTag("li");
xs.cr();
}
}
if (level == 3) {
// another subsubentry
- xs << StartTag("li", "class='subsubentry'")
+ xs << html::StartTag("li", "class='subsubentry'")
<< XHTMLStream::NextRaw() << subsub;
} else if (level == 2) {
// there are two ways we can be here:
// note that in this case, too, though, the sub-entry might already
// have a sub-sub-entry.
if (eit->sub != last.sub)
- xs << StartTag("li", "class='subentry'")
+ xs << html::StartTag("li", "class='subentry'")
<< XHTMLStream::NextRaw() << sub;
if (!subsub.empty()) {
// it's actually a subsubentry, so we need to start that list
xs.cr();
- xs << StartTag("ul", "class='subsubentry'")
- << StartTag("li", "class='subsubentry'")
+ xs << html::StartTag("ul", "class='subsubentry'")
+ << html::StartTag("li", "class='subsubentry'")
<< XHTMLStream::NextRaw() << subsub;
level = 3;
}
// note that in this case, too, though, the main entry might already
// have a sub-entry, or even a sub-sub-entry.
if (eit->main != last.main)
- xs << StartTag("li", "class='main'") << main;
+ xs << html::StartTag("li", "class='main'") << main;
if (!sub.empty()) {
// there's a sub-entry, too
xs.cr();
- xs << StartTag("ul", "class='subentry'")
- << StartTag("li", "class='subentry'")
+ xs << html::StartTag("ul", "class='subentry'")
+ << html::StartTag("li", "class='subentry'")
<< XHTMLStream::NextRaw() << sub;
level = 2;
if (!subsub.empty()) {
// and a sub-sub-entry
xs.cr();
- xs << StartTag("ul", "class='subsubentry'")
- << StartTag("li", "class='subsubentry'")
+ xs << html::StartTag("ul", "class='subsubentry'")
+ << html::StartTag("li", "class='subsubentry'")
<< XHTMLStream::NextRaw() << subsub;
level = 3;
}
// finally, then, we can output the index link itself
string const parattr = "href='#" + par.magicLabel() + "'";
xs << (entry_number == 0 ? ":" : ",");
- xs << " " << StartTag("a", parattr)
- << ++entry_number << EndTag("a");
+ xs << " " << html::StartTag("a", parattr)
+ << ++entry_number << html::EndTag("a");
last = *eit;
}
// now we have to close all the open levels
while (level > 0) {
- xs << EndTag("li") << EndTag("ul");
+ xs << html::EndTag("li") << html::EndTag("ul");
xs.cr();
--level;
}
- xs << EndTag("div");
+ xs << html::EndTag("div");
xs.cr();
return ods.str();
}