More fixes for bugs noticed by Philippe.

We want to do all the excluding before we do any of the adding.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27278 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-11-05 19:13:25 +00:00
parent df475c2002
commit c94d0da408

View File

@ -1475,13 +1475,28 @@ void BufferParams::removeExcludedModules()
clearLayoutModules();
list<string>::const_iterator oit = oldModules.begin();
list<string>::const_iterator oen = oldModules.end();
list<string> const & provmods = baseClass()->providedModules();
list<string> const & exclmods = baseClass()->excludedModules();
for (; oit != oen; ++oit) {
string const & modname = *oit;
// are we excluded by the document class?
if (find(exclmods.begin(), exclmods.end(), *oit) != exclmods.end()) {
LYXERR0("Module " << *oit << " dropped because excluded by document class.");
if (find(exclmods.begin(), exclmods.end(), modname) != exclmods.end()) {
LYXERR0("Module " << modname << " dropped because excluded by document class.");
continue;
}
// determine whether some provided module excludes us or we exclude it
list<string>::const_iterator pit = provmods.begin();
list<string>::const_iterator pen = provmods.end();
bool excluded = false;
for (; !excluded && pit != pen; ++pit) {
if (!LyXModule::areCompatible(modname, *pit)) {
LYXERR0("Module " << modname <<
" dropped becuase it conflicts with provided module " << *pit);
excluded = true;
}
}
if (excluded)
continue;
layoutModules_.push_back(*oit);
}
}