]> git.lyx.org Git - lyx.git/blobdiff - src/toc.C
Fix bug 886 and others not reported related with the document paper size.
[lyx.git] / src / toc.C
index cfb9f9724a8cbb65117a7263f6673f04f77917e0..d207636526dfc41171830281c734ef064358689a 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -15,7 +15,9 @@
 
 #include "buffer.h"
 #include "bufferparams.h"
+#include "FloatList.h"
 #include "funcrequest.h"
+#include "gettext.h"
 #include "LyXAction.h"
 #include "paragraph.h"
 #include "pariterator.h"
@@ -59,12 +61,23 @@ string const getType(string const & cmdName)
 {
        // special case
        if (cmdName == "tableofcontents")
-               return "TOC";
+               return _("TOC");
        else
                return cmdName;
 }
 
 
+string const getGuiName(string const & cmdName, Buffer const & buffer)
+{
+       FloatList const & floats =
+               buffer.params().getLyXTextClass().floats();
+       if (floats.typeExist(cmdName))
+               return _(floats.getType(cmdName).name());
+       else
+               return getType(cmdName);
+}
+
+
 TocList const getTocList(Buffer const & buf)
 {
        TocList toclist;
@@ -98,7 +111,7 @@ TocList const getTocList(Buffer const & buf)
                                        break;
                                Paragraph const & par = *static_cast<InsetOptArg*>(it->inset)->paragraphs().begin();
                                if (!pit->getLabelstring().empty())
-                                       tocstring = pit->getLabelstring() 
+                                       tocstring = pit->getLabelstring()
                                                + ' ';
                                tocstring += par.asString(buf, false);
                                break;
@@ -110,14 +123,14 @@ TocList const getTocList(Buffer const & buf)
 
                /// now the toc entry for the paragraph
                int const toclevel = pit->layout()->toclevel;
-               if (toclevel >= min_toclevel 
+               if (toclevel >= min_toclevel
                    && toclevel <= bufparams.tocdepth) {
                        // insert this into the table of contents
                        if (tocstring.empty())
                                tocstring = pit->asString(buf, true);
-                       TocItem const item(pit->id(), toclevel - min_toclevel, 
+                       TocItem const item(pit->id(), toclevel - min_toclevel,
                                           tocstring);
-                       toclist["TOC"].push_back(item);
+                       toclist[_("TOC")].push_back(item);
                }
        }
        return toclist;