Coil-Globule Type Transitions in Polymers. 2. Theory of Coil-Globule Transition in Linear Macromolecules