Analogues of Mathai–Quillen forms in sheaf cohomology and applications to topological field theory