]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetBibtex.cpp
index 9996cd23f0089e36b0c1376c986dca4a30615816..40632057697579d6e06e7c325f73846043fbc884 100644 (file)
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "DispatchResult.h"
-#include "support/debug.h"
 #include "EmbeddedFiles.h"
 #include "Encoding.h"
 #include "FuncRequest.h"
-#include "support/gettext.h"
 #include "LaTeXFeatures.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 
 #include "frontends/alert.h"
 
+#include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/docstream.h"
 #include "support/filetools.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/Path.h"
 #include "support/textutils.h"
 
 #include <boost/tokenizer.hpp>
+#include <limits>
 
 using namespace std;
 using namespace lyx::support;
@@ -104,8 +105,6 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
                embedStatus = split(embedStatus, emb, ',');
                while (!tmp.empty()) {
                        EmbeddedFile file(changeExtension(tmp, "bib"), cur.buffer().filePath());
-                       if (!file.exists())
-                               continue;
                        if (!newBibfiles.empty())
                                newBibfiles += ",";
                        newBibfiles += tmp;
@@ -741,8 +740,7 @@ void InsetBibtex::fillWithBibKeys(Buffer const & buffer,
                                docstring value;
                                docstring commaNewline;
                                docstring data;
-                               BibTeXInfo keyvalmap;
-                               keyvalmap.entryType = entryType;
+                               BibTeXInfo keyvalmap(key, entryType);
                                
                                bool readNext = removeWSAndComma(ifs);
  
@@ -768,15 +766,13 @@ void InsetBibtex::fillWithBibKeys(Buffer const & buffer,
 
                                        keyvalmap[name] = value;
                                        data += "\n\n" + value;
-                                       keylist.fieldNames.insert(name);
+                                       keylist.addFieldName(name);
                                        readNext = removeWSAndComma(ifs);
                                }
 
                                // add the new entry
-                               keylist.entryTypes.insert(entryType);
-                               keyvalmap.allData = data;
-                               keyvalmap.isBibTeX = true;
-                               keyvalmap.bibKey = key;
+                               keylist.addEntryType(entryType);
+                               keyvalmap.setAllData(data);
                                keylist[key] = keyvalmap;
                        }
                } //< searching '@'