keypress event with java uno for writer document

Dear Fellows,

when we open a writer document and start typing text, how can one intercept key strokes.
So that when a certain key is pressed
a certain dialog can be shown.
i would request the info for java uno coding and not for oobasic.

Thanks
Regards