X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetIndex.cpp;h=e46e6cea8016168a921ddad2c26523f53ba7f0a1;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=1c479b6bbdf43dc5eaeeb998580b17068202d835;hpb=9d0ea8aeff32833a90b3fe64df0c5518a9e241be;p=lyx.git diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 1c479b6bbd..e46e6cea80 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -11,22 +11,23 @@ #include "InsetIndex.h" +#include "Buffer.h" #include "DispatchResult.h" #include "FuncRequest.h" #include "FuncStatus.h" -#include "support/gettext.h" #include "LaTeXFeatures.h" #include "MetricsInfo.h" #include "sgml.h" +#include "TocBackend.h" + +#include "support/gettext.h" #include +using namespace std; namespace lyx { -using std::string; -using std::ostream; - InsetIndex::InsetIndex(BufferParams const & bp) : InsetCollapsable(bp) @@ -54,19 +55,32 @@ Inset * InsetIndex::clone() const } -void InsetIndex::write(Buffer const & buf, std::ostream & os) const +void InsetIndex::write(Buffer const & buf, ostream & os) const { os << to_utf8(name()) << "\n"; InsetCollapsable::write(buf, os); } +void InsetIndex::addToToc(Buffer const & buf, + ParConstIterator const & cpit) const +{ + ParConstIterator pit = cpit; + pit.push_back(*this); + + Toc & toc = buf.tocBackend().toc("index"); + docstring str; + str = getNewLabel(str); + toc.push_back(TocItem(pit, 0, str)); +} + + InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p) : InsetCommand(p, string()) {} -CommandInfo const * InsetPrintIndex::findInfo(std::string const & /* cmdName */) +CommandInfo const * InsetPrintIndex::findInfo(string const & /* cmdName */) { static const char * const paramnames[] = {"name", ""}; static const bool isoptional[] = {false}; @@ -92,5 +106,4 @@ InsetCode InsetPrintIndex::lyxCode() const return INDEX_PRINT_CODE; } - } // namespace lyx