Properly mirror document_get_from_page() in document_get_notebook_page()

Now document_get_from_page() supports arbitrary nesting inside the
notebook page, update document_get_notebook_page() to support it also,
by searching up for the direct notebook child rather than assuming it
is the ScintillaWidget's direct parent.
Avoid code duplication in document_get_current()
Fix a few missing/extra includes