This code was used in one of the projects I was involved into. The first source file (stream) is used as master document, so, all styles defined in this one will be applied to subdocuments (incl. headers and footers).