Fix oddity in bibtotoc handling.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23339 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-02-28 21:25:57 +00:00
parent 5e853c1803
commit cef5f40f47
3 changed files with 18 additions and 15 deletions

View File

@ -1151,6 +1151,17 @@ DocumentClass::DocumentClass(TextClass const & tc)
{}
bool DocumentClass::hasLaTeXLayout(std::string const & lay) const
{
LayoutList::const_iterator it = layoutlist_.begin();
LayoutList::const_iterator end = layoutlist_.end();
for (; it != end; ++it)
if (it->get()->latexname() == lay)
return true;
return false;
}
ostream & operator<<(ostream & os, PageSides p)
{
switch (p) {

View File

@ -205,6 +205,9 @@ public:
bool hasTocLevels() const;
///
static InsetLayout const & emptyInsetLayout() { return empty_insetlayout_; }
protected:
/// Paragraph styles used in this layout
LayoutList layoutlist_;
private:
///
bool deleteLayout(docstring const &);
@ -265,10 +268,6 @@ private:
TitleLatexType titletype_;
/// The name of the title command
std::string titlename_;
/// Paragraph styles used in this layout
LayoutList layoutlist_;
/// Input layouts available to this layout
mutable InsetLayouts insetlayoutlist_;
@ -299,6 +298,8 @@ private:
/// These TextClasses represent the layout information that is
/// associated with a given buffer.
class DocumentClass : public TextClass {
public:
bool hasLaTeXLayout(std::string const & lay) const;
private:
/// Constructs a DocumentClass based upon a TextClass.
DocumentClass(TextClass const & tc);

View File

@ -306,11 +306,7 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
// bibtotoc-Option
if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
// maybe a problem when a textclass has no "art" as
// part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support
// all well
if (!contains(buffer().params().documentClass().name(), "art")) {
if (buffer().params().documentClass().hasLaTeXLayout("chapter")) {
if (buffer().params().sides == OneSide) {
// oneside
os << "\\clearpage";
@ -318,14 +314,9 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
// twoside
os << "\\cleardoublepage";
}
// bookclass
os << "\\addcontentsline{toc}{chapter}{\\bibname}";
} else {
// article class
} else if (buffer().params().documentClass().hasLaTeXLayout("section"))
os << "\\addcontentsline{toc}{section}{\\refname}";
}
}
if (!db_out.empty() && !buffer().params().use_bibtopic) {