The stellar metallicity distribution function of galaxies in the CALIFA survey