]> git.lyx.org Git - lyx.git/commitdiff
Fix bug 2182: LyX should default unknown classes to article class
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 27 Jan 2007 17:22:58 +0000 (17:22 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 27 Jan 2007 17:22:58 +0000 (17:22 +0000)
* src/bufferparams.C
(BufferParams::readToken): If the text class is unknown, use the
same code as in the constructor to set a default

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16888 a592a061-630c-0410-9148-cb99ea01b6c8

src/bufferparams.C

index dff424a9af00d7cb4d0b5cae3fedd22f7e08c9f9..a3af1079a817533ffe6c7ec352282151297d12f1 100644 (file)
@@ -236,9 +236,18 @@ SpaceTranslator const & spacetranslator()
        return translator;
 }
 
-// ends annonym namespace
+
+textclass_type defaultTextclass()
+{
+       // Initialize textclass to point to article. if `first' is
+       // true in the returned pair, then `second' is the textclass
+       // number; if it is false, second is 0. In both cases, second
+       // is what we want.
+       return textclasslist.numberOfClass("article").second;
 }
 
+} // anon namespace
+
 
 class BufferParams::Impl
 {
@@ -282,12 +291,7 @@ void BufferParams::MemoryTraits::destroy(BufferParams::Impl * ptr)
 
 
 BufferParams::BufferParams()
-       : // Initialize textclass to point to article. if `first' is
-         // true in the returned pair, then `second' is the textclass
-         // number; if it is false, second is 0. In both cases, second
-         // is what we want.
-       textclass(textclasslist.numberOfClass("article").second),
-       pimpl_(new Impl)
+       : textclass(defaultTextclass()), pimpl_(new Impl)
 {
        paragraph_separation = PARSEP_INDENT;
        quotes_language = InsetQuotes::EnglishQ;
@@ -422,7 +426,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                        if (pp.first) {
                                textclass = pp.second;
                        } else {
-                               textclass = 0;
+                               textclass = defaultTextclass();
                                return classname;
                        }
                }