#include "lyxtext.h"
#include "paragraph_pimpl.h"
-using lyx::pos_type;
-using lyx::pit_type;
-
-using std::string;
+namespace lyx {
-namespace {
+using std::string;
-bool moveItem(Paragraph & from, Paragraph & to,
- BufferParams const & params, pos_type i, pos_type j,
- Change change = Change(Change::INSERTED));
-bool moveItem(Paragraph & from, Paragraph & to,
+static bool moveItem(Paragraph & from, Paragraph & to,
BufferParams const & params, pos_type i, pos_type j,
- Change change)
+ Change change = Change(Change::INSERTED))
{
Paragraph::value_type const tmpchar = from.getChar(i);
LyXFont tmpfont = from.getFontSettings(params, i);
return true;
}
-}
-
void breakParagraph(BufferParams const & bparams,
ParagraphList & pars, pit_type par_offset, pos_type pos, int flag)
for (pos_type i = pos, j = pos; i <= pos_end; ++i) {
Change::Type change = par.lookupChange(i).type;
if (moveItem(par, *tmp, bparams, i, j - pos)) {
- tmp->setChange(j - pos, change);
+ // FIXME: change tracking (MG)
+ tmp->setChange(j - pos, Change(change));
++j;
}
}
for (pos_type i = pos_end; i >= pos; --i)
- par.eraseIntern(i);
+ // FIXME: change tracking (MG)
+ par.eraseChar(i, false); // erase without change tracking
}
if (pos) {
for (pos_type i = pos, j = pos; i <= pos_end; ++i) {
Change::Type change = par.lookupChange(i).type;
- if (moveItem(par, tmp, bparams, i, j - pos, change))
+ // FIXME: change tracking (MG)
+ if (moveItem(par, tmp, bparams, i, j - pos, Change(change)))
++j;
}
// Move over end-of-par change attr
- tmp.setChange(tmp.size(), par.lookupChange(par.size()).type);
+ // FIXME: change tracking (MG)
+ tmp.setChange(tmp.size(), Change(par.lookupChange(par.size()).type));
// If tracking changes, set all the text that is to be
// erased to Type::INSERTED.
for (pos_type k = pos_end; k >= pos; --k) {
if (bparams.trackChanges)
// FIXME: Change tracking (MG)
- par.setChange(k, Change::INSERTED);
- par.erase(k);
+ par.setChange(k, Change(Change::INSERTED));
+ // FIXME: change tracking (MG)
+ par.eraseChar(k, false);
}
}
}
// one. It will (should) remain "orphaned", having no CT info to it,
// and check() in changes.C will assert. Setting the para break
// forcibly to "black" prevents this scenario. -- MV 13.3.2006
- par.setChange(par.size(), Change::UNCHANGED);
+ // FIXME: change tracking (MG)
+ par.setChange(par.size(), Change(Change::UNCHANGED));
Change::Type cr = next.lookupChange(next.size()).type;
// ok, now copy the paragraph
for (pos_type i = 0, j = 0; i <= pos_end; ++i) {
Change::Type change = next.lookupChange(i).type;
- if (moveItem(next, par, bparams, i, pos_insert + j, change))
+ // FIXME: change tracking (MG)
+ if (moveItem(next, par, bparams, i, pos_insert + j, Change(change)))
++j;
}
// Move the change status of "carriage return" over
- par.setChange(par.size(), cr);
+ // FIXME: change tracking (MG)
+ par.setChange(par.size(), Change(cr));
pars.erase(boost::next(pars.begin(), par_offset + 1));
}
-pit_type depthHook(pit_type pit,
- ParagraphList const & pars, Paragraph::depth_type depth)
+pit_type depthHook(pit_type pit, ParagraphList const & pars, depth_type depth)
{
pit_type newpit = pit;
if (par.getDepth() == 0)
return pars.size();
- return depthHook(par_offset, pars, Paragraph::depth_type(par.getDepth() - 1));
+ return depthHook(par_offset, pars, depth_type(par.getDepth() - 1));
}
int getEndLabel(pit_type p, ParagraphList const & pars)
{
pit_type pit = p;
- Paragraph::depth_type par_depth = pars[p].getDepth();
+ depth_type par_depth = pars[p].getDepth();
while (pit != pit_type(pars.size())) {
LyXLayout_ptr const & layout = pars[pit].layout();
int const endlabeltype = layout->endlabeltype;
if (p + 1 == pit_type(pars.size()))
return endlabeltype;
- Paragraph::depth_type const next_depth =
+ depth_type const next_depth =
pars[p + 1].getDepth();
if (par_depth > next_depth ||
(par_depth == next_depth && layout != pars[p + 1].layout()))
LyXFont const outerFont(pit_type par_offset, ParagraphList const & pars)
{
- Paragraph::depth_type par_depth = pars[par_offset].getDepth();
+ depth_type par_depth = pars[par_offset].getDepth();
LyXFont tmpfont(LyXFont::ALL_INHERIT);
// Resolve against environment font information
}
return num;
}
+
+
+} // namespace lyx