int const thistoclevel = start->layout()->toclevel;
int toclevel;
+
+ // Move out (down) from this section header
+ if (finish != end)
+ ++finish;
+ // Seek the one (on same level) below
+ for (; finish != end; ++finish) {
+ toclevel = finish->layout()->toclevel;
+ if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel) {
+ break;
+ }
+ }
+
switch (mode) {
case OutlineUp: {
- // Move out (down) from this section header
- if (finish != end)
- ++finish;
- // Seek the one (on same level) below
- for (; finish != end; ++finish) {
- toclevel = finish->layout()->toclevel;
- if (toclevel != Layout::NOT_IN_TOC
- && toclevel <= thistoclevel) {
- break;
- }
- }
ParagraphList::iterator dest = start;
// Move out (up) from this header
if (dest == bgn)
- break;
+ return;
// Search previous same-level header above
do {
--dest;
|| toclevel > thistoclevel));
// Not found; do nothing
if (toclevel == Layout::NOT_IN_TOC || toclevel > thistoclevel)
- break;
+ return;
pit_type const newpit = distance(bgn, dest);
pit_type const len = distance(start, finish);
pit_type const deletepit = pit + len;
start = boost::next(pars.begin(), deletepit);
pit = newpit;
pars.erase(start, finish);
- break;
+ return;
}
case OutlineDown: {
- // Go down out of current header:
- if (finish != end)
- ++finish;
- // Find next same-level header:
- for (; finish != end; ++finish) {
- toclevel = finish->layout()->toclevel;
- if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
- break;
- }
ParagraphList::iterator dest = finish;
- // Go one down from *this* header:
- if (dest != end)
- ++dest;
- else
- break;
- // Go further down to find header to insert in front of:
- for (; dest != end; ++dest) {
- toclevel = dest->layout()->toclevel;
- if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
- break;
- }
// One such was found:
pit_type newpit = distance(bgn, dest);
pit_type const len = distance(start, finish);
start = boost::next(bgn, pit);
pit = newpit - len;
pars.erase(start, finish);
- break;
+ return;
}
- case OutlineIn:
- buf.undo().recordUndo(cur);
- for (size_t i = 0; i != tc.layoutCount(); ++i) {
- LayoutPtr const & lt = tc.layout(i);
- if (lt->toclevel == thistoclevel + 1 &&
- start->layout()->labeltype == lt->labeltype) {
- start->setLayout(lt);
- break;
+ case OutlineIn: {
+ pit_type const len = distance(start, finish);
+ buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
+ for (; start != finish; ++start) {
+ toclevel = start->layout()->toclevel;
+ if (toclevel == Layout::NOT_IN_TOC)
+ continue;
+ for (size_t i = 0; i != tc.layoutCount(); ++i) {
+ LayoutPtr const & lt = tc.layout(i);
+ if (lt->toclevel == toclevel + 1 &&
+ start->layout()->labeltype == lt->labeltype) {
+ start->setLayout(lt);
+ break;
+ }
}
}
- break;
- case OutlineOut:
- buf.undo().recordUndo(cur);
- for (size_t i = 0; i != tc.layoutCount(); ++i) {
- LayoutPtr const & lt = tc.layout(i);
- if (lt->toclevel == thistoclevel - 1 &&
- start->layout()->labeltype == lt->labeltype) {
- start->setLayout(lt);
- break;
+ return;
+ }
+ case OutlineOut: {
+ pit_type const len = distance(start, finish);
+ buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, pit + len - 1);
+ for (; start != finish; ++start) {
+ toclevel = start->layout()->toclevel;
+ if (toclevel == Layout::NOT_IN_TOC)
+ continue;
+ for (size_t i = 0; i != tc.layoutCount(); ++i) {
+ LayoutPtr const & lt = tc.layout(i);
+ if (lt->toclevel == toclevel - 1 &&
+ start->layout()->labeltype == lt->labeltype) {
+ start->setLayout(lt);
+ break;
+ }
}
}
- break;
- default:
- break;
+ return;
+ }
}
}
*/
if (cur.selection())
cutSelection(cur, true, false);
- insertInset(cur, inset);
+ cur.insert(inset);
cur.posForward();
}
break;
pasteFromStack(cur, bv->buffer().errorList("Paste"),
convert<unsigned int>(arg));
} else {
- Clipboard::GraphicsType type;
+ Clipboard::GraphicsType type = Clipboard::AnyGraphicsType;
if (arg == "pdf")
type = Clipboard::PdfGraphicsType;
else if (arg == "png")
}
#if 0
case LFUN_LIST_INSERT:
- case LFUN_THEOREM_INSERT:
#endif
case LFUN_CAPTION_INSERT:
case LFUN_FOOTNOTE_INSERT:
case LFUN_LIST_INSERT:
code = LIST_CODE;
break;
- case LFUN_THEOREM_INSERT:
- code = THEOREM_CODE;
- break;
#endif
case LFUN_CAPTION_INSERT:
code = CAPTION_CODE;