#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "Counters.h"
#include "Cursor.h"
#include "debug.h"
#include "DispatchResult.h"
#include "FuncStatus.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "Color.h"
#include "Lexer.h"
#include "OutputParams.h"
-#include "Paragraph.h"
-#include "TocBackend.h"
#include "support/lstrings.h"
#include "support/convert.h"
: InsetCollapsable(bp), name_(from_utf8(type))
{
setLabel(_("float: ") + floatName(type, bp));
- LyXFont font(LyXFont::ALL_SANE);
+ Font font(Font::ALL_SANE);
font.decSize();
font.decSize();
font.setColor(Color::collapsable);
}
+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';
}
-auto_ptr<InsetBase> InsetFloat::doClone() const
+auto_ptr<Inset> InsetFloat::doClone() const
{
- return auto_ptr<InsetBase>(new InsetFloat(*this));
+ return auto_ptr<Inset>(new InsetFloat(*this));
}
int InsetFloat::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- FloatList const & floats = buf.params().getLyXTextClass().floats();
+ FloatList const & floats = buf.params().getTextClass().floats();
string tmptype = (params_.wide ? params_.type + "*" : params_.type);
if (params_.sideways) {
if (params_.type == "table")
int InsetFloat::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- os << '[' << _("float") << ' ' << floatName(params_.type, buf.params()) << ":\n";
+ os << '[' << buf.B_("float") << ' ' << floatName(params_.type, buf.params()) << ":\n";
InsetText::plaintext(buf, os, runparams);
os << "\n]";
int InsetFloat::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- // FIXME UNICODE
- os << '<' << from_ascii(params_.type) << '>';
+ // FIXME UNICODE
+ os << '<' << from_ascii(params_.type) << '>';
int const i = InsetText::docbook(buf, os, runparams);
os << "</" << from_ascii(params_.type) << '>';
}
-bool InsetFloat::insetAllowed(InsetBase::Code code) const
+bool InsetFloat::insetAllowed(Inset::Code code) const
{
- return code != InsetBase::FLOAT_CODE
- && code != InsetBase::FOOT_CODE
- && code != InsetBase::MARGIN_CODE;
+ return code != Inset::FLOAT_CODE
+ && code != Inset::FOOT_CODE
+ && code != Inset::MARGIN_CODE;
}
}
-void InsetFloat::addToToc(TocList & toclist, Buffer const & buf) const
-{
- // Is there a need to provide a list of float insets?
- return;
-
- // Abdel (01/02/2006): I'll let this code for reference in case
- // there's a need to do something similar for another kind of
- // inset.
- ParConstIterator pit = par_const_iterator_begin(*this);
- ParConstIterator end = par_const_iterator_end(*this);
-
- // Find a caption layout in one of the (child inset's) pars
- for (; pit != end; ++pit) {
- if (pit->layout()->labeltype == LABEL_SENSITIVE) {
- Toc & toc = toclist[params_.type];
- docstring const str =
- convert<docstring>(toc.size() + 1)
- + ". " + pit->asString(buf, false);
- toc.push_back(TocItem(pit, 0, str));
- return;
- }
- }
-}
-
-
string const InsetFloatMailer::name_("float");
InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
return print_mailer_error("InsetFloatMailer", in, 1, name_);
// This is part of the inset proper that is usually swallowed
- // by LyXText::readInset
+ // by Text::readInset
string id;
lex >> id;
if (!lex || id != "Float")