]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathHull.cpp
Add a member to TocItem that tells us whether the item in question
[features.git] / src / mathed / InsetMathHull.cpp
index 6598bd913dcfaa27180870d765e4b3716c6968da..2a47f2035683a563576f458fdf72cc60b1a21892 100644 (file)
@@ -284,7 +284,7 @@ void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype)
 }
 
 
-void InsetMathHull::addToToc(DocIterator const & pit) const
+void InsetMathHull::addToToc(DocIterator const & pit, bool output_active) const
 {
        if (!buffer_) {
                //FIXME: buffer_ should be set at creation for this inset! Problem is
@@ -299,8 +299,8 @@ void InsetMathHull::addToToc(DocIterator const & pit) const
                if (!numbered_[row])
                        continue;
                if (label_[row])
-                       label_[row]->addToToc(pit);
-               toc.push_back(TocItem(pit, 0, nicelabel(row)));
+                       label_[row]->addToToc(pit, output_active);
+               toc.push_back(TocItem(pit, 0, nicelabel(row), output_active));
        }
 }
 
@@ -1895,7 +1895,8 @@ bool InsetMathHull::readQuiet(Lexer & lex)
 }
 
 
-int InsetMathHull::plaintext(odocstream & os, OutputParams const & op) const
+int InsetMathHull::plaintext(odocstringstream & os,
+        OutputParams const & op, size_t max_length) const
 {
        // disables ASCII-art for export of equations. See #2275.
        if (0 && display()) {
@@ -1923,7 +1924,7 @@ int InsetMathHull::plaintext(odocstream & os, OutputParams const & op) const
                                wi << (c == 0 ? "" : "\t") << cell(index(r, c));
                        // if it's for the TOC, we write just the first line
                        // and do not include the newline.
-                       if (op.for_toc)
+                       if (op.for_toc || op.for_tooltip || oss.str().size() >= max_length)
                                break;
                        wi << "\n";
                }
@@ -2239,7 +2240,9 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
 
 void InsetMathHull::toString(odocstream & os) const
 {
-       plaintext(os, OutputParams(0));
+       odocstringstream ods;
+       plaintext(ods, OutputParams(0));
+       os << ods.str();
 }