throw new com.sun.star.lang.IllegalArgumentException(
"The window is not supported by this handler", this, (short) -1);
//To acces the separate controls of the window we need to obtain the
//XControlContainer from window implementation
XControlContainer xContainer = (XControlContainer) UnoRuntime.queryInterface(
XControlContainer.class, aWindow);
if (xContainer == null)
throw new com.sun.star.uno.Exception(
"Could not get XControlContainer from window.", this);
//This is an implementation which will be used for several options pages
//which all have the same controls. m_arStringControls is an array which
//contains the names.
for (int i = 0; i < m_arStringControls.length; i++) {
//load the values from the registry
//To access the registry we have previously created a service instance
//of com.sun.star.configuration.ConfigurationUpdateAccess which supports
//com.sun.star.container.XNameAccess. We obtain now the section
//of the registry which is assigned to this options page.
XPropertySet xLeaf = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, m_xAccessLeaves.getByName(sWindowName));
if (xLeaf == null)
throw new com.sun.star.uno.Exception(
"XPropertySet not supported.", this);
//The properties in the registry have the same name as the respective
//controls. We use the names now to obtain the property values.
Object aValue = xLeaf.getPropertyValue(m_arStringControls[i]);
//Now that we have the value we need to set it at the corresponding
//control in the window. The XControlContainer, which we obtained earlier
//is the means to get hold of all the controls.
XControl xControl = xContainer.getControl(m_arStringControls[i]);
//This generic handler and the corresponding registry schema support
//up to five text controls. However, if a options page does not use all
//five controls then we will not complain here.
if (xControl == null)