Theory and optical properties of photonic crystal slabs