#include "support/lstrings.h"
#include "support/lyxalgo.h"
#include "support/TempFile.h"
+#include "support/unique_ptr.h"
#include "frontends/alert.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
-#include <boost/tuple/tuple.hpp>
-
#include <string>
+#include <tuple>
using namespace std;
using namespace lyx::support;
struct PasteReturnValue {
- PasteReturnValue(pit_type r_par, pos_type r_pos, bool r_nu) :
- par(r_par), pos(r_pos), needupdate(r_nu)
+ PasteReturnValue(pit_type r_pit, pos_type r_pos, bool r_nu) :
+ pit(r_pit), pos(r_pos), needupdate(r_nu)
{}
- pit_type par;
+ pit_type pit;
pos_type pos;
bool needupdate;
};
// Paste it!
if (empty) {
- pars.insert(next(pars.begin(), pit),
+ pars.insert(lyx::next(pars.begin(), pit),
insertion.begin(),
insertion.end());
mergeParagraph(buffer.params(), pars,
pit + insertion.size() - 1);
} else {
- pars.insert(next(pars.begin(), pit + 1),
+ pars.insert(lyx::next(pars.begin(), pit + 1),
insertion.begin(),
insertion.end());
LASSERT(startpit != endpit || start <= end, return);
// Clone the paragraphs within the selection.
- ParagraphList copy_pars(next(pars.begin(), startpit),
- next(pars.begin(), endpit + 1));
+ ParagraphList copy_pars(lyx::next(pars.begin(), startpit),
+ lyx::next(pars.begin(), endpit + 1));
// Remove the end of the last paragraph; afterwards, remove the
// beginning of the first paragraph. Keep this order - there may only
if (begpit != endpit)
cur.screenUpdateFlags(Update::Force | Update::FitCursor);
- boost::tie(endpit, endpos) =
- eraseSelectionHelper(bp,
- text->paragraphs(),
- begpit, endpit,
- cur.selBegin().pos(), endpos);
+ tie(endpit, endpos) =
+ eraseSelectionHelper(bp, text->paragraphs(), begpit, endpit,
+ cur.selBegin().pos(), endpos);
// cutSelection can invalidate the cursor so we need to set
// it anew. (Lgb)
LBUFERR(text);
// ok we have a selection. This is always between cur.selBegin()
// and sel_end cursor
-
- // copy behind a space if there is one
- ParagraphList & pars = text->paragraphs();
- pos_type pos = cur.selBegin().pos();
- pit_type par = cur.selBegin().pit();
- while (pos < pars[par].size() &&
- pars[par].isLineSeparator(pos) &&
- (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
- ++pos;
-
- copySelectionHelper(*cur.buffer(), *text, par, cur.selEnd().pit(),
- pos, cur.selEnd().pos(),
- cur.buffer()->params().documentClassPtr(), cutstack);
-
+ copySelectionHelper(*cur.buffer(), *text,
+ cur.selBegin().pit(), cur.selEnd().pit(),
+ cur.selBegin().pos(), cur.selEnd().pos(),
+ cur.buffer()->params().documentClassPtr(),
+ cutstack);
// Reset the dirty_tabular_stack_ flag only when something
// is copied to the clipboard (not to the selectionBuffer).
if (&cutstack == &theCuts)
if (sel_index >= theCuts.size())
return docstring();
- boost::scoped_ptr<Buffer> buffer(copyToTempBuffer(theCuts[sel_index].first, docclass));
+ unique_ptr<Buffer> buffer(copyToTempBuffer(theCuts[sel_index].first,
+ docclass));
if (!buffer)
return docstring();
pasteSelectionHelper(cur, parlist, docclass, 0, errorList);
cur.forceBufferUpdate();
cur.clearSelection();
- text->setCursor(cur, prv.par, prv.pos);
+ text->setCursor(cur, prv.pit, prv.pos);
}
// mathed is handled in InsetMathNest/InsetMathGrid
if (lyxrc.auto_region_delete)
selDel(cur);
else
- cur.setSelection(false);
+ cur.selection(false);
}