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"
27 Floating::Floating(string const & type, string const & placement,
28 string const & ext, string const & within,
29 string const & style, string const & name,
30 string const & listName, std::string const & listCmd,
31 string const & refPrefix, std::string const & allowedplacement,
32 string const & htmlTag, string const & htmlAttrib,
33 string const & htmlStyle, bool usesfloat, bool ispredefined,
34 bool allowswide, bool allowssideways)
35 : floattype_(type), placement_(placement), ext_(ext), within_(within),
36 style_(style), name_(name), listname_(listName), listcommand_(listCmd),
37 refprefix_(refPrefix), allowedplacement_(allowedplacement),
38 usesfloatpkg_(usesfloat), ispredefined_(ispredefined),
39 allowswide_(allowswide), allowssideways_(allowssideways),
40 html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle)
44 string const & Floating::htmlAttrib() const
46 if (html_attrib_.empty())
47 html_attrib_ = "class='float " + defaultCSSClass() + "'";
52 string const & Floating::htmlTag() const
54 if (html_tag_.empty())
60 string Floating::defaultCSSClass() const
62 if (!defaultcssclass_.empty())
63 return defaultcssclass_;
65 string n = floattype_;
66 string::const_iterator it = n.begin();
67 string::const_iterator en = n.end();
68 for (; it != en; ++it) {
69 if (!isAlphaASCII(*it))
71 else if (isLower(*it))
74 d += support::lowercase(*it);
76 // are there other characters we need to remove?
77 defaultcssclass_ = "float-" + d;
78 return defaultcssclass_;