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/debug.h"
18 #include "support/lstrings.h"
19 #include "support/textutils.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, std::string const & listCmd,
35 string const & refPrefix,
36 string const & htmlTag, string const & htmlAttrib,
37 string const & htmlStyle, bool usesfloat, bool ispredefined)
38 : floattype_(type), placement_(placement), ext_(ext), within_(within),
39 style_(style), name_(name), listname_(listName), listcommand_(listCmd),
40 refprefix_(refPrefix), usesfloatpkg_(usesfloat),
41 ispredefined_(ispredefined), html_tag_(htmlTag),
42 html_attrib_(htmlAttrib), html_style_(htmlStyle)
46 string const & Floating::htmlAttrib() const
48 if (html_attrib_.empty())
49 html_attrib_ = "class='float " + defaultCSSClass() + "'";
54 string const & Floating::htmlTag() const
56 if (html_tag_.empty())
62 string Floating::defaultCSSClass() const
64 if (!defaultcssclass_.empty())
65 return defaultcssclass_;
67 string n = floattype_;
68 string::const_iterator it = n.begin();
69 string::const_iterator en = n.end();
70 for (; it != en; ++it) {
71 if (!isAlphaASCII(*it))
73 else if (isLower(*it))
76 d += support::lowercase(*it);
78 // are there other characters we need to remove?
79 defaultcssclass_ = "float-" + d;
80 return defaultcssclass_;