void Buffer::getLabelList(vector<docstring> & list) const
{
- /// if this is a child document and the parent is already loaded
- /// Use the parent's list instead [ale990407]
- Buffer const * tmp = masterBuffer();
- if (!tmp) {
- lyxerr << "masterBuffer() failed!" << endl;
- BOOST_ASSERT(tmp);
- }
- if (tmp != this) {
- tmp->getLabelList(list);
+ // If this is a child document, use the parent's list instead.
+ if (d->parent_buffer) {
+ masterBuffer()->getLabelList(list);
return;
}
- updateMacros();
-
- for (InsetIterator it = inset_iterator_begin(inset()); it; ++it)
- it.nextInset()->getLabelList(list);
+ list.clear();
+ Toc & toc = d->toc_backend.toc("label");
+ TocIterator toc_it = toc.begin();
+ TocIterator end = toc.end();
+ for (; toc_it != end; ++toc_it)
+ list.push_back(toc_it->str());
}
#include "TextClass.h"
#include "TextMetrics.h"
#include "TexRow.h"
+#include "TocBackend.h"
#include "VSpace.h"
#include "WordLangTuple.h"
void BufferView::gotoLabel(docstring const & label)
{
- for (InsetIterator it = inset_iterator_begin(buffer_.inset()); it; ++it) {
- vector<docstring> labels;
- it->getLabelList(labels);
- if (std::find(labels.begin(), labels.end(), label) != labels.end()) {
- setCursor(it);
- showCursor();
- return;
- }
+ Toc & toc = buffer().tocBackend().toc("label");
+ TocIterator toc_it = toc.begin();
+ TocIterator end = toc.end();
+ for (; toc_it != end; ++toc_it) {
+ if (label == toc_it->str())
+ dispatch(toc_it->action());
}
+ //FIXME: We could do a bit more searching thanks to this:
+ //InsetLabel const * inset = buffer_.insetLabel(label);
}
/// request "external features"
virtual void validate(LaTeXFeatures &) const {}
- /// Appends \c list with all labels found within this inset.
- virtual void getLabelList(std::vector<docstring> & /* list */) const {}
/// describe content if cursor inside
virtual void infoize(odocstream &) const {}
}
-void InsetInclude::getLabelList(vector<docstring> & list) const
-{
- if (isListings(params()) && label_) {
- label_->getLabelList(list);
- return;
- }
-
- if (loadIfNeeded(buffer(), params())) {
- string const included_file = includedFilename(buffer(), params()).absFilename();
- Buffer * tmp = theBufferList().getBuffer(included_file);
- tmp->setParent(0);
- tmp->getLabelList(list);
- tmp->setParent(const_cast<Buffer *>(&buffer()));
- }
-}
-
-
void InsetInclude::fillWithBibKeys(BiblioInfo & keys,
InsetIterator const & /*di*/) const
{
DisplayType display() const;
///
InsetCode lyxCode() const { return INCLUDE_CODE; }
- /** Fills \c list
- * \param buffer the Buffer containing this inset.
- * \param list the list of labels in the child buffer.
- */
- void getLabelList(std::vector<docstring> & list) const;
/** Fills \c keys
* \param buffer the Buffer containing this inset.
* \param keys the list of bibkeys in the child buffer.
}
-void InsetLabel::getLabelList(vector<docstring> & list) const
-{
- list.push_back(getParam("name"));
-}
-
-
docstring InsetLabel::screenLabel() const
{
return screen_label_;
EDITABLE editable() const { return IS_EDITABLE; }
///
InsetCode lyxCode() const { return LABEL_CODE; }
- /// Appends \c list with this label
- void getLabelList(std::vector<docstring> & list) const;
///
int latex(odocstream &, OutputParams const &) const;
///
}
-void InsetMathHull::getLabelList(vector<docstring> & labels) const
-{
- for (row_type row = 0; row < nrows(); ++row)
- if (label_[row] && !nonum_[row])
- labels.push_back(label_[row]->screenLabel());
-}
-
-
bool InsetMathHull::numberedType() const
{
if (type_ == hullNone)
bool numberedType() const;
///
bool ams() const;
- /// Appends \c list with all labels found within this inset.
- void getLabelList(std::vector<docstring> & list) const;
///
void validate(LaTeXFeatures & features) const;
/// identifies HullInset