some index fixes:

* src/insets/InsetIndex.{cpp,h} reimplement ::latex in order to:
	- un-\protect the index entry (fixes bug 4600).
	- handle formatted index entries (bug 4800). 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24513 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-04-26 14:24:28 +00:00
parent 1b0892ac1c
commit 96b0466c49
2 changed files with 29 additions and 0 deletions

View File

@ -40,6 +40,21 @@ InsetIndex::InsetIndex(Buffer const & buf)
{} {}
int InsetIndex::latex(odocstream & os,
OutputParams const & runparams) const
{
os << "\\index";
os << '{';
if (hasFontChanges()) {
InsetText::plaintext(os, runparams);
os << '@';
}
int i = InsetText::latex(os, runparams);
os << '}';
return i;
}
int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const
{ {
os << "<indexterm><primary>"; os << "<indexterm><primary>";
@ -68,6 +83,16 @@ void InsetIndex::addToToc(ParConstIterator const & cpit) const
} }
bool InsetIndex::hasFontChanges() const
{
// we only have one par
Paragraph par = paragraphs().back();
FontSpan const font_span = par.fontSpan(0);
Font firstfont = par.getFirstFontSettings(buffer().params());
return (firstfont.fontInfo() != inherit_font || par.size() > font_span.last + 1);
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// //
// InsetPrintIndex // InsetPrintIndex

View File

@ -36,12 +36,16 @@ private:
void write(std::ostream & os) const; void write(std::ostream & os) const;
/// ///
int docbook(odocstream &, OutputParams const &) const; int docbook(odocstream &, OutputParams const &) const;
///
int latex(odocstream &, OutputParams const &) const;
/// should paragraph indendation be omitted in any case? /// should paragraph indendation be omitted in any case?
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
void addToToc(ParConstIterator const &) const; void addToToc(ParConstIterator const &) const;
/// ///
Inset * clone() const { return new InsetIndex(*this); } Inset * clone() const { return new InsetIndex(*this); }
///
bool hasFontChanges() const;
}; };