I went with the first option and created this patch:
It turned out we need to implement both. The first option was fine when only
closing the window - but we also want to be able to close the visible frames
with "File->Exit" while keeping the process running.
So I changed the semantics of the TerminationVetoException accordingly:
With that patch, the TerminationVetoException lets you close the windows, but
vetoes the termination. Before it also vetoed the closing of the windows.
If one still need to veto closing documents/frames, one could use the
I will of course document the new behavior in the release notes (if no
objections come in).
LibreOffice mailing list