summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-06-04 14:23:34 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-06-04 14:23:34 +0200
commit3a9fa417bcc24977c9db13b9f8b9103f94942974 (patch)
treed2c2c66df8d2ec70e5aa4998faff1a975e1519a6 /forms
parent9e515931a710a1f350494d7b99cfd1ec0add3471 (diff)
parent516ced09925f589873d65cbb9571294dddbe7af8 (diff)
CWS-TOOLING: integrate CWS dba33f
Notes
Notes: split repo tag: components_ooo/DEV300_m81
Diffstat (limited to 'forms')
-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/runtime/formoperations.cxx22
5 files changed, 31 insertions, 51 deletions
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 88135c040d71..f2ad20613a22 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -700,25 +700,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();
@@ -729,7 +714,6 @@ namespace frm
if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet))
xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName;
}
- disposeComponent(xComposer);
}
}
if (!aFieldName.getLength())
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 );
}
//------------------------------------------------------------------------------