#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "Counters.h"
#include "Cursor.h"
-#include "debug.h"
#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
+#include "TextClass.h"
+#include "support/debug.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/docstream.h"
#include "support/convert.h"
+using namespace std;
namespace lyx {
-using support::contains;
-
-using std::endl;
-using std::string;
-using std::auto_ptr;
-using std::istringstream;
-using std::ostream;
-using std::ostringstream;
-
// With this inset it will be possible to support the latex package
// float.sty, and I am sure that with this and some additional support
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type, bp));
- Font font(Font::ALL_SANE);
- font.decSize();
- font.decSize();
- font.setColor(Color::collapsable);
- setLabelFont(font);
params_.type = type;
}
}
+void InsetFloat::updateLabels(Buffer const & buf, ParIterator const & it)
+{
+ Counters & cnts = buf.params().getTextClass().counters();
+ string const saveflt = cnts.current_float();
+
+ // Tell to captions what the current float is
+ cnts.current_float(params().type);
+
+ InsetCollapsable::updateLabels(buf, it);
+
+ //reset afterwards
+ cnts.current_float(saveflt);
+}
+
+
void InsetFloatParams::write(ostream & os) const
{
os << "Float " << type << '\n';
void InsetFloat::validate(LaTeXFeatures & features) const
{
- if (contains(params_.placement, 'H')) {
+ if (support::contains(params_.placement, 'H')) {
features.require("float");
}
if (params_.sideways)
- features.require("rotating");
+ features.require("rotfloat");
features.useFloat(params_.type);
InsetCollapsable::validate(features);
}
-auto_ptr<Inset> InsetFloat::doClone() const
+Inset * InsetFloat::clone() const
{
- return auto_ptr<Inset>(new InsetFloat(*this));
+ return new InsetFloat(*this);
}
OutputParams const & runparams) const
{
FloatList const & floats = buf.params().getTextClass().floats();
- string tmptype = (params_.wide ? params_.type + "*" : params_.type);
- if (params_.sideways) {
- if (params_.type == "table")
- tmptype = "sidewaystable";
- else if (params_.type == "figure")
- tmptype = "sidewaysfigure";
- }
+ string tmptype = params_.type;
+ if (params_.sideways)
+ tmptype = "sideways" + params_.type;
+ if (params_.wide && (!params_.sideways ||
+ params_.type == "figure" ||
+ params_.type == "table"))
+ tmptype += "*";
// Figure out the float placement to use.
// From lowest to highest:
// - float default placement
}
-bool InsetFloat::insetAllowed(Inset::Code code) const
+bool InsetFloat::insetAllowed(InsetCode code) const
{
- return code != Inset::FLOAT_CODE
- && code != Inset::FOOT_CODE
- && code != Inset::MARGIN_CODE;
+ return code != FLOAT_CODE
+ && code != FOOT_CODE
+ && code != MARGIN_CODE;
}