]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
Fix crash after undo following replacement of a multicell selection (#8973).
[lyx.git] / src / insets / InsetTOC.cpp
index 6ed1fa91e94c534d81b5a730053ffaff84c38f26..fc1f42bcae86ab8c3cb0d41e136d1e62bea65b48 100644 (file)
@@ -144,16 +144,7 @@ void InsetTOC::makeTOCEntry(XHTMLStream & xs,
        Font const dummy;
        par.simpleLyXHTMLOnePar(buffer(), xs, ours, dummy);
 
-       xs << html::EndTag("a") << " ";
-
-       // Now a link to the paragraph
-       string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'";
-       xs << html::StartTag("a", parattr);
-       // FIXME XHTML 
-       // There ought to be a simple way to customize this.
-       // Maybe if we had an InsetLayout for TOC...
-       xs << XHTMLStream::ESCAPE_NONE << "&gt;";
-       xs << html::EndTag("a");                
+       xs << html::EndTag("a") << html::CR();
 }
 
 
@@ -226,7 +217,7 @@ void InsetTOC::makeTOCNoDepth(XHTMLStream xs,
                if (!it->isOutput())
                        continue;
 
-               xs << html::StartTag("div", "class='lyxtop-1'") << html::CR();
+               xs << html::StartTag("div", "class='lyxtoc-flat'") << html::CR();
 
                Paragraph const & par = it->dit().innerParagraph();
                makeTOCEntry(xs, par, op);
@@ -241,17 +232,12 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
        string const & command = getCmdName();
        if (command != "tableofcontents" && command != "lstlistoflistings") {
                LYXERR0("TOC type " << command << " not yet implemented.");
-               LASSERT(false, /* */);
-               return docstring();
+               LASSERT(false, return docstring());
        }
 
-       // with lists of listings, at least, there is no depth
-       // to worry about. so the code can be simpler.
-       bool const use_depth = (command == "tableofcontents");
-
-       Layout const & lay = buffer().params().documentClass().htmlTOCLayout();
-       string const & tocclass = lay.defaultCSSClass();
-       string const tocattr = "class='tochead " + tocclass + "'";
+       Toc const & toc = buffer().masterBuffer()->tocBackend().toc(cmd2type(command));
+       if (toc.empty())
+               return docstring();
 
        // we'll use our own stream, because we are going to defer everything.
        // that's how we deal with the fact that we're probably inside a standard
@@ -259,17 +245,22 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
        odocstringstream ods;
        XHTMLStream xs(ods);
 
-       Toc const & toc = buffer().tocBackend().toc(cmd2type(command));
-       if (toc.empty())
-               return docstring();
-
        xs << html::StartTag("div", "class='toc'");
 
        // Title of TOC
+       InsetLayout const & il = getLayout();
+       string const & tag = il.htmltag();
        docstring title = screenLabel();
-       xs << html::StartTag("div", tocattr)
+       Layout const & lay = buffer().params().documentClass().htmlTOCLayout();
+       string const & tocclass = lay.defaultCSSClass();
+       string const tocattr = "class='tochead " + tocclass + "'";
+       xs << html::StartTag(tag, tocattr)
                 << title
-                << html::EndTag("div");
+                << html::EndTag(tag);
+
+       // with lists of listings, at least, there is no depth
+       // to worry about. so the code can be simpler.
+       bool const use_depth = (command == "tableofcontents");
 
        // Output of TOC
        if (use_depth)