fdo#82616: set limits on spinboxes according to size of workarea

Do it the same way as position'n'size dialog does, for that matter
move shared code into a separate header/class.

This fixes regression from .ui migration that omitted spinbox limits

Change-Id: I884904719b2608dd80aecc5d7ffb3923de71774d
Reviewed-on: https://gerrit.libreoffice.org/13174
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Katarina Behrens <bubli@bubli.org>