Analytic solutions of the magnetic annihilation and reconnection problems. I. Planar flow profiles