as to allow us to call the routine when we are preparing for output and
so to do certain things we might not want to do every time.
This is an abuse of updateLabels(), in a way, but updateLabels() long
ago became the general recurse-through-the-Buffer routine, and to
implement the sort of thing I want to do here in validate(), say, much
of the code in updateLabels()---in particular, the counter-update
code---would have to be duplicated. So I believe this is the best, and
easiest, way to go.
Actual use of the new argument will follow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32318
a592a061-630c-0410-9148-
cb99ea01b6c8
29 files changed:
-void Buffer::updateLabels(UpdateScope scope) const
+void Buffer::updateLabels(bool out, UpdateScope scope) const
{
// Use the master text class also for child documents
Buffer const * const master = masterBuffer();
{
// Use the master text class also for child documents
Buffer const * const master = masterBuffer();
// If this is a child document start with the master
if (master != this) {
bufToUpdate.insert(this);
// If this is a child document start with the master
if (master != this) {
bufToUpdate.insert(this);
- master->updateLabels();
+ master->updateLabels(out);
// Do this here in case the master has no gui associated with it. Then,
// the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
if (!master->gui_)
// Do this here in case the master has no gui associated with it. Then,
// the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
if (!master->gui_)
// do the real work
ParIterator parit = cbuf.par_iterator_begin();
// do the real work
ParIterator parit = cbuf.par_iterator_begin();
+ updateLabels(parit, out);
if (master != this)
// TocBackend update will be done later.
if (master != this)
// TocBackend update will be done later.
-void Buffer::updateLabels(ParIterator & parit) const
+void Buffer::updateLabels(ParIterator & parit, bool out) const
{
LASSERT(parit.pit() == 0, /**/);
{
LASSERT(parit.pit() == 0, /**/);
InsetList::const_iterator end = parit->insetList().end();
for (; iit != end; ++iit) {
parit.pos() = iit->pos;
InsetList::const_iterator end = parit->insetList().end();
for (; iit != end; ++iit) {
parit.pos() = iit->pos;
- iit->inset->updateLabels(parit);
+ iit->inset->updateLabels(parit, out);
// clear how to do it just for the individual pieces we need.
void setBuffersForInsets() const;
///
// clear how to do it just for the individual pieces we need.
void setBuffersForInsets() const;
///
- void updateLabels(UpdateScope = UpdateMaster) const;
+ void updateLabels(bool output = false, UpdateScope = UpdateMaster) const;
- void updateLabels(ParIterator & parit) const;
+ void updateLabels(ParIterator & parit, bool output = false) const;
/// Spellcheck starting from \p from.
/// \p from initial position, will then points to the next misspelled
/// Spellcheck starting from \p from.
/// \p from initial position, will then points to the next misspelled
virtual void addToToc(DocIterator const &) {}
/// Fill keys with BibTeX information
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const {}
virtual void addToToc(DocIterator const &) {}
/// Fill keys with BibTeX information
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const {}
- /// Update the counters of this inset and of its contents
- virtual void updateLabels(ParIterator const &) {}
+ /// Update the counters of this inset and of its contents.
+ /// The boolean indicates whether we are preparing for output, e.g.,
+ /// of XHTML.
+ virtual void updateLabels(ParIterator const &, bool) {}
/// Updates the inset's dialog
virtual Buffer const * updateFrontend() const;
/// Updates the inset's dialog
virtual Buffer const * updateFrontend() const;
// Update the counters of this inset and of its contents
// Update the counters of this inset and of its contents
-void InsetBibitem::updateLabels(ParIterator const & it)
+void InsetBibitem::updateLabels(ParIterator const & it, bool)
{
BufferParams const & bp = buffer().masterBuffer()->params();
Counters & counters = bp.documentClass().counters();
{
BufferParams const & bp = buffer().masterBuffer()->params();
Counters & counters = bp.documentClass().counters();
///
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
/// Update the counter of this inset
///
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
/// Update the counter of this inset
- virtual void updateLabels(ParIterator const &);
+ virtual void updateLabels(ParIterator const &, bool);
///
void updateCommand(docstring const & new_key, bool dummy = false);
///
///
void updateCommand(docstring const & new_key, bool dummy = false);
///
-void InsetCaption::updateLabels(ParIterator const & it)
+void InsetCaption::updateLabels(ParIterator const & it, bool out)
{
Buffer const & master = *buffer().masterBuffer();
DocumentClass const & tclass = master.params().documentClass();
{
Buffer const & master = *buffer().masterBuffer();
DocumentClass const & tclass = master.params().documentClass();
}
// Do the real work now.
}
// Do the real work now.
- InsetText::updateLabels(it);
+ InsetText::updateLabels(it, out);
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
// Update the counters of this inset and of its contents
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
int latex(odocstream & os, OutputParams const &) const;
///
///
int latex(odocstream & os, OutputParams const &) const;
///
-void InsetCitation::updateLabels(ParIterator const &)
+void InsetCitation::updateLabels(ParIterator const &, bool)
{
CiteEngine const engine = buffer().params().citeEngine();
if (cache.params == params() && cache.engine == engine)
{
CiteEngine const engine = buffer().params().citeEngine();
if (cache.params == params() && cache.engine == engine)
///
void validate(LaTeXFeatures &) const;
///
///
void validate(LaTeXFeatures &) const;
///
- void updateLabels(ParIterator const & it);
+ void updateLabels(ParIterator const & it, bool);
///
void addToToc(DocIterator const &);
///
void addToToc(DocIterator const &);
-void InsetFloat::updateLabels(ParIterator const & it)
+void InsetFloat::updateLabels(ParIterator const & it, bool out)
{
Counters & cnts =
buffer().masterBuffer()->params().documentClass().counters();
{
Counters & cnts =
buffer().masterBuffer()->params().documentClass().counters();
cnts.current_float(params().type);
cnts.isSubfloat(subflt);
cnts.current_float(params().type);
cnts.isSubfloat(subflt);
- InsetCollapsable::updateLabels(it);
+ InsetCollapsable::updateLabels(it, out);
//reset afterwards
cnts.current_float(saveflt);
//reset afterwards
cnts.current_float(saveflt);
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
-void InsetFoot::updateLabels(ParIterator const & it)
+void InsetFoot::updateLabels(ParIterator const & it, bool out)
{
BufferParams const & bp = buffer().masterBuffer()->params();
Counters & cnts = bp.documentClass().counters();
{
BufferParams const & bp = buffer().masterBuffer()->params();
Counters & cnts = bp.documentClass().counters();
+ ' ' + cnts.theCounter(count, outer.getParLanguage(bp)->code());
setLabel(custom_label_);
}
+ ' ' + cnts.theCounter(count, outer.getParLanguage(bp)->code());
setLabel(custom_label_);
}
- InsetCollapsable::updateLabels(it);
+ InsetCollapsable::updateLabels(it, out);
///
int docbook(odocstream &, OutputParams const &) const;
/// Update the counters of this inset and of its contents
///
int docbook(odocstream &, OutputParams const &) const;
/// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
void addToToc(DocIterator const &);
///
///
void addToToc(DocIterator const &);
///
-void InsetInclude::updateLabels(ParIterator const & it)
+void InsetInclude::updateLabels(ParIterator const & it, bool out)
{
Buffer const * const childbuffer = getChildBuffer();
if (childbuffer) {
{
Buffer const * const childbuffer = getChildBuffer();
if (childbuffer) {
- childbuffer->updateLabels(Buffer::UpdateChildOnly);
+ childbuffer->updateLabels(out, Buffer::UpdateChildOnly);
return;
}
if (!isListings(params()))
return;
if (label_)
return;
}
if (!isListings(params()))
return;
if (label_)
- label_->updateLabels(it);
+ label_->updateLabels(it, out);
InsetListingsParams const par(to_utf8(params()["lstparams"]));
if (par.getParamValue("caption").empty()) {
InsetListingsParams const par(to_utf8(params()["lstparams"]));
if (par.getParamValue("caption").empty()) {
///
void updateCommand();
///
///
void updateCommand();
///
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
static ParamInfo const & findInfo(std::string const &);
///
///
static ParamInfo const & findInfo(std::string const &);
///
-void InsetLabel::updateLabels(ParIterator const &)
+void InsetLabel::updateLabels(ParIterator const &, bool)
{
docstring const & label = getParam("name");
if (buffer().insetLabel(label)) {
{
docstring const & label = getParam("name");
if (buffer().insetLabel(label)) {
static bool isCompatibleCommand(std::string const & s)
{ return s == "label"; }
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "label"; }
///
- void updateLabels(ParIterator const & it);
+ void updateLabels(ParIterator const & it, bool);
///
void addToToc(DocIterator const &);
///
///
void addToToc(DocIterator const &);
///
-void InsetListings::updateLabels(ParIterator const & it)
+void InsetListings::updateLabels(ParIterator const & it, bool out)
{
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
string const saveflt = cnts.current_float();
{
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
string const saveflt = cnts.current_float();
// Tell to captions what the current float is
cnts.current_float("listing");
// Tell to captions what the current float is
cnts.current_float("listing");
- InsetCollapsable::updateLabels(it);
+ InsetCollapsable::updateLabels(it, out);
//reset afterwards
cnts.current_float(saveflt);
//reset afterwards
cnts.current_float(saveflt);
///
docstring name() const { return from_ascii("Listings"); }
// Update the counters of this inset and of its contents
///
docstring name() const { return from_ascii("Listings"); }
// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
void write(std::ostream & os) const;
///
///
void write(std::ostream & os) const;
///
-void InsetRef::updateLabels(ParIterator const & it)
+void InsetRef::updateLabels(ParIterator const & it, bool)
{
docstring const & label = getParam("reference");
// register this inset into the buffer reference cache.
{
docstring const & label = getParam("reference");
// register this inset into the buffer reference cache.
///
static bool isCompatibleCommand(std::string const & s);
///
///
static bool isCompatibleCommand(std::string const & s);
///
- void updateLabels(ParIterator const & it);
+ void updateLabels(ParIterator const & it, bool);
///
void addToToc(DocIterator const &);
protected:
///
void addToToc(DocIterator const &);
protected:
-void InsetTabular::updateLabels(ParIterator const & it)
+void InsetTabular::updateLabels(ParIterator const & it, bool out)
{
// In a longtable, tell captions what the current float is
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
{
// In a longtable, tell captions what the current float is
Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
it2.forwardPos();
size_t const end = it2.nargs();
for ( ; it2.idx() < end; it2.top().forwardIdx())
it2.forwardPos();
size_t const end = it2.nargs();
for ( ; it2.idx() < end; it2.top().forwardIdx())
- buffer().updateLabels(it2);
+ buffer().updateLabels(it2, out);
//reset afterwards
if (tabular.is_long_tabular)
//reset afterwards
if (tabular.is_long_tabular)
/// can we go further down on mouse click?
bool descendable(BufferView const &) const { return true; }
// Update the counters of this inset and of its contents
/// can we go further down on mouse click?
bool descendable(BufferView const &) const { return true; }
// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
bool completionSupported(Cursor const &) const;
///
bool completionSupported(Cursor const &) const;
-void InsetText::updateLabels(ParIterator const & it)
+void InsetText::updateLabels(ParIterator const & it, bool out)
{
ParIterator it2 = it;
it2.forwardPos();
LASSERT(&it2.inset() == this && it2.pit() == 0, return);
if (producesOutput())
{
ParIterator it2 = it;
it2.forwardPos();
LASSERT(&it2.inset() == this && it2.pit() == 0, return);
if (producesOutput())
- buffer().updateLabels(it2);
+ buffer().updateLabels(it2, out);
else {
DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
Counters const savecnt = tclass.counters();
else {
DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
Counters const savecnt = tclass.counters();
- buffer().updateLabels(it2);
+ buffer().updateLabels(it2, out);
tclass.counters() = savecnt;
}
}
tclass.counters() = savecnt;
}
}
{ return getLayout().allowParagraphCustomization(); }
/// Update the counters of this inset and of its contents
{ return getLayout().allowParagraphCustomization(); }
/// Update the counters of this inset and of its contents
- virtual void updateLabels(ParIterator const &);
+ virtual void updateLabels(ParIterator const &, bool);
/// the string that is passed to the TOC
void tocString(odocstream &) const;
///
/// the string that is passed to the TOC
void tocString(odocstream &) const;
///
-void InsetWrap::updateLabels(ParIterator const & it)
+void InsetWrap::updateLabels(ParIterator const & it, bool out)
{
setLabel(_("wrap: ") + floatName(params_.type));
Counters & cnts =
{
setLabel(_("wrap: ") + floatName(params_.type));
Counters & cnts =
// Tell to captions what the current float is
cnts.current_float(params().type);
// Tell to captions what the current float is
cnts.current_float(params().type);
- InsetCollapsable::updateLabels(it);
+ InsetCollapsable::updateLabels(it, out);
// reset afterwards
cnts.current_float(saveflt);
// reset afterwards
cnts.current_float(saveflt);
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
/// Update the counters of this inset and of its contents
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
/// Update the counters of this inset and of its contents
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
-void InsetMathHull::updateLabels(ParIterator const & it)
+void InsetMathHull::updateLabels(ParIterator const & it, bool out)
{
if (!buffer_) {
//FIXME: buffer_ should be set at creation for this inset! Problem is
{
if (!buffer_) {
//FIXME: buffer_ should be set at creation for this inset! Problem is
}
for (size_t i = 0; i != label_.size(); ++i) {
if (label_[i])
}
for (size_t i = 0; i != label_.size(); ++i) {
if (label_[i])
- label_[i]->updateLabels(it);
+ label_[i]->updateLabels(it, out);
///
void setBuffer(Buffer &);
///
///
void setBuffer(Buffer &);
///
- void updateLabels(ParIterator const &);
+ void updateLabels(ParIterator const &, bool);
///
void addToToc(DocIterator const &);
///
///
void addToToc(DocIterator const &);
///