9 #include "BufferView.h"
11 #include "frontends/Dialogs.h"
17 string const InsetTOC::getScreenLabel(Buffer const *) const
19 string const cmdname(getCmdName());
21 if (cmdname == "tableofcontents")
22 return _("Table of Contents");
23 return _("Unknown toc list");
27 Inset::Code InsetTOC::lyxCode() const
29 string const cmdname(getCmdName());
30 if (cmdname == "tableofcontents")
31 return Inset::TOC_CODE;
32 return Inset::NO_CODE;
36 void InsetTOC::edit(BufferView * bv, int, int, unsigned int)
38 bv->owner()->getDialogs()->showTOC(this);
42 void InsetTOC::edit(BufferView * bv, bool)
48 int InsetTOC::ascii(Buffer const * buffer, std::ostream & os, int) const
50 os << getScreenLabel(buffer) << "\n\n";
53 string const cmdname = getCmdName();
54 if (cmdname == "tableofcontents")
56 Buffer::Lists const toc_list = buffer->getLists();
57 Buffer::Lists::const_iterator cit =
59 if (cit != toc_list.end()) {
60 Buffer::SingleList::const_iterator ccit = cit->second.begin();
61 Buffer::SingleList::const_iterator end = cit->second.end();
62 for (; ccit != end; ++ccit)
63 os << string(4 * ccit->depth, ' ')
72 int InsetTOC::linuxdoc(Buffer const *, std::ostream & os) const
74 if (getCmdName() == "tableofcontents")
80 int InsetTOC::DocBook(Buffer const *, std::ostream & os) const
82 if (getCmdName() == "tableofcontents")