paperpackage fix, hopefully without side effects

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@8839 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2004-07-15 11:13:10 +00:00
parent 561bf5d97f
commit 1d4b2ab362
2 changed files with 27 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-07-15 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* buffer.C (parseSingleLyXformat2Token): fix the off-by-one-error
in the paperpackage selection without modifying the file format
with help from Jean-Marc Lasgouttes
2004-07-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* tex-strings.C: revert paperpackage fix from 2004-06-27 as it

View File

@ -751,12 +751,27 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
else
params.papersize2 = tmpret;
} else if (token == "\\paperpackage") {
int tmpret = lex.findToken(string_paperpackages);
if (tmpret == -1) {
++tmpret;
params.paperpackage = BufferParams::PACKAGE_NONE;
} else
params.paperpackage = tmpret;
// string_paperpackages is missing the first entry "none".
// Therefore, the strings in the .lyx file are off by one,
// and the last setting PACKAGE_WIDEMARGINSA4 is written as
// an empty string.
// Since we cannot fix string_paperpackages because this
// would be a file format change, we have to recognize the
// empty argument of "\\paperpackage" as PACKAGE_WIDEMARGINSA4
// here.
lex.eatLine();
string const nextToken = lex.getString();
if (nextToken.empty()) {
params.paperpackage = BufferParams::PACKAGE_WIDEMARGINSA4;
} else {
lex.pushToken(nextToken);
int tmpret = lex.findToken(string_paperpackages);
if (tmpret == -1) {
++tmpret;
params.paperpackage = BufferParams::PACKAGE_NONE;
} else
params.paperpackage = tmpret;
}
} else if (token == "\\use_geometry") {
lex.nextToken();
params.use_geometry = lex.getInteger();