Inherit areas of parent or ancestor page
It depends how arbitrarily flexible the layouts need to be but:

For the layout switching you could probably use Omega and Delta http://drupal.org/project/delta

Then write your own custom context condition that says "does this page have a parent with the layout X?" then use the reactions provided by Delta to switch to layout X for the closest parent.

For the defining/storing what layout is associated with each "page" you could just use the Field API. If each "page" is a node then it will be easier for you, otherwise you might have to also define a new type of Entity for your site.