1999-09-27 18:44:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2000-07-14 07:52:03 +00:00
|
|
|
#include "gettext.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "insettoc.h"
|
2000-02-25 12:06:15 +00:00
|
|
|
#include "BufferView.h"
|
2000-08-01 17:33:32 +00:00
|
|
|
#include "LyXView.h"
|
|
|
|
#include "frontends/Dialogs.h"
|
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
using std::ostream;
|
|
|
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
string const InsetTOC::getScreenLabel() const
|
2000-04-04 00:19:15 +00:00
|
|
|
{
|
2000-08-01 17:33:32 +00:00
|
|
|
string cmdname( getCmdName() );
|
2000-11-04 10:00:12 +00:00
|
|
|
if (cmdname == "tableofcontents" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return _("Table of Contents");
|
2000-11-04 10:00:12 +00:00
|
|
|
else if (cmdname == "listofalgorithms" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return _("List of Algorithms");
|
2000-11-04 10:00:12 +00:00
|
|
|
else if (cmdname == "listoffigures" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return _("List of Figures");
|
|
|
|
else
|
|
|
|
return _("List of Tables");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Inset::Code InsetTOC::LyxCode() const
|
|
|
|
{
|
|
|
|
string cmdname( getCmdName() );
|
2000-11-04 10:00:12 +00:00
|
|
|
if (cmdname == "tableofcontents" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return Inset::TOC_CODE;
|
2000-11-04 10:00:12 +00:00
|
|
|
else if (cmdname == "listofalgorithms" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return Inset::LOA_CODE;
|
2000-11-04 10:00:12 +00:00
|
|
|
else if (cmdname == "listoffigures" )
|
2000-08-01 17:33:32 +00:00
|
|
|
return Inset::LOF_CODE;
|
|
|
|
else
|
|
|
|
return Inset::LOT_CODE;
|
2000-04-04 00:19:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-08-01 17:33:32 +00:00
|
|
|
bv->owner()->getDialogs()->showTOC( this );
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-08-01 17:33:32 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
|
2000-03-06 02:42:40 +00:00
|
|
|
{
|
2000-11-04 10:00:12 +00:00
|
|
|
if (getCmdName() == "tableofcontents" )
|
2000-08-01 17:33:32 +00:00
|
|
|
os << "<toc>";
|
2000-03-06 02:42:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int InsetTOC::DocBook(Buffer const *, ostream & os) const
|
2000-03-06 02:42:40 +00:00
|
|
|
{
|
2000-11-04 10:00:12 +00:00
|
|
|
if (getCmdName() == "tableofcontents" )
|
2000-08-01 17:33:32 +00:00
|
|
|
os << "<toc></toc>";
|
2000-03-06 02:42:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|