#include "Format.h"
#include "frontends/LyXView.h"
#include "FuncRequest.h"
-#include "callback.h"
#include "support/filetools.h"
using support::changeExtension;
using support::FileName;
using support::makeDisplayPath;
+using frontend::LyXView;
bool Importer::Import(LyXView * lv, FileName const & filename,
if (loader_format == "lyx") {
- lv->loadLyXFile(lyxfile);
+ Buffer * buf = lv->loadLyXFile(lyxfile);
+ if (!buf) {
+ // we are done
+ lv->message(_("file not imported!"));
+ return false;
+ }
+ updateLabels(*buf);
+ lv->setBuffer(buf);
+ lv->showErrorList("Parse");
} else {
Buffer * const b = newFile(lyxfile.absFilename(), string(), true);
if (b)
string filename2 = (loader_format == format) ? filename.absFilename()
: changeExtension(filename.absFilename(),
formats.extension(loader_format));
- insertPlaintextFile(lv->view(), filename2, as_paragraphs);
+ lv->view()->insertPlaintextFile(filename2, as_paragraphs);
lv->dispatch(FuncRequest(LFUN_MARK_OFF));
}