make sure to check for formula first, fdo#80301

Change-Id: Ie822d1a154b7b25437ce7e5d09eb399460823acf
Reviewed-on: https://gerrit.libreoffice.org/13082
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>