Macro Parameter "confluence-content" filtered by "spacekey"

Hi at all,

I want to have a macro-editor with a filtered “confluence-content”:

<xhtml-macro name="mymacro" class="com.company.MyMacro" key="mymacro">
  <parameters>
    <parameter name="scope" type="enum" required="true">
        <value name="Page"/>
        <value name="Space"/>
    </parameter>
    <parameter name="targetspace" type="spacekey" />
    <parameter name="targetpage" type="confluence-content" />
  </parameters>
</xhtml-macro>
  1. “targetpage” shall only list pages avaiable in space seleced by “targetspace”
  2. IF “targetspace” is empty: “targetpage” shall only list pages avaiable in current space
  3. On changing “scope” “targetspace” shall be set to visible=false

So my first question is, is it possible to filter pages of a parameter of type “confluence-content”?
The next question: Is there a possibility to define a onSelect()-Method for a parameter of type “enum”?

BR,
Rainer