9 #include "BufferView.h"
11 #include "frontends/Dialogs.h"
18 string const InsetTOC::getScreenLabel() const
20 string cmdname( getCmdName() );
21 if (cmdname == "tableofcontents" )
22 return _("Table of Contents");
23 else if (cmdname == "listofalgorithms" )
24 return _("List of Algorithms");
25 else if (cmdname == "listoffigures" )
26 return _("List of Figures");
28 return _("List of Tables");
32 Inset::Code InsetTOC::LyxCode() const
34 string cmdname( getCmdName() );
35 if (cmdname == "tableofcontents" )
36 return Inset::TOC_CODE;
37 else if (cmdname == "listofalgorithms" )
38 return Inset::LOA_CODE;
39 else if (cmdname == "listoffigures" )
40 return Inset::LOF_CODE;
42 return Inset::LOT_CODE;
46 void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
48 bv->owner()->getDialogs()->showTOC( this );
52 int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
54 os << getScreenLabel() << endl << endl;
58 string cmdname = getCmdName();
59 if (cmdname == "tableofcontents" )
60 type = Buffer::TOC_TOC;
61 else if (cmdname == "listofalgorithms" )
62 type = Buffer::TOC_LOA;
63 else if (cmdname == "listoffigures" )
64 type = Buffer::TOC_LOF;
66 type = Buffer::TOC_LOT;
68 vector<vector<Buffer::TocItem> > const toc_list =
70 vector<Buffer::TocItem> const & toc = toc_list[type];
71 for (vector<Buffer::TocItem>::const_iterator it = toc.begin();
72 it != toc.end(); ++it)
73 os << string(4 * it->depth, ' ') << it->str << endl;
75 #warning Fix Me! (Lgb)
77 string cmdname = getCmdName();
78 if (cmdname == "tableofcontents" )
80 else if (cmdname == "listofalgorithms" )
82 else if (cmdname == "listoffigures" )
87 Buffer::Lists const toc_list = buffer->getLists();
88 Buffer::Lists::const_iterator cit =
90 if (cit != toc_list.end()) {
91 Buffer::SingleList::const_iterator ccit = cit->second.begin();
92 Buffer::SingleList::const_iterator end = cit->second.end();
93 for (; ccit != end; ++ccit)
94 os << string(4 * ccit->depth, ' ')
103 int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
105 if (getCmdName() == "tableofcontents" )
111 int InsetTOC::DocBook(Buffer const *, ostream & os) const
113 if (getCmdName() == "tableofcontents" )