+ LyXModule const * const lm = theModuleList[module];
+ if (!lm) {
+ cerr << "Could not find module " << module << " in module list.\n";
+ return false;
+ }
+ bool foundone = false;
+ LayoutModuleList::const_iterator const exclmodstart = baseClass.excludedModules().begin();
+ LayoutModuleList::const_iterator const exclmodend = baseClass.excludedModules().end();
+ LayoutModuleList::const_iterator const provmodstart = baseClass.providedModules().begin();
+ LayoutModuleList::const_iterator const provmodend = baseClass.providedModules().end();
+ vector<string> const reqs = lm->getRequiredModules();
+ if (reqs.empty())
+ foundone = true;
+ else {
+ LayoutModuleList::const_iterator mit = m.begin();
+ LayoutModuleList::const_iterator men = m.end();
+ vector<string>::const_iterator rit = reqs.begin();
+ vector<string>::const_iterator ren = reqs.end();
+ for (; rit != ren; ++rit) {
+ if (find(mit, men, *rit) != men) {
+ foundone = true;
+ break;
+ }
+ if (find(provmodstart, provmodend, *rit) != provmodend) {
+ foundone = true;
+ break;
+ }
+ }
+ if (!foundone) {
+ visited.push_back(module);
+ for (rit = reqs.begin(); rit != ren; ++rit) {
+ if (find(exclmodstart, exclmodend, *rit) == exclmodend) {
+ if (addModule(*rit, baseClass, m, visited)) {
+ foundone = true;
+ break;
+ }
+ }
+ }
+ visited.pop_back();
+ }
+ }
+ if (!foundone) {
+ cerr << "Could not add required modules for " << module << ".\n";