]> git.lyx.org Git - lyx.git/blob - src/Floating.h
Fix C++20 compilation on systems where char_type is wchar_t
[lyx.git] / src / Floating.h
1 // -*- C++ -*-
2 /**
3  * \file Floating.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef FLOATING_H
13 #define FLOATING_H
14
15 #include "support/strfwd.h"
16
17 #include <string>
18
19
20 namespace lyx {
21
22 /** This is a "float layout" object. It contains the parameters for how to
23  *  handle the different kinds of floats, default ones and user created ones.
24  *  Objects of this class is stored in a container in FloatList. The different
25  *  InsetFloat(s) have a pointer/reference through the name of the Floating
26  *  so that it knows how the different floats should be handled.
27  */
28 class Floating {
29 public:
30         ///
31         Floating() : usesfloatpkg_(false), ispredefined_(false),
32             allowswide_(true), allowssideways_(true) {}
33         ///
34         Floating(std::string const & type, std::string const & placement,
35                  std::string const & ext, std::string const & within,
36                  std::string const & style, std::string const & name,
37                  std::string const & listName, std::string const & listCmd,
38                  std::string const & refPrefix, std::string const & allowedplacement,
39                  std::string const & htmlTag, std::string const & htmlAttrib,
40                  docstring const & htmlStyle,
41                  std::string const & docbookAttr, std::string const & docbookTagType,
42                  std::string const & required, bool usesfloat, bool ispredefined,
43                  bool allowswide, bool allowssideways);
44         ///
45         std::string const & floattype() const { return floattype_; }
46         ///
47         std::string docbookFloatType() const;
48         ///
49         std::string const & placement() const { return placement_; }
50         ///
51         std::string const & ext() const {return ext_; }
52         ///
53         std::string const & within() const { return within_; }
54         ///
55         std::string const & style() const { return style_; }
56         ///
57         std::string const & name() const { return name_; }
58         /// the title of a list of this kind of float
59         std::string const & listName() const { return listname_; }
60         /// the command used to generate that list. this has to be given
61         /// if usesFloatPkg() is false, unless this float uses the same
62         /// auxfile as another defined previously. this should not contain
63         /// the leading "\".
64         std::string const & listCommand() const { return listcommand_; }
65         /// prefix to use for formatted references to such floats
66         std::string const & refPrefix() const { return refprefix_; }
67         /// allowed placement options
68         std::string const & allowedPlacement() const { return allowedplacement_; }
69         ///
70         bool usesFloatPkg() const { return usesfloatpkg_; }
71         /// allowed placement options
72         std::string const & required() const { return required_; }
73         ///
74         bool isPredefined() const { return ispredefined_; }
75         ///
76         bool allowsWide() const { return allowswide_; }
77         ///
78         bool allowsSideways() const { return allowssideways_; }
79         /// style information, for preamble
80         docstring const & htmlStyle() const { return html_style_; }
81         /// class, for css, defaults to "float-" + type()
82         std::string const & htmlAttrib() const;
83         /// tag type, defaults to "div"
84         std::string const & htmlTag() const;
85         ///
86         std::string docbookTag(bool hasTitle = false) const;
87         ///
88         std::string docbookAttr() const;
89         ///
90         std::string const & docbookTagType() const;
91         ///
92         std::string const & docbookCaption() const;
93 private:
94         ///
95         std::string defaultCSSClass() const;
96         ///
97         std::string floattype_;
98         ///
99         std::string placement_;
100         ///
101         std::string ext_;
102         ///
103         std::string within_;
104         ///
105         std::string style_;
106         ///
107         std::string name_;
108         ///
109         std::string listname_;
110         ///
111         std::string listcommand_;
112         ///
113         std::string refprefix_;
114         ///
115         std::string allowedplacement_;
116         ///
117         std::string required_;
118         ///
119         bool usesfloatpkg_;
120         ///
121         bool ispredefined_;
122         ///
123         bool allowswide_;
124         ///
125         bool allowssideways_;
126         ///
127         mutable std::string html_tag_;
128         ///
129         mutable std::string html_attrib_;
130         ///
131         mutable std::string defaultcssclass_;
132         ///
133         docstring html_style_;
134         // There is no way to override the DocBook tag based on the layouts: half of it is determined by whether the float
135         // has a title or not, an information that is not available in the layouts.
136         /// attribute (mostly, role)
137         mutable std::string docbook_caption_;
138         /// caption tag (mostly, either caption or title)
139         std::string docbook_attr_;
140         /// DocBook tag type (block, paragraph, inline)
141         mutable std::string docbook_tag_type_;
142 };
143
144
145 } // namespace lyx
146
147 #endif