You could add a virtual attribute to the object you are displaying, which returns the URL of either the file, or the URL itself. The Url of a file is
'/file?fileID=' + $fileDocument/FileID
Use this attribute in combination with an external link widget.