X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLayoutFile.cpp;h=88a4cf63f57a26e56807702fced1997823b38fb4;hb=fa2f219d928f7b07ee98cb499f78f7581b62dabc;hp=05fc109941c311aac05f1010b424360534aff034;hpb=e445666594185940b4e340a782b2b07aae4c276c;p=lyx.git diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp index 05fc109941..88a4cf63f5 100644 --- a/src/LayoutFile.cpp +++ b/src/LayoutFile.cpp @@ -18,11 +18,14 @@ #include "Lexer.h" #include "TextClass.h" -#include "support/lassert.h" +#include "frontends/alert.h" + #include "support/debug.h" #include "support/FileName.h" #include "support/filetools.h" #include "support/gettext.h" +#include "support/lassert.h" +#include "support/lstrings.h" #include #include @@ -288,6 +291,24 @@ LayoutFileIndex } +bool LayoutFileList::load(string const & name, string const & buf_path) +{ + if (!haveClass(name)) { + LYXERR0("Document class \"" << name << "\" does not exist."); + return false; + } + + LayoutFile * tc = classmap_[name]; + if (!tc->load(buf_path)) { + docstring s = bformat(_("The document class %1$s " + "could not be loaded."), from_utf8(name)); + frontend::Alert::error(_("Could not load class"), s); + return false; + } + return true; +} + + LayoutFileIndex defaultBaseclass() { if (LayoutFileList::get().haveClass("article"))