more Paragraph * -> Paragraph & changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6879 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-04-29 10:56:15 +00:00
parent 263b9fc043
commit ee9e6fc377
5 changed files with 17 additions and 16 deletions

View File

@ -8,6 +8,7 @@
* paragraph.[Ch]:
paragraph_pimpl.[Ch]:
paragraph_funcs.C:
undo_funcs.C: Paragraph * -> Paragraph (const) &
2003-04-28 John Levon <levon@movementarian.org>

View File

@ -133,7 +133,7 @@ pitPosPair CutAndPaste::eraseSelection(ParagraphList & pars,
// paste the paragraphs again, if possible
if (all_erased &&
(startpit->hasSameLayout(&*boost::next(startpit)) ||
(startpit->hasSameLayout(*boost::next(startpit)) ||
boost::next(startpit)->empty())) {
#warning current_view used here.
// should we pass buffer or buffer->params around?
@ -289,7 +289,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
// make the buf exactly the same layout than
// the cursor paragraph
paragraphs.begin()->makeSameLayout(*par);
paragraphs.begin()->makeSameLayout(**par);
// find the end of the buffer
ParagraphList::iterator lastbuffer = paragraphs.begin();
@ -325,14 +325,14 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
pos = lastbuffer->size();
// maybe some pasting
if (lastbuffer->next() && paste_the_end) {
if (lastbuffer->next()->hasSameLayout(&*lastbuffer)) {
if (lastbuffer->next()->hasSameLayout(*lastbuffer)) {
mergeParagraph(current_view->buffer()->params,
current_view->buffer()->paragraphs, lastbuffer);
} else if (!lastbuffer->next()->size()) {
lastbuffer->next()->makeSameLayout(&*lastbuffer);
lastbuffer->next()->makeSameLayout(*lastbuffer);
mergeParagraph(current_view->buffer()->params, current_view->buffer()->paragraphs, lastbuffer);
} else if (!lastbuffer->size()) {
lastbuffer->makeSameLayout(lastbuffer->next());
lastbuffer->makeSameLayout(*lastbuffer->next());
mergeParagraph(current_view->buffer()->params,
current_view->buffer()->paragraphs, lastbuffer);
} else

View File

@ -664,11 +664,11 @@ Paragraph const * Paragraph::previous() const
#endif
void Paragraph::makeSameLayout(Paragraph const * par)
void Paragraph::makeSameLayout(Paragraph const & par)
{
layout(par->layout());
layout(par.layout());
// move to pimpl?
params() = par->params();
params() = par.params();
}
@ -687,11 +687,11 @@ int Paragraph::stripLeadingSpaces()
}
bool Paragraph::hasSameLayout(Paragraph const * par) const
bool Paragraph::hasSameLayout(Paragraph const & par) const
{
return
par->layout() == layout() &&
params().sameLayout(par->params());
par.layout() == layout() &&
params().sameLayout(par.params());
}

View File

@ -106,10 +106,10 @@ public:
TexRow & texrow, bool moving_arg);
///
bool hasSameLayout(Paragraph const * par) const;
bool hasSameLayout(Paragraph const & par) const;
///
void makeSameLayout(Paragraph const * par);
void makeSameLayout(Paragraph const & par);
///
Inset * inInset() const;

View File

@ -149,7 +149,7 @@ void breakParagraphConservative(BufferParams const & bparams,
// create a new paragraph
ParagraphList::iterator tmp = paragraphs.insert(boost::next(par),
new Paragraph);
tmp->makeSameLayout(&*par);
tmp->makeSameLayout(*par);
// When can pos > Last()?
// I guess pos == Last() is possible.
@ -457,7 +457,7 @@ TeXOnePar(Buffer const * buf,
}
if (!pit->params().spacing().isDefault()
&& (pit == paragraphs.begin() || !boost::prior(pit)->hasSameLayout(&*pit))) {
&& (pit == paragraphs.begin() || !boost::prior(pit)->hasSameLayout(*pit))) {
os << pit->params().spacing().writeEnvirBegin() << '\n';
texrow.newline();
}
@ -637,7 +637,7 @@ TeXOnePar(Buffer const * buf,
}
if (!pit->params().spacing().isDefault()
&& (boost::next(pit) == paragraphs.end()|| !boost::next(pit)->hasSameLayout(&*pit))) {
&& (boost::next(pit) == paragraphs.end()|| !boost::next(pit)->hasSameLayout(*pit))) {
os << pit->params().spacing().writeEnvirEnd() << '\n';
texrow.newline();
}