- string const & type = params().type;
- DocIterator pit = cpit;
- pit.push_back(CursorSlice(const_cast<InsetFloat &>(*this)));
- docstring str;
- int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
- text().forOutliner(str, length);
- shared_ptr<TocBuilder> builder = buffer().tocBackend().builder(type);
- builder->pushItem(pit, str, output_active);
- // Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit, output_active);
- builder->pop();
-}
-
-
-void InsetFloat::updateBuffer(ParIterator const & it, UpdateType utype)
-{
- Counters & cnts =
- buffer().masterBuffer()->params().documentClass().counters();
- if (utype == OutputUpdate) {
- // counters are local to the float
- cnts.saveLastCounter();
- }
- string const saveflt = cnts.current_float();
- bool const savesubflt = cnts.isSubfloat();
-
- bool const subflt = (it.innerInsetOfType(FLOAT_CODE)
- || it.innerInsetOfType(WRAP_CODE));
- // floats can only embed subfloats of their own kind
- if (subflt)
- params_.type = saveflt;
- setSubfloat(subflt);
-
- // Tell to captions what the current float is
- cnts.current_float(params().type);
- cnts.isSubfloat(subflt);
-
- InsetCollapsable::updateBuffer(it, utype);
-
- //reset afterwards
- cnts.current_float(saveflt);
- if (utype == OutputUpdate)
- cnts.restoreLastCounter();
- cnts.isSubfloat(savesubflt);