/* ------------------------------------------------------------------ */ /** Quick access to a given interface of the view @paramaInterfaceClass theclassoftheinterfacewhichshallbereturned
*/ public <T> T query( Class<T> aInterfaceClass )
{ return UnoRuntime.queryInterface( aInterfaceClass, m_controller );
}
/* ------------------------------------------------------------------ */ /** retrieves a dispatcher for the given URL, obtained at the current view of the document @paramaURL aone-elementarray.Thefirstelementmustcontainavalid <memberscope="com.sun.star.util">URL::Complete</member>value.Uponreturn,theURLiscorrectly parsed. @return thedispatcherfortheURLinquestion
*/ private XDispatch getDispatcher( URL[] aURL ) throws java.lang.Exception
{
XDispatch xReturn = null;
// go get the current view
XController xController = query( XController.class ); // go get the dispatch provider of its frame
XDispatchProvider xProvider = UnoRuntime.queryInterface(
XDispatchProvider.class, xController.getFrame() ); if ( null != xProvider )
{ // need a URLTransformer
XURLTransformer xTransformer = UnoRuntime.queryInterface(
XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) );
xTransformer.parseStrict( aURL );
/* ------------------------------------------------------------------ */ /** retrieves a dispatcher for the given URL, obtained at the current view of the document
*/ public XDispatch getDispatcher( String url ) throws java.lang.Exception
{
URL[] aURL = new URL[] { new URL() };
aURL[0].Complete = url; return getDispatcher( aURL );
}
/* ------------------------------------------------------------------ */ /** dispatches the given URL into the view, if there's a dispatcher for it
/* ------------------------------------------------------------------ */ /** retrieves a control within the current view of a document @paramxModel specifiesthecontrolmodelwhosecontrolshouldbelocated @return thecontroltiedtothemodel
*/ public XControl getControl( XControlModel xModel ) throws com.sun.star.uno.Exception
{ // the current view of the document
XControlAccess xCtrlAcc = query( XControlAccess.class ); // delegate the task of looking for the control return xCtrlAcc.getControl( xModel );
}
/* ------------------------------------------------------------------ */ /** retrieves the form controller for a given logical form
*/ private XFormController getFormController( XForm _form )
{
XFormLayerAccess formLayerAccess = query( XFormLayerAccess.class ); return formLayerAccess.getFormController( _form );
}
/* ------------------------------------------------------------------ */ /** retrieves the form controller for a given logical form
*/ public XFormController getFormController( Object _form )
{ return getFormController( UnoRuntime.queryInterface( XForm.class, _form ));
}
/* ------------------------------------------------------------------ */ /** toggles the design mode of the form layer of active view of our sample document
*/ protectedvoid toggleFormDesignMode( ) throws java.lang.Exception
{ if ( m_document instanceof XMLDocument )
dispatch( ".uno:SwitchXFormsDesignMode" ); else
dispatch( ".uno:SwitchControlDesignMode" ); // at least SwitchControlDesignMode is async, so wait for it to be done
XToolkitExperimental xToolkit = UnoRuntime.queryInterface(
XToolkitExperimental.class,
m_orb.createInstance("com.sun.star.awt.Toolkit"));
xToolkit.processEventsToIdle();
}
/* ------------------------------------------------------------------ */ /** sets the focus to a specific control @paramxModel acontrolmodel.Thefocusissettothatcontrolwhichispartofourview andassociatedwiththegivenmodel.
*/ publicvoid grabControlFocus( Object xModel ) throws com.sun.star.uno.Exception
{ // look for the control from the current view which belongs to the model
XControl xControl = getControl( xModel );
// the focus can be set to an XWindow only
XWindow xControlWindow = UnoRuntime.queryInterface( XWindow.class,
xControl );
// grab the focus
xControlWindow.setFocus();
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.