INTEGRATION: CWS dba31a (1.6.34); FILE MERGED
2008/07/04 20:11:47 fs 1.6.34.3: #i66628# impl_getCurrentControlModel_throw: also care for grid control/columns 2008/07/03 08:41:55 fs 1.6.34.2: #i66628# +RefreshCurrentControl 2008/07/02 12:13:14 fs 1.6.34.1: #i90914# after doing a reload, refresh everything which is refreshable
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: formoperations.cxx,v $
|
||||
* $Revision: 1.7 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@@ -122,7 +122,9 @@ namespace frm
|
||||
using ::com::sun::star::beans::PropertyValue;
|
||||
using ::com::sun::star::ui::dialogs::XExecutableDialog;
|
||||
using ::com::sun::star::beans::NamedValue;
|
||||
|
||||
using ::com::sun::star::util::XRefreshable;
|
||||
using ::com::sun::star::awt::XControlModel;
|
||||
/** === end UNO using === **/
|
||||
namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
|
||||
namespace RowChangeAction = ::com::sun::star::sdb::RowChangeAction;
|
||||
@@ -311,6 +313,13 @@ namespace frm
|
||||
}
|
||||
break;
|
||||
|
||||
case FormFeature::RefreshCurrentControl:
|
||||
{
|
||||
Reference< XRefreshable > xControlModelRefresh( impl_getCurrentControlModel_throw(), UNO_QUERY );
|
||||
aState.Enabled = xControlModelRefresh.is();
|
||||
}
|
||||
break;
|
||||
|
||||
case FormFeature::SaveRecordChanges:
|
||||
case FormFeature::UndoRecordChanges:
|
||||
aState.Enabled = impl_isModifiedRow_throw() || m_bActiveControlModified;
|
||||
@@ -495,7 +504,6 @@ namespace frm
|
||||
switch ( _nFeature )
|
||||
{
|
||||
case FormFeature::MoveToFirst:
|
||||
// move
|
||||
m_xCursor->first();
|
||||
break;
|
||||
|
||||
@@ -550,6 +558,15 @@ namespace frm
|
||||
}
|
||||
break;
|
||||
|
||||
case FormFeature::RefreshCurrentControl:
|
||||
{
|
||||
Reference< XRefreshable > xControlModelRefresh( impl_getCurrentControlModel_throw(), UNO_QUERY );
|
||||
OSL_ENSURE( xControlModelRefresh.is(), "FormOperations::execute: how did you reach this?" );
|
||||
if ( xControlModelRefresh.is() )
|
||||
xControlModelRefresh->refresh();
|
||||
}
|
||||
break;
|
||||
|
||||
case FormFeature::DeleteRecord:
|
||||
{
|
||||
sal_uInt32 nCount = impl_getRowCount_throw();
|
||||
@@ -1281,6 +1298,31 @@ namespace frm
|
||||
return lcl_safeGetPropertyValue_throw( m_xCursorProperties, PROPERTY_INSERTONLY, true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Reference< XControlModel > FormOperations::impl_getCurrentControlModel_throw() const
|
||||
{
|
||||
Reference< XControl > xControl( m_xController->getCurrentControl() );
|
||||
|
||||
// special handling for grid controls
|
||||
Reference< XGrid > xGrid( xControl, UNO_QUERY );
|
||||
Reference< XControlModel > xControlModel;
|
||||
|
||||
if ( xGrid.is() )
|
||||
{
|
||||
Reference< XIndexAccess > xColumns( xControl->getModel(), UNO_QUERY_THROW );
|
||||
sal_Int16 nCurrentPos = xGrid->getCurrentColumnPosition();
|
||||
nCurrentPos = impl_gridView2ModelPos_nothrow( xColumns, nCurrentPos );
|
||||
|
||||
if ( nCurrentPos != (sal_Int16)-1 )
|
||||
xColumns->getByIndex( nCurrentPos ) >>= xControlModel;
|
||||
}
|
||||
else if ( xControl.is() )
|
||||
{
|
||||
xControlModel = xControl->getModel();
|
||||
}
|
||||
return xControlModel;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Reference< XPropertySet > FormOperations::impl_getCurrentBoundField_nothrow( ) const
|
||||
{
|
||||
@@ -1291,25 +1333,7 @@ namespace frm
|
||||
Reference< XPropertySet > xField;
|
||||
try
|
||||
{
|
||||
Reference< XControl > xControl( m_xController->getCurrentControl() );
|
||||
|
||||
// special handling for grid controls
|
||||
Reference< XGrid > xGrid( xControl, UNO_QUERY );
|
||||
Reference< XPropertySet > xControlModel;
|
||||
|
||||
if ( xGrid.is() )
|
||||
{
|
||||
Reference< XIndexAccess > xColumns( xControl->getModel(), UNO_QUERY_THROW );
|
||||
sal_Int16 nCurrentPos = xGrid->getCurrentColumnPosition();
|
||||
nCurrentPos = impl_gridView2ModelPos_nothrow( xColumns, nCurrentPos );
|
||||
|
||||
if ( nCurrentPos != (sal_Int16)-1 )
|
||||
xColumns->getByIndex( nCurrentPos ) >>= xControlModel;
|
||||
}
|
||||
else if ( xControl.is() )
|
||||
{
|
||||
xControlModel = xControlModel.query( xControl->getModel() );
|
||||
}
|
||||
Reference< XPropertySet > xControlModel( impl_getCurrentControlModel_throw(), UNO_QUERY );
|
||||
|
||||
if ( xControlModel.is() && ::comphelper::hasProperty( PROPERTY_BOUNDFIELD, xControlModel ) )
|
||||
xControlModel->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xField;
|
||||
|
Reference in New Issue
Block a user