#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "PDFOptions.h"
-#include "Session.h"
#include "sgml.h"
#include "TexRow.h"
#include "TexStream.h"
namespace {
-int const LYX_FORMAT = 318;
+int const LYX_FORMAT = 321;
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
typedef pair<DocIterator, MacroData> ScopeMacro;
typedef map<DocIterator, ScopeMacro> PositionScopeMacroMap;
typedef map<docstring, PositionScopeMacroMap> NamePositionScopeMacroMap;
+ /// map from the macro name to the position map,
+ /// which maps the macro definition position to the scope and the MacroData.
NamePositionScopeMacroMap macros;
bool macro_lock;
typedef map<Buffer const * const, DocIterator> BufferPositionMap;
typedef pair<DocIterator, Buffer const *> ScopeBuffer;
typedef map<DocIterator, ScopeBuffer> PositionScopeBufferMap;
+ /// position of children buffers in this buffer
BufferPositionMap children_positions;
+ /// map from children inclusion positions to their scope and their buffer
PositionScopeBufferMap position_to_children;
/// Container for all sort of Buffer dependant errors.
LYXERR(Debug::PARSER, "Handling document header token: `"
<< token << '\'');
- string unknown = params().readToken(lex, token, d->filename.onlyPath());
+ string unknown = params().readToken(lex, token, d->filename.onlyPath(),
+ d->temppath);
if (!unknown.empty()) {
if (unknown[0] != '\\' && token == "\\textclass") {
Alert::warning(_("Unknown document class"),
// Enable embeded files, which will set temp path and move
// inconsistent inzip files if needed.
- embeddedFiles().enable(params().embedded, *this, false);
+ try {
+ embeddedFiles().validate(*this);
+ embeddedFiles().enable(params().embedded, *this, false);
+ } catch (ExceptionMessage const & message) {
+ Alert::error(message.title_, message.details_);
+ Alert::warning(_("Failed to read embedded files"),
+ _("Due to most likely a bug, LyX failed to locate all embedded "
+ "file. If you unzip the LyX file, you should be able to see and "
+ "open content.lyx which is your main text. You may also be able "
+ "to recover some embedded files. Please report this bug to the "
+ "lyx-devel mailing list."));
+ return false;
+ }
updateMacros();
updateMacroInstances();
}
if (!retval) {
- message(str + _(" could not write file!."));
+ message(str + _(" could not write file!"));
return false;
}
removeAutosaveFile(d->filename.absFilename());
if (params().embedded) {
- message(str + _(" writing embedded files!."));
+ message(str + _(" writing embedded files."));
// if embedding is enabled, write file.lyx and all the embedded files
// to the zip file fname.
if (!d->embedded_files.writeFile(fname, *this)) {
- message(str + _(" could not write embedded files!."));
+ message(str + _(" could not write embedded files!"));
return false;
}
}