X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFlex.cpp;h=279f9940542a2327f2fd1d300e5cf3b1bb4bf3b7;hb=0362c6aae73c293d1c20277c12d362acfe0b2ef6;hp=e2a6cacbe560fc92bafb3063d071478039e12edc;hpb=9e5eebc14cd06f58000a4bd1903f157b65a3ab19;p=lyx.git diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp index e2a6cacbe5..279f994054 100644 --- a/src/insets/InsetFlex.cpp +++ b/src/insets/InsetFlex.cpp @@ -30,9 +30,6 @@ #include "paragraph_funcs.h" #include "sgml.h" -#include "frontends/FontMetrics.h" -#include "frontends/Painter.h" - #include "support/convert.h" #include @@ -43,12 +40,13 @@ namespace lyx { InsetFlex::InsetFlex(BufferParams const & bp, - InsetLayout const & il) - : InsetCollapsable(bp, Collapsed, &il) + TextClassPtr tc, string const & layoutName) + : InsetCollapsable(bp, Collapsed, tc), + name_(layoutName) { - name_ = il.name; - packages_ = il.requires; - preamble_ = il.preamble; + setLayout(tc); // again, because now the name is initialized + packages_ = getLayout().requires(); + preamble_ = getLayout().preamble(); } @@ -63,12 +61,6 @@ Inset * InsetFlex::clone() const } -bool InsetFlex::undefined() const -{ - return layout_->labelstring == from_utf8("UNDEFINED"); -} - - docstring const InsetFlex::editMessage() const { return _("Opened Flex Inset"); @@ -77,7 +69,8 @@ docstring const InsetFlex::editMessage() const void InsetFlex::write(Buffer const & buf, ostream & os) const { - os << "Flex " << name_ << "\n"; + os << "Flex " << + (name_.empty() ? "undefined" : name_) << "\n"; InsetCollapsable::write(buf, os); } @@ -118,8 +111,8 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os, ParagraphList::const_iterator end = paragraphs().end(); if (!undefined()) - sgml::openTag(os, layout_->latexname, - par->getID(buf, runparams) + layout_->latexparam); + sgml::openTag(os, getLayout().latexname(), + par->getID(buf, runparams) + getLayout().latexparam()); for (; par != end; ++par) { par->simpleDocBookOnePar(buf, os, runparams, @@ -128,7 +121,7 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os, } if (!undefined()) - sgml::closeTag(os, layout_->latexname); + sgml::closeTag(os, getLayout().latexname()); return 0; } @@ -144,12 +137,7 @@ void InsetFlex::validate(LaTeXFeatures & features) const { if (!preamble_.empty()) features.addPreambleSnippet(preamble_); - if (packages_.empty()) - return; - for (vector::const_iterator it = packages_.begin(); - it != packages_.end(); ++it) { - features.require(*it); - } + features.require(packages_); } } // namespace lyx