]> git.lyx.org Git - lyx.git/blob - src/Floating.h
Avoid full metrics computation with Update:FitCursor
[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, std::string const & docbookTag,
41                  std::string const & docbookAttr, std::string const & docbookTagType,
42                  std::string const & docbookFloatType, std::string const & docbookCaption,
43                  std::string const & required, bool usesfloat, bool ispredefined,
44                  bool allowswide, bool allowssideways);
45         ///
46         std::string const & floattype() const { return floattype_; }
47         ///
48         std::string docbookFloatType() const;
49         ///
50         std::string const & placement() const { return placement_; }
51         ///
52         std::string const & ext() const {return ext_; }
53         ///
54         std::string const & within() const { return within_; }
55         ///
56         std::string const & style() const { return style_; }
57         ///
58         std::string const & name() const { return name_; }
59         /// the title of a list of this kind of float
60         std::string const & listName() const { return listname_; }
61         /// the command used to generate that list. this has to be given
62         /// if usesFloatPkg() is false, unless this float uses the same
63         /// auxfile as another defined previously. this should not contain
64         /// the leading "\".
65         std::string const & listCommand() const { return listcommand_; }
66         /// prefix to use for formatted references to such floats
67         std::string const & refPrefix() const { return refprefix_; }
68         /// allowed placement options
69         std::string const & allowedPlacement() const { return allowedplacement_; }
70         ///
71         bool usesFloatPkg() const { return usesfloatpkg_; }
72         /// allowed placement options
73         std::string const & required() const { return required_; }
74         ///
75         bool isPredefined() const { return ispredefined_; }
76         ///
77         bool allowsWide() const { return allowswide_; }
78         ///
79         bool allowsSideways() const { return allowssideways_; }
80         /// style information, for preamble
81         docstring const & htmlStyle() const { return html_style_; }
82         /// class, for css, defaults to "float-" + type()
83         std::string const & htmlAttrib() const;
84         /// tag type, defaults to "div"
85         std::string const & htmlTag() const;
86         ///
87         std::string docbookTag(bool hasTitle = false) const;
88         ///
89         std::string docbookAttr() const;
90         ///
91         std::string const & docbookTagType() const;
92         ///
93         std::string const & docbookCaption() const;
94 private:
95         ///
96         std::string defaultCSSClass() const;
97         ///
98         std::string floattype_;
99         ///
100         std::string placement_;
101         ///
102         std::string ext_;
103         ///
104         std::string within_;
105         ///
106         std::string style_;
107         ///
108         std::string name_;
109         ///
110         std::string listname_;
111         ///
112         std::string listcommand_;
113         ///
114         std::string refprefix_;
115         ///
116         std::string allowedplacement_;
117         ///
118         std::string required_;
119         ///
120         bool usesfloatpkg_;
121         ///
122         bool ispredefined_;
123         ///
124         bool allowswide_;
125         ///
126         bool allowssideways_;
127         ///
128         mutable std::string html_tag_;
129         ///
130         mutable std::string html_attrib_;
131         ///
132         mutable std::string defaultcssclass_;
133         ///
134         docstring html_style_;
135         // There is no way to override the DocBook tag based on the layouts: half of it is determined by whether the float
136         // has a title or not, an information that is not available in the layouts.
137         /// attribute (mostly, role)
138         mutable std::string docbook_caption_;
139         /// float tag
140         std::string docbook_tag_;
141         /// attributes for the float tag
142         std::string docbook_attr_;
143         /// DocBook tag type (block, paragraph, inline)
144         mutable std::string docbook_tag_type_;
145         /// DocBook float type, to override float_type_ (figure, table, algorithm, video)
146         std::string docbook_float_type_;
147 };
148
149
150 } // namespace lyx
151
152 #endif