]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIndex.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / insets / InsetIndex.cpp
index 6b60824302ec4e5476beb0e5a520d593b0623e9e..4fdbfc502ef028667e99fbcf04f76d88be367bdd 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
+#include "output_latex.h"
 #include "sgml.h"
 #include "TocBackend.h"
 
@@ -48,14 +49,17 @@ namespace lyx {
 ///////////////////////////////////////////////////////////////////////
 
 
-InsetIndex::InsetIndex(Buffer const & buf, InsetIndexParams const & params)
+InsetIndex::InsetIndex(Buffer * buf, InsetIndexParams const & params)
        : InsetCollapsable(buf), params_(params)
 {}
 
 
 int InsetIndex::latex(odocstream & os,
-                     OutputParams const & runparams) const
+                     OutputParams const & runparams_in) const
 {
+       OutputParams runparams(runparams_in);
+       runparams.inIndexEntry = true;
+
        if (buffer().masterBuffer()->params().use_indices && !params_.index.empty()
            && params_.index != "idx") {
                os << "\\sindex[";
@@ -88,9 +92,6 @@ int InsetIndex::latex(odocstream & os,
                // ...and erase that stuff from latexstr
                latexstr = latexstr.erase(pos);
                // ...and similarly from plainstr
-               // FIXME This utterly fails if the "|" is in ERT
-               // which is necessary with font encodings other
-               // than T1.
                size_t ppos = plainstr.find(from_ascii("|"));
                if (ppos < plainstr.size())
                        plainstr.erase(ppos);
@@ -100,7 +101,6 @@ int InsetIndex::latex(odocstream & os,
 
        // Separate the entires and subentries, i.e., split on "!"
        // FIXME This would do the wrong thing with escaped ! characters
-       // and with "!" in ERT.
        std::vector<docstring> const levels =
                getVectorFromString(latexstr, from_ascii("!"), true);
        std::vector<docstring> const levels_plain =
@@ -175,7 +175,7 @@ int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-docstring InsetIndex::xhtml(odocstream &, OutputParams const &) const
+docstring InsetIndex::xhtml(XHTMLStream &, OutputParams const &) const
 {
        return docstring();
 }
@@ -246,16 +246,6 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-docstring const InsetIndex::buttonLabel(BufferView const & bv) const
-{
-       docstring s = _("Idx");
-       if (decoration() == InsetLayout::CLASSIC)
-               return isOpen(bv) ? s : getNewLabel(s);
-       else
-               return getNewLabel(s);
-}
-
-
 ColorCode InsetIndex::labelColor() const
 {
        if (params_.index.empty() || params_.index == from_ascii("idx"))
@@ -397,8 +387,8 @@ void InsetIndexParams::read(Lexer & lex)
 //
 ///////////////////////////////////////////////////////////////////////
 
-InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
-       : InsetCommand(p, "index_print")
+InsetPrintIndex::InsetPrintIndex(Buffer * buf, InsetCommandParams const & p)
+       : InsetCommand(buf, p, "index_print")
 {}
 
 
@@ -561,7 +551,8 @@ bool InsetPrintIndex::hasSettings() const
        return buffer().masterBuffer()->params().use_indices;
 }
 
-docstring InsetPrintIndex::xhtml(odocstream &, OutputParams const &) const
+
+docstring InsetPrintIndex::xhtml(XHTMLStream &, OutputParams const &) const
 {
        return docstring();
 }