+public:
+ ///
+ class inset_iterator {
+ public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef Inset value_type;
+ typedef ptrdiff_t difference_type;
+ typedef Inset * pointer;
+ typedef Inset & reference;
+
+
+ ///
+ inset_iterator() : par(0) /*, it(0)*/ {}
+ //
+ inset_iterator(Paragraph * paragraph) : par(paragraph) {
+ setParagraph();
+ }
+ ///
+ inset_iterator(Paragraph * paragraph,
+ Paragraph::size_type pos);
+ ///
+ inset_iterator & operator++() { // prefix ++
+ if (par) {
+ ++it;
+ if (it == par->inset_iterator_end()) {
+ par = par->next();
+ setParagraph();
+ }
+ }
+ return *this;
+ }
+ ///
+ inset_iterator operator++(int) { // postfix ++
+ inset_iterator tmp(par, it.getPos());
+ if (par) {
+ ++it;
+ if (it == par->inset_iterator_end()) {
+ par = par->next();
+ setParagraph();
+ }
+ }
+ return tmp;
+ }
+ ///
+ Inset * operator*() { return *it; }
+
+ ///
+ Paragraph * getPar() { return par; }
+ ///
+ Paragraph::size_type getPos() const { return it.getPos(); }
+ ///
+ friend
+ bool operator==(inset_iterator const & iter1,
+ inset_iterator const & iter2);
+ private:
+ ///
+ void setParagraph();
+ ///
+ Paragraph * par;
+ ///
+ Paragraph::inset_iterator it;
+ };
+
+ ///
+ inset_iterator inset_iterator_begin() {
+ return inset_iterator(paragraph);
+ }
+ ///
+ inset_iterator inset_iterator_end() {
+ return inset_iterator();
+ }