I created a project with a OfficeMenuBar and OfficeToolBar. They contain
same submenus, with same URL.
In the main java class I definied an addStatusListener function what
change the state of menu by FeatureStateEvent.

public void addStatusListener(com.sun.star.frame.XStatusListener xControl,
            com.sun.star.util.URL aURL) {
  if (aURL.Protocol.compareTo("com.thotsoft:") == 0) {
    if (aURL.Path.compareTo("Start") == 0) {
      FeatureStateEvent aEvent = new FeatureStateEvent();
      aEvent.FeatureURL = aURL;
      aEvent.Source = (XDispatch) this;
      aEvent.IsEnabled = !isStarted;
      aEvent.Requery = false;
      xControl.statusChanged(aEvent);
    }
  }
}

This statusListener works fine on the OfficeMenuBar elements, but it has
no effects on the OfficeToolBar elements. What is the solution, if i have
to change the toolbar elements' state too?

Shortly: how can I enable and disable ToolBar elements from Java code in
running time?

I use ImageButton in toolbar, what is a simple ToggleButton by
specification what can be controlled by status change.

<node oor:name="OfficeToolBar">
  <node oor:name="com.thotsoft" oor:op="replace">
    <node oor:name="m2" oor:op="replace">
      <prop oor:name="URL" oor:type="xs:string">
        <value>com.thotsoft:Start</value>
      </prop>
      <prop oor:name="Target" oor:type="xs:string">
        <value>_self</value>
      </prop>
      <prop oor:name="Title" oor:type="xs:string">
        <value/>
        <value xml:lang="en">Start</value>
      </prop>
      <prop oor:name="ControlType" oor:type="xs:string">
        <value>ImageButton</value>
      </prop>
    </node>
  </node>
</node>

Any idea?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to