#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
+#include "support/lyxalgo.h"
#include "support/lyxtime.h"
#include "support/os.h"
#include "support/regex.h"
#include "mathed/InsetMathHull.h"
#include "mathed/MathMacroTemplate.h"
-#include <boost/next_prior.hpp>
-
#include <clocale>
#include <sstream>
}
return true;
}
+ else if (cmd.action() == LFUN_ARGUMENT_INSERT) {
+ bool cotextinsert = false;
+ InsetArgument const * const ia = static_cast<InsetArgument const *>(inset);
+ Layout const & lay = cur.paragraph().layout();
+ Layout::LaTeXArgMap args = lay.args();
+ Layout::LaTeXArgMap::const_iterator const lait = args.find(ia->name());
+ if (lait != args.end())
+ cotextinsert = (*lait).second.insertcotext;
+ else {
+ InsetLayout const & il = cur.inset().getLayout();
+ args = il.args();
+ Layout::LaTeXArgMap::const_iterator const ilait = args.find(ia->name());
+ if (ilait != args.end())
+ cotextinsert = (*ilait).second.insertcotext;
+ }
+ // The argument requests to insert a copy of the co-text to the inset
+ if (cotextinsert) {
+ docstring ds;
+ // If we have a selection within a paragraph, use this
+ if (cur.selection() && cur.selBegin().pit() == cur.selEnd().pit())
+ ds = cur.selectionAsString(false);
+ // else use the whole paragraph
+ else
+ ds = cur.paragraph().asString();
+ text->insertInset(cur, inset);
+ if (edit)
+ inset->edit(cur, true);
+ // Now put co-text into inset
+ Font const f(inherit_font, cur.current_font.language());
+ if (!ds.empty()) {
+ cur.text()->insertStringAsLines(cur, ds, f);
+ cur.leaveInset(*inset);
+ }
+ return true;
+ }
+ }
bool gotsel = false;
if (cur.selection()) {
ParagraphList & pars = buf.text().paragraphs();
ParagraphList::iterator const bgn = pars.begin();
// The first paragraph of the area to be copied:
- ParagraphList::iterator start = boost::next(bgn, pit);
+ ParagraphList::iterator start = next(bgn, pit);
// The final paragraph of area to be copied:
ParagraphList::iterator finish = start;
ParagraphList::iterator const end = pars.end();
// Nothing to move.
return;
// Go one down from *this* header:
- ParagraphList::iterator dest = boost::next(finish, 1);
+ ParagraphList::iterator dest = next(finish, 1);
// Go further down to find header to insert in front of:
for (; dest != end; ++dest) {
toclevel = buf.text().getTocLevel(distance(bgn, dest));
ParagraphList & pars = buf.text().paragraphs();
ParagraphList::iterator bgn = pars.begin();
// The first paragraph of the area to be selected:
- ParagraphList::iterator start = boost::next(bgn, pit);
+ ParagraphList::iterator start = next(bgn, pit);
// The final paragraph of area to be selected:
ParagraphList::iterator finish = start;
ParagraphList::iterator end = pars.end();
needsUpdate |= backspace(cur);
cur.resetAnchor();
}
- // It is possible to make it a lot faster still
- // just comment out the line below...
}
} else {
cutSelection(cur, true, false);
break;
}
- // explicit graphics type?
Clipboard::GraphicsType type = Clipboard::AnyGraphicsType;
- if ((arg == "pdf" && (type = Clipboard::PdfGraphicsType))
- || (arg == "png" && (type = Clipboard::PngGraphicsType))
- || (arg == "jpeg" && (type = Clipboard::JpegGraphicsType))
- || (arg == "linkback" && (type = Clipboard::LinkBackGraphicsType))
- || (arg == "emf" && (type = Clipboard::EmfGraphicsType))
- || (arg == "wmf" && (type = Clipboard::WmfGraphicsType))) {
- enable = theClipboard().hasGraphicsContents(type);
+ if (arg == "pdf")
+ type = Clipboard::PdfGraphicsType;
+ else if (arg == "png")
+ type = Clipboard::PngGraphicsType;
+ else if (arg == "jpeg")
+ type = Clipboard::JpegGraphicsType;
+ else if (arg == "linkback")
+ type = Clipboard::LinkBackGraphicsType;
+ else if (arg == "emf")
+ type = Clipboard::EmfGraphicsType;
+ else if (arg == "wmf")
+ type = Clipboard::WmfGraphicsType;
+ else {
+ // unknown argument
+ LYXERR0("Unrecognized graphics type: " << arg);
+ // we don't want to assert if the user just mistyped the LFUN
+ LATTEST(cmd.origin() != FuncRequest::INTERNAL);
+ enable = false;
break;
}
-
- // unknown argument
- LYXERR0("Unrecognized graphics type: " << arg);
- // we don't want to assert if the user just mistyped the LFUN
- LATTEST(cmd.origin() != FuncRequest::INTERNAL);
- enable = false;
+ enable = theClipboard().hasGraphicsContents(type);
break;
- }
+ }
case LFUN_CLIPBOARD_PASTE:
case LFUN_CLIPBOARD_PASTE_SIMPLE: