]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNomencl.cpp
Limit ligature protection to quote ligature chars
[lyx.git] / src / insets / InsetNomencl.cpp
index f7f740aa6f4673fbde19818cee36ff27f2141c11..76bd7b3a0aa8d56da215ddc628cc16c88f23a59d 100644 (file)
@@ -31,6 +31,7 @@
 #include "OutputParams.h"
 #include "output_xhtml.h"
 #include "sgml.h"
+#include "texstream.h"
 #include "TocBackend.h"
 
 #include "frontends/FontMetrics.h"
@@ -75,12 +76,8 @@ ParamInfo const & InsetNomencl::findInfo(string const & /* cmdName */)
 docstring InsetNomencl::screenLabel() const
 {
        size_t const maxLabelChars = 25;
-
        docstring label = _("Nom: ") + getParam("symbol");
-       if (label.size() > maxLabelChars) {
-               label.erase(maxLabelChars - 3);
-               label += "...";
-       }
+       support::truncateWithEllipsis(label, maxLabelChars);
        return label;
 }
 
@@ -96,6 +93,14 @@ docstring InsetNomencl::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/)
 }
 
 
+int InsetNomencl::plaintext(odocstringstream & os,
+        OutputParams const &, size_t) const
+{
+       docstring s = "[" + getParam("symbol") + ": " + getParam("description") + "]";
+       os << s;
+       return s.size();
+}
+
 
 int InsetNomencl::docbook(odocstream & os, OutputParams const &) const
 {
@@ -132,10 +137,11 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active) const
+void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active,
+                                                       UpdateType) const
 {
        docstring const str = getParam("symbol");
-       buffer().tocBackend().toc("nomencl").push_back(TocItem(cpit, 0, str, output_active));
+       buffer().tocBackend().toc("nomencl")->push_back(TocItem(cpit, 0, str, output_active));
 }
 
 
@@ -174,7 +180,7 @@ docstring InsetPrintNomencl::screenLabel() const
 
 
 struct NomenclEntry {
-       NomenclEntry() {}
+       NomenclEntry() : par(0) {}
        NomenclEntry(docstring s, docstring d, Paragraph const * p)
          : symbol(s), desc(d), par(p)
        {}
@@ -190,11 +196,11 @@ typedef map<docstring, NomenclEntry > EntryMap;
 
 docstring InsetPrintNomencl::xhtml(XHTMLStream &, OutputParams const & op) const
 {
-       Toc const & toc = buffer().tocBackend().toc("nomencl");
+       shared_ptr<Toc const> toc = buffer().tocBackend().toc("nomencl");
 
        EntryMap entries;
-       Toc::const_iterator it = toc.begin();
-       Toc::const_iterator const en = toc.end();
+       Toc::const_iterator it = toc->begin();
+       Toc::const_iterator const en = toc->end();
        for (; it != en; ++it) {
                DocIterator dit = it->dit();
                Paragraph const & par = dit.innerParagraph();