From c94d0da4084e8f2e8571c852a463f05281912899 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 5 Nov 2008 19:13:25 +0000 Subject: [PATCH] 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 --- src/BufferParams.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 22fa38e607..875c3c5fb0 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1475,13 +1475,28 @@ void BufferParams::removeExcludedModules() clearLayoutModules(); list::const_iterator oit = oldModules.begin(); list::const_iterator oen = oldModules.end(); + list const & provmods = baseClass()->providedModules(); list 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::const_iterator pit = provmods.begin(); + list::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); } } -- 2.39.2