Do not use static objects in Preamble

This does not make any difference currently, since the only instance of the
Preamble class is a global one, but it is cleaner and will be needed for
parsing the encoding with a second Preamble instance.
This commit is contained in:
Georg Baum 2016-01-31 12:37:22 +01:00
parent 7b35843b0f
commit 250b058192
2 changed files with 7 additions and 7 deletions

View File

@ -185,9 +185,6 @@ const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb",
"rotfloat", "splitidx", "setspace", "subscript", "textcomp", "tipa", "tipx",
"tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor", "xunicode", 0};
// used for the handling of \newindex
int index_number = 0;
// codes used to remove packages that are loaded automatically by LyX.
// Syntax: package_beg_sep<name>package_mid_sep<package loading code>package_end_sep
const char package_beg_sep = '\001';
@ -460,7 +457,7 @@ string remove_braces(string const & value)
Preamble::Preamble() : one_language(true), explicit_babel(false),
title_layout_found(false), h_font_cjk_set(false)
title_layout_found(false), index_number(0), h_font_cjk_set(false)
{
//h_backgroundcolor;
//h_boxbgcolor;
@ -1413,9 +1410,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
// check the case that a standard color is used
if (space.empty() && is_known(argument, known_basic_colors)) {
h_fontcolor = rgbcolor2code(argument);
preamble.registerAutomaticallyLoadedPackage("color");
registerAutomaticallyLoadedPackage("color");
} else if (space.empty() && argument == "document_fontcolor")
preamble.registerAutomaticallyLoadedPackage("color");
registerAutomaticallyLoadedPackage("color");
// check the case that LyX's document_fontcolor is defined
// but not used for \color
else {
@ -1435,7 +1432,7 @@ void Preamble::parse(Parser & p, string const & forceclass,
if (is_known(argument, known_basic_colors)) {
h_backgroundcolor = rgbcolor2code(argument);
} else if (argument == "page_backgroundcolor")
preamble.registerAutomaticallyLoadedPackage("color");
registerAutomaticallyLoadedPackage("color");
// check the case that LyX's page_backgroundcolor is defined
// but not used for \pagecolor
else {

View File

@ -119,6 +119,9 @@ private:
/// was at least one title layout found?
bool title_layout_found;
/// used for the handling of \newindex
int index_number;
std::ostringstream h_preamble;
std::string h_backgroundcolor;
std::string h_biblio_style;