]> 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 1f135f54c2e6eafc7fe50160a35faec138901b83..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));
        }
 }
 
@@ -1039,7 +1039,7 @@ void InsetMathHull::splitTo3Cols()
        InsetMathGrid::addCol(2);
        for (row_type row = 0; row < nrows(); ++row) {
                idx_type const i = 3 * row + 1;
-               if (cell(i).size()) {
+               if (!cell(i).empty()) {
                        cell(i + 1) = MathData(buffer_, cell(i).begin() + 1, cell(i).end());
                        cell(i).erase(1, cell(i).size());
                }
@@ -1309,7 +1309,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
                MathData ar;
                if (cur.inMathed() && cur.selection()) {
                        asArray(grabAndEraseSelection(cur), ar);
-               } else if (pos == cur.cell().size()) {
+               } else if (!pos == cur.cell().empty()) {
                        ar = cur.cell();
                        lyxerr << "use whole cell: " << ar << endl;
                } else {
@@ -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();
 }