]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Some cleanup for the Floating class.
[lyx.git] / src / BufferParams.cpp
index bf24b5937cb7c177fd25564897ea164963f2d1a4..06bd898b5f1599e82f60f183f0809866813d95ce 100644 (file)
@@ -343,6 +343,7 @@ BufferParams::BufferParams()
        trackChanges = false;
        outputChanges = false;
        use_default_options = true;
+       maintain_unincluded_children = false;
        secnumdepth = 3;
        tocdepth = 3;
        language = default_language;
@@ -538,6 +539,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                readRemovedModules(lex);
        } else if (token == "\\begin_includeonly") {
                readIncludeonly(lex);
+       } else if (token == "\\maintain_unincluded_children") {
+               lex >> maintain_unincluded_children;
        } else if (token == "\\options") {
                lex.eatLine();
                options = lex.getString();
@@ -846,6 +849,8 @@ void BufferParams::writeFile(ostream & os) const
                        os << *it << '\n';
                os << "\\end_includeonly" << '\n';
        }
+       os << "\\maintain_unincluded_children "
+          << convert<string>(maintain_unincluded_children) << '\n';
 
        // local layout information
        if (!local_layout.empty()) {
@@ -1262,7 +1267,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        writeEncodingPreamble(os, features, texrow);
 
        // includeonly
-       if (!includedChildren_.empty()) {
+       if (!features.runparams().includeall && !includedChildren_.empty()) {
                os << "\\includeonly{";
                list<string>::const_iterator it = includedChildren_.begin();
                bool first = true;
@@ -1529,13 +1534,23 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        //   before hyperref. Then hyperref has a chance to detect babel.
        // * Has to be loaded before the "LyX specific LaTeX commands" to
        //   avoid errors with algorithm floats.
-       // use hyperref explicitely when it is required
+       // use hyperref explicitly if it is required
        if (features.isRequired("hyperref")) {
-               odocstringstream oss;
-               pdfoptions().writeLaTeX(oss, documentClass().provides("hyperref"));
-               lyxpreamble += oss.str();
+               // pass what we have to stream here, since we need 
+               // to access the stream itself in PDFOptions.
+               os << lyxpreamble;
+
+               int lines =
+                       int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
+
+               OutputParams tmp_params = features.runparams();
+               lines += pdfoptions().writeLaTeX(tmp_params, os,
+                                       documentClass().provides("hyperref"));
+               texrow.newlines(lines);
+               // set back for the rest
+               lyxpreamble.clear();
        }
-       
+
        // Will be surrounded by \makeatletter and \makeatother when not empty
        docstring atlyxpreamble;
 
@@ -1639,9 +1654,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
 
        int const nlines =
                int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
-       for (int j = 0; j != nlines; ++j) {
-               texrow.newline();
-       }
+       texrow.newlines(nlines);
 
        os << lyxpreamble;
 
@@ -2256,7 +2269,7 @@ string const BufferParams::loadFonts(string const & rm,
        }
 
        // ROMAN FONTS
-       // Computer Modern (must be explicitely selectable -- there might be classes
+       // Computer Modern (must be explicitly selectable -- there might be classes
        // that define a different default font!
        if (rm == "cmr") {
                os << "\\renewcommand{\\rmdefault}{cmr}\n";