X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftoc.C;h=d90cab6e37812c83ce88fc07193b6ce72ecda316;hb=9ee46b846e5e84ad40ceda4f4af94aeb86cd90a2;hp=cfb9f9724a8cbb65117a7263f6673f04f77917e0;hpb=2b6b957d3ed8931b5ab281befef549a4ef7e0236;p=lyx.git diff --git a/src/toc.C b/src/toc.C index cfb9f9724a..d90cab6e37 100644 --- a/src/toc.C +++ b/src/toc.C @@ -15,6 +15,7 @@ #include "buffer.h" #include "bufferparams.h" +#include "FloatList.h" #include "funcrequest.h" #include "LyXAction.h" #include "paragraph.h" @@ -65,6 +66,17 @@ string const getType(string const & cmdName) } +string const getGuiName(string const & type, Buffer const & buffer) +{ + FloatList const & floats = + buffer.params().getLyXTextClass().floats(); + if (floats.typeExist(type)) + return floats.getType(type).name(); + else + return type; +} + + TocList const getTocList(Buffer const & buf) { TocList toclist; @@ -98,7 +110,7 @@ TocList const getTocList(Buffer const & buf) break; Paragraph const & par = *static_cast(it->inset)->paragraphs().begin(); if (!pit->getLabelstring().empty()) - tocstring = pit->getLabelstring() + tocstring = pit->getLabelstring() + ' '; tocstring += par.asString(buf, false); break; @@ -110,12 +122,13 @@ 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 != LyXLayout::NOT_IN_TOC + && 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); }