]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
de.po
[lyx.git] / src / insets / InsetBibtex.cpp
index 43c944dc04e7583f37242182514755949c420ce5..ae76a7f26c0c2bd7e8270fc35e322f3ec501e63c 100644 (file)
@@ -32,6 +32,7 @@
 #include "PDFOptions.h"
 #include "texstream.h"
 #include "TextClass.h"
+#include "TocBackend.h"
 
 #include "frontends/alert.h"
 
@@ -104,6 +105,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
 
                cur.recordUndo();
                setParams(p);
+               cur.buffer()->clearBibFileCache();
                cur.forceBufferUpdate();
                break;
        }
@@ -895,15 +897,36 @@ void InsetBibtex::updateBuffer(ParIterator const &, UpdateType)
                                string() : to_ascii(params()["encoding"]);
        if (buffer().params().bibEncoding() != enc) {
                buffer().params().setBibEncoding(enc);
-               buffer().reloadBibInfoCache(true);
+               buffer().invalidateBibinfoCache();
        }
 }
 
 
+docstring InsetBibtex::getRefLabel() const
+{
+       if (buffer().masterParams().documentClass().hasLaTeXLayout("chapter"))
+               return buffer().B_("Bibliography");
+       return buffer().B_("References");
+}
+
+
+void InsetBibtex::addToToc(DocIterator const & cpit, bool output_active,
+                          UpdateType, TocBackend & backend) const
+{
+       if (!prefixIs(to_utf8(getParam("options")), "bibtotoc"))
+               return;
+
+       docstring const str = getRefLabel();
+       TocBuilder & b = backend.builder("tableofcontents");
+       b.pushItem(cpit, str, output_active);
+       b.pop();
+}
+
+
 int InsetBibtex::plaintext(odocstringstream & os,
        OutputParams const & op, size_t max_length) const
 {
-       docstring const reflabel = buffer().B_("References");
+       docstring const reflabel = getRefLabel();
 
        // We could output more information here, e.g., what databases are included
        // and information about options. But I don't necessarily see any reason to