rhbz#1043551: sw: avoid division-by-0 in Text Grid painting code

Possible to trigger with a document containing:
    style:layout-grid-base-height="0cm"

(cherry picked from commit 71b55cf57460aec3fec948676251448934ba31d1)

got to love the sal_Int32 as long/int
(cherry picked from commit 18c89ae6ff01f3d555a7cb030eb4572d504e8de7)

Change-Id: Id3bd1f29157b39e8a577be0b87b86236dbe5a50c
Reviewed-on: https://gerrit.libreoffice.org/8497
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>