Language:

The Free and Open Productivity Suite
Apache OpenOffice 4.1.4 released

Developer's Guide

API

SDK

Tips 'n' Tricks

Miscellaneous


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

unpublished interface XFilterController
Usage Restrictions
not published
Description
provides access to a form based filter for a database form

In a form based filter, form controls bound to a searchable database field are replaced with a control which allows entering a search expression. This so-called predicate expression is basically a part of an SQL WHERE clause, but without the the part denoting the database column. For instance, if you have a form control bound to a table column named Name, then entering the string LIKE '%Smith%' effectively consitutes a SQL WHERE clause "Name" LIKE '%Smith%'.

In the actual document view, there are usually some relaxations to this. For instance, keywords such as LIKE might be localized, according to OpenOffice.org's UI locale. Also, for an equality criterion, the equality sign = is usually omitted. However, this interface here provides programmatic access to the form based filter, so those relaxations are not considered here.

The filter maintained by a filter controller is, logically, a disjunctive normal form of an SQL WHERE class. That is, it is a disjunction of m terms, where each term is a conjunction of n clauses of the form <column> <predicate> <literal> or of the form <column> IS [NOT] NULL.

n equals the number of filter controls which the filter controller is responsible for. This number doesn't change during one session of the form based filter. On the other hand, m, the number of disjunctive terms, is dynamic.

With the above, there are potentially m * n predicate expressions (though usually only a fraction of those will actually exist). Since in a form based filter, there are only n filter controls, and each filter control displays exactly one predicate expression, this means that only a part of the complete filter can be displayed, in particular, only one disjunctive term can be displayed at a time. Thus, the filter controller knows the concept of an active term, denoted by the ActiveTerm attribute, controls which of the terms is currently displayed in the form controls.

Since
OOo 3.3
See also
XFormController, ::com::sun::star::sdbc::XResultSetMetaData::isSearchable, ::com::sun::star::sdb::XSingleSelectQueryAnalyzer::getStructuredFilter, ::com::sun::star::sdb::SQLFilterOperator

Methods' Summary
addFilterControllerListener registers a listener to be notified of certain changes in the form based filter.  
removeFilterControllerListener revokes a listener which was previously registered to be notified of certain changes in the form based filter.  
setPredicateExpression sets a given predicate expression  
getFilterComponent retrieves the filter component with the given index.  
getPredicateExpressions retrieves the entirety of the predicate expressions represented by the filter controller.  
removeDisjunctiveTerm removes a given disjunctive term  
appendEmptyDisjunctiveTerm appends an empty disjunctive term to the list of terms.  
Attributes' Summary
FilterComponents is the number of filter components, or filter controls, which the filter controller is responsible for.  
DisjunctiveTerms is the number of disjunctive terms of the filter expression represented by the form based filter.  
ActiveTerm denotes the active term of the filter controller.  
Methods' Details
addFilterControllerListener
void
addFilterControllerListener( [in] XFilterControllerListener  _Listener );

Description
registers a listener to be notified of certain changes in the form based filter.

Registering the same listener multiple times results in multiple notifications of the same event, and also requires multiple revocations of the listener.

removeFilterControllerListener
void
removeFilterControllerListener( [in] XFilterControllerListener  _Listener );

Description
revokes a listener which was previously registered to be notified of certain changes in the form based filter.
setPredicateExpression
void
setPredicateExpression( [in] long  _Component,
[in] long  _Term,
[in] string  _PredicateExpression )
raises( ::com::sun::star::lang::IndexOutOfBoundsException );

Description
sets a given predicate expression
Parameter _Component
denotes the filter component whose expression is to be set. Must be greater than or equal to 0, and smaller than FilterComponents.
Parameter _Term
denotes the disjunctive term in which the expression is to be set. Must be greater than or equal to 0, and smaller than DisjunctiveTerms.
Parameter _PredicateExpression
denotes the predicate expression to set for the given filter component in the given term.
Throws
::com::sun::star::lang::IndexOutOfBoundsException if one of the indexes is out of the allowed range
getFilterComponent
::com::sun::star::awt::XControl
getFilterComponent( [in] long  _Component )
raises( ::com::sun::star::lang::IndexOutOfBoundsException );

Description
retrieves the filter component with the given index.

The filter control has the same control model as the control which it stands in for. Consequently, you can use this method to obtain the database column which the filter control works on, by examining the control model's BoundField property.

Parameter _Component
denotes the index of the filter component whose control should be obtained. Must be greater than or equal to 0, and smaller than FilterComponents.
Throws
::com::sun::star::lang::IndexOutOfBoundsException if _Component is out of the allowed range.
See also
::com::sun::star::form::component::DataAwareControlModel::BoundField
getPredicateExpressions
sequence< sequence< string > >
getPredicateExpressions();

Description
retrieves the entirety of the predicate expressions represented by the filter controller.

Each element of the returned sequence is a disjunctive term, having exactly FilterComponents elements, which denote the single predicate expressions of this term.

removeDisjunctiveTerm
void
removeDisjunctiveTerm( [in] long  _Term )
raises( ::com::sun::star::lang::IndexOutOfBoundsException );

Description
removes a given disjunctive term
Parameter _Term
the index of the term to remove. Must be greater than or equal to 0, and smaller than DisjunctiveTerms.
Throws
::com::sun::star::lang::IndexOutOfBoundsException if _Term is out of the allowed range.
appendEmptyDisjunctiveTerm
void
appendEmptyDisjunctiveTerm();

Description
appends an empty disjunctive term to the list of terms.
Attributes' Details
FilterComponents
[ readonly ] long FilterComponents;
Description
is the number of filter components, or filter controls, which the filter controller is responsible for.

This number is constant during one session of the form based filter.

DisjunctiveTerms
[ readonly ] long DisjunctiveTerms;
Description
is the number of disjunctive terms of the filter expression represented by the form based filter.
ActiveTerm
long ActiveTerm
set raises (::com::sun::star::lang::IndexOutOfBoundsException);

Description
denotes the active term of the filter controller.
Top of Page

Apache Software Foundation

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

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