mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Some cleanup for the Floating class.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33617 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8c244aa68d
commit
afb8365d82
@ -35,7 +35,7 @@ FloatList::const_iterator FloatList::end() const
|
||||
|
||||
void FloatList::newFloat(Floating const & fl)
|
||||
{
|
||||
list[fl.type()] = fl;
|
||||
list[fl.floattype()] = fl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,60 +32,12 @@ Floating::Floating(string const & type, string const & placement,
|
||||
string const & listName, string const & htmlTag,
|
||||
string const & htmlAttrib, string const & htmlStyle,
|
||||
bool builtin)
|
||||
: type_(type), placement_(placement), ext_(ext), within_(within),
|
||||
style_(style), name_(name), listName_(listName), html_tag_(htmlTag),
|
||||
html_attrib_(htmlAttrib), html_style_(htmlStyle), builtin_(builtin)
|
||||
: floattype_(type), placement_(placement), ext_(ext), within_(within),
|
||||
style_(style), name_(name), listname_(listName), builtin_(builtin),
|
||||
html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle)
|
||||
{}
|
||||
|
||||
|
||||
string const & Floating::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::placement() const
|
||||
{
|
||||
return placement_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::ext() const
|
||||
{
|
||||
return ext_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::within() const
|
||||
{
|
||||
return within_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::style() const
|
||||
{
|
||||
return style_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::listName() const
|
||||
{
|
||||
return listName_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::htmlStyle() const
|
||||
{
|
||||
return html_style_;
|
||||
}
|
||||
|
||||
|
||||
string const & Floating::htmlAttrib() const
|
||||
{
|
||||
if (html_attrib_.empty())
|
||||
@ -107,7 +59,7 @@ string Floating::defaultCSSClass() const
|
||||
if (!defaultcssclass_.empty())
|
||||
return defaultcssclass_;
|
||||
string d;
|
||||
string n = type_;
|
||||
string n = floattype_;
|
||||
string::const_iterator it = n.begin();
|
||||
string::const_iterator en = n.end();
|
||||
for (; it != en; ++it) {
|
||||
@ -124,10 +76,4 @@ string Floating::defaultCSSClass() const
|
||||
}
|
||||
|
||||
|
||||
bool Floating::builtin() const
|
||||
{
|
||||
return builtin_;
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -35,32 +35,32 @@ public:
|
||||
std::string const & htmlClass, std::string const & htmlStyle,
|
||||
bool builtin = false);
|
||||
///
|
||||
std::string const & type() const;
|
||||
std::string const & floattype() const { return floattype_; }
|
||||
///
|
||||
std::string const & placement() const;
|
||||
std::string const & placement() const { return placement_; }
|
||||
///
|
||||
std::string const & ext() const;
|
||||
std::string const & ext() const {return ext_; }
|
||||
///
|
||||
std::string const & within() const;
|
||||
std::string const & within() const { return within_; }
|
||||
///
|
||||
std::string const & style() const;
|
||||
std::string const & style() const { return style_; }
|
||||
///
|
||||
std::string const & name() const;
|
||||
std::string const & name() const { return name_; }
|
||||
///
|
||||
std::string const & listName() const;
|
||||
std::string const & listName() const { return listname_; }
|
||||
///
|
||||
bool builtin() const { return builtin_; }
|
||||
/// style information, for preamble
|
||||
std::string const & htmlStyle() const;
|
||||
std::string const & htmlStyle() const { return html_style_; }
|
||||
/// class, for css, defaults to "float-" + type()
|
||||
std::string const & htmlAttrib() const;
|
||||
/// tag type, defaults to "div"
|
||||
std::string const & htmlTag() const;
|
||||
///
|
||||
bool builtin() const;
|
||||
private:
|
||||
///
|
||||
std::string defaultCSSClass() const;
|
||||
///
|
||||
std::string type_;
|
||||
std::string floattype_;
|
||||
///
|
||||
std::string placement_;
|
||||
///
|
||||
@ -72,7 +72,9 @@ private:
|
||||
///
|
||||
std::string name_;
|
||||
///
|
||||
std::string listName_;
|
||||
std::string listname_;
|
||||
///
|
||||
bool builtin_;
|
||||
///
|
||||
mutable std::string html_tag_;
|
||||
///
|
||||
@ -81,8 +83,6 @@ private:
|
||||
mutable std::string defaultcssclass_;
|
||||
///
|
||||
std::string html_style_;
|
||||
///
|
||||
bool builtin_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -432,7 +432,7 @@ void LaTeXFeatures::useFloat(string const & name, bool subfloat)
|
||||
// use the "H" modifier. This includes modified table and
|
||||
// figure floats. (Lgb)
|
||||
Floating const & fl = params_.documentClass().floats().getType(name);
|
||||
if (!fl.type().empty() && !fl.builtin()) {
|
||||
if (!fl.floattype().empty() && !fl.builtin()) {
|
||||
require("float");
|
||||
}
|
||||
}
|
||||
@ -1055,7 +1055,7 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel) const
|
||||
UsedFloats::const_iterator fend = usedFloats_.end();
|
||||
for (; fit != fend; ++fit) {
|
||||
Floating const & fl = floats.getType(fit->first);
|
||||
docstring const type = from_ascii(fl.type());
|
||||
docstring const type = from_ascii(fl.floattype());
|
||||
docstring const flname = from_utf8(fl.name());
|
||||
docstring name = translateIfPossible(flname,
|
||||
buffer().language()->code());
|
||||
@ -1156,15 +1156,16 @@ void LaTeXFeatures::getFloatDefinitions(odocstream & os) const
|
||||
Floating const & fl = floats.getType(cit->first);
|
||||
|
||||
// For builtin floats we do nothing.
|
||||
if (fl.builtin()) continue;
|
||||
if (fl.builtin())
|
||||
continue;
|
||||
|
||||
// We have to special case "table" and "figure"
|
||||
if (fl.type() == "tabular" || fl.type() == "figure") {
|
||||
if (fl.floattype() == "tabular" || fl.floattype() == "figure") {
|
||||
// Output code to modify "table" or "figure"
|
||||
// but only if builtin == false
|
||||
// and that have to be true at this point in the
|
||||
// function.
|
||||
docstring const type = from_ascii(fl.type());
|
||||
docstring const type = from_ascii(fl.floattype());
|
||||
docstring const placement = from_ascii(fl.placement());
|
||||
docstring const style = from_ascii(fl.style());
|
||||
if (!style.empty()) {
|
||||
@ -1178,7 +1179,7 @@ void LaTeXFeatures::getFloatDefinitions(odocstream & os) const
|
||||
} else {
|
||||
// The other non builtin floats.
|
||||
|
||||
docstring const type = from_ascii(fl.type());
|
||||
docstring const type = from_ascii(fl.floattype());
|
||||
docstring const placement = from_ascii(fl.placement());
|
||||
docstring const ext = from_ascii(fl.ext());
|
||||
docstring const within = from_ascii(fl.within());
|
||||
@ -1203,7 +1204,7 @@ void LaTeXFeatures::getFloatDefinitions(odocstream & os) const
|
||||
// effect. (Lgb)
|
||||
}
|
||||
if (cit->second)
|
||||
os << "\n\\newsubfloat{" << from_ascii(fl.type()) << "}\n";
|
||||
os << "\n\\newsubfloat{" << from_ascii(fl.floattype()) << "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ void FloatPlacement::initFloatTypeCO(FloatList const & floats)
|
||||
FloatList::const_iterator const end = floats.end();
|
||||
for (; it != end; ++it) {
|
||||
floatTypeCO->addItem(qt_(it->second.name()),
|
||||
toqstr(it->second.type()));
|
||||
toqstr(it->second.floattype()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ void MenuDefinition::expandFloatListInsert(Buffer const * buf)
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
qt_(cit->second.listName()),
|
||||
FuncRequest(LFUN_FLOAT_LIST_INSERT,
|
||||
cit->second.type())));
|
||||
cit->second.floattype())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1051,7 +1051,7 @@ void MenuDefinition::expandFloatInsert(Buffer const * buf)
|
||||
QString const label = qt_(cit->second.name());
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command, label,
|
||||
FuncRequest(LFUN_FLOAT_INSERT,
|
||||
cit->second.type())));
|
||||
cit->second.floattype())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int InsetFloatList::latex(odocstream & os, OutputParams const &) const
|
||||
if (cit != floats.end()) {
|
||||
if (cit->second.builtin()) {
|
||||
// Only two different types allowed here:
|
||||
string const type = cit->second.type();
|
||||
string const type = cit->second.floattype();
|
||||
if (type == "table") {
|
||||
os << "\\listoftables\n";
|
||||
} else if (type == "figure") {
|
||||
@ -165,7 +165,7 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const {
|
||||
docstring toclabel;
|
||||
if (cit->second.builtin()) {
|
||||
// Only two different types allowed here:
|
||||
string const type = cit->second.type();
|
||||
string const type = cit->second.floattype();
|
||||
if (type == "table") {
|
||||
toctype = "table";
|
||||
toclabel = _("List of Tables");
|
||||
|
Loading…
Reference in New Issue
Block a user