]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
* Paragraph: erase unused some method and move some members to Paragraph::Private.
[lyx.git] / src / TextClass.cpp
index 8aae1abe87667f081ba339f8327cb8a461266ccc..5397227b08652f5b19c5d61428801656c92c38a8 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "TextClass.h"
 #include "debug.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "Counters.h"
 #include "gettext.h"
 #include "support/filetools.h"
 #include "support/os.h"
 
-#include <boost/filesystem/operations.hpp>
-namespace fs = boost::filesystem;
-
 #include <sstream>
 
-
 namespace lyx {
 
 using support::FileName;
@@ -176,7 +173,7 @@ enum TextClassTags {
 // Reads a textclass structure from file.
 bool TextClass::read(FileName const & filename, ReadType rt)
 {
-       if (!support::isFileReadable(filename)) {
+       if (!filename.isFileReadable()) {
                lyxerr << "Cannot read layout file `" << filename << "'."
                       << endl;
                return true;
@@ -514,7 +511,7 @@ void TextClass::readTitleType(Lexer & lexrc)
                return;
        case TITLE_COMMAND_AFTER:
        case TITLE_ENVIRONMENT:
-               titletype_ = static_cast<LYX_TITLE_LATEX_TYPES>(le);
+               titletype_ = static_cast<TitleLatexType>(le);
                break;
        default:
                lyxerr << "Unhandled value " << le
@@ -619,7 +616,9 @@ enum InsetLayoutTags {
        IL_LATEXPARAM,
        IL_LATEXTYPE,
        IL_LYXTYPE,
+       IL_MULTIPAR,
        IL_PREAMBLE,
+       IL_VERBATIM,
        IL_END
 };
 
@@ -637,7 +636,9 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
                { "latexparam", IL_LATEXPARAM },
                { "latextype", IL_LATEXTYPE },
                { "lyxtype", IL_LYXTYPE },
-               { "preamble", IL_PREAMBLE }
+               { "multipar", IL_MULTIPAR },
+               { "preamble", IL_PREAMBLE },
+               { "verbatim", IL_VERBATIM }
        };
 
        lexrc.pushTable(elementTags, IL_END);
@@ -648,10 +649,12 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
        string decoration;
        string latexname;
        string latexparam;
-       Font font(Font::ALL_INHERIT);
-       Font labelfont(Font::ALL_INHERIT);
+       Font font(defaultfont());
+       Font labelfont(defaultfont());
        Color::color bgcolor(Color::background);
        string preamble;
+       bool multipar(false);
+       bool verbatim(false);
 
        bool getout = false;
        while (!getout && lexrc.isOK()) {
@@ -691,6 +694,14 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
                        labelfont.lyxRead(lexrc);
                        labelfont.realize(defaultfont());
                        break;
+               case IL_MULTIPAR:
+                       lexrc.next();
+                       multipar = lexrc.getBool();
+                       break;
+               case IL_VERBATIM:
+                       lexrc.next();
+                       verbatim = lexrc.getBool();
+                       break;
                case IL_FONT:
                        font.lyxRead(lexrc);
                        font.realize(defaultfont());
@@ -723,6 +734,8 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
                il.latextype = latextype;
                il.latexname = latexname;
                il.latexparam = latexparam;
+               il.multipar = multipar;
+               il.verbatim = verbatim;
                il.font = font;
                il.labelfont = labelfont;
                il.bgcolor = bgcolor;           
@@ -1005,7 +1018,7 @@ bool TextClass::load(string const & path) const
        FileName layout_file;
        if (!path.empty())
                layout_file = FileName(addName(path, name_ + ".layout"));
-       if (layout_file.empty() || !fs::exists(layout_file.toFilesystemEncoding()))
+       if (layout_file.empty() || !layout_file.exists())
                layout_file = libFileSearch("layouts", name_, "layout");
        loaded_ = const_cast<TextClass*>(this)->read(layout_file) == 0;
 
@@ -1168,7 +1181,7 @@ unsigned int TextClass::columns() const
 }
 
 
-LYX_TITLE_LATEX_TYPES TextClass::titletype() const
+TitleLatexType TextClass::titletype() const
 {
        return titletype_;
 }