Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


:: com :: sun :: star :: form :: runtime ::

unpublished interface XFormController
Base Interfaces
XFormController
┣ ::com::sun::star::awt::XTabController
┣ ::com::sun::star::container::XChild
┣ ::com::sun::star::container::XIndexAccess
┃ ┗ ::com::sun::star::container::XElementAccess
┣ ::com::sun::star::container::XEnumerationAccess
┃ ┗ ::com::sun::star::container::XElementAccess
┣ ::com::sun::star::lang::XComponent
┣ ::com::sun::star::util::XModifyBroadcaster
┣ ::com::sun::star::form::XConfirmDeleteBroadcaster
┣ ::com::sun::star::sdb::XSQLErrorBroadcaster
┣ ::com::sun::star::sdb::XRowSetApproveBroadcaster
┣ ::com::sun::star::form::XDatabaseParameterBroadcaster2
┃ ┗ ::com::sun::star::form::XDatabaseParameterBroadcaster
┣ ::com::sun::star::util::XModeSelectorXFilterController

::com::sun::star::awt::XTabController
Description
is used for tab controlling and grouping of the controls.

The model obtained via ::com::sun::star::awt::XTabController::getModel is the form for which the controller is responsible.

::com::sun::star::container::XChild
Description
allows access to the parent controller.
::com::sun::star::container::XIndexAccess
Description
allows access to the sub controllers.
::com::sun::star::container::XEnumerationAccess
Description
allows enumerating sub controllers
::com::sun::star::lang::XComponent
Description
allows life time control of the controller.
::com::sun::star::util::XModifyBroadcaster
Description
allows to register as listener for modifications in the controls which the controller is responsible for.
::com::sun::star::form::XConfirmDeleteBroadcaster
Description
used to notify deletions of data in the form before they happen.

A form controller listens for deletion events at the form it is responsible for. If and only if no ::com::sun::star::form::XConfirmDeleteListener is registered at the controller, it uses an own dialog to ask the user for confirmation.

::com::sun::star::sdb::XSQLErrorBroadcaster
Description
is used to notify errors which happen in the form the controller is responsible for.

A form controller listens for error events at the form it is responsible for. If and only if no ::com::sun::star::sdb::XSQLErrorListener is registered at the controller, it uses an own dialog to notify the user of the error.

::com::sun::star::sdb::XRowSetApproveBroadcaster
Description
is used for multiplexing row set events happening on the form which the controller is responsible for.
::com::sun::star::form::XDatabaseParameterBroadcaster2
Description
is used broadcasting parameter events in the form.

A form controller listens for parameter events at the form it is responsible for. If and only if no ::com::sun::star::form::XDatabaseParameterListener is registered at the controller, it uses an own dialog to ask the user for parameter values.

::com::sun::star::util::XModeSelector
Description
allows switching the form controller to different operation modes.

The two modes usually (but not necessarily) supported by a form controller are the DataMode and the FilterMode, where the former is the usual modus operandi for displaying and modifying data, and the latter is a special mode to enter a filter for the database form which the controller is responsible for.

XFilterController
Usage Restrictions
optional
Description
allows controlling the filter mode.

If the form controller supports a form based filter mode, then it shall also support the XFilterController interface, which allows controlling this mode.

Usage Restrictions
not published
Description
specifies a component controlling the interaction between the user and form functionality.

As soon as a form (containing controls) is to be presented to the user, there is a need for an instance controlling the user interaction.
Such a FormController is responsible for dialog processing, like controlling the tab order and the grouping of controls.

As a form may contain one or many subforms, a FormController may contain one or more other FormControllers, so the form model structure or hierarchy is reflected in the structure of FormControllers. That is, retrieving the parent of the model of a controller will give you the same object as retrieving the model of the parent of the controller. Similarly, retrieving the model of the nth child of a controller gives you the same object as retrieving the nth child of the model of the controller.

A controller is called active if one of the controls it is responsible for has the focus, else inactive. To be notified whenever this activation state of a given controller changes, you can add listeners.

This interface supersedes the ::com::sun::star::form::FormController.

Responsibilities

A FormController is responsible for a ::com::sun::star::awt::UnoControlContainer, and all controls therein.

Furthermore, a form controller is responsible for preventing invalid user input. That is, if the form contains controls bound to a database, or to an external validator, then the form controller will check their current value when the current record is to be saved to the database.

First, it will check whether any controls with an external validator exist. If so, those validators will be asked to validate the current control content. If this fails, the message provided by the validator is displayed to the user, the control is focused, and the update of the record is vetoed.

Second, the controls are examined for NULL values. If a control is bound to a database field which is declared to be NOT NULL, no auto-increment field, but still NULL, then an error message is shown to the user saying that input is required, the respective control is focused, and the update of the record is vetoed.

Note that you can precent the second check - for database fields containing NULL values - on a per-form and a per-database basis.
For the former, you need to add a boolean property FormsCheckRequiredFields to the form (aka the FormController's model), using its ::com::sun::star::beans::XPropertyContainer::addProperty method, with a value of false.
For the latter, you need to set the respective property of the data source's Settings (also named FormsCheckRequiredFields) to false.

Alternatively, you can prevent the check on a per-control basis, using the ::DataAwareControlModel::InputRequired property of a single control model.

If a control which the controller is responsible for supports the ::com::sun::star::frame::XDispatchProviderInterception interface, the controller registers a dispatch interceptor. Then, the control can try to delegate part of its functionality to the controller by querying the dispatch interceptor for it.

Below, there's a list of URLs which have a defined meaning - if an implementation supports one of them, there must be a guaranteed semantices. However, concrete implementations may support an arbitrary sub or super set of these URLs.

In general, all URLs start with the same prefix, namely .uno:FormController/. To this, a suffix is appended which describes the requested functionality.
Example: The URL suffix for deleting the current record is deleteRecord, so the complete URL for requesting a dispatcher for this functionality is .uno:FormController/deleteRecord.

Some URLs may require parameters. For this, the sequence of ::com::sun::star::beans::PropertyValues passed to the ::com::sun::star::frame::XDispatch::dispatch call is used - every property value is used as one named parameter.

For all URLs, interested parties can register as status listeners (::com::sun::star::frame::XStatusListener) at the dispatchers, and be notified whenever the functionality associated with the URL becomes enabled or disabled.
For instance, the URL with the suffix moveToFirst is associated with moving the form to the first record, and it will be disabled in case the form is already positioned on the first record.

URL suffix functionality
positionForm positions the form on a record given by absolute number.
There's one parameter for this functionality, named Position, which must be a long value specifying the absolute position to which the form should be moved
RecordCount This is a passive functionality: It cannot be dispatched, instead, interested parties may use the dispatcher to add as ::com::sun::star::frame::XStatusListener, and be notified when the record count changes.
The status value which is being notified (::com::sun::star::frame::FeatureStateEvent::State) is a string which can be used to display the record count. In particular, if the record count is not yet known (::com::sun::star::sdb::RowSet::IsRowCountFinal is false), this is indicated in the string, too.
moveToFirst moves the form to the first record
moveToPrev moves the form to the record preceding the current one
moveToNext moves the form to the record after the current one
moveToLast moves the form to the last record
moveToNew moves the form to the virtual "insert row", where new records can be inserted
saveRecord Commits any potentially pending changes in the current control, and saves the current record to the database, or inserts a new record if the form is currently positioned on the virtual insertion row.
undoRecord reverts the changes done to the current record. Basically, this means refreshing the current row from the database, and updating all controls with the new content.
deleteRecord deletes the current record, after asking the user for confirmation.
refreshForm reloads the complete form. After this, the form is positioned on the first record
sortUp Adds an order clause to the form, to sort it ascending by the field which the current control is bound to, and then reloads the form.
sortDown Adds an order clause to the form, to sort it descending by the field which the current control is bound to, and then reloads the form.
sort opens an dialog, which allows the user to manipulate the current sorting order of the form. If the dialog is closed with OK, the form is reloaded after setting the new sorting order.
autoFilter creates, from the current control, a filter for the form. This is, if the current control is bound to the field, say, "customer", and contains the value "Furs, Inc.", then a filter "customer = 'Furs, Inc.'" is created and set at the form. After this, the form is reloaded.
filter opens an dialog, which allows the user to manipulate the current filter of the form. If the dialog is closed with OK, the form is reloaded after setting the new filter.
applyFilter

Toggles the ::com::sun::star::sdb::RowSet::ApplyFilter property of the form.

Additionally, status listeners will be provided with the current (boolean) state of this property in the ::com::sun::star::frame::FeatureStateEvent::State member of the event notified by the dispatcher.

removeFilterOrder completely removes any filter and sorting order from the form, and reloads it.
Since
OOo 3.3
See also
::com::sun::star::form::component, ::com::sun::star::form::binding::BindableControlModel, ::com::sun::star::sdb::DataSource::Settings

Methods' Summary
addActivateListener adds the specified listener to receive notifications whenever the activation state of the controller changes.  
removeActivateListener removes the specified listener from the list of components to receive notifications whenever the activation state of the controller changes.  
addChildController adds a controller to the list of child controllers  
Attributes' Summary
FormOperations denotes the instance which is used to implement operations on the form which the controller works for.  
CurrentControl provicdes access to the currently active control  
Context allows to delegate certain tasks to the context of the form controller  
InteractionHandler used (if not NULL) for user interactions triggered by the form controller.  
Methods' Details
addActivateListener
void
addActivateListener( [in] ::com::sun::star::form::XFormControllerListener  _Listener );

Description
adds the specified listener to receive notifications whenever the activation state of the controller changes.
removeActivateListener
void
removeActivateListener( [in] ::com::sun::star::form::XFormControllerListener  _Listener );

Description
removes the specified listener from the list of components to receive notifications whenever the activation state of the controller changes.
addChildController
void
addChildController( [in] XFormController  _ChildController )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
adds a controller to the list of child controllers
Throws
::com::sun::star::lang::IllegalArgumentException if the given controller is NULL, or cannot rightfully be a child controller. Since controllers mirror the hierarchy of the forms the are responsible for, this means that the form of the given child controller must be a child of the controller at which the method is invoked.
Attributes' Details
FormOperations
[ readonly ] XFormOperations FormOperations;
Description
denotes the instance which is used to implement operations on the form which the controller works for.

This instance can be used, for instance, to determine the current state of certain form features.

CurrentControl
[ readonly ] ::com::sun::star::awt::XControl CurrentControl;
Description
provicdes access to the currently active control
Context
XFormControllerContext Context;
Description
allows to delegate certain tasks to the context of the form controller
InteractionHandler
::com::sun::star::task::XInteractionHandler InteractionHandler;
Description
used (if not NULL) for user interactions triggered by the form controller.
Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.