]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
de.po
[lyx.git] / src / insets / InsetBibitem.cpp
index 1c8bc786db6ddb9130151fb96dcbbfe7c8ef988f..f9b244c4603f556d3a5c68af74a1c182f4830b22 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "frontends/alert.h"
 
+#include "support/lassert.h"
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
@@ -67,11 +68,12 @@ InsetBibitem::InsetBibitem(Buffer * buf, InsetCommandParams const & p)
 
 InsetBibitem::~InsetBibitem()
 {
-       if (isBufferLoaded())
-               /* Coverity believs that this may throw an exception, but
-                * actually this code path is not taken when buffer_ == 0 */
-               // coverity[exn_spec_violation]
-               buffer().invalidateBibinfoCache();
+       if (isBufferLoaded()) {
+               /* We do not use buffer() because Coverity believes that this
+                * may throw an exception. Actually this code path is not
+                * taken when buffer_ == 0 */
+               buffer_->invalidateBibinfoCache();
+       }
 }
 
 
@@ -110,7 +112,8 @@ ParamInfo const & InsetBibitem::findInfo(string const & /* cmdName */)
                param_info_.add("label", ParamInfo::LATEX_OPTIONAL,
                                ParamInfo::HANDLING_LATEXIFY);
                param_info_.add("key", ParamInfo::LATEX_REQUIRED,
-                               ParamInfo::HANDLING_ESCAPE);
+                               ParamInfo::ParamHandling(ParamInfo::HANDLING_ESCAPE
+                                                        | ParamInfo::HANDLING_LTRIM));
                param_info_.add("literal", ParamInfo::LYX_INTERNAL);
        }
        return param_info_;
@@ -246,6 +249,7 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
        ParagraphList::const_iterator it = buffer.paragraphs().begin();
        ParagraphList::const_iterator end = buffer.paragraphs().end();
 
+       bool is_literal = false;
        for (; it != end; ++it) {
                if (it->insetList().empty())
                        continue;
@@ -271,11 +275,14 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
                if (wx > w) {
                        w = wx;
                        lbl = label;
+                       is_literal = (bitem->getParam("literal") == "true");
                }
        }
 
        if (!lbl.empty()) {
                InsetCommandParams p(BIBITEM_CODE);
+               if (is_literal)
+                       p["literal"] = from_ascii("true");
                return p.prepareCommand(runparams, lbl, ParamInfo::HANDLING_LATEXIFY);
        }
 
@@ -283,7 +290,7 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 }
 
 
-void InsetBibitem::collectBibKeys(InsetIterator const & it) const
+void InsetBibitem::collectBibKeys(InsetIterator const & it, FileNameList & /*checkedFiles*/) const
 {
        docstring const key = getParam("key");
        docstring const label = getParam("label");