Introduce centralized detection for storage-based files

This will allow us to get rid of the duplicated code,
and simplify the type detectors.

Also this commit fixes fdo#46310 and fdo#74978.

Change-Id: I08e958ab10d05e1036cdc2bed5ce14bf73b6245c
Reviewed-on: https://gerrit.libreoffice.org/9221
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>