[Fixes bug #1186785] Disable a few more menu items when no documents are open.

Also removed some duplicated code to make this easier in the future.