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