Two-loop QCD corrections to the heavy quark form factors: the vector contributions