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;
75 #warning Fix Me! (Lgb)
78 string const 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 *, std::ostream & os) const
106 if (getCmdName() == "tableofcontents" )
112 int InsetTOC::DocBook(Buffer const *, std::ostream & os) const
114 if (getCmdName() == "tableofcontents" )