* src/paragraph.C:

* src/paragraph.h:
	* src/paragraph_pimpl.C:
	* src/paragraph_pimpl.h: add method isMergedOnEndOfParDeletion()


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16029 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2006-11-24 21:16:46 +00:00
parent 5524f5f857
commit 62ef9250a2
4 changed files with 30 additions and 2 deletions

View File

@ -1421,6 +1421,12 @@ bool Paragraph::isChanged(pos_type start, pos_type end) const
} }
bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
{
return pimpl_->isMergedOnEndOfParDeletion(trackChanges);
}
void Paragraph::setChange(Change const & change) void Paragraph::setChange(Change const & change)
{ {
pimpl_->setChange(change); pimpl_->setChange(change);

View File

@ -209,6 +209,10 @@ public:
return lookupChange(pos).type == Change::DELETED; return lookupChange(pos).type == Change::DELETED;
} }
/// will the paragraph be physically merged with the next
/// one if the imaginary end-of-par character is logically deleted?
bool isMergedOnEndOfParDeletion(bool trackChanges) const;
/// set change for the entire par /// set change for the entire par
void setChange(Change const & change); void setChange(Change const & change);

View File

@ -87,6 +87,19 @@ bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
} }
bool Paragraph::Pimpl::isMergedOnEndOfParDeletion(bool trackChanges) const {
// keep the logic here in sync with the logic of eraseChars()
if (!trackChanges) {
return true;
}
Change change = changes_.lookup(size());
return change.type == Change::INSERTED && change.author == 0;
}
void Paragraph::Pimpl::setChange(Change const & change) void Paragraph::Pimpl::setChange(Change const & change)
{ {
// beware of the imaginary end-of-par character! // beware of the imaginary end-of-par character!
@ -263,6 +276,8 @@ bool Paragraph::Pimpl::eraseChar(pos_type pos, bool trackChanges)
{ {
BOOST_ASSERT(pos >= 0 && pos <= size()); BOOST_ASSERT(pos >= 0 && pos <= size());
// keep the logic here in sync with the logic of isMergedOnEndOfParDeletion()
if (trackChanges) { if (trackChanges) {
Change change = changes_.lookup(pos); Change change = changes_.lookup(pos);

View File

@ -43,8 +43,11 @@ public:
Change const lookupChange(pos_type pos) const; Change const lookupChange(pos_type pos) const;
/// is there a change within the given range ? /// is there a change within the given range ?
bool isChanged(pos_type start, pos_type end) const; bool isChanged(pos_type start, pos_type end) const;
/// set change for the entire par /// will the paragraph be physically merged with the next
void setChange(Change const & change); /// one if the imaginary end-of-par character is logically deleted?
bool isMergedOnEndOfParDeletion(bool trackChanges) const;
/// set change for the entire par
void setChange(Change const & change);
/// set change at given pos /// set change at given pos
void setChange(pos_type pos, Change const & change); void setChange(pos_type pos, Change const & change);
/// accept changes within the given range /// accept changes within the given range