9 #include "BufferView.h"
11 #include "frontends/Dialogs.h"
19 string const InsetTOC::getScreenLabel() const
21 string cmdname( getCmdName() );
22 if (cmdname == "tableofcontents" )
23 return _("Table of Contents");
24 else if (cmdname == "listofalgorithms" )
25 return _("List of Algorithms");
26 else if (cmdname == "listoffigures" )
27 return _("List of Figures");
29 return _("List of Tables");
33 Inset::Code InsetTOC::LyxCode() const
35 string cmdname( getCmdName() );
36 if (cmdname == "tableofcontents" )
37 return Inset::TOC_CODE;
38 else if (cmdname == "listofalgorithms" )
39 return Inset::LOA_CODE;
40 else if (cmdname == "listoffigures" )
41 return Inset::LOF_CODE;
43 return Inset::LOT_CODE;
47 void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
49 bv->owner()->getDialogs()->showTOC( this );
53 int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
55 os << getScreenLabel() << endl << endl;
59 string cmdname = getCmdName();
60 if (cmdname == "tableofcontents" )
61 type = Buffer::TOC_TOC;
62 else if (cmdname == "listofalgorithms" )
63 type = Buffer::TOC_LOA;
64 else if (cmdname == "listoffigures" )
65 type = Buffer::TOC_LOF;
67 type = Buffer::TOC_LOT;
69 vector<vector<Buffer::TocItem> > const toc_list =
71 vector<Buffer::TocItem> const & toc = toc_list[type];
72 for (vector<Buffer::TocItem>::const_iterator it = toc.begin();
73 it != toc.end(); ++it)
74 os << string(4 * it->depth, ' ') << it->str << endl;
76 #warning Fix Me! (Lgb)
78 string cmdname = getCmdName();
79 if (cmdname == "tableofcontents" )
81 else if (cmdname == "listofalgorithms" )
83 else if (cmdname == "listoffigures" )
88 Buffer::Lists const toc_list = buffer->getLists();
89 Buffer::Lists::const_iterator cit =
91 if (cit != toc_list.end()) {
92 Buffer::SingleList::const_iterator ccit = cit->second.begin();
93 Buffer::SingleList::const_iterator end = cit->second.end();
94 for (; ccit != end; ++ccit)
95 os << string(4 * ccit->depth, ' ')
104 int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
106 if (getCmdName() == "tableofcontents" )
112 int InsetTOC::DocBook(Buffer const *, ostream & os) const
114 if (getCmdName() == "tableofcontents" )