A bit more empty-->plain. I've also changed createEmptyLayout() to createBasicLayout(),

as the former could be confusing. It's not really empty....


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26027 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-08-01 21:13:03 +00:00
parent 36ce36f341
commit 0a8d713fad
2 changed files with 17 additions and 14 deletions

View File

@ -114,7 +114,7 @@ std::string translateRT(TextClass::ReadType rt)
docstring const TextClass::plain_layout_ = from_ascii("Plain Layout"); docstring const TextClass::plain_layout_ = from_ascii("Plain Layout");
InsetLayout DocumentClass::empty_insetlayout_; InsetLayout DocumentClass::plain_insetlayout_;
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
@ -243,11 +243,11 @@ bool TextClass::read(FileName const & filename, ReadType rt)
LYXERR(Debug::TCLASS, "Reading " + translateRT(rt) + ": " + LYXERR(Debug::TCLASS, "Reading " + translateRT(rt) + ": " +
to_utf8(makeDisplayPath(filename.absFilename()))); to_utf8(makeDisplayPath(filename.absFilename())));
// Define the `empty' layout used in table cells, ert, etc. Note that // Define the plain layout used in table cells, ert, etc. Note that
// we do this before loading any layout file, so that classes can // we do this before loading any layout file, so that classes can
// override features of this layout if they should choose to do so. // override features of this layout if they should choose to do so.
if (rt == BASECLASS && !hasLayout(plain_layout_)) if (rt == BASECLASS && !hasLayout(plain_layout_))
layoutlist_.push_back(createEmptyLayout(plain_layout_)); layoutlist_.push_back(createBasicLayout(plain_layout_));
Lexer lexrc(textClassTags); Lexer lexrc(textClassTags);
lexrc.setFile(filename); lexrc.setFile(filename);
@ -1000,7 +1000,7 @@ bool TextClass::load(string const & path) const
void DocumentClass::addLayoutIfNeeded(docstring const & n) const void DocumentClass::addLayoutIfNeeded(docstring const & n) const
{ {
if (!hasLayout(n)) if (!hasLayout(n))
layoutlist_.push_back(createEmptyLayout(n, true)); layoutlist_.push_back(createBasicLayout(n, true));
} }
@ -1019,7 +1019,7 @@ InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
break; break;
n = n.substr(0,i); n = n.substr(0,i);
} }
return empty_insetlayout_; return plain_insetlayout_;
} }
@ -1048,7 +1048,7 @@ bool TextClass::isPlainLayout(Layout const & layout) const
} }
Layout TextClass::createEmptyLayout(docstring const & name, bool unknown) const Layout TextClass::createBasicLayout(docstring const & name, bool unknown) const
{ {
static Layout * defaultLayout = NULL; static Layout * defaultLayout = NULL;

View File

@ -190,12 +190,15 @@ protected:
/// Protect construction /// Protect construction
TextClass(); TextClass();
/// ///
Layout & operator[](docstring const & vname); Layout & operator[](docstring const & name);
/// Create an new, empty layout for this textclass. /** Create an new, very basic layout for this textclass. This is used for
/** \param unknown Set to true if this layout is an empty layout used to the Plain Layout common to all TextClass objects and also, in
* represent an unknown layout DocumentClass, for the creation of new layouts `on the fly' when
previously unknown layouts are encountered.
\param unknown Set to true if this layout is used to represent an
unknown layout
*/ */
Layout createEmptyLayout(docstring const & name, bool unknown = false) const; Layout createBasicLayout(docstring const & name, bool unknown = false) const;
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// non-const iterators // non-const iterators
@ -341,8 +344,8 @@ public:
/// happen). -- Idea JMarc, comment MV /// happen). -- Idea JMarc, comment MV
InsetLayout const & insetLayout(docstring const & name) const; InsetLayout const & insetLayout(docstring const & name) const;
/// a plain inset layout for use as a default /// a plain inset layout for use as a default
static InsetLayout const & plainInsetLayout() { return empty_insetlayout_; } static InsetLayout const & plainInsetLayout() { return plain_insetlayout_; }
/// add a new, empty layout \c name if it does not exist in layoutlist_ /// add a new layout \c name if it does not exist in layoutlist_
void addLayoutIfNeeded(docstring const & name) const; void addLayoutIfNeeded(docstring const & name) const;
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
@ -406,7 +409,7 @@ private:
/// DocumentClassBundle, which calls the protected constructor. /// DocumentClassBundle, which calls the protected constructor.
friend class DocumentClassBundle; friend class DocumentClassBundle;
/// ///
static InsetLayout empty_insetlayout_; static InsetLayout plain_insetlayout_;
}; };