mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Small cleanup in order to improve toc change detection within insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26574 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
42693547f7
commit
5731e7faae
@ -2192,11 +2192,9 @@ void Cursor::recordUndoSelection() const
|
||||
|
||||
void Cursor::checkBufferStructure()
|
||||
{
|
||||
if (paragraph().layout().toclevel == Layout::NOT_IN_TOC)
|
||||
return;
|
||||
Buffer const * master = buffer().masterBuffer();
|
||||
master->tocBackend().updateItem(ParConstIterator(*this));
|
||||
master->structureChanged();
|
||||
if (master->tocBackend().updateItem(*this))
|
||||
master->structureChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,13 +104,16 @@ Toc & TocBackend::toc(string const & type)
|
||||
}
|
||||
|
||||
|
||||
void TocBackend::updateItem(DocIterator const & dit)
|
||||
bool TocBackend::updateItem(DocIterator const & dit)
|
||||
{
|
||||
if (dit.paragraph().layout().toclevel == Layout::NOT_IN_TOC)
|
||||
return false;
|
||||
|
||||
if (toc("tableofcontents").empty()) {
|
||||
// FIXME: should not happen,
|
||||
// a call to TocBackend::update() is missing somewhere
|
||||
LYXERR0("TocBackend::updateItem called but the TOC is empty!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
BufferParams const & bufparams = buffer_->params();
|
||||
@ -145,6 +148,8 @@ void TocBackend::updateItem(DocIterator const & dit)
|
||||
tocstring = par.asString(AS_STR_LABEL);
|
||||
|
||||
const_cast<TocItem &>(*toc_item).str_ = tocstring;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,8 +97,8 @@ public:
|
||||
void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
|
||||
///
|
||||
void update();
|
||||
///
|
||||
void updateItem(DocIterator const & pit);
|
||||
/// \return true if the item was updated.
|
||||
bool updateItem(DocIterator const & pit);
|
||||
|
||||
///
|
||||
TocList const & tocs() const { return tocs_; }
|
||||
|
Loading…
Reference in New Issue
Block a user