3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
17 #include "support/docstring.h"
18 #include "support/lstrings.h"
19 #include "support/Messages.h"
31 Floating::Floating(string const & type, string const & placement,
32 string const & ext, string const & within,
33 string const & style, string const & name,
34 string const & listName, string const & htmlTag,
35 string const & htmlAttrib, string const & htmlStyle,
37 : floattype_(type), placement_(placement), ext_(ext), within_(within),
38 style_(style), name_(name), listname_(listName), needsfloatpkg_(needsfloat),
39 html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle)
43 docstring const & Floating::listCommand(string const & lang) const
45 if (listcommand_.empty()) {
47 listcommand_ = from_ascii("\\listof{" + floattype_ + "}{")
48 + getMessages(lang).get(listName()) + "}";
50 if (floattype_ == "table")
51 listcommand_ = from_ascii("\\listoftables");
52 else if (floattype_ == "figure")
53 listcommand_ = from_ascii("\\listoffigures");
55 // FIXME We really need a special tag for this.
56 listcommand_ = from_ascii("\\listof" + floattype_ + "s");
63 string const & Floating::htmlAttrib() const
65 if (html_attrib_.empty())
66 html_attrib_ = "class='float " + defaultCSSClass() + "'";
71 string const & Floating::htmlTag() const
73 if (html_tag_.empty())
79 string Floating::defaultCSSClass() const
81 if (!defaultcssclass_.empty())
82 return defaultcssclass_;
84 string n = floattype_;
85 string::const_iterator it = n.begin();
86 string::const_iterator en = n.end();
87 for (; it != en; ++it) {
90 else if (islower(*it))
93 d += support::lowercase(*it);
95 // are there other characters we need to remove?
96 defaultcssclass_ = "float-" + d;
97 return defaultcssclass_;