]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlToc.C
John's character.C patch (bug fix).
[lyx.git] / src / frontends / controllers / ControlToc.C
index 6bf0fbb83fe311d2c9571ce6dc16f8045d129432..9498787396c0e7eb285e89d70b953ad3fe2bfec6 100644 (file)
 #pragma implementation
 #endif
 
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
 #include "ControlToc.h"
 #include "buffer.h"
 #include "Dialogs.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
 #include "support/lstrings.h" // tostr
+#include "gettext.h"
+#include "BufferView.h"
 
 using std::vector;
 using SigC::slot;
@@ -38,7 +42,7 @@ ControlToc::ControlToc(LyXView & lv, Dialogs & d)
 void ControlToc::Goto(int const & id) const
 {
        string const tmp = tostr(id);
-       lv_.getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
+       lv_.getLyXFunc()->dispatch(LFUN_GOTO_PARAGRAPH, tmp);
 }
 
 
@@ -61,15 +65,11 @@ vector<string> const ControlToc::getTypes() const
 
 Buffer::SingleList const ControlToc::getContents(string const & type) const
 {
-       Buffer::SingleList contents;
-       
-       Buffer::TocItem noContent(0, 0, string());
+       Buffer::SingleList empty_list;
 
        // This shouldn't be possible...
        if (!lv_.view()->available()) {
-               noContent.str = _("*** No Document ***");
-               contents.push_back(noContent);
-               return contents;
+               return empty_list;
        }
 
        Buffer::Lists tmp = lv_.view()->buffer()->getLists();
@@ -77,9 +77,7 @@ Buffer::SingleList const ControlToc::getContents(string const & type) const
        Buffer::Lists::iterator it = tmp.find(type);
 
        if (it == tmp.end()) {
-               noContent.str = _("*** No Lists ***");
-               contents.push_back(noContent);
-               return contents;
+               return empty_list;
        }
 
        return it->second;
@@ -89,7 +87,7 @@ Buffer::SingleList const ControlToc::getContents(string const & type) const
 namespace toc 
 {
 
-string getType(string const & cmdName)
+string const getType(string const & cmdName)
 {
        string type;
 
@@ -98,16 +96,7 @@ string getType(string const & cmdName)
        if (cmdName == "tableofcontents" )
                type = "TOC";
 
-       else if (cmdName == "listofalgorithms" )
-               type = "algorithm";
-
-       else if (cmdName == "listoffigures" )
-               type = "figure";
-
-       else
-               type = "table";
-
-       return type;
+       return cmdName;
 }
  
 } // namespace toc