]> git.lyx.org Git - features.git/blobdiff - src/insets/insettoc.C
patch from Angus
[features.git] / src / insets / insettoc.C
index 1c633ff0a7257f58777d80caa84f1ee17cae42f0..f74b85ff8e869d6c5d5e258b6139e13080db4149 100644 (file)
@@ -6,35 +6,59 @@
 
 #include "gettext.h"
 #include "insettoc.h"
-#include "commandtags.h"
-#include "debug.h"
-#include "lyxfunc.h"
-#include "LyXView.h"
 #include "BufferView.h"
+#include "LyXView.h"
+#include "frontends/Dialogs.h"
+#include "debug.h"
 
 using std::ostream;
 
 
 string InsetTOC::getScreenLabel() const 
 {
-       return _("Table of Contents");
+       string cmdname( getCmdName() );
+       if( cmdname == "tableofcontents" )
+               return _("Table of Contents");
+       else if( cmdname == "listofalgorithms" )
+               return _("List of Algorithms");
+       else if( cmdname == "listoffigures" )
+               return _("List of Figures");
+       else
+               return _("List of Tables");
+}
+
+
+Inset::Code InsetTOC::LyxCode() const
+{
+       string cmdname( getCmdName() );
+       if( cmdname == "tableofcontents" )
+               return Inset::TOC_CODE;
+       else if( cmdname == "listofalgorithms" )
+               return Inset::LOA_CODE;
+       else if( cmdname == "listoffigures" )
+               return Inset::LOF_CODE; 
+       else
+               return Inset::LOT_CODE;
 }
 
 
 void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
 {
-       bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
+       bv->owner()->getDialogs()->showTOC( this );
 }
 
+
 int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
 {
-       os << "<toc>";
+       if( getCmdName() == "tableofcontents" )
+               os << "<toc>";
        return 0;
 }
 
 
 int InsetTOC::DocBook(Buffer const *, ostream & os) const
 {
-       os << "<toc></toc>";
+       if( getCmdName() == "tableofcontents" )
+               os << "<toc></toc>";
        return 0;
 }