Add beforeHistoryChange event

Intent: the event is useful to get notifications about
future changes of the document so that one might be able
to update his own external document representation on an incremental
basis. This event is complimentary to the "beforeChange" event which
may be used for this purpose but which doesn't fire for the undo/redo
commands.