9 #include "BufferView.h"
11 #include "frontends/Dialogs.h"
17 string const InsetTOC::getScreenLabel() 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 int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const
44 os << getScreenLabel() << "\n\n";
47 string const cmdname = getCmdName();
48 if (cmdname == "tableofcontents")
50 Buffer::Lists const toc_list = buffer->getLists();
51 Buffer::Lists::const_iterator cit =
53 if (cit != toc_list.end()) {
54 Buffer::SingleList::const_iterator ccit = cit->second.begin();
55 Buffer::SingleList::const_iterator end = cit->second.end();
56 for (; ccit != end; ++ccit)
57 os << string(4 * ccit->depth, ' ')
66 int InsetTOC::Linuxdoc(Buffer const *, std::ostream & os) const
68 if (getCmdName() == "tableofcontents")
74 int InsetTOC::DocBook(Buffer const *, std::ostream & os) const
76 if (getCmdName() == "tableofcontents")