Alfredo Braunstein <[EMAIL PROTECTED]> writes:

| Alfredo Braunstein wrote:
>
>> Yes, I'd prefer to understand what's happening.
>
| Found it. The problem is big and unrelated.
>
| CollapsableInsets contain an InsetText *as a member* so this insettext is
| not in any paragraph InsetList.
>
| This is also a general problem with ParIterator: the pars inside the
| insettext are not visited.

they should be...

ParIterator & ParIterator::operator++()
{
        while (!pimpl_->positions.empty()) {
                ParPosition & p = pimpl_->positions.back();

                // Does the current inset contain more "cells" ?
                if (p.index) {
                        ++(*p.index);
                        ParagraphList * plist =
                (*p.it)->inset->getParagraphs(*p
.index);
                        if (plist && !plist->empty()) {
                                pimpl_->positions.push_back(ParPosition(plist->b
egin(), *plist));
                                return *this;
                        }
                        ++(*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.reset(p.pit->insetlist.begin());

                // Try to find the next inset that contains paragraphs
                InsetList::iterator end = p.pit->insetlist.end();
                for (; *p.it != end; ++(*p.it)) {
                        ParagraphList * plist =
                (*p.it)->inset->getParagraphs(0)
;
                        if (plist && !plist->empty()) {
                                p.index.reset(0);
                                pimpl_->positions.push_back(ParPosition(plist->b
egin(), *plist));
                                return *this;
                        }
                }

                // Try to go to the next paragarph
                if (next(p.pit) !=
                const_cast<ParagraphList*>(p.plist)->end()
                    || pimpl_->positions.size() == 1) {
                        ++p.pit;
                        p.index.reset();
                        p.it.reset();

                        return *this;
                }

                // Drop end and move up in the stack.
                pimpl_->positions.pop_back();
        }
        return *this;
}

This code is also supposed to visit paragraphs inside insets. There
may be bugs.

| Solutions?

dunno

-- 
        Lgb

Reply via email to