This patch introduces ParagraphList::const_iterator, and adjust stuff
to fit.  All problems larger than --><-- has been solved by a
const_cast.

Have a look if you want to.

? src/frontends/xforms/lyx_forms.h
? src/frontends/xforms/lyx_xpm.h
Index: src/ParagraphList.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphList.C,v
retrieving revision 1.25
diff -u -p -r1.25 ParagraphList.C
--- src/ParagraphList.C	27 May 2003 20:59:00 -0000	1.25
+++ src/ParagraphList.C	27 May 2003 22:15:22 -0000
@@ -80,6 +80,80 @@ bool operator!=(ParagraphList::iterator 
 	return !(i1 == i2);
 }
 
+////////// The ParagraphList::const_iterator
+
+ParagraphList::const_iterator::const_iterator()
+	: ptr(0)
+{}
+
+
+ParagraphList::const_iterator::const_iterator(Paragraph * p)
+	: ptr(p)
+{}
+
+
+ParagraphList::const_iterator::const_reference
+ParagraphList::const_iterator::operator*()
+{
+	return *ptr;
+}
+
+
+ParagraphList::const_iterator::const_pointer
+ParagraphList::const_iterator::operator->()
+{
+	return ptr;
+}
+
+
+ParagraphList::const_iterator &
+ParagraphList::const_iterator::operator++()
+{
+	ptr = ptr->next_par_;
+	return *this;
+}
+
+
+ParagraphList::const_iterator
+ParagraphList::const_iterator::operator++(int)
+{
+	const_iterator tmp = *this;
+	++*this;
+	return tmp;
+}
+
+
+ParagraphList::const_iterator &
+ParagraphList::const_iterator::operator--()
+{
+	ptr = ptr->prev_par_;
+	return *this;
+}
+
+
+ParagraphList::const_iterator
+ParagraphList::const_iterator::operator--(int)
+{
+	const_iterator tmp = *this;
+	--*this;
+	return tmp;
+}
+
+
+bool operator==(ParagraphList::const_iterator const & i1,
+		ParagraphList::const_iterator const & i2)
+{
+	return &(*const_cast<ParagraphList::const_iterator&>(i1))
+	    == &(*const_cast<ParagraphList::const_iterator&>(i2));
+}
+
+
+bool operator!=(ParagraphList::const_iterator const & i1,
+		ParagraphList::const_iterator const & i2)
+{
+	return !(i1 == i2);
+}
+
 //////////
 ////////// The ParagraphList proper
 //////////
@@ -93,8 +167,8 @@ ParagraphList::ParagraphList(ParagraphLi
 	: parlist(0)
 {
 	// Deep copy.
-	ParagraphList::iterator it = pl.begin();
-	ParagraphList::iterator end = pl.end();
+	ParagraphList::const_iterator it = pl.begin();
+	ParagraphList::const_iterator end = pl.end();
 	for (; it != end; ++it) {
 		push_back(*it);
 	}
@@ -231,9 +305,9 @@ ParagraphList::iterator ParagraphList::b
 }
 
 
-ParagraphList::iterator ParagraphList::begin() const
+ParagraphList::const_iterator ParagraphList::begin() const
 {
-	return iterator(parlist);
+	return const_iterator(parlist);
 }
 
 
@@ -243,9 +317,9 @@ ParagraphList::iterator ParagraphList::e
 }
 
 
-ParagraphList::iterator ParagraphList::end() const
+ParagraphList::const_iterator ParagraphList::end() const
 {
-	return iterator();
+	return const_iterator();
 }
 
 
Index: src/ParagraphList.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphList.h,v
retrieving revision 1.17
diff -u -p -r1.17 ParagraphList.h
--- src/ParagraphList.h	27 May 2003 20:59:00 -0000	1.17
+++ src/ParagraphList.h	27 May 2003 22:15:22 -0000
@@ -58,6 +58,40 @@ public:
 		Paragraph * ptr;
 	};
 	///
+	class const_iterator {
+	public:
+		friend class ParagraphList;
+		///
+		typedef std::bidirectional_iterator_tag iterator_category;
+		///
+		typedef Paragraph * value_type;
+		///
+		typedef ptrdiff_t difference_type;
+		///
+		typedef Paragraph const * const_pointer;
+		///
+		typedef Paragraph const & const_reference;
+		///
+		const_iterator();
+		///
+		const_reference operator*();
+		///
+		const_pointer operator->();
+		///
+		const_iterator & operator++();
+		///
+		const_iterator operator++(int);
+		///
+		const_iterator & operator--();
+		///
+		const_iterator operator--(int);
+	private:
+		///
+		const_iterator(value_type);
+		///
+		Paragraph * ptr;
+	};
+	///
 	ParagraphList();
 	///
 	ParagraphList(ParagraphList const &);
@@ -80,11 +114,11 @@ public:
 	///
 	iterator begin();
 	///
-	iterator begin() const;
+	const_iterator begin() const;
 	///
 	iterator end();
 	///
-	iterator end() const;
+	const_iterator end() const;
 	///
 	void push_back(Paragraph const &);
 	///
@@ -116,6 +150,13 @@ bool operator==(ParagraphList::iterator 
 ///
 bool operator!=(ParagraphList::iterator const & i1,
 		ParagraphList::iterator const & i2);
+
+///
+bool operator==(ParagraphList::const_iterator const & i1,
+		ParagraphList::const_iterator const & i2);
+///
+bool operator!=(ParagraphList::const_iterator const & i1,
+		ParagraphList::const_iterator const & i2);
 
 #endif
 
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.473
diff -u -p -r1.473 buffer.C
--- src/buffer.C	27 May 2003 17:28:59 -0000	1.473
+++ src/buffer.C	27 May 2003 22:15:23 -0000
@@ -681,8 +681,8 @@ bool Buffer::writeFile(string const & fn
 
 	// this will write out all the paragraphs
 	// using recursive descent.
-	ParagraphList::iterator pit = paragraphs.begin();
-	ParagraphList::iterator pend = paragraphs.end();
+	ParagraphList::const_iterator pit = paragraphs.begin();
+	ParagraphList::const_iterator pend = paragraphs.end();
 	for (; pit != pend; ++pit)
 		pit->write(this, ofs, params, depth);
 
@@ -2254,13 +2254,13 @@ ParIterator Buffer::par_iterator_end()
 
 ParConstIterator Buffer::par_iterator_begin() const
 {
-	return ParConstIterator(paragraphs.begin(), paragraphs);
+	return ParConstIterator(const_cast<ParagraphList&>(paragraphs).begin(), paragraphs);
 }
 
 
 ParConstIterator Buffer::par_iterator_end() const
 {
-	return ParConstIterator(paragraphs.end(), paragraphs);
+	return ParConstIterator(const_cast<ParagraphList&>(paragraphs).end(), paragraphs);
 }
 
 
Index: src/buffer.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v
retrieving revision 1.140
diff -u -p -r1.140 buffer.h
--- src/buffer.h	22 May 2003 21:10:22 -0000	1.140
+++ src/buffer.h	27 May 2003 22:15:23 -0000
@@ -399,7 +399,7 @@ public:
 
 	///
 	inset_iterator inset_const_iterator_begin() const {
-		return inset_iterator(paragraphs.begin(), paragraphs.end());
+		return inset_iterator(const_cast<ParagraphList&>(paragraphs).begin(), const_cast<ParagraphList&>(paragraphs).end());
 	}
 
 	///
Index: src/iterators.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/iterators.C,v
retrieving revision 1.10
diff -u -p -r1.10 iterators.C
--- src/iterators.C	23 May 2003 10:33:38 -0000	1.10
+++ src/iterators.C	27 May 2003 22:15:23 -0000
@@ -45,7 +45,7 @@ public:
 ParPosition::ParPosition(ParagraphList::iterator p, ParagraphList const & pl)
 	: pit(p), plist(&pl)
 {
-	if (p != pl.end()) {
+	if (p != const_cast<ParagraphList&>(pl).end()) {
 		it.reset(p->insetlist.begin());
 	}
 }
@@ -127,7 +127,7 @@ ParIterator & ParIterator::operator++()
 		}
 
 		// Try to go to the next paragarph
-		if (next(p.pit) != p.plist->end()
+		if (next(p.pit) != const_cast<ParagraphList*>(p.plist)->end()
 		    || pimpl_->positions.size() == 1) {
 			++p.pit;
 			p.index.reset();
@@ -239,7 +239,7 @@ ParConstIterator & ParConstIterator::ope
 		}
 
 		// Try to go to the next paragarph
-		if (next(p.pit) != p.plist->end()
+		if (next(p.pit) != const_cast<ParagraphList*>(p.plist)->end()
 		    || pimpl_->positions.size() == 1) {
 			++p.pit;
 			p.index.reset();
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.276
diff -u -p -r1.276 paragraph.C
--- src/paragraph.C	27 May 2003 20:59:00 -0000	1.276
+++ src/paragraph.C	27 May 2003 22:15:23 -0000
@@ -727,7 +727,7 @@ int Paragraph::getPositionOfInset(Inset 
 }
 
 
-InsetBibitem * Paragraph::bibitem()
+InsetBibitem * Paragraph::bibitem() const
 {
 	InsetList::iterator it = insetlist.begin();
 	if (it != insetlist.end() && it.getInset()->lyxCode() == Inset::BIBTEX_CODE)
Index: src/paragraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
retrieving revision 1.82
diff -u -p -r1.82 paragraph.h
--- src/paragraph.h	27 May 2003 20:59:01 -0000	1.82
+++ src/paragraph.h	27 May 2003 22:15:24 -0000
@@ -45,6 +45,7 @@ public:
 	// Remove this whan ParagraphList transition is over. (Lgb)
 	friend class ParagraphList;
 	friend class ParagraphList::iterator;
+	friend class ParagraphList::const_iterator;
 #endif
 	///
 	enum META_KIND {
@@ -145,7 +146,7 @@ public:
 	char itemdepth;
 
 	///
-	InsetBibitem * bibitem();  // ale970302
+	InsetBibitem * bibitem() const;  // ale970302
 
 	/// initialise tracking for this par
 	void trackChanges(Change::Type = Change::UNCHANGED);
Index: src/paragraph_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v
retrieving revision 1.41
diff -u -p -r1.41 paragraph_funcs.C
--- src/paragraph_funcs.C	24 May 2003 12:13:30 -0000	1.41
+++ src/paragraph_funcs.C	27 May 2003 22:15:24 -0000
@@ -203,7 +203,7 @@ ParagraphList::iterator depthHook(Paragr
 				  Paragraph::depth_type depth)
 {
 	ParagraphList::iterator newpit = pit;
-	ParagraphList::iterator beg = plist.begin();
+	ParagraphList::iterator beg = const_cast<ParagraphList&>(plist).begin();
 
 	if (newpit != beg)
 		--newpit;
@@ -223,7 +223,7 @@ ParagraphList::iterator outerHook(Paragr
 				  ParagraphList const & plist)
 {
 	if (!pit->getDepth())
-		return plist.end();
+		return const_cast<ParagraphList&>(plist).end();
 	return depthHook(pit, plist,
 			 Paragraph::depth_type(pit->getDepth() - 1));
 }
@@ -243,12 +243,12 @@ int getEndLabel(ParagraphList::iterator 
 {
 	ParagraphList::iterator pit = p;
 	Paragraph::depth_type par_depth = p->getDepth();
-	while (pit != plist.end()) {
+	while (pit != const_cast<ParagraphList&>(plist).end()) {
 		LyXLayout_ptr const & layout = pit->layout();
 		int const endlabeltype = layout->endlabeltype;
 
 		if (endlabeltype != END_LABEL_NO_LABEL) {
-			if (boost::next(p) == plist.end())
+			if (boost::next(p) == const_cast<ParagraphList&>(plist).end())
 				return endlabeltype;
 
 			Paragraph::depth_type const next_depth = boost::next(p)->getDepth();
@@ -261,7 +261,7 @@ int getEndLabel(ParagraphList::iterator 
 		if (par_depth == 0)
 			break;
 		pit = outerHook(pit, plist);
-		if (pit != plist.end())
+		if (pit != const_cast<ParagraphList&>(plist).end())
 			par_depth = pit->getDepth();
 	}
 	return END_LABEL_NO_LABEL;
@@ -296,7 +296,7 @@ TeXDeeper(Buffer const * buf,
 	lyxerr[Debug::LATEX] << "TeXDeeper...     " << &*pit << endl;
 	ParagraphList::iterator par = pit;
 
-	while (par != paragraphs.end() &&
+	while (par != const_cast<ParagraphList&>(paragraphs).end() &&
 		     par->params().depth() == pit->params().depth()) {
 		if (par->layout()->isEnvironment()) {
 			par = TeXEnvironment(buf, paragraphs, par,
@@ -328,7 +328,7 @@ TeXEnvironment(Buffer const * buf,
 	Language const * language = pit->getParLanguage(bparams);
 	Language const * doc_language = bparams.language;
 	Language const * previous_language =
-		(pit != paragraphs.begin())
+		(pit != const_cast<ParagraphList&>(paragraphs).begin())
 		? boost::prior(pit)->getParLanguage(bparams)
 		: doc_language;
 	if (language->babel() != previous_language->babel()) {
@@ -379,7 +379,7 @@ TeXEnvironment(Buffer const * buf,
 	do {
 		par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams);
 
-		if (par != paragraphs.end()&& par->params().depth() > pit->params().depth()) {
+		if (par != const_cast<ParagraphList&>(paragraphs).end()&& par->params().depth() > pit->params().depth()) {
 			    if (par->layout()->isParagraph()) {
 
 			    // Thinko!
@@ -402,7 +402,7 @@ TeXEnvironment(Buffer const * buf,
 			par = TeXDeeper(buf, paragraphs, par, os, texrow,
 					runparams);
 		}
-	} while (par != paragraphs.end()
+	} while (par != const_cast<ParagraphList&>(paragraphs).end()
 		 && par->layout() == pit->layout()
 		 && par->params().depth() == pit->params().depth()
 		 && par->params().leftIndent() == pit->params().leftIndent());
@@ -466,7 +466,7 @@ TeXOnePar(Buffer const * buf,
 		}
 
 		if (!pit->params().spacing().isDefault()
-			&& (pit == paragraphs.begin() || !boost::prior(pit)->hasSameLayout(*pit))) {
+			&& (pit == const_cast<ParagraphList&>(paragraphs).begin() || !boost::prior(pit)->hasSameLayout(*pit))) {
 			os << pit->params().spacing().writeEnvirBegin() << '\n';
 			texrow.newline();
 		}
@@ -504,14 +504,14 @@ TeXOnePar(Buffer const * buf,
 	Language const * language = pit->getParLanguage(bparams);
 	Language const * doc_language = bparams.language;
 	Language const * previous_language =
-		(pit != paragraphs.begin())
+		(pit != const_cast<ParagraphList&>(paragraphs).begin())
 		? boost::prior(pit)->getParLanguage(bparams)
 		: doc_language;
 
 	if (language->babel() != previous_language->babel()
 	    // check if we already put language command in TeXEnvironment()
 	    && !(style->isEnvironment()
-		 && (pit == paragraphs.begin() ||
+		 && (pit == const_cast<ParagraphList&>(paragraphs).begin() ||
 		     (boost::prior(pit)->layout() != pit->layout() &&
 		      boost::prior(pit)->getDepth() <= pit->getDepth())
 		     || boost::prior(pit)->getDepth() < pit->getDepth())))
@@ -591,7 +591,7 @@ TeXOnePar(Buffer const * buf,
 	bool is_command = style->isCommand();
 
 	if (style->resfont.size() != font.size()
-	    && boost::next(pit) != paragraphs.end()
+	    && boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
 	    && !is_command) {
 		if (!need_par)
 			os << '{';
@@ -604,7 +604,7 @@ TeXOnePar(Buffer const * buf,
 	switch (style->latextype) {
 	case LATEX_ITEM_ENVIRONMENT:
 	case LATEX_LIST_ENVIRONMENT:
-		if (boost::next(pit) != paragraphs.end()
+		if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
 		    && (pit->params().depth() < boost::next(pit)->params().depth())) {
 			os << '\n';
 			texrow.newline();
@@ -613,14 +613,14 @@ TeXOnePar(Buffer const * buf,
 	case LATEX_ENVIRONMENT:
 		// if its the last paragraph of the current environment
 		// skip it otherwise fall through
-		if (boost::next(pit) != paragraphs.end()
+		if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()
 		    && (boost::next(pit)->layout() != pit->layout()
 			|| boost::next(pit)->params().depth() != pit->params().depth()))
 			break;
 		// fall through possible
 	default:
 		// we don't need it for the last paragraph!!!
-		if (boost::next(pit) != paragraphs.end()) {
+		if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
 			os << '\n';
 			texrow.newline();
 		}
@@ -649,14 +649,14 @@ TeXOnePar(Buffer const * buf,
 		}
 
 		if (!pit->params().spacing().isDefault()
-			&& (boost::next(pit) == paragraphs.end()|| !boost::next(pit)->hasSameLayout(*pit))) {
+			&& (boost::next(pit) == const_cast<ParagraphList&>(paragraphs).end()|| !boost::next(pit)->hasSameLayout(*pit))) {
 			os << pit->params().spacing().writeEnvirEnd() << '\n';
 			texrow.newline();
 		}
 	}
 
 	// we don't need it for the last paragraph!!!
-	if (boost::next(pit) != paragraphs.end()) {
+	if (boost::next(pit) != const_cast<ParagraphList&>(paragraphs).end()) {
 		os << '\n';
 		texrow.newline();
 	} else {
@@ -699,8 +699,8 @@ void latexParagraphs(Buffer const * buf,
 	bool was_title = false;
 	bool already_title = false;
 	LyXTextClass const & tclass = buf->params.getLyXTextClass();
-	ParagraphList::iterator par = paragraphs.begin();
-	ParagraphList::iterator endpar = paragraphs.end();
+	ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
+	ParagraphList::iterator endpar = const_cast<ParagraphList&>(paragraphs).end();
 
 	// if only_body
 	while (par != endpar) {
@@ -1057,10 +1057,10 @@ LyXFont const outerFont(ParagraphList::i
 	LyXFont tmpfont(LyXFont::ALL_INHERIT);
 
 	// Resolve against environment font information
-	while (pit != plist.end() &&
+	while (pit != const_cast<ParagraphList&>(plist).end() &&
 	       par_depth && !tmpfont.resolved()) {
 		pit = outerHook(pit, plist);
-		if (pit != plist.end()) {
+		if (pit != const_cast<ParagraphList&>(plist).end()) {
 			tmpfont.realize(pit->layout()->font);
 			par_depth = pit->getDepth();
 		}
Index: src/tabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular.C,v
retrieving revision 1.160
diff -u -p -r1.160 tabular.C
--- src/tabular.C	26 May 2003 09:13:51 -0000	1.160
+++ src/tabular.C	27 May 2003 22:15:24 -0000
@@ -2590,8 +2590,8 @@ vector<string> const LyXTabular::getLabe
 LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
 {
 	ParagraphList const & parlist = GetCellInset(cell)->paragraphs;
-	ParagraphList::iterator cit = parlist.begin();
-	ParagraphList::iterator end = parlist.end();
+	ParagraphList::const_iterator cit = parlist.begin();
+	ParagraphList::const_iterator end = parlist.end();
 
 	for (; cit != end; ++cit) {
 		for (int i = 0; i < cit->size(); ++i) {
Index: src/insets/insetbibitem.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbibitem.C,v
retrieving revision 1.12
diff -u -p -r1.12 insetbibitem.C
--- src/insets/insetbibitem.C	26 May 2003 09:13:53 -0000	1.12
+++ src/insets/insetbibitem.C	27 May 2003 22:15:25 -0000
@@ -169,11 +169,11 @@ string const bibitemWidest(Buffer const 
 	int w = 0;
 	// Does look like a hack? It is! (but will change at 0.13)
 
-	InsetBibitem * bitem = 0;
+	InsetBibitem const * bitem = 0;
 	LyXFont font;
 
-	ParagraphList::iterator it = buffer->paragraphs.begin();
-	ParagraphList::iterator end = buffer->paragraphs.end();
+	ParagraphList::const_iterator it = buffer->paragraphs.begin();
+	ParagraphList::const_iterator end = buffer->paragraphs.end();
 	for (; it != end; ++it) {
 		if (it->bibitem()) {
 			int const wx =
Index: src/insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.398
diff -u -p -r1.398 insettext.C
--- src/insets/insettext.C	27 May 2003 17:29:02 -0000	1.398
+++ src/insets/insettext.C	27 May 2003 22:15:26 -0000
@@ -79,8 +79,8 @@ using lyx::textclass_type;
 void InsetText::saveLyXTextState(LyXText * t) const
 {
 	// check if my paragraphs are still valid
-	ParagraphList::iterator it = paragraphs.begin();
-	ParagraphList::iterator end = paragraphs.end();
+	ParagraphList::iterator it = const_cast<ParagraphList&>(paragraphs).begin();
+	ParagraphList::iterator end = const_cast<ParagraphList&>(paragraphs).end();
 	for (; it != end; ++it) {
 		if (it == t->cursor.par())
 			break;
@@ -99,14 +99,14 @@ void InsetText::saveLyXTextState(LyXText
 		sstate.selection = t->selection.set();
 		sstate.mark_set = t->selection.mark();
 	} else {
-		sstate.lpar = paragraphs.end();
+		sstate.lpar = const_cast<ParagraphList&>(paragraphs).end();
 	}
 }
 
 
 void InsetText::restoreLyXTextState(LyXText * t) const
 {
-	if (sstate.lpar == paragraphs.end())
+	if (sstate.lpar == const_cast<ParagraphList&>(paragraphs).end())
 		return;
 
 	t->selection.set(true);
@@ -286,8 +286,8 @@ void InsetText::write(Buffer const * buf
 
 void InsetText::writeParagraphData(Buffer const * buf, ostream & os) const
 {
-	ParagraphList::iterator it = paragraphs.begin();
-	ParagraphList::iterator end = paragraphs.end();
+	ParagraphList::const_iterator it = paragraphs.begin();
+	ParagraphList::const_iterator end = paragraphs.end();
 	Paragraph::depth_type dth = 0;
 	for (; it != end; ++it) {
 		it->write(buf, os, buf->params, dth);
@@ -1504,9 +1504,9 @@ int InsetText::ascii(Buffer const * buf,
 {
 	unsigned int lines = 0;
 
-	ParagraphList::iterator beg = paragraphs.begin();
-	ParagraphList::iterator end = paragraphs.end();
-	ParagraphList::iterator it = beg;
+	ParagraphList::const_iterator beg = paragraphs.begin();
+	ParagraphList::const_iterator end = paragraphs.end();
+	ParagraphList::const_iterator it = beg;
 	for (; it != end; ++it) {
 		string const tmp = buf->asciiParagraph(*it, linelen, it == beg);
 		lines += lyx::count(tmp.begin(), tmp.end(), '\n');
@@ -1528,8 +1528,8 @@ int InsetText::docbook(Buffer const * bu
 
 	Paragraph::depth_type depth = 0; // paragraph depth
 
-	ParagraphList::iterator pit = paragraphs.begin();
-	ParagraphList::iterator pend = paragraphs.end();
+	ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
+	ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
 
 	for (; pit != pend; ++pit) {
 		string sgmlparam;
@@ -1865,8 +1865,8 @@ vector<string> const InsetText::getLabel
 {
 	vector<string> label_list;
 
-	ParagraphList::iterator pit = paragraphs.begin();
-	ParagraphList::iterator pend = paragraphs.end();
+	ParagraphList::const_iterator pit = paragraphs.begin();
+	ParagraphList::const_iterator pend = paragraphs.end();
 	for (; pit != pend; ++pit) {
 		InsetList::iterator beg = pit->insetlist.begin();
 		InsetList::iterator end = pit->insetlist.end();
@@ -1995,8 +1995,8 @@ void InsetText::setParagraphData(Paragra
 	// See if this can be simplified when std::list is in effect.
 	paragraphs.clear();
 
-	ParagraphList::iterator it = plist.begin();
-	ParagraphList::iterator end = plist.end();
+	ParagraphList::const_iterator it = plist.begin();
+	ParagraphList::const_iterator end = plist.end();
 	for (; it != end; ++it) {
 		paragraphs.push_back(*it);
 		Paragraph & tmp = paragraphs.back();
@@ -2178,7 +2178,7 @@ LyXText * InsetText::getLyXText(BufferVi
 		if (recursive && the_locking_inset)
 			return the_locking_inset->getLyXText(lbv, true);
 		LyXText * lt = cached_text.get();
-		lyx::Assert(lt && lt->rows().begin()->par() == paragraphs.begin());
+		lyx::Assert(lt && lt->rows().begin()->par() == const_cast<ParagraphList&>(paragraphs).begin());
 		return lt;
 	}
 	// Super UGLY! (Lgb)
@@ -2204,7 +2204,7 @@ LyXText * InsetText::getLyXText(BufferVi
 				if (locked) {
 					saveLyXTextState(it->second.text.get());
 				} else {
-					sstate.lpar = paragraphs.end();
+					sstate.lpar = const_cast<ParagraphList&>(paragraphs).end();
 				}
 			}
 			//
@@ -2251,7 +2251,8 @@ void InsetText::deleteLyXText(BufferView
 	it->second.remove = true;
 	if (recursive) {
 		/// then remove all LyXText in text-insets
-		for_each(paragraphs.begin(), paragraphs.end(),
+		for_each(const_cast<ParagraphList&>(paragraphs).begin(),
+			 const_cast<ParagraphList&>(paragraphs).end(),
 			 boost::bind(&Paragraph::deleteInsetsLyXText, _1, bv));
 	}
 }
@@ -2288,7 +2289,8 @@ void InsetText::resizeLyXText(BufferView
 	LyXText * t = it->second.text.get();
 	saveLyXTextState(t);
 
-	for_each(paragraphs.begin(), paragraphs.end(),
+	for_each(const_cast<ParagraphList&>(paragraphs).begin(),
+		 const_cast<ParagraphList&>(paragraphs).end(),
 		 boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv));
 
 	t->init(bv, true);
@@ -2327,7 +2329,8 @@ void InsetText::reinitLyXText() const
 
 		saveLyXTextState(t);
 
-		for_each(paragraphs.begin(), paragraphs.end(),
+		for_each(const_cast<ParagraphList&>(paragraphs).begin(),
+			 const_cast<ParagraphList&>(paragraphs).end(),
 			 boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv));
 
 		t->init(bv, true);
@@ -2440,8 +2443,8 @@ Inset * InsetText::getInsetFromID(int id
 	if (id_arg == id())
 		return const_cast<InsetText *>(this);
 
-	ParagraphList::iterator pit = paragraphs.begin();
-	ParagraphList::iterator pend = paragraphs.end();
+	ParagraphList::const_iterator pit = paragraphs.begin();
+	ParagraphList::const_iterator pend = paragraphs.end();
 	for (; pit != pend; ++pit) {
 		InsetList::iterator it = pit->insetlist.begin();
 		InsetList::iterator end = pit->insetlist.end();
@@ -2734,8 +2737,8 @@ void InsetText::appendParagraphs(Buffer 
 
 void InsetText::addPreview(grfx::PreviewLoader & loader) const
 {
-	ParagraphList::iterator pit = paragraphs.begin();
-	ParagraphList::iterator pend = paragraphs.end();
+	ParagraphList::const_iterator pit = paragraphs.begin();
+	ParagraphList::const_iterator pend = paragraphs.end();
 
 	for (; pit != pend; ++pit) {
 		InsetList::iterator it  = pit->insetlist.begin();
-- 
        Lgb

Reply via email to