* info-insert buffer vcs-*: renamed to info-insert vcs *
+* file-insert: optional second parameter "ignorelang" to make the insertion
+ ignore the inserted file's main language (and rather adapt it to the insertion
+ context's language).
+
!!!The following LyX functions have been removed in 2.4:
}
-void BufferView::insertLyXFile(FileName const & fname)
+void BufferView::insertLyXFile(FileName const & fname, bool const ignorelang)
{
LASSERT(d->cursor_.inTexted(), return);
ErrorList & el = buffer_.errorList("Parse");
// Copy the inserted document error list into the current buffer one.
el = buf.errorList("Parse");
+ ParagraphList & pars = buf.paragraphs();
+ if (ignorelang)
+ // set main language of imported file to context language
+ buf.changeLanguage(buf.language(), d->cursor_.getFont().language());
buffer_.undo().recordUndo(d->cursor_);
- cap::pasteParagraphList(d->cursor_, buf.paragraphs(),
+ cap::pasteParagraphList(d->cursor_, pars,
buf.params().documentClassPtr(), el);
res = _("Document %1$s inserted.");
} else {
// Insert plain text file (if filename is empty, prompt for one)
void insertPlaintextFile(support::FileName const & f, bool asParagraph);
///
- void insertLyXFile(support::FileName const & f);
+ void insertLyXFile(support::FileName const & f, bool const ignorelang = false);
/// save temporary bookmark for jump back navigation
void bookmarkEditPosition();
/// Find and return the inset associated with given dialog name.
/*!
* \var lyx::FuncCode lyx::LFUN_FILE_INSERT
* \li Action: Inserts another LyX file.
- * \li Syntax: file-insert [<FILE>]
+ * \li Syntax: file-insert [<FILE>] [ignorelang]
* \li Params: <FILE>: Filename to be inserted.
+ * ignorelang: If given, the (main) language of the inserted file
+ * is ignored (the context language is used).
* \endvar
*/
{ LFUN_FILE_INSERT, "file-insert", Noop, Edit },
}
-void GuiView::insertLyXFile(docstring const & fname)
+void GuiView::insertLyXFile(docstring const & fname, bool ignorelang)
{
BufferView * bv = documentBufferView();
if (!bv)
}
}
- bv->insertLyXFile(filename);
+ bv->insertLyXFile(filename, ignorelang);
bv->buffer().errors("Parse");
}
menu->exec(QCursor::pos());
break;
- case LFUN_FILE_INSERT:
- insertLyXFile(cmd.argument());
+ case LFUN_FILE_INSERT: {
+ if (cmd.getArg(1) == "ignorelang")
+ insertLyXFile(from_utf8(cmd.getArg(0)), true);
+ else
+ insertLyXFile(cmd.argument());
break;
+ }
case LFUN_FILE_INSERT_PLAINTEXT:
case LFUN_FILE_INSERT_PLAINTEXT_PARA: {
///
void toggleFullScreen();
///
- void insertLyXFile(docstring const & fname);
+ void insertLyXFile(docstring const & fname, bool ignorelang = false);
///
/// Open Export As ... dialog. \p iformat is the format the
/// filter is initially set to.