]> git.lyx.org Git - lyx.git/blobdiff - src/TocBackend.cpp
Fix bug 3377 by Ozgur Ugras BARAN:
[lyx.git] / src / TocBackend.cpp
index fb196e46fcc384ff7dbcf01783d268cb7be9ed62..e805917bf134ad4dc33cded00ed64d3492d68149 100644 (file)
@@ -123,8 +123,13 @@ Toc const & TocBackend::toc(std::string const & type) const
 
 void TocBackend::updateItem(ParConstIterator const & par_it)
 {
+       // TODO should not happen, 
+       // a call to TocBackend::update() is missing somewhere
+       if (toc("tableofcontents").empty())
+               return;
+
        BufferParams const & bufparams = buffer_->params();
-       const int min_toclevel = bufparams.getLyXTextClass().min_toclevel();
+       const int min_toclevel = bufparams.getTextClass().min_toclevel();
 
        TocIterator toc_item = item("tableofcontents", par_it);
 
@@ -149,7 +154,7 @@ void TocBackend::updateItem(ParConstIterator const & par_it)
        }
 
        int const toclevel = toc_item->par_it_->layout()->toclevel;
-       if (toclevel != LyXLayout::NOT_IN_TOC
+       if (toclevel != Layout::NOT_IN_TOC
            && toclevel >= min_toclevel
            && toclevel <= bufparams.tocdepth
                && tocstring.empty())
@@ -164,7 +169,7 @@ void TocBackend::update()
        tocs_.clear();
 
        BufferParams const & bufparams = buffer_->params();
-       const int min_toclevel = bufparams.getLyXTextClass().min_toclevel();
+       const int min_toclevel = bufparams.getTextClass().min_toclevel();
 
        Toc & toc = tocs_["tableofcontents"];
        ParConstIterator pit = buffer_->par_iterator_begin();
@@ -199,7 +204,7 @@ void TocBackend::update()
 
                /// now the toc entry for the paragraph
                int const toclevel = pit->layout()->toclevel;
-               if (toclevel != LyXLayout::NOT_IN_TOC
+               if (toclevel != Layout::NOT_IN_TOC
                    && toclevel >= min_toclevel
                    && toclevel <= bufparams.tocdepth) {
                        // insert this into the table of contents