]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
restore comment about boost::shared_ptr and dtor.
[lyx.git] / src / BufferParams.cpp
index 3425efe4f3ab0783dcf06a3f86a31d6a1bc9fb0f..9ed248fcea65afc975517333262afe396413ae80 100644 (file)
@@ -18,7 +18,7 @@
 #include "BufferParams.h"
 
 #include "Author.h"
-#include "BaseClassList.h"
+#include "LayoutFile.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "Bullet.h"
@@ -283,7 +283,7 @@ public:
         */
        VSpace defskip;
        PDFOptions pdfoptions;
-       BaseClassIndex baseClass_;
+       LayoutFileIndex baseClass_;
 };
 
 
@@ -464,9 +464,9 @@ string const BufferParams::readToken(Lexer & lex, string const & token,
                // if there exists a local layout file, ignore the system one
                // NOTE: in this case, the textclass (.cls file) is assumed to be available.
                string tcp;
-               BaseClassList & bcl = BaseClassList::get();
+               LayoutFileList & bcl = LayoutFileList::get();
                if (!filepath.empty())
-                       tcp = bcl.addTextClass(classname, filepath.absFilename());
+                       tcp = bcl.addLayoutFile(classname, filepath.absFilename());
                if (!tcp.empty())
                        setBaseClass(tcp);
                else if (bcl.haveClass(classname)) {
@@ -479,7 +479,7 @@ string const BufferParams::readToken(Lexer & lex, string const & token,
                // FIXME: this warning will be given even if there exists a local .cls
                // file. Even worse, the .lyx file can not be compiled or exported
                // because the textclass is marked as unavilable.
-               if (!documentClass().isTeXClassAvailable()) {
+               if (!baseClass()->isTeXClassAvailable()) {
                        docstring const msg =
                                bformat(_("The layout file requested by this document,\n"
                                                 "%1$s.layout,\n"
@@ -1386,22 +1386,18 @@ void BufferParams::setDocumentClass(DocumentClass const * const tc) {
 
 bool BufferParams::setBaseClass(string const & classname)
 {
-       string localtc = classname;
-       BaseClassList const & bcl = BaseClassList::get();
-       if (!bcl.haveClass(localtc)) {
-               // OK, let's try again assuming it's a local file
-               localtc = BaseClassList::localPrefix + localtc;
-               if (!bcl.haveClass(localtc)) {
-                       docstring s = 
-                               bformat(_("The document class %1$s could not be found."),
-                               from_utf8(classname));
-                       frontend::Alert::error(_("Class not found"), s);
-                       return false;
-               }
+       LYXERR(Debug::TCLASS, "setBaseClass: " << classname);
+       LayoutFileList const & bcl = LayoutFileList::get();
+       if (!bcl.haveClass(classname)) {
+               docstring s = 
+                       bformat(_("The document class %1$s could not be found."),
+                       from_utf8(classname));
+               frontend::Alert::error(_("Class not found"), s);
+               return false;
        }
 
-       if (bcl[localtc].load()) {
-               pimpl_->baseClass_ = localtc;
+       if (bcl[classname].load()) {
+               pimpl_->baseClass_ = classname;
                return true;
        }
        
@@ -1413,16 +1409,16 @@ bool BufferParams::setBaseClass(string const & classname)
 }
 
 
-TextClass const * BufferParams::baseClass() const
+LayoutFile const * BufferParams::baseClass() const
 {
-       if (BaseClassList::get().haveClass(pimpl_->baseClass_))
-               return &(BaseClassList::get()[pimpl_->baseClass_]);
+       if (LayoutFileList::get().haveClass(pimpl_->baseClass_))
+               return &(LayoutFileList::get()[pimpl_->baseClass_]);
        else 
                return 0;
 }
 
 
-BaseClassIndex const & BufferParams::baseClassID() const
+LayoutFileIndex const & BufferParams::baseClassID() const
 {
        return pimpl_->baseClass_;
 }