+bool LyXVC::ensureClean()
+{
+ if (owner_->isClean())
+ return true;
+
+ string const file = MakeDisplayPath(owner_->fileName(), 30);
+ string text = bformat(_("The document %1$s has unsaved changes.\n\n"
+ "Do you want to save the document?"), file);
+ int const ret = Alert::prompt(_("Save changed document?"),
+ text, 0, 1, _("&Save"), _("&Cancel"));
+
+ if (ret == 0) {
+ vcs->owner()->getUser()->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
+ }
+
+ return owner_->isClean();
+}
+
+