]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetBibtex.cpp
index b4869b0c1b5e02e201498c49738cf1e8b0867042..ff9c6733602ea75fcb6077d3361a2f25d571835e 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "output_xhtml.h"
 #include "OutputParams.h"
+#include "PDFOptions.h"
 #include "TextClass.h"
 
 #include "frontends/alert.h"
@@ -51,7 +52,7 @@ namespace os = support::os;
 
 
 InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p)
-       : InsetCommand(buf, p, "bibtex")
+       : InsetCommand(buf, p)
 {
        buffer().invalidateBibinfoCache();
 }
@@ -87,8 +88,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_INSET_MODIFY: {
                InsetCommandParams p(BIBTEX_CODE);
                try {
-                       if (!InsetCommand::string2params("bibtex", 
-                                       to_utf8(cmd.argument()), p)) {
+                       if (!InsetCommand::string2params(to_utf8(cmd.argument()), p)) {
                                cur.noScreenUpdate();
                                break;
                        }
@@ -379,16 +379,12 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
 
        // bibtotoc-Option
        if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
-               if (buffer().params().documentClass().hasLaTeXLayout("chapter")) {
-                       if (buffer().params().sides == OneSide) {
-                               // oneside
-                               os << "\\clearpage";
-                       } else {
-                               // twoside
-                               os << "\\cleardoublepage";
-                       }
+               // set label for hyperref, see http://www.lyx.org/trac/ticket/6470
+               if (buffer().params().pdfoptions().use_hyperref)
+                               os << "\\phantomsection";
+               if (buffer().params().documentClass().hasLaTeXLayout("chapter"))
                        os << "\\addcontentsline{toc}{chapter}{\\bibname}";
-               else if (buffer().params().documentClass().hasLaTeXLayout("section"))
+               else if (buffer().params().documentClass().hasLaTeXLayout("section"))
                        os << "\\addcontentsline{toc}{section}{\\refname}";
        }