From d605c30d8cfdba7ab14c111b0cbe4b9d4fdbacc4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 21 May 2003 21:20:50 +0000 Subject: [PATCH] iterators-2.diff + some whitespace changes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6995 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 6 +- src/BufferView_pimpl.C | 4 +- src/ChangeLog | 24 +++- src/CutAndPaste.C | 14 +- src/buffer.C | 14 +- src/insets/ChangeLog | 11 +- src/insets/insetbutton.C | 6 +- src/insets/insetcollapsable.C | 2 +- src/insets/inseterror.C | 4 +- src/insets/insetert.C | 2 +- src/insets/insetfloat.C | 8 +- src/iterators.C | 251 +++++++++++++++++++++++++++++----- src/iterators.h | 110 +++++---------- src/mathed/math_cursor.C | 2 +- src/mathed/math_parser.C | 2 +- src/toc.C | 12 +- 16 files changed, 318 insertions(+), 154 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 4de7fcd061..730e30ac97 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -373,7 +373,7 @@ bool BufferView::removeAutoInsets() ParIterator it = buffer()->par_iterator_begin(); ParIterator end = buffer()->par_iterator_end(); for (; it != end; ++it) { - Paragraph * par = *it; + Paragraph * par = &*(*it); Paragraph * par_prev = par ? par->previous() : 0; bool removed = false; @@ -495,7 +495,7 @@ void BufferView::showErrorList(string const & action) const } -ErrorList const & +ErrorList const & BufferView::getErrorList() const { return pimpl_->errorlist_; @@ -764,7 +764,7 @@ bool BufferView::ChangeInsets(Inset::Code code, ParIterator end = buffer()->par_iterator_end(); for (ParIterator it = buffer()->par_iterator_begin(); it != end; ++it) { - Paragraph * par = *it; + Paragraph * par = &*(*it); bool changed_inset = false; for (InsetList::iterator it2 = par->insetlist.begin(); it2 != par->insetlist.end(); ++it2) { diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 176a0a4961..9787625304 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -842,9 +842,9 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) string const disp_fn = MakeDisplayPath(filename); owner_->message(bformat(_("Inserting document %1$s..."), disp_fn)); bool const res = bv_->insertLyXFile(filename); - if (res) + if (res) owner_->message(bformat(_("Document %1$s inserted."), disp_fn)); - else + else owner_->message(bformat(_("Could not insert document %1$s"), disp_fn)); } diff --git a/src/ChangeLog b/src/ChangeLog index 9b9d5d7d44..cae91f9913 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2003-05-21 Lars Gullik Bjønnes + + * toc.C (getTocList): adjust + + * iterators.[Ch]: rework for parlist + + * buffer.C (par_iterator_begin): adjust + (par_iterator_end): adjust + + * CutAndPaste.C (SwitchLayoutsBetweenClasses): adjust + + * BufferView.C (removeAutoInsets): adjust + (ChangeInsets): adjust + 2003-05-21 Alfredo Braunstein * text.C (top_y): fix bug 1110 @@ -55,13 +69,13 @@ * ParagraphParameters.C (params2string): small bug fixed 2003-05-16 André Pönitz - + * debug.C: - * bufferview_funcs.C: patch from Kornel Benko to prevent + * bufferview_funcs.C: patch from Kornel Benko to prevent crash when _(...) is called twice in a statement 2003-05-16 André Pönitz - + * BufferView.C: * lyxfunc.C: * text.C: @@ -74,7 +88,7 @@ * lyx_main.C (init): remove spurious static_cast 2003-05-14 André Pönitz - + * BufferView.C: fix format string 2003-05-12 Alfredo Braunstein @@ -85,7 +99,7 @@ * converter.C (scanLog): call showErrorList instead of inserterrors 2003-05-13 André Pönitz - + * BufferView_pimpl.C: * buffer.C: * bufferview_func.C: diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 91762f895e..c2c4c04b37 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -223,7 +223,7 @@ CutAndPaste::pasteSelection(ParagraphList & pars, // new environment and set also another font if that is required. // Make sure there is no class difference. - SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone, + SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone, errorlist); ParagraphList::iterator tmpbuf = simple_cut_clone.begin(); @@ -338,17 +338,15 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, { lyx::Assert(!pars.empty()); - Paragraph * par = &*pars.begin(); - int ret = 0; if (c1 == c2) return ret; LyXTextClass const & tclass1 = textclasslist[c1]; LyXTextClass const & tclass2 = textclasslist[c2]; - ParIterator end = ParIterator(); - for (ParIterator it = ParIterator(par); it != end; ++it) { - par = *it; + ParIterator end = ParIterator(pars.end(), pars); + for (ParIterator it = ParIterator(pars.begin(), pars); it != end; ++it) { + Paragraph * par = &*(*it); string const name = par->layout()->name(); bool hasLayout = tclass2.hasLayout(name); @@ -364,8 +362,8 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, "because of class conversion from\n%3$s to %4$s"), name, par->layout()->name(), tclass1.name(), tclass2.name()); // To warn the user that something had to be done. - errorlist.push_back(ErrorItem("Changed Layout", s, - par->id(), 0, + errorlist.push_back(ErrorItem("Changed Layout", s, + par->id(), 0, par->size())); } } diff --git a/src/buffer.C b/src/buffer.C index ccb271815e..3bb3d78951 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -148,7 +148,7 @@ Buffer::~Buffer() users->buffer(0); if (!tmppath.empty() && destroyDir(tmppath) != 0) { - Alert::warning(_("Could not remove temporary directory"), + Alert::warning(_("Could not remove temporary directory"), bformat(_("Could not remove the temporary directory %1$s"), tmppath)); } @@ -249,7 +249,7 @@ namespace { void unknownClass(string const & unknown) { - Alert::warning(_("Unknown document class"), + Alert::warning(_("Unknown document class"), bformat(_("Using the default document class, because the " " class %1$s is unknown."), unknown)); } @@ -1969,7 +1969,7 @@ int Buffer::runChktex() _("Could not run chktex successfully.")); } else if (res > 0) { // Insert all errors as errors boxes - ErrorList el (*this, terr); + ErrorList el (*this, terr); users->setErrorList(el); users->showErrorList(_("ChkTeX")); } @@ -2249,24 +2249,24 @@ bool Buffer::hasParWithID(int id) const ParIterator Buffer::par_iterator_begin() { - return ParIterator(&*(paragraphs.begin())); + return ParIterator(paragraphs.begin(), paragraphs); } ParIterator Buffer::par_iterator_end() { - return ParIterator(); + return ParIterator(paragraphs.end(), paragraphs); } ParConstIterator Buffer::par_iterator_begin() const { - return ParConstIterator(&*(paragraphs.begin())); + return ParConstIterator(paragraphs.begin(), paragraphs); } ParConstIterator Buffer::par_iterator_end() const { - return ParConstIterator(); + return ParConstIterator(paragraphs.end(), paragraphs); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 9e13ba024e..3ca4cff9b5 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,6 @@ +2003-05-21 Lars Gullik Bjønnes + + * insetfloat.C (addToToc): adjust 2003-05-21 André Pönitz @@ -24,17 +27,17 @@ * insetspecialchar.[Ch]: * insettabular.[Ch]: * insettext.[Ch]: dimensions() instead of ascend/descend/width - + 2003-05-19 André Pönitz * insetenv.[Ch]: - * insettext.C: more insetenv + * insettext.C: more insetenv 2003-05-16 André Pönitz * insetcommand.C: * insetminimpage.[Ch]: - * insetcollapsable.[Ch]: fix #832 + * insetcollapsable.[Ch]: fix #832 2003-05-16 André Pönitz @@ -61,7 +64,7 @@ * insettoc.[Ch]: * inseturl.[Ch]: * updatableinset.[Ch]: edit() -> LFUN_INSET_EDIT - + 2003-05-13 André Pönitz * insetbibitem.C: diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index 8f46a75574..7367a638ac 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -37,11 +37,11 @@ void InsetButton::dimension(BufferView * bv, LyXFont const &, string const s = getScreenLabel(bv->buffer()); - if (editable()) + if (editable()) font_metrics::buttonText(s, font, dim.w, dim.a, dim.d); - else + else font_metrics::rectText(s, font, dim.w, dim.a, dim.d); - + dim.w += 4; } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 3bb3f46f1d..4b9c48381f 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -127,7 +127,7 @@ void InsetCollapsable::dimension(BufferView * bv, LyXFont const & font, Dimension & dim) const { dimension_collapsed(dim); - if (collapsed_) + if (collapsed_) return; Dimension insetdim; inset.dimension(bv, font, insetdim); diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index dbca5c1222..568f5758d0 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -44,8 +44,8 @@ dispatch_result InsetError::localDispatch(FuncRequest const & cmd) dispatch_result result = UNDISPATCHED; switch (cmd.action) { - case LFUN_MOUSE_RELEASE: - case LFUN_INSET_EDIT: + case LFUN_MOUSE_RELEASE: + case LFUN_INSET_EDIT: cmd.view()->owner()->getDialogs().show("error", getContents(), this); return DISPATCHED; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 24c076ff63..881ca1c017 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -555,7 +555,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */) void InsetERT::dimension(BufferView * bv, LyXFont const & font, Dimension & dim) const { - if (inlined()) + if (inlined()) inset.dimension(bv, font, dim); else InsetCollapsable::dimension(bv, font, dim); diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 54295b4d8d..d987fc3ec8 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -362,12 +362,12 @@ void InsetFloat::wide(bool w, BufferParams const & bp) void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const { - ParIterator pit(&*inset.paragraphs.begin()); - ParIterator end; + ParIterator pit(inset.paragraphs.begin(), inset.paragraphs); + ParIterator end(inset.paragraphs.end(), inset.paragraphs); // Find a caption layout in one of the (child inset's) pars for (; pit != end; ++pit) { - Paragraph * tmp = *pit; + Paragraph * tmp = &*(*pit); if (tmp->layout()->name() == caplayout) { string const name = floatname(params_.type, buf->params); @@ -401,7 +401,7 @@ void InsetFloatMailer::string2params(string const & in, if (in.empty()) return; - + istringstream data(STRCONV(in)); LyXLex lex(0,0); lex.setStream(data); diff --git a/src/iterators.C b/src/iterators.C index 9521313243..7f067728d1 100644 --- a/src/iterators.C +++ b/src/iterators.C @@ -1,86 +1,273 @@ +/* \file iterators.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author unknown + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS + */ + + #include #include "iterators.h" +#include "paragraph.h" + +#include +#include + +#include + +using boost::next; +using boost::optional; +using std::stack; + +/// +/// ParPosition +/// + +class ParPosition { +public: + /// + ParPosition(ParagraphList::iterator p, ParagraphList const & pl); + /// + ParagraphList::iterator pit; + /// + ParagraphList const * plist; + /// + optional it; + /// + optional index; +}; + + +ParPosition::ParPosition(ParagraphList::iterator p, ParagraphList const & pl) + : pit(p), plist(&pl) +{ + if (p != pl.end()) { + it.reset(p->insetlist.begin()); + } +} + + +bool operator==(ParPosition const & pos1, ParPosition const & pos2) +{ + return pos1.pit == pos2.pit; +} + + +bool operator!=(ParPosition const & pos1, ParPosition const & pos2) +{ + return !(pos1 == pos2); +} + + +/// +/// ParIterator +/// + +struct ParIterator::Pimpl { + typedef stack PosHolder; + PosHolder positions; +}; + +ParIterator::ParIterator(ParagraphList::iterator pit, ParagraphList const & pl) + : pimpl_(new Pimpl) +{ + pimpl_->positions.push(ParPosition(pit, pl)); +} + + +ParIterator::~ParIterator() +{} + + +ParIterator::ParIterator(ParIterator const & pi) + : pimpl_(new Pimpl(*pi.pimpl_)) +{} + ParIterator & ParIterator::operator++() { - while (!positions.empty()) { - ParPosition & p = positions.top(); + while (!pimpl_->positions.empty()) { + ParPosition & p = pimpl_->positions.top(); // Does the current inset contain more "cells" ? - if (p.index >= 0) { - ++p.index; - ParagraphList * plist = p.it.getInset()->getParagraphs(p.index); + if (p.index) { + ++(*p.index); + ParagraphList * plist = p.it->getInset()->getParagraphs(*p.index); if (plist && !plist->empty()) { - positions.push(ParPosition(&plist->front())); + pimpl_->positions.push(ParPosition(plist->begin(), *plist)); return *this; } - ++p.it; + ++(*p.it); } else // The following line is needed because the value of // p.it may be invalid if inset was added/removed to // the paragraph pointed by the iterator - p.it = p.par->insetlist.begin(); + p.it.reset(p.pit->insetlist.begin()); // Try to find the next inset that contains paragraphs - InsetList::iterator end = p.par->insetlist.end(); - for (; p.it != end; ++p.it) { - ParagraphList * plist = p.it.getInset()->getParagraphs(0); + InsetList::iterator end = p.pit->insetlist.end(); + for (; *p.it != end; ++(*p.it)) { + ParagraphList * plist = p.it->getInset()->getParagraphs(0); if (plist && !plist->empty()) { - p.index = 0; - positions.push(ParPosition(&plist->front())); + p.index.reset(0); + pimpl_->positions.push(ParPosition(plist->begin(), *plist)); return *this; } } + // Try to go to the next paragarph - if (p.par->next()) { - p = ParPosition(p.par->next()); + if (next(p.pit) != p.plist->end() + || pimpl_->positions.size() == 1) { + ++p.pit; + p.index.reset(); + p.it.reset(); + return *this; } - positions.pop(); + // Drop end and move up in the stack. + pimpl_->positions.pop(); } return *this; } +ParagraphList::iterator ParIterator::operator*() +{ + return pimpl_->positions.top().pit; +} + + +ParagraphList::iterator ParIterator::operator->() +{ + return pimpl_->positions.top().pit; +} + + +size_t ParIterator::size() const +{ + return pimpl_->positions.size(); +} + + +bool operator==(ParIterator const & iter1, ParIterator const & iter2) +{ + return iter1.pimpl_->positions == iter2.pimpl_->positions; +} + + +bool operator!=(ParIterator const & iter1, ParIterator const & iter2) +{ + return !(iter1 == iter2); +} + + +/// +/// ParConstIterator +/// + + +struct ParConstIterator::Pimpl { + typedef stack PosHolder; + PosHolder positions; +}; + + +ParConstIterator::ParConstIterator(ParagraphList::iterator pit, + ParagraphList const & pl) + : pimpl_(new Pimpl) +{ + pimpl_->positions.push(ParPosition(pit, pl)); +} + + +ParConstIterator::~ParConstIterator() +{} + + +ParConstIterator::ParConstIterator(ParConstIterator const & pi) + : pimpl_(new Pimpl(*pi.pimpl_)) +{} + + ParConstIterator & ParConstIterator::operator++() { - while (!positions.empty()) { - ParPosition & p = positions.top(); + while (!pimpl_->positions.empty()) { + ParPosition & p = pimpl_->positions.top(); // Does the current inset contain more "cells" ? - if (p.index >= 0) { - ++p.index; - ParagraphList * plist = p.it.getInset()->getParagraphs(p.index); + if (p.index) { + ++(*p.index); + ParagraphList * plist = p.it->getInset()->getParagraphs(*p.index); if (plist && !plist->empty()) { - positions.push(ParPosition(&plist->front())); + pimpl_->positions.push(ParPosition(plist->begin(), *plist)); return *this; } - ++p.it; + ++(*p.it); } else // The following line is needed because the value of // p.it may be invalid if inset was added/removed to // the paragraph pointed by the iterator - p.it = p.par->insetlist.begin(); + p.it.reset(p.pit->insetlist.begin()); // Try to find the next inset that contains paragraphs - InsetList::iterator end = p.par->insetlist.end(); - for (; p.it != end; ++p.it) { - ParagraphList * plist = p.it.getInset()->getParagraphs(0); + InsetList::iterator end = p.pit->insetlist.end(); + for (; *p.it != end; ++(*p.it)) { + ParagraphList * plist = p.it->getInset()->getParagraphs(0); if (plist && !plist->empty()) { - p.index = 0; - positions.push(ParPosition(&plist->front())); + p.index.reset(0); + pimpl_->positions.push(ParPosition(plist->begin(), *plist)); return *this; } } + // Try to go to the next paragarph - if (p.par->next()) { - p = ParPosition(p.par->next()); + if (next(p.pit) != p.plist->end() + || pimpl_->positions.size() == 1) { + ++p.pit; + p.index.reset(); + p.it.reset(); + return *this; } - positions.pop(); + // Drop end and move up in the stack. + pimpl_->positions.pop(); } + return *this; } + + +ParagraphList::iterator ParConstIterator::operator*() +{ + return pimpl_->positions.top().pit; +} + + +ParagraphList::iterator ParConstIterator::operator->() +{ + return pimpl_->positions.top().pit; +} + + +size_t ParConstIterator::size() const +{ + return pimpl_->positions.size(); +} + + +bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2) +{ + return iter1.pimpl_->positions == iter2.pimpl_->positions; +} + + +bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2) +{ + return !(iter1 == iter2); +} diff --git a/src/iterators.h b/src/iterators.h index 8bc2128a08..9bc322ec6b 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -1,119 +1,83 @@ // -*- C++ -*- +/* \file iterators.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author unknown + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS + */ #ifndef ITERATORS_H #define ITERATORS_H -#include - -#include "paragraph.h" - -class ParPosition { -public: - ParPosition(Paragraph * p) - : par(p), it(p->insetlist.begin()), index(-1) {} - /// - Paragraph * par; - /// - InsetList::iterator it; - /// - int index; -}; - - -inline -bool operator==(ParPosition const & pos1, ParPosition const & pos2) { - return pos1.par == pos2.par && - pos1.it == pos2.it && - pos1.index == pos2.index; -} - -inline -bool operator!=(ParPosition const & pos1, ParPosition const & pos2) { - return !(pos1 == pos2); -} +#include "ParagraphList.h" +#include class ParIterator { public: /// - typedef std::stack PosHolder; + ParIterator(ParagraphList::iterator pit, ParagraphList const & pl); /// - ParIterator() {} + ~ParIterator(); /// - ParIterator(Paragraph * par) { - positions.push(ParPosition(par)); - } + ParIterator(ParIterator const &); /// ParIterator & operator++(); /// - Paragraph * operator*() { - return positions.top().par; - } + ParagraphList::iterator operator*(); + /// + ParagraphList::iterator operator->(); /// - PosHolder::size_type size() const - { return positions.size(); } + size_t size() const; /// friend bool operator==(ParIterator const & iter1, ParIterator const & iter2); private: - /// - PosHolder positions; + struct Pimpl; + boost::scoped_ptr pimpl_; }; - /// -inline -bool operator==(ParIterator const & iter1, ParIterator const & iter2) { - return iter1.positions == iter2.positions; -} - +bool operator==(ParIterator const & iter1, ParIterator const & iter2); /// -inline -bool operator!=(ParIterator const & iter1, ParIterator const & iter2) { - return !(iter1 == iter2); -} +bool operator!=(ParIterator const & iter1, ParIterator const & iter2); class ParConstIterator { public: /// - typedef std::stack PosHolder; + ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl); /// - ParConstIterator() {} + ~ParConstIterator(); /// - ParConstIterator(Paragraph * par) { - positions.push(ParPosition(par)); - } + ParConstIterator(ParConstIterator const &); /// ParConstIterator & operator++(); /// - Paragraph const * operator*() { - return positions.top().par; - } + ParagraphList::iterator operator*(); + + /// + ParagraphList::iterator operator->(); + /// - PosHolder::size_type size() const - { return positions.size(); } + size_t size() const; /// friend bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2); private: - /// - PosHolder positions; + struct Pimpl; + boost::scoped_ptr pimpl_; }; +bool operator==(ParConstIterator const & iter1, + ParConstIterator const & iter2); -/// -inline -bool operator==(ParConstIterator const & iter1, ParConstIterator const & iter2) { - return iter1.positions == iter2.positions; -} - -/// -inline -bool operator!=(ParConstIterator const & iter1, ParConstIterator const & iter2) { - return !(iter1 == iter2); -} +bool operator!=(ParConstIterator const & iter1, + ParConstIterator const & iter2); #endif diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 0ae4239153..ac95f75b97 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1409,7 +1409,7 @@ MathCursorPos MathCursor::normalAnchor() const dispatch_result MathCursor::dispatch(FuncRequest const & cmd) { - // mouse clicks are somewhat special + // mouse clicks are somewhat special // check switch (cmd.action) { case LFUN_MOUSE_PRESS: diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 8d02368048..56b89b58f1 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -617,7 +617,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, if (flags & FLAG_ITEM) { - if (t.cat() == catBegin) { + if (t.cat() == catBegin) { // skip the brace and collect everything to the next matching // closing brace parse1(grid, FLAG_BRACE_LAST, mode, numbered); diff --git a/src/toc.C b/src/toc.C index 8912609988..96ea0364ee 100644 --- a/src/toc.C +++ b/src/toc.C @@ -78,26 +78,24 @@ TocList const getTocList(Buffer const * buf) ParConstIterator pit = buf->par_iterator_begin(); ParConstIterator end = buf->par_iterator_end(); for (; pit != end; ++pit) { - Paragraph const * par = *pit; - #ifdef WITH_WARNINGS #warning bogus type (Lgb) #endif - char const labeltype = par->layout()->labeltype; + char const labeltype = pit->layout()->labeltype; if (labeltype >= LABEL_COUNTER_CHAPTER && labeltype <= LABEL_COUNTER_CHAPTER + buf->params.tocdepth) { // insert this into the table of contents const int depth = max(0, labeltype - textclass.maxcounter()); - TocItem const item(par->id(), depth, - par->asString(buf, true)); + TocItem const item(pit->id(), depth, + pit->asString(buf, true)); toclist["TOC"].push_back(item); } // For each paragraph, traverse its insets and look for // FLOAT_CODE or WRAP_CODE - InsetList::iterator it = par->insetlist.begin(); - InsetList::iterator end = par->insetlist.end(); + InsetList::iterator it = pit->insetlist.begin(); + InsetList::iterator end = pit->insetlist.end(); for (; it != end; ++it) { if (it.getInset()->lyxCode() == Inset::FLOAT_CODE) { InsetFloat * il = -- 2.39.5