]> git.lyx.org Git - lyx.git/blobdiff - src/Importer.cpp
39 to go
[lyx.git] / src / Importer.cpp
index 63c92a4a280a2eb1250c0d004f58ebe2e9bd2c18..902df65e1ac60edb85901d4c1d701c1da8ca7349 100644 (file)
 #include "Format.h"
 #include "frontends/LyXView.h"
 #include "FuncRequest.h"
-#include "lyx_cb.h"
 
 #include "support/filetools.h"
 
-#include "frontends/Alert.h"
+#include "frontends/alert.h"
 
 #include "gettext.h"
 #include "BufferView.h"
 #include "buffer_funcs.h"
 
+using std::find;
+using std::string;
+using std::vector;
+
 
 namespace lyx {
 
@@ -34,10 +37,7 @@ using support::bformat;
 using support::changeExtension;
 using support::FileName;
 using support::makeDisplayPath;
-
-using std::find;
-using std::string;
-using std::vector;
+using frontend::LyXView;
 
 
 bool Importer::Import(LyXView * lv, FileName const & filename,
@@ -76,7 +76,15 @@ 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)
@@ -87,7 +95,7 @@ bool Importer::Import(LyXView * lv, FileName const & filename,
                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));
        }