/** * set new frame for this view We start listening for frame action/status and click events * instandly. If an event occurs, we use it to synchronize our controls with states of a (maybe) * new document view of this frame. * * @param xFrame the reference to the frame, which provides the possibility to get the required * status information * <p>Attention: We don't accept new frames here. We get one after startup and work with it. * That's it! */ public void setFrame(com.sun.star.frame.XFrame xFrame) { if (xFrame == null) return; // be listener for click events // They will toogle the UI controls. ClickListener aMenuBarHandler = new ClickListener(FEATUREURL_MENUBAR, FEATUREPROP_MENUBAR, xFrame); ClickListener aToolBarHandler = new ClickListener(FEATUREURL_TOOLBAR, FEATUREPROP_TOOLBAR, xFrame); ClickListener aObjectBarHandler = new ClickListener(FEATUREURL_OBJECTBAR, FEATUREPROP_OBJECTBAR, xFrame); m_cbMenuBar.addActionListener(aMenuBarHandler); m_cbToolBar.addActionListener(aToolBarHandler); m_cbObjectBar.addActionListener(aObjectBarHandler); // be frame action listener // The callback will update listener connections // for status updates automaticly! m_aMenuBarListener = new StatusListener(m_cbMenuBar, MENUBAR_ON, MENUBAR_OFF, xFrame, FEATUREURL_MENUBAR); m_aToolBarListener = new StatusListener(m_cbToolBar, TOOLBAR_ON, TOOLBAR_OFF, xFrame, FEATUREURL_TOOLBAR); m_aObjectBarListener = new StatusListener( m_cbObjectBar, OBJECTBAR_ON, OBJECTBAR_OFF, xFrame, FEATUREURL_OBJECTBAR); m_aMenuBarListener.startListening(); m_aToolBarListener.startListening(); m_aObjectBarListener.startListening(); }