mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Enhancements and bugfixes to the TOCs
* New TOC "math-macro". This means that math macros can now be accessed in the
outline pane in their order of appearance or in alphabetical order, and can be
searched using the filter.
* Lists of floats now show subfloats deeper in the navigation menu
* The arbitrary 30 element cut-off after which nothing is shown except "Open
Navigator..." is removed. Menus now have no limit in size, so Qt may display
them scrollable. In exchange, we always show "Open outliner..." at the
beginning. I tested for performance issues with a rather complex document and
it is fine; but this does not exclude corner cases with lots of TOC entries of
a certain kind. If necessary, populating the navigation sub-menu should be
delayed like the main menu.
* Elements that do not contribute to the output (e.g. in a note, a disabled
branch) are now preceded with a symbol indicating this status. (The machinery
was already there; I wonder why it was not implemented already.) I have chosen
U+274E NEGATIVE SQUARED CROSS MARK.
* Fix the contextual menus in the outliner (bug introduced at 94e992c5
).
* Toc item now move to the caption when present, but first center on the float,
to prevent the situation where the caption is at the top of the screen and the
contents of the float is off-screen above the caption.
(Internally, the action of the toc items can now be customised)
* Fix the LyXHTML output. Disabled captions no longer appear in the list of
figures.
This commit is contained in:
parent
89342f2946
commit
d5a5fbb8ee
@ -4462,7 +4462,7 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
||||
d->bibinfo_cache_valid_ = true;
|
||||
d->cite_labels_valid_ = true;
|
||||
/// FIXME: Perf
|
||||
cbuf.tocBackend().update(utype == OutputUpdate);
|
||||
cbuf.tocBackend().update(true, utype);
|
||||
if (scope == UpdateMaster)
|
||||
cbuf.structureChanged();
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ using namespace std;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TocItem implementation
|
||||
@ -46,8 +47,9 @@ namespace lyx {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TocItem::TocItem(DocIterator const & dit, int d, docstring const & s,
|
||||
bool output_active, docstring const & t) :
|
||||
dit_(dit), depth_(d), str_(s), tooltip_(t), output_(output_active)
|
||||
bool output_active, docstring const & t, FuncRequest action) :
|
||||
dit_(dit), depth_(d), str_(s), tooltip_(t), output_(output_active),
|
||||
action_(action)
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,15 +68,32 @@ docstring const & TocItem::tooltip() const
|
||||
|
||||
docstring const TocItem::asString() const
|
||||
{
|
||||
return docstring(4 * depth_, ' ') + str_;
|
||||
// U+2327 X IN A RECTANGLE BOX
|
||||
// char_type const cross = 0x2327;
|
||||
// U+274E NEGATIVE SQUARED CROSS MARK
|
||||
char_type const cross = 0x274e;
|
||||
docstring prefix;
|
||||
if (!output_) {
|
||||
prefix += cross;
|
||||
prefix += " ";
|
||||
}
|
||||
return prefix + str_;
|
||||
}
|
||||
|
||||
// convert a DocIterator into an argument to LFUN_PARAGRAPH_GOTO
|
||||
docstring paragraph_goto_arg(DocIterator const & dit)
|
||||
{
|
||||
CursorSlice const & s = dit.innerTextSlice();
|
||||
return convert<docstring>(s.paragraph().id()) + ' ' +
|
||||
convert<docstring>(s.pos());
|
||||
}
|
||||
|
||||
FuncRequest TocItem::action() const
|
||||
{
|
||||
string const arg = convert<string>(dit_.paragraph().id())
|
||||
+ ' ' + convert<string>(dit_.pos());
|
||||
return FuncRequest(LFUN_PARAGRAPH_GOTO, arg);
|
||||
if (action_.action() == LFUN_UNKNOWN_ACTION) {
|
||||
return FuncRequest(LFUN_PARAGRAPH_GOTO, paragraph_goto_arg(dit_));
|
||||
} else
|
||||
return action_;
|
||||
}
|
||||
|
||||
|
||||
@ -156,15 +175,29 @@ void TocBuilder::pushItem(DocIterator const & dit, docstring const & s,
|
||||
void TocBuilder::captionItem(DocIterator const & dit, docstring const & s,
|
||||
bool output_active)
|
||||
{
|
||||
// first show the float before moving to the caption
|
||||
docstring arg = "paragraph-goto " + paragraph_goto_arg(dit);
|
||||
if (!stack_.empty())
|
||||
arg = "paragraph-goto " +
|
||||
paragraph_goto_arg((*toc_)[stack_.top().pos].dit_) + ";" + arg;
|
||||
FuncRequest func(LFUN_COMMAND_SEQUENCE, arg);
|
||||
|
||||
if (!stack_.empty() && !stack_.top().is_captioned) {
|
||||
// The float we entered has not yet been assigned a caption.
|
||||
// Assign the caption string to it.
|
||||
(*toc_)[stack_.top().pos].str(s);
|
||||
TocItem & captionable = (*toc_)[stack_.top().pos];
|
||||
captionable.str(s);
|
||||
captionable.setAction(func);
|
||||
stack_.top().is_captioned = true;
|
||||
} else {
|
||||
// This is a new entry.
|
||||
pop();
|
||||
pushItem(dit, s, output_active, true);
|
||||
// the dit is at the float's level, e.g. for the contextual menu of
|
||||
// outliner entries
|
||||
DocIterator captionable_dit = dit;
|
||||
captionable_dit.pop_back();
|
||||
pushItem(captionable_dit, s, output_active, true);
|
||||
(*toc_)[stack_.top().pos].setAction(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,14 +302,14 @@ bool TocBackend::updateItem(DocIterator const & dit)
|
||||
&& tocstring.empty())
|
||||
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
|
||||
|
||||
const_cast<TocItem &>(*toc_item).str_ = tocstring;
|
||||
const_cast<TocItem &>(*toc_item).str(tocstring);
|
||||
|
||||
buffer_->updateTocItem("tableofcontents", dit);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TocBackend::update(bool output_active)
|
||||
void TocBackend::update(bool output_active, UpdateType utype)
|
||||
{
|
||||
for (TocList::iterator it = tocs_.begin(); it != tocs_.end(); ++it)
|
||||
it->second->clear();
|
||||
@ -284,7 +317,7 @@ void TocBackend::update(bool output_active)
|
||||
builders_.clear();
|
||||
if (!buffer_->isInternal()) {
|
||||
DocIterator dit;
|
||||
buffer_->inset().addToToc(dit, output_active);
|
||||
buffer_->inset().addToToc(dit, output_active, utype);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#define TOC_BACKEND_H
|
||||
|
||||
#include "DocIterator.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "OutputEnums.h"
|
||||
|
||||
#include "support/shared_ptr.h"
|
||||
#include "support/strfwd.h"
|
||||
@ -29,7 +31,6 @@
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
class FuncRequest;
|
||||
|
||||
|
||||
/* FIXME: toc types are currently identified by strings. It cannot be converted
|
||||
@ -66,6 +67,7 @@ class TocItem
|
||||
{
|
||||
friend class Toc;
|
||||
friend class TocBackend;
|
||||
friend class TocBuilder;
|
||||
|
||||
public:
|
||||
/// Default constructor for STL containers.
|
||||
@ -75,7 +77,8 @@ public:
|
||||
int depth,
|
||||
docstring const & s,
|
||||
bool output_active,
|
||||
docstring const & t = docstring()
|
||||
docstring const & t = docstring(),
|
||||
FuncRequest action = FuncRequest(LFUN_UNKNOWN_ACTION)
|
||||
);
|
||||
///
|
||||
~TocItem() {}
|
||||
@ -89,19 +92,22 @@ public:
|
||||
void str(docstring const & s) { str_ = s; }
|
||||
///
|
||||
docstring const & tooltip() const;
|
||||
///
|
||||
/// String for display, e.g. it has a mark if output is inactive
|
||||
docstring const asString() const;
|
||||
///
|
||||
DocIterator const & dit() const { return dit_; }
|
||||
///
|
||||
bool isOutput() const { return output_; }
|
||||
|
||||
/// the action corresponding to the goTo above
|
||||
///
|
||||
void setAction(FuncRequest a) { action_ = a; }
|
||||
/// custom action, or the default one (paragraph-goto) if not customised
|
||||
FuncRequest action() const;
|
||||
|
||||
protected:
|
||||
/// Current position of item.
|
||||
DocIterator dit_;
|
||||
|
||||
private:
|
||||
/// nesting depth
|
||||
int depth_;
|
||||
/// Full item string
|
||||
@ -110,6 +116,8 @@ protected:
|
||||
docstring tooltip_;
|
||||
/// Is this item in a note, inactive branch, etc?
|
||||
bool output_;
|
||||
/// Custom action
|
||||
FuncRequest action_;
|
||||
};
|
||||
|
||||
|
||||
@ -192,7 +200,7 @@ public:
|
||||
///
|
||||
void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
|
||||
///
|
||||
void update(bool output_active);
|
||||
void update(bool output_active, UpdateType utype);
|
||||
/// \return true if the item was updated.
|
||||
bool updateItem(DocIterator const & pit);
|
||||
///
|
||||
|
@ -1219,7 +1219,7 @@ void MenuDefinition::expandFlexInsert(
|
||||
}
|
||||
|
||||
|
||||
size_t const max_number_of_items = 25;
|
||||
size_t const max_number_of_items = 30;
|
||||
|
||||
void MenuDefinition::expandToc2(Toc const & toc_list,
|
||||
size_t from, size_t to, int depth)
|
||||
@ -1236,7 +1236,7 @@ void MenuDefinition::expandToc2(Toc const & toc_list,
|
||||
if (to - from <= max_number_of_items) {
|
||||
for (size_t i = from; i < to; ++i) {
|
||||
QString label(4 * max(0, toc_list[i].depth() - depth), ' ');
|
||||
label += limitStringLength(toc_list[i].str());
|
||||
label += limitStringLength(toc_list[i].asString());
|
||||
if (toc_list[i].depth() == depth) {
|
||||
label += '|';
|
||||
if (shortcut_count < 9) {
|
||||
@ -1246,6 +1246,9 @@ void MenuDefinition::expandToc2(Toc const & toc_list,
|
||||
}
|
||||
add(MenuItem(MenuItem::Command, label,
|
||||
FuncRequest(toc_list[i].action())));
|
||||
// separator after the menu heading
|
||||
if (toc_list[i].depth() < depth)
|
||||
add(MenuItem(MenuItem::Separator));
|
||||
}
|
||||
} else {
|
||||
size_t pos = from;
|
||||
@ -1255,7 +1258,7 @@ void MenuDefinition::expandToc2(Toc const & toc_list,
|
||||
++new_pos;
|
||||
|
||||
QString label(4 * max(0, toc_list[pos].depth() - depth), ' ');
|
||||
label += limitStringLength(toc_list[pos].str());
|
||||
label += limitStringLength(toc_list[pos].asString());
|
||||
if (toc_list[pos].depth() == depth) {
|
||||
label += '|';
|
||||
if (shortcut_count < 9) {
|
||||
@ -1285,12 +1288,10 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
// all MenuItem constructors and to expandToc2. However, we
|
||||
// know that all the entries in a TOC will be have status_ ==
|
||||
// OK, so we avoid this unnecessary overhead (JMarc)
|
||||
|
||||
if (!buf) {
|
||||
add(MenuItem(MenuItem::Info, qt_("<No Document Open>")));
|
||||
add(MenuItem(MenuItem::Info, qt_("(No Document Open)")));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add an entry for the master doc if this is a child doc
|
||||
Buffer const * const master = buf->masterBuffer();
|
||||
if (buf != master) {
|
||||
@ -1301,68 +1302,36 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
}
|
||||
|
||||
MenuDefinition other_lists;
|
||||
|
||||
FloatList const & floatlist = buf->params().documentClass().floats();
|
||||
TocList const & toc_list = buf->tocBackend().tocs();
|
||||
TocList::const_iterator cit = toc_list.begin();
|
||||
TocList::const_iterator end = toc_list.end();
|
||||
for (; cit != end; ++cit) {
|
||||
// Handle this later
|
||||
if (cit->first == "tableofcontents")
|
||||
// Handle table of contents later
|
||||
if (cit->first == "tableofcontents" || cit->second->empty())
|
||||
continue;
|
||||
|
||||
MenuDefinition submenu;
|
||||
if (floatlist.typeExist(cit->first)) {
|
||||
TocIterator ccit = cit->second->begin();
|
||||
TocIterator eend = cit->second->end();
|
||||
for (; ccit != eend; ++ccit) {
|
||||
if (0 == ccit->depth()) {// omit subfloats
|
||||
submenu.add(MenuItem(MenuItem::Command,
|
||||
limitStringLength(ccit->str()) + '|',
|
||||
FuncRequest(ccit->action())));
|
||||
}
|
||||
}
|
||||
|
||||
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
|
||||
submenu.add(MenuItem(MenuItem::Separator));
|
||||
submenu.add(MenuItem(MenuItem::Command, qt_("Open Navigator..."), f));
|
||||
MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
|
||||
// deserves to be in the main menu.
|
||||
item.setSubmenu(submenu);
|
||||
// "Open outliner..." entry
|
||||
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
|
||||
submenu.add(MenuItem(MenuItem::Command, qt_("Open outliner..."), f));
|
||||
submenu.add(MenuItem(MenuItem::Separator));
|
||||
// add entries
|
||||
submenu.expandToc2(* cit->second, 0, cit->second->size(), 0);
|
||||
MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
|
||||
item.setSubmenu(submenu);
|
||||
// deserves to be in the main menu?
|
||||
if (floatlist.typeExist(cit->first) || cit->first == "child")
|
||||
add(item);
|
||||
} else {
|
||||
if (cit->second->size() >= 30) {
|
||||
// FIXME: the behaviour of the interface should not change
|
||||
// arbitrarily. Each type should be audited to see if the list
|
||||
// can be optimised like for floats above.
|
||||
FuncRequest f(LFUN_DIALOG_SHOW, "toc " + cit->first);
|
||||
submenu.add(MenuItem(MenuItem::Command, qt_("Open Navigator..."), f));
|
||||
} else {
|
||||
TocIterator ccit = cit->second->begin();
|
||||
TocIterator eend = cit->second->end();
|
||||
for (; ccit != eend; ++ccit) {
|
||||
submenu.add(MenuItem(MenuItem::Command,
|
||||
limitStringLength(ccit->str()) + '|',
|
||||
FuncRequest(ccit->action())));
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem item(MenuItem::Submenu, guiName(cit->first, buf->params()));
|
||||
item.setSubmenu(submenu);
|
||||
if (cit->first == "child") {
|
||||
// deserves to be in the main menu.
|
||||
add(item);
|
||||
} else
|
||||
other_lists.add(item);
|
||||
}
|
||||
else
|
||||
other_lists.add(item);
|
||||
}
|
||||
if (!other_lists.empty()) {
|
||||
MenuItem item(MenuItem::Submenu, qt_("Other Lists"));
|
||||
item.setSubmenu(other_lists);
|
||||
add(item);
|
||||
}
|
||||
|
||||
// Handle normal TOC
|
||||
add(MenuItem(MenuItem::Separator));
|
||||
cit = toc_list.find("tableofcontents");
|
||||
if (cit == end)
|
||||
LYXERR(Debug::GUI, "No table of contents.");
|
||||
@ -1370,7 +1339,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
|
||||
if (!cit->second->empty())
|
||||
expandToc2(* cit->second, 0, cit->second->size(), 0);
|
||||
else
|
||||
add(MenuItem(MenuItem::Info, qt_("<Empty Table of Contents>")));
|
||||
add(MenuItem(MenuItem::Info, qt_("(Empty Table of Contents)")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ void TocModel::updateItem(DocIterator const & dit)
|
||||
{
|
||||
QModelIndex index = modelIndex(dit);
|
||||
TocItem const & toc_item = tocItem(index);
|
||||
model_->setData(index, toqstr(toc_item.str()), Qt::DisplayRole);
|
||||
model_->setData(index, toqstr(toc_item.asString()), Qt::DisplayRole);
|
||||
model_->setData(index, toqstr(toc_item.tooltip()), Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
@ -183,12 +183,12 @@ void TocModel::reset(shared_ptr<Toc const> toc)
|
||||
int current_row = model_->rowCount();
|
||||
model_->insertRows(current_row, 1);
|
||||
QModelIndex top_level_item = model_->index(current_row, 0);
|
||||
model_->setData(top_level_item, toqstr(item.str()), Qt::DisplayRole);
|
||||
model_->setData(top_level_item, toqstr(item.asString()), Qt::DisplayRole);
|
||||
model_->setData(top_level_item, index, Qt::UserRole);
|
||||
model_->setData(top_level_item, toqstr(item.tooltip()), Qt::ToolTipRole);
|
||||
|
||||
LYXERR(Debug::GUI, "Toc: at depth " << item.depth()
|
||||
<< ", added item " << item.str());
|
||||
<< ", added item " << item.asString());
|
||||
|
||||
populate(index, top_level_item);
|
||||
if (index >= end)
|
||||
@ -224,7 +224,7 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent)
|
||||
int current_row = model_->rowCount(parent);
|
||||
model_->insertRows(current_row, 1, parent);
|
||||
child_item = model_->index(current_row, 0, parent);
|
||||
model_->setData(child_item, toqstr(item.str()), Qt::DisplayRole);
|
||||
model_->setData(child_item, toqstr(item.asString()), Qt::DisplayRole);
|
||||
model_->setData(child_item, index, Qt::UserRole);
|
||||
model_->setData(child_item, toqstr(item.tooltip()), Qt::ToolTipRole);
|
||||
populate(index, child_item);
|
||||
@ -315,7 +315,7 @@ void TocModels::goTo(QString const & type, QModelIndex const & index) const
|
||||
}
|
||||
LASSERT(index.model() == it.value()->model(), return);
|
||||
TocItem const item = it.value()->tocItem(index);
|
||||
LYXERR(Debug::GUI, "TocModels::goTo " << item.str());
|
||||
LYXERR(Debug::GUI, "TocModels::goTo " << item.asString());
|
||||
dispatch(item.action());
|
||||
}
|
||||
|
||||
|
@ -119,16 +119,12 @@ Inset * TocWidget::itemInset() const
|
||||
|
||||
else if (current_type_ == "branch"
|
||||
|| current_type_ == "index"
|
||||
|| current_type_ == "change")
|
||||
|| current_type_ == "change"
|
||||
|| current_type_ == "table"
|
||||
|| current_type_ == "listing"
|
||||
|| current_type_ == "figure")
|
||||
inset = &dit.inset();
|
||||
|
||||
else if (current_type_ == "table"
|
||||
|| current_type_ == "listing"
|
||||
|| current_type_ == "figure") {
|
||||
DocIterator tmp_dit(dit);
|
||||
tmp_dit.pop_back();
|
||||
inset = &tmp_dit.inset();
|
||||
}
|
||||
return inset;
|
||||
}
|
||||
|
||||
@ -157,7 +153,7 @@ bool TocWidget::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_LABEL_COPY_AS_REFERENCE: {
|
||||
// For labels in math, we need to supply the label as a string
|
||||
FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.asString());
|
||||
FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.str());
|
||||
if (inset)
|
||||
return inset->getStatus(cur, label_copy, status);
|
||||
break;
|
||||
@ -202,7 +198,7 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_LABEL_COPY_AS_REFERENCE: {
|
||||
// For labels in math, we need to supply the label as a string
|
||||
FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.asString());
|
||||
FuncRequest label_copy(LFUN_LABEL_COPY_AS_REFERENCE, item.str());
|
||||
if (inset)
|
||||
inset->dispatch(cur, label_copy);
|
||||
break;
|
||||
|
@ -616,6 +616,8 @@ QString guiName(string const & type, BufferParams const & bp)
|
||||
return qt_("Index Entries");
|
||||
if (type == "marginalnote")
|
||||
return qt_("Marginal notes");
|
||||
if (type == "math-macro")
|
||||
return qt_("Math macros");
|
||||
if (type == "nomencl")
|
||||
return qt_("Nomenclature Entries");
|
||||
if (type == "note")
|
||||
|
@ -74,7 +74,7 @@ std::string insetName(InsetCode);
|
||||
/// Eg, insetDisplayName(BRANCH_CODE) == _("Branch")
|
||||
docstring insetDisplayName(InsetCode);
|
||||
///
|
||||
static int const TOC_ENTRY_LENGTH = 40;
|
||||
static int const TOC_ENTRY_LENGTH = 80;
|
||||
|
||||
/// Common base class to all insets
|
||||
|
||||
@ -493,7 +493,15 @@ public:
|
||||
/// Add an entry to the TocList
|
||||
/// Pass a DocIterator that points at the paragraph containing
|
||||
/// the inset
|
||||
virtual void addToToc(DocIterator const & /* di */, bool /* output_active */) const {}
|
||||
///
|
||||
/// \param output_active : is the inset active or is it in an inactive
|
||||
/// branch or a note?
|
||||
///
|
||||
/// \param utype : is the toc being generated for use by the output
|
||||
/// routines?
|
||||
virtual void addToToc(DocIterator const & /* di */,
|
||||
bool /* output_active */,
|
||||
UpdateType /* utype*/) const {}
|
||||
/// Collect BibTeX information
|
||||
virtual void collectBibKeys(InsetIterator const &) const {}
|
||||
/// Update the counters of this inset and of its contents.
|
||||
|
@ -348,7 +348,8 @@ void InsetBranch::string2params(string const & in, InsetBranchParams & params)
|
||||
}
|
||||
|
||||
|
||||
void InsetBranch::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetBranch::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetBranch &>(*this)));
|
||||
@ -359,7 +360,7 @@ void InsetBranch::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
toc->push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
|
||||
// Proceed with the rest of the inset.
|
||||
bool const doing_output = output_active && isBranchSelected();
|
||||
InsetCollapsable::addToToc(cpit, doing_output);
|
||||
InsetCollapsable::addToToc(cpit, doing_output, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +82,8 @@ private:
|
||||
///
|
||||
std::string contextMenuName() const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
InsetBranchParams const & params() const { return params_; }
|
||||
///
|
||||
|
@ -90,17 +90,25 @@ void InsetCaption::setCustomLabel(docstring const & label)
|
||||
}
|
||||
|
||||
|
||||
void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetCaption::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
string const & type = floattype_.empty() ? "senseless" : floattype_;
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetCaption &>(*this)));
|
||||
docstring str = full_label_;
|
||||
int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
|
||||
text().forOutliner(str, length);
|
||||
int length = (utype == OutputUpdate) ?
|
||||
// For output (e.g. xhtml) all (bug #8603) or nothing
|
||||
(output_active ? INT_MAX : 0) :
|
||||
// TOC for LyX interface
|
||||
TOC_ENTRY_LENGTH;
|
||||
docstring str;
|
||||
if (length > 0) {
|
||||
str = full_label_;
|
||||
text().forOutliner(str, length);
|
||||
}
|
||||
buffer().tocBackend().builder(type)->captionItem(pit, str, output_active);
|
||||
// Proceed with the rest of the inset.
|
||||
InsetText::addToToc(cpit, output_active);
|
||||
InsetText::addToToc(cpit, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,9 +79,8 @@ private:
|
||||
docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
|
||||
///
|
||||
void setCustomLabel(docstring const & label);
|
||||
/// \param output_active : is the toc being generated for use by the
|
||||
/// output routines?
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active, UpdateType utype) const;
|
||||
///
|
||||
virtual bool forcePlainLayout(idx_type = 0) const { return true; }
|
||||
/// Captions don't accept alignment, spacing, etc.
|
||||
|
@ -45,17 +45,21 @@ docstring InsetCaptionable::floatName(string const & type) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetCaptionable &>(*this)));
|
||||
docstring str;
|
||||
int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
|
||||
text().forOutliner(str, length);
|
||||
// Leave str empty if we generate for output (e.g. xhtml lists of figures).
|
||||
// This ensures that there is a caption if and only if the string is
|
||||
// non-empty.
|
||||
if (utype != OutputUpdate)
|
||||
text().forOutliner(str, TOC_ENTRY_LENGTH);
|
||||
shared_ptr<TocBuilder> b = buffer().tocBackend().builder(caption_type_);
|
||||
b->pushItem(pit, str, output_active);
|
||||
// Proceed with the rest of the inset.
|
||||
InsetCollapsable::addToToc(cpit, output_active);
|
||||
InsetCollapsable::addToToc(cpit, output_active, utype);
|
||||
b->pop();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,8 @@ protected:
|
||||
/// are our captions subcaptions?
|
||||
virtual bool hasSubCaptions(ParIterator const &) const { return false; }
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
/// Update the counters of this inset and of its contents
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
|
@ -331,7 +331,8 @@ void InsetCitation::updateBuffer(ParIterator const &, UpdateType)
|
||||
}
|
||||
|
||||
|
||||
void InsetCitation::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetCitation::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
// NOTE
|
||||
// BiblioInfo::collectCitedEntries() uses the TOC to collect the citations
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
///
|
||||
void updateBuffer(ParIterator const & it, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
std::string contextMenuName() const;
|
||||
//@}
|
||||
|
@ -209,8 +209,6 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const & op) const {
|
||||
op.local_font->language()->lang());
|
||||
}
|
||||
|
||||
// FIXME Do we need to check if it exists? If so, we need a new
|
||||
// routine in TocBackend to do that.
|
||||
shared_ptr<Toc const> toc = buffer().tocBackend().toc(toctype);
|
||||
if (toc->empty())
|
||||
return docstring();
|
||||
@ -252,6 +250,8 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const & op) const {
|
||||
Toc::const_iterator it = toc->begin();
|
||||
Toc::const_iterator const en = toc->end();
|
||||
for (; it != en; ++it) {
|
||||
if (it->str().empty())
|
||||
continue;
|
||||
Paragraph const & par = it->dit().innerParagraph();
|
||||
string const attr = "class='lyxtoc-floats lyxtoc-" + toctype + "'";
|
||||
xs << html::StartTag("div", attr);
|
||||
|
@ -74,7 +74,8 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
}
|
||||
|
||||
|
||||
void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetFoot::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetFoot &>(*this)));
|
||||
@ -84,7 +85,7 @@ void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
text().forOutliner(str, TOC_ENTRY_LENGTH);
|
||||
toc->push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetFootlike::addToToc(cpit, output_active);
|
||||
InsetFootlike::addToToc(cpit, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,8 @@ private:
|
||||
/// Update the counters of this inset and of its contents
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
|
@ -1027,7 +1027,8 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p) const
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
//FIXME UNICODE
|
||||
docstring const str = from_utf8(params_.filename.onlyFileName());
|
||||
|
@ -99,7 +99,8 @@ private:
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
std::string contextMenuName() const;
|
||||
/// Force inset into LTR environment if surroundings are RTL
|
||||
|
@ -1125,13 +1125,14 @@ void InsetInclude::addPreview(DocIterator const & /*inset_pos*/,
|
||||
}
|
||||
|
||||
|
||||
void InsetInclude::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetInclude::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
TocBackend & backend = buffer().tocBackend();
|
||||
|
||||
if (isListings(params())) {
|
||||
if (label_)
|
||||
label_->addToToc(cpit, output_active);
|
||||
label_->addToToc(cpit, output_active, utype);
|
||||
|
||||
InsetListingsParams p(to_utf8(params()["lstparams"]));
|
||||
string caption = p.getParamValue("caption");
|
||||
@ -1151,8 +1152,7 @@ void InsetInclude::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
docstring str = childbuffer->fileName().displayName();
|
||||
toc->push_back(TocItem(cpit, 0, str, output_active));
|
||||
|
||||
//TocList & toclist = backend.tocs();
|
||||
childbuffer->tocBackend().update(output_active);
|
||||
childbuffer->tocBackend().update(output_active, utype);
|
||||
TocList const & childtoclist = childbuffer->tocBackend().tocs();
|
||||
TocList::const_iterator it = childtoclist.begin();
|
||||
TocList::const_iterator const end = childtoclist.end();
|
||||
|
@ -104,7 +104,8 @@ public:
|
||||
///
|
||||
void addPreview(DocIterator const &, graphics::PreviewLoader &) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
|
@ -348,7 +348,8 @@ void InsetIndex::string2params(string const & in, InsetIndexParams & params)
|
||||
}
|
||||
|
||||
|
||||
void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetIndex::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
|
||||
@ -360,7 +361,7 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
text().forOutliner(str, INT_MAX);
|
||||
buffer().tocBackend().toc(type)->push_back(TocItem(pit, 0, str, output_active));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetCollapsable::addToToc(cpit, output_active);
|
||||
InsetCollapsable::addToToc(cpit, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +71,8 @@ private:
|
||||
/// should paragraph indendation be omitted in any case?
|
||||
bool neverIndent() const { return true; }
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
|
@ -169,7 +169,8 @@ void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype)
|
||||
}
|
||||
|
||||
|
||||
void InsetLabel::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetLabel::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
docstring const & label = getParam("name");
|
||||
shared_ptr<Toc> toc = buffer().tocBackend().toc("label");
|
||||
|
@ -57,7 +57,8 @@ public:
|
||||
///
|
||||
void updateBuffer(ParIterator const & it, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -51,7 +51,8 @@ int InsetMarginal::docbook(odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
|
||||
@ -61,7 +62,7 @@ void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
text().forOutliner(str, TOC_ENTRY_LENGTH);
|
||||
toc->push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
|
||||
// Proceed with the rest of the inset.
|
||||
InsetFootlike::addToToc(cpit, output_active);
|
||||
InsetFootlike::addToToc(cpit, output_active, utype);
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -36,7 +36,8 @@ public:
|
||||
///
|
||||
int docbook(odocstream &, OutputParams const & runparams) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
private:
|
||||
///
|
||||
Inset * clone() const { return new InsetMarginal(*this); }
|
||||
|
@ -132,7 +132,8 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetNomencl::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
docstring const str = getParam("symbol");
|
||||
buffer().tocBackend().toc("nomencl")->push_back(TocItem(cpit, 0, str, output_active));
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return NOMENCL_CODE; }
|
||||
///
|
||||
|
@ -207,7 +207,8 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
void InsetNote::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetNote::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator pit = cpit;
|
||||
pit.push_back(CursorSlice(const_cast<InsetNote &>(*this)));
|
||||
@ -220,7 +221,7 @@ void InsetNote::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
|
||||
// Proceed with the rest of the inset.
|
||||
bool doing_output = output_active && producesOutput();
|
||||
InsetCollapsable::addToToc(cpit, doing_output);
|
||||
InsetCollapsable::addToToc(cpit, doing_output, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,7 +96,8 @@ private:
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
|
@ -303,7 +303,8 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
|
||||
}
|
||||
|
||||
|
||||
void InsetRef::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
docstring const & label = getParam("reference");
|
||||
if (buffer().insetLabel(label))
|
||||
|
@ -70,7 +70,8 @@ public:
|
||||
///
|
||||
void updateBuffer(ParIterator const & it, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
bool forceLTR() const { return true; }
|
||||
//@}
|
||||
|
@ -3439,9 +3439,10 @@ docstring InsetTableCell::asString(bool intoInsets)
|
||||
}
|
||||
|
||||
|
||||
void InsetTableCell::addToToc(DocIterator const & di, bool output_active) const
|
||||
void InsetTableCell::addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
InsetText::iterateForToc(di, output_active);
|
||||
InsetText::iterateForToc(di, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
@ -3927,13 +3928,14 @@ void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::addToToc(DocIterator const & cpit, bool output_active) const
|
||||
void InsetTabular::addToToc(DocIterator const & cpit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator dit = cpit;
|
||||
dit.forwardPos();
|
||||
size_t const end = dit.nargs();
|
||||
for ( ; dit.idx() < end; dit.top().forwardIdx())
|
||||
cell(dit.idx())->addToToc(dit, output_active);
|
||||
cell(dit.idx())->addToToc(dit, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +71,8 @@ public:
|
||||
///
|
||||
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
private:
|
||||
/// unimplemented
|
||||
InsetTableCell();
|
||||
@ -942,7 +943,8 @@ public:
|
||||
/// Update the counters of this inset and of its contents
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
|
||||
///
|
||||
bool completionSupported(Cursor const &) const;
|
||||
|
@ -797,18 +797,20 @@ void InsetText::forOutliner(docstring & os, size_t maxlen) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::addToToc(DocIterator const & cdit, bool output_active) const
|
||||
void InsetText::addToToc(DocIterator const & cdit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator dit = cdit;
|
||||
dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
|
||||
iterateForToc(dit, output_active);
|
||||
iterateForToc(dit, output_active, utype);
|
||||
}
|
||||
|
||||
|
||||
void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) const
|
||||
void InsetText::iterateForToc(DocIterator const & cdit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
DocIterator dit = cdit;
|
||||
// Ensure that any document has a table of contents
|
||||
// This also ensures that any document has a table of contents
|
||||
shared_ptr<Toc> toc = buffer().tocBackend().toc("tableofcontents");
|
||||
|
||||
BufferParams const & bufparams = buffer_->params();
|
||||
@ -832,7 +834,7 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) cons
|
||||
Inset & inset = *it->inset;
|
||||
dit.pos() = it->pos;
|
||||
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
|
||||
inset.addToToc(dit, doing_output);
|
||||
inset.addToToc(dit, doing_output, utype);
|
||||
if (inset.lyxCode() == ARG_CODE)
|
||||
arginset = inset.asInsetText();
|
||||
}
|
||||
@ -841,7 +843,8 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) cons
|
||||
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
|
||||
// insert this into the table of contents
|
||||
docstring tocstring;
|
||||
int const length = doing_output ? INT_MAX : TOC_ENTRY_LENGTH;
|
||||
int const length = (doing_output && utype == OutputUpdate) ?
|
||||
INT_MAX : TOC_ENTRY_LENGTH;
|
||||
if (arginset) {
|
||||
tocstring = par.labelString();
|
||||
if (!tocstring.empty())
|
||||
|
@ -171,7 +171,8 @@ public:
|
||||
///
|
||||
void forOutliner(docstring &, size_t) const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
Inset * clone() const { return new InsetText(*this); }
|
||||
///
|
||||
@ -217,7 +218,8 @@ protected:
|
||||
///
|
||||
docstring getCaptionHTML(OutputParams const &) const;
|
||||
///
|
||||
void iterateForToc(DocIterator const & cdit, bool output_active) const;
|
||||
void iterateForToc(DocIterator const & cdit, bool output_active,
|
||||
UpdateType utype) const;
|
||||
private:
|
||||
///
|
||||
bool drawFrame_;
|
||||
|
@ -292,7 +292,8 @@ void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||
}
|
||||
|
||||
|
||||
void InsetMathHull::addToToc(DocIterator const & pit, bool output_active) const
|
||||
void InsetMathHull::addToToc(DocIterator const & pit, bool output_active,
|
||||
UpdateType utype) const
|
||||
{
|
||||
if (!buffer_) {
|
||||
//FIXME: buffer_ should be set at creation for this inset! Problem is
|
||||
@ -307,7 +308,7 @@ void InsetMathHull::addToToc(DocIterator const & pit, bool output_active) const
|
||||
if (!numbered(row))
|
||||
continue;
|
||||
if (label_[row])
|
||||
label_[row]->addToToc(pit, output_active);
|
||||
label_[row]->addToToc(pit, output_active, utype);
|
||||
toc->push_back(TocItem(pit, 0, nicelabel(row), output_active));
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ public:
|
||||
///
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active) const;
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
///
|
||||
InsetMathHull & operator=(InsetMathHull const &);
|
||||
///
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "Lexer.h"
|
||||
#include "TocBackend.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
@ -1383,4 +1384,17 @@ string MathMacroTemplate::contextMenuName() const
|
||||
return "context-math-macro-definition";
|
||||
}
|
||||
|
||||
void MathMacroTemplate::addToToc(DocIterator const & pit, bool output_active,
|
||||
UpdateType) const
|
||||
{
|
||||
shared_ptr<Toc> toc = buffer().tocBackend().toc("math-macro");
|
||||
docstring str;
|
||||
if (!validMacro())
|
||||
str = bformat(_("Invalid macro! \\%1$s"), name());
|
||||
else
|
||||
str = "\\" + name();
|
||||
toc->push_back(TocItem(pit, 0, str, output_active));
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -103,6 +103,9 @@ public:
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
std::string contextMenuName() const;
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
protected:
|
||||
///
|
||||
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user