- // notify user of import ahead
- string displaypath = MakeDisplayPath(filename);
- owner->getMiniBuffer()->Set(_("Importing"), displaypath, "...");
-
- // call real importer
- bool result = func(owner->view(), filename);
-
- // we are done
- if (result)
- owner->getMiniBuffer()->Set(displaypath, _("imported."));
- else
- owner->getMiniBuffer()->Set(displaypath, _(": import failed."));
-}
-
-static
-bool doImportASCIIasLines(BufferView * view, string const & filename)
-{
- view->buffer(bufferlist.newFile(filename, string()));
- InsertAsciiFile(view, filename, false);
- return true;
-}
-
-static
-bool doImportASCIIasParagraphs(BufferView * view, string const & filename)
-{
- view->buffer(bufferlist.newFile(filename, string()));
- InsertAsciiFile(view, filename, true);
- return true;
-}
-
-static
-bool doImportLaTeX(BufferView * view, string const & filename)
-{
- ImportLaTeX myImport(filename);
- Buffer * openbuf = myImport.run();
- if (openbuf) {
- view->buffer(openbuf);
- return true;
- }
- else
- return false;
-}
-
-static
-bool doImportNoweb(BufferView * view, string const & filename)
-{
- ImportNoweb myImport(filename);
- Buffer * openbuf = myImport.run();
- if (openbuf) {
- view->buffer(openbuf);
- return true;
- }
- else
- return false;
-}
-
-static
-bool doImportLinuxDoc(BufferView *, string const & filename)
-{
- // run sgml2lyx
- string tmp = lyxrc.linuxdoc_to_lyx_command + filename;
- Systemcalls one;
- Buffer * buf = 0;
-
- int result = one.startscript(Systemcalls::System, tmp);
- if (result == 0) {
- string filename = ChangeExtension(filename, ".lyx");
- // File was generated without problems. Load it.
- buf = bufferlist.loadLyXFile(filename);
- }
-
- return result == 0;