]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Typo.
[lyx.git] / src / BufferParams.cpp
index 2c97acef6b199ae668cb4ec2a45e159f6514386c..bfee4cff3f859fd1b1992015aa8f0ee473690654 100644 (file)
@@ -447,6 +447,7 @@ vector<string> const & BufferParams::auto_packages()
        if (packages.empty()) {
                // adding a package here implies a file format change!
                packages.push_back("amsmath");
+               packages.push_back("amssymb");
                packages.push_back("esint");
                packages.push_back("mathdots");
                packages.push_back("mathtools");
@@ -941,7 +942,7 @@ void BufferParams::writeFile(ostream & os) const
                os << "\\begin_removed_modules" << '\n';
                list<string>::const_iterator it = removed_modules_.begin();
                list<string>::const_iterator en = removed_modules_.end();
-               for (; it != en; it++)
+               for (; it != en; ++it)
                        os << *it << '\n';
                os << "\\end_removed_modules" << '\n';
        }
@@ -951,7 +952,7 @@ void BufferParams::writeFile(ostream & os) const
                os << "\\begin_modules" << '\n';
                LayoutModuleList::const_iterator it = layout_modules_.begin();
                LayoutModuleList::const_iterator en = layout_modules_.end();
-               for (; it != en; it++)
+               for (; it != en; ++it)
                        os << *it << '\n';
                os << "\\end_modules" << '\n';
        }
@@ -961,7 +962,7 @@ void BufferParams::writeFile(ostream & os) const
                os << "\\begin_includeonly" << '\n';
                list<string>::const_iterator it = included_children_.begin();
                list<string>::const_iterator en = included_children_.end();
-               for (; it != en; it++)
+               for (; it != en; ++it)
                        os << *it << '\n';
                os << "\\end_includeonly" << '\n';
        }
@@ -1780,6 +1781,11 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                // hyperref loads this automatically
                lyxpreamble += "\\usepackage{nameref}\n";
 
+       // bibtopic needs to be loaded after hyperref.
+       // the dot provides the aux file naming which LyX can detect.
+       if (features.mustProvide("bibtopic"))
+               lyxpreamble += "\\usepackage[dot]{bibtopic}\n";
+
        // Will be surrounded by \makeatletter and \makeatother when not empty
        docstring atlyxpreamble;
 
@@ -1947,20 +1953,20 @@ bool BufferParams::hasClassDefaults() const
 
 DocumentClass const & BufferParams::documentClass() const
 {
-       return *doc_class_;
+       return *doc_class_.get();
 }
 
 
-DocumentClass const * BufferParams::documentClassPtr() const
+DocumentClassConstPtr BufferParams::documentClassPtr() const
 {
        return doc_class_;
 }
 
 
-void BufferParams::setDocumentClass(DocumentClass const * const tc)
+void BufferParams::setDocumentClass(DocumentClassConstPtr tc)
 {
        // evil, but this function is evil
-       doc_class_ = const_cast<DocumentClass *>(tc);
+       doc_class_ = const_pointer_cast<DocumentClass>(tc);
 }
 
 
@@ -2025,13 +2031,13 @@ void BufferParams::makeDocumentClass()
 
        it = layout_modules_.begin();
        en = layout_modules_.end();
-       for (; it != en; it++)
+       for (; it != en; ++it)
                mods.push_back(*it);
        it = cite_engine_.begin();
        en = cite_engine_.end();
-       for (; it != en; it++)
+       for (; it != en; ++it)
                mods.push_back(*it);
-       doc_class_ = &(DocumentClassBundle::get().makeDocumentClass(*baseClass(), mods));
+       doc_class_ = getDocumentClass(*baseClass(), mods);
 
        if (!local_layout.empty()) {
                TextClass::ReturnValues success =
@@ -2055,7 +2061,7 @@ bool BufferParams::addLayoutModule(string const & modName)
 {
        LayoutModuleList::const_iterator it = layout_modules_.begin();
        LayoutModuleList::const_iterator end = layout_modules_.end();
-       for (; it != end; it++)
+       for (; it != end; ++it)
                if (*it == modName)
                        return false;
        layout_modules_.push_back(modName);
@@ -2133,17 +2139,24 @@ bool BufferParams::isExportableFormat(string const & format) const
 vector<string> BufferParams::backends() const
 {
        vector<string> v;
-       v.push_back(bufferFormat());
+       string const buffmt = bufferFormat();
+
        // FIXME: Don't hardcode format names here, but use a flag
-       if (v.back() == "latex") {
-               v.push_back("pdflatex");
+       if (buffmt == "latex") {
+               if (!useNonTeXFonts) {
+                       v.push_back("pdflatex");
+                       v.push_back("latex");
+               }
                v.push_back("luatex");
                v.push_back("dviluatex");
                v.push_back("xetex");
-       } else if (v.back() == "xetex") {
+       } else if (buffmt == "xetex") {
+               v.push_back("xetex");
                v.push_back("luatex");
                v.push_back("dviluatex");
-       }
+       } else
+               v.push_back(buffmt);
+
        v.push_back("xhtml");
        v.push_back("text");
        v.push_back("lyx");
@@ -2165,6 +2178,10 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const format) const
 
        if (dformat == "xhtml")
                result = OutputParams::HTML;
+       else if (dformat == "text")
+               result = OutputParams::TEXT;
+       else if (dformat == "lyx")
+               result = OutputParams::LYX;
        else {
                // Try to determine flavor of default output format
                vector<string> backs = backends();
@@ -2381,7 +2398,7 @@ void BufferParams::readRemovedModules(Lexer & lex)
        // start of the read.
        list<string>::const_iterator rit = removed_modules_.begin();
        list<string>::const_iterator const ren = removed_modules_.end();
-       for (; rit != ren; rit++) {
+       for (; rit != ren; ++rit) {
                LayoutModuleList::iterator const mit = layout_modules_.begin();
                LayoutModuleList::iterator const men = layout_modules_.end();
                LayoutModuleList::iterator found = find(mit, men, *rit);