What's the correct way to allow or prevent document editing or saving? How do you guarantee that your special code executes whenever document editing starts, or when a document is saved?