+ case INCLUDE_CODE: {
+ InsetInclude & inc = static_cast<InsetInclude &>(*it);
+ inc.updateCommand();
+ // We need to update the list of included files.
+ cur.forceBufferUpdate();
+ break;
+ }
+
+ case BIBITEM_CODE: {
+ // check for duplicates
+ InsetBibitem & bib = static_cast<InsetBibitem &>(*it);
+ docstring const oldkey = bib.getParam("key");
+ bib.updateCommand(oldkey, false);
+ // We need to update the buffer reference cache.
+ cur.forceBufferUpdate();
+ docstring const newkey = bib.getParam("key");
+ if (oldkey == newkey)
+ break;
+ // adapt the references
+ for (InsetIterator itt = inset_iterator_begin(in);
+ itt != i_end; ++itt) {
+ if (itt->lyxCode() == CITE_CODE) {
+ InsetCommand * ref = itt->asInsetCommand();
+ if (ref->getParam("key") == oldkey)
+ ref->setParam("key", newkey);
+ }
+ }
+ break;
+ }
+
+ case BRANCH_CODE: {
+ // check if branch is known to target buffer
+ // or its master
+ InsetBranch & br = static_cast<InsetBranch &>(*it);
+ docstring const name = br.branch();
+ if (name.empty())
+ break;
+ bool const is_child = (&buffer != buffer.masterBuffer());
+ BranchList branchlist = buffer.params().branchlist();
+ if ((!is_child && branchlist.find(name))
+ || (is_child && (branchlist.find(name)
+ || buffer.masterBuffer()->params().branchlist().find(name))))
+ break;
+ // FIXME: add an option to add the branch to the master's BranchList.
+ docstring text = bformat(
+ _("The pasted branch \"%1$s\" is undefined.\n"
+ "Do you want to add it to the document's branch list?"),
+ name);
+ if (frontend::Alert::prompt(_("Unknown branch"),
+ text, 0, 1, _("&Add"), _("&Don't Add")) != 0)
+ break;
+ lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, name));
+ // We need to update the list of branches.
+ cur.forceBufferUpdate();
+ break;
+ }
+