summaryrefslogtreecommitdiffstats
path: root/forms
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-16 13:55:24 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-16 13:55:24 +0200
commit69929004c60c78e8022f89b002128f551dc0f8c7 (patch)
tree6d5c4439769b27f8c5fcbae0595bf20b09465542 /forms
parentCWS-TOOLING: integrate CWS mingwport29 (diff)
parentdba33f: #i110036#: when creating new controls or grid columns, set MouseWheel... (diff)
downloadcore-69929004c60c78e8022f89b002128f551dc0f8c7.tar.gz
core-69929004c60c78e8022f89b002128f551dc0f8c7.zip
dba33f: merge with m76-branch
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/Columns.cxx20
-rw-r--r--forms/source/component/ComboBox.cxx23
-rw-r--r--forms/source/component/Filter.cxx15
-rw-r--r--forms/source/component/FormattedField.cxx2
-rw-r--r--forms/source/component/ListBox.cxx20
-rw-r--r--forms/source/inc/componenttools.hxx6
-rw-r--r--forms/source/misc/componenttools.cxx12
-rw-r--r--forms/source/runtime/formoperations.cxx22
8 files changed, 62 insertions, 58 deletions
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index ae1cbc2b7a5b..a93d121d4b99 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -32,6 +32,7 @@
#include "property.hrc"
#endif
#include "property.hxx"
+#include "componenttools.hxx"
#include "ids.hxx"
#include "findpos.hxx"
#include <com/sun/star/io/XPersistObject.hpp>
@@ -169,11 +170,20 @@ Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(RuntimeExce
//------------------------------------------------------------------
Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
{
- Reference<XTypeProvider> xProv;
-
- if (query_aggregation(m_xAggregate, xProv))
- return concatSequences(OGridColumn_BASE::getTypes(), xProv->getTypes());
- return OGridColumn_BASE::getTypes();
+ TypeBag aTypes( OGridColumn_BASE::getTypes() );
+ // erase the types which we do not support
+ aTypes.removeType( XFormComponent::static_type() );
+ aTypes.removeType( XServiceInfo::static_type() );
+ aTypes.removeType( XBindableValue::static_type() );
+ aTypes.removeType( XPropertyContainer::static_type() );
+ // but re-add their base class(es)
+ aTypes.addType( XChild::static_type() );
+
+ Reference< XTypeProvider > xProv;
+ if ( query_aggregation( m_xAggregate, xProv ))
+ aTypes.addTypes( xProv->getTypes() );
+
+ return aTypes.getTypes();
}
//------------------------------------------------------------------
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 4dfdb61cbb2b..278e561de251 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -532,26 +532,11 @@ void OComboBoxModel::loadData( bool _bForce )
else
{
// otherwise look for the alias
- Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY);
- if (!xFactory.is())
- break;
-
- Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer();
- try
- {
- Reference<XPropertySet> xFormAsSet(xForm, UNO_QUERY);
- ::rtl::OUString aStatement;
- xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement;
- xComposer->setQuery(aStatement);
- }
- catch(Exception&)
- {
- disposeComponent(xComposer);
- break;
- }
+ Reference<XPropertySet> xFormProp(xForm,UNO_QUERY);
+ Reference< XColumnsSupplier > xSupplyFields;
+ xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupplyFields;
// search the field
- Reference< XColumnsSupplier > xSupplyFields(xComposer, UNO_QUERY);
DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !");
Reference< XNameAccess > xFieldNames = xSupplyFields->getColumns();
@@ -562,8 +547,6 @@ void OComboBoxModel::loadData( bool _bForce )
if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet))
xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName;
}
-
- disposeComponent(xComposer);
}
if (!aFieldName.getLength())
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index b4c7eddf81d8..9cbc5237cf95 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -397,17 +397,10 @@ namespace frm
const Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
// create a query composer
- const Reference< XConnection > xConnection( ::dbtools::getConnection( xForm ), UNO_SET_THROW );
- const Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY_THROW );
- const Reference< XSQLQueryComposer > xComposer( xFactory->createQueryComposer(), UNO_SET_THROW );
-
- // set the statement on the composer
- ::rtl::OUString sStatement;
- xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sStatement;
- xComposer->setQuery( sStatement );
+ Reference< XColumnsSupplier > xSuppColumns;
+ xFormProps->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSuppColumns;
- // the field we're bound to
- const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW );
+ const Reference< XConnection > xConnection( ::dbtools::getConnection( xForm ), UNO_SET_THROW );
const Reference< XNameAccess > xFieldNames( xSuppColumns->getColumns(), UNO_SET_THROW );
if ( !xFieldNames->hasByName( sFieldName ) )
return;
@@ -417,7 +410,7 @@ namespace frm
xComposerFieldProps->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName;
// obtain the table of the field
- const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW );
+ const Reference< XTablesSupplier > xSuppTables( xSuppColumns, UNO_QUERY_THROW );
const Reference< XNameAccess > xTablesNames( xSuppTables->getTables(), UNO_SET_THROW );
const Reference< XNamed > xNamedTable( xTablesNames->getByName( sTableName ), UNO_QUERY_THROW );
sTableName = xNamedTable->getName();
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 6e11fa7c9dbb..a35a300dda78 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -580,7 +580,7 @@ void OFormattedModel::_propertyChanged( const com::sun::star::beans::PropertyCha
// as m_aSaveValue (which is used by commitControlValueToDbColumn) is format dependent we have
// to recalc it, which is done by translateDbColumnToControlValue
- if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast())
+ if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast())
{
setControlValue( translateDbColumnToControlValue(), eOther );
}
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 0aa90d9919cf..3ef087c42bf5 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -701,25 +701,10 @@ namespace frm
else
{
// otherwise look for the alias
- Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY);
- if (!xFactory.is())
- break;
-
- Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer();
- try
- {
- ::rtl::OUString aStatement;
- xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= aStatement;
- xComposer->setQuery( aStatement );
- }
- catch(Exception&)
- {
- disposeComponent(xComposer);
- break;
- }
+ Reference< XColumnsSupplier > xSupplyFields;
+ xFormProps->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupplyFields;
// search the field
- Reference<XColumnsSupplier> xSupplyFields(xComposer, UNO_QUERY);
DBG_ASSERT(xSupplyFields.is(), "OListBoxModel::loadData : invalid query composer !");
Reference<XNameAccess> xFieldNames = xSupplyFields->getColumns();
@@ -730,7 +715,6 @@ namespace frm
if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet))
xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName;
}
- disposeComponent(xComposer);
}
}
if (!aFieldName.getLength())
diff --git a/forms/source/inc/componenttools.hxx b/forms/source/inc/componenttools.hxx
index 73771f19783a..e91573c43d2f 100644
--- a/forms/source/inc/componenttools.hxx
+++ b/forms/source/inc/componenttools.hxx
@@ -48,7 +48,7 @@ namespace frm
typedef ::com::sun::star::uno::Type Type;
public:
- bool operator()( const Type& _rLHS, const Type& _rRHS )
+ bool operator()( const Type& _rLHS, const Type& _rRHS ) const
{
return _rLHS.getTypeName() < _rRHS.getTypeName();
}
@@ -85,7 +85,9 @@ namespace frm
const TypeSequence& _rTypes3
);
- void addTypes( const TypeSequence& _rTypes );
+ void addType( const Type& i_rType );
+ void addTypes( const TypeSequence& _rTypes );
+ void removeType( const Type& i_rType );
/** returns the types represented by this bag
*/
diff --git a/forms/source/misc/componenttools.cxx b/forms/source/misc/componenttools.cxx
index 80e772dbd0da..bdba7456fa7f 100644
--- a/forms/source/misc/componenttools.cxx
+++ b/forms/source/misc/componenttools.cxx
@@ -84,6 +84,18 @@ namespace frm
}
//--------------------------------------------------------------------
+ void TypeBag::addType( const Type& i_rType )
+ {
+ m_aTypes.insert( i_rType );
+ }
+
+ //--------------------------------------------------------------------
+ void TypeBag::removeType( const TypeBag::Type& i_rType )
+ {
+ m_aTypes.erase( i_rType );
+ }
+
+ //--------------------------------------------------------------------
TypeBag::TypeSequence TypeBag::getTypes() const
{
TypeSequence aTypes( m_aTypes.size() );
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 48e6159585ab..68f3e0e7773f 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -48,6 +48,8 @@
#include <com/sun/star/form/XConfirmDeleteListener.hpp>
#include <com/sun/star/sdb/RowChangeEvent.hpp>
#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/SQLFilterOperator.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
@@ -94,6 +96,7 @@ namespace frm
using ::com::sun::star::form::runtime::FeatureState;
using ::com::sun::star::lang::IllegalArgumentException;
using ::com::sun::star::sdbc::SQLException;
+ using namespace ::com::sun::star::sdbc;
using ::com::sun::star::form::XForm;
using ::com::sun::star::ucb::AlreadyInitializedException;
using ::com::sun::star::util::XModifyBroadcaster;
@@ -112,6 +115,7 @@ namespace frm
using ::com::sun::star::sdbcx::XRowLocate;
using ::com::sun::star::form::XConfirmDeleteListener;
using ::com::sun::star::sdb::RowChangeEvent;
+ using namespace ::com::sun::star::sdb;
using ::com::sun::star::form::XReset;
using ::com::sun::star::beans::XMultiPropertySet;
using ::com::sun::star::uno::makeAny;
@@ -1684,7 +1688,23 @@ namespace frm
void FormOperations::impl_appendFilterByColumn_throw( const void* _pActionParam ) const
{
const param_appendFilterByColumn* pParam = static_cast< const param_appendFilterByColumn* >( _pActionParam );
- m_xParser->appendFilterByColumn( pParam->xField, sal_True );
+ sal_Int32 nOp = SQLFilterOperator::EQUAL;
+ if ( pParam->xField.is() )
+ {
+ sal_Int32 nType = 0;
+ pParam->xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nType;
+ switch(nType)
+ {
+ case DataType::VARCHAR:
+ case DataType::CHAR:
+ case DataType::LONGVARCHAR:
+ nOp = SQLFilterOperator::LIKE;
+ break;
+ default:
+ nOp = SQLFilterOperator::EQUAL;
+ }
+ }
+ m_xParser->appendFilterByColumn( pParam->xField, sal_True,nOp );
}
//------------------------------------------------------------------------------