Hi Sam,
In the query itself you can use macros like ##WHERE## and ##ORDERBY## - these are then replaced by the WHERE and ORDER By properties of the web part - and in these properties you can use query string macros. This should answer the first question.
For the second question - this depends on your custom query. You will need to create some complex query that will get the page value and us it in a sub-query to check the parent.
The third question - this depends what data you need from the pages and document types. I would check some of the views - like View_Tree_Joined if it contains the columns you need.
Best regards,
Juraj Ondrus