diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/cui/macropg.src | 4 | ||||
-rw-r--r-- | svx/source/cui/selector.cxx | 9 | ||||
-rw-r--r-- | svx/source/cui/selector.hxx | 1 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 23 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 855 | ||||
-rw-r--r-- | svx/source/form/fmPropBrw.cxx | 14 | ||||
-rw-r--r-- | svx/source/form/fmctrler.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/fmpgeimp.cxx | 95 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 10 | ||||
-rw-r--r-- | svx/source/form/fmstring.src | 103 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/formcontrolfactory.cxx | 70 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 2 | ||||
-rw-r--r-- | svx/source/inc/fmPropBrw.hxx | 1 | ||||
-rw-r--r-- | svx/source/inc/fmpgeimp.hxx | 13 | ||||
-rw-r--r-- | svx/source/inc/fmresids.hrc | 46 | ||||
-rw-r--r-- | svx/source/inc/formcontrolfactory.hxx | 17 | ||||
-rw-r--r-- | svx/source/inc/gridcell.hxx | 199 |
18 files changed, 1027 insertions, 447 deletions
diff --git a/svx/source/cui/macropg.src b/svx/source/cui/macropg.src index 0de8a8c5e1dd..e9b6c10d6014 100644 --- a/svx/source/cui/macropg.src +++ b/svx/source/cui/macropg.src @@ -172,12 +172,12 @@ String RID_SVXSTR_EVENT_CREATEDOC String RID_SVXSTR_EVENT_CLOSEDOC { - Text [ en-US ] = "Document is closing" ; + Text [ en-US ] = "Document closed" ; }; String RID_SVXSTR_EVENT_PREPARECLOSEDOC { - Text [ en-US ] = "Close Document" ; + Text [ en-US ] = "Document is closing" ; }; String RID_SVXSTR_EVENT_OPENDOC diff --git a/svx/source/cui/selector.cxx b/svx/source/cui/selector.cxx index 39e22e5ab9f2..83e4aa2b1612 100644 --- a/svx/source/cui/selector.cxx +++ b/svx/source/cui/selector.cxx @@ -1053,6 +1053,7 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog( aCategories.SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); aCommands.SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); + aCommands.SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) ); aOKButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); aCancelButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); @@ -1140,6 +1141,14 @@ IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl ) return 0; } +IMPL_LINK( SvxScriptSelectorDialog, FunctionDoubleClickHdl, Control*, pCtrl ) +{ + (void)pCtrl; + if ( aOKButton.IsEnabled() ) + return ClickHdl( &aOKButton ); + return 0; +} + // Check if command is selected and enable the OK button accordingly // Grab the help text for this id if available and update the description field void diff --git a/svx/source/cui/selector.hxx b/svx/source/cui/selector.hxx index fe6152131c9d..10346f251563 100644 --- a/svx/source/cui/selector.hxx +++ b/svx/source/cui/selector.hxx @@ -216,6 +216,7 @@ class SvxScriptSelectorDialog : public ModelessDialog DECL_LINK( ClickHdl, Button * ); DECL_LINK( SelectHdl, Control* ); + DECL_LINK( FunctionDoubleClickHdl, Control* ); void UpdateUI(); void ResizeControls(); diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 20de4e139b9d..c210919bd09d 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -889,9 +889,6 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe break; case SID_FM_SHOWCOLS_MORE: { - //CHINA001 FmShowColsDialog dlg(NULL); - //CHINA001 dlg.SetColumns(xCols); - //CHINA001 dlg.Execute(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { @@ -960,24 +957,14 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe } else { - // Standardlabel setzen - ::rtl::OUString sLabelBase = String( SVX_RES( RID_STR_COLUMN ) ); - // disambiguate the name - Reference< XNameAccess > xColNames( xCols, UNO_QUERY ); - ::rtl::OUString sLabel; - for ( sal_Int32 i=1; i<65535; ++i ) - { - sLabel = sLabelBase; - sLabel += ::rtl::OUString::valueOf( (sal_Int32)i ); - if ( !xColNames->hasByName( sLabel ) ) - break; - } - // no fallback in case the name is not unique (which is rather improbable) .... + FormControlFactory factory( ::comphelper::getProcessServiceFactory() ); + + ::rtl::OUString sLabel = factory.getDefaultUniqueName_ByComponentType( + Reference< XNameAccess >( xCols, UNO_QUERY_THROW ), xNewCol ); xNewCol->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel ) ); xNewCol->setPropertyValue( FM_PROP_NAME, makeAny( sLabel ) ); - FormControlFactory determine( ::comphelper::getProcessServiceFactory() ); - determine.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xNewCol ); + factory.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xNewCol ); xCols->insertByIndex( nPos, makeAny( xNewCol ) ); } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 45a67a09e52d..96f11adfa6df 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -30,55 +30,52 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include "gridcell.hxx" -#include "fmtools.hxx" -#include <stdio.h> -#ifndef _SVX_FMPROP_HRC + + #include "fmprop.hrc" -#endif +#include "fmresids.hrc" +#include "fmtools.hxx" +#include "gridcell.hxx" #include "gridcols.hxx" #include "sdbdatacolumn.hxx" + +#include <com/sun/star/awt/LineEndFormat.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/awt/VisualEffect.hpp> -#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/form/FormComponentType.hpp> +#include <com/sun/star/form/XBoundComponent.hpp> #include <com/sun/star/script/XEventAttacherManager.hpp> -#ifndef _COM_SUN_STAR_SDDB_XCOLUMNSSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif #include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> -#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/util/NumberFormat.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/awt/LineEndFormat.hpp> -#include <com/sun/star/awt/MouseWheelBehavior.hpp> -#ifndef _COM_SUN_STAR_SCRTIP_XEVENTATTACHERMANAGER_HPP_ -#include <com/sun/star/script/XEventAttacherManager.hpp> -#endif -#include <svtools/fmtfield.hxx> -#include <svtools/numuno.hxx> -#include <svtools/calendar.hxx> -#include <vcl/longcurr.hxx> -#include <svx/dialmgr.hxx> -#ifndef _SVX_FMRESIDS_HRC -#include "fmresids.hrc" -#endif -#include <tools/shl.hxx> -#include <tools/diagnose_ex.h> +#include <com/sun/star/util/XNumberFormatter.hpp> + +#include <comphelper/extract.hxx> #include <comphelper/numbers.hxx> #include <comphelper/property.hxx> -#include <comphelper/extract.hxx> +#include <connectivity/formattedcolumnvalue.hxx> #include <cppuhelper/typeprovider.hxx> #include <i18npool/lang.h> -#include <connectivity/formattedcolumnvalue.hxx> -#include <math.h> #include <rtl/math.hxx> +#include <svtools/calendar.hxx> +#include <svtools/fmtfield.hxx> +#include <svtools/numuno.hxx> #include <svtools/svmedit.hxx> +#include <svx/dialmgr.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> +#include <tools/shl.hxx> +#include <vcl/longcurr.hxx> + +#include <math.h> +#include <stdio.h> using namespace ::connectivity; using namespace ::connectivity::simple; @@ -228,13 +225,15 @@ void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< ::com::s { switch (nTypeId) { - case TYPE_CHECKBOX: m_pCell = new FmXCheckBoxCell(this, pCellControl); break; - case TYPE_LISTBOX: m_pCell = new FmXListBoxCell(this, pCellControl); break; + case TYPE_CHECKBOX: m_pCell = new FmXCheckBoxCell( this, *pCellControl ); break; + case TYPE_LISTBOX: m_pCell = new FmXListBoxCell( this, *pCellControl ); break; + case TYPE_COMBOBOX: m_pCell = new FmXComboBoxCell( this, *pCellControl ); break; default: - m_pCell = new FmXEditCell(this, pCellControl); + m_pCell = new FmXEditCell( this, *pCellControl ); } } m_pCell->acquire(); + m_pCell->init(); impl_toggleScriptManager_nothrow( true ); @@ -3199,13 +3198,33 @@ TYPEINIT0(FmXGridCell); DBG_NAME(FmXGridCell); //----------------------------------------------------------------------------- -FmXGridCell::FmXGridCell(DbGridColumn* pColumn, DbCellControl* pControl) +FmXGridCell::FmXGridCell( DbGridColumn* pColumn, DbCellControl* _pControl ) :OComponentHelper(m_aMutex) ,m_pColumn(pColumn) - ,m_pCellControl(pControl) + ,m_pCellControl( _pControl ) + ,m_aWindowListeners( m_aMutex ) + ,m_aFocusListeners( m_aMutex ) + ,m_aKeyListeners( m_aMutex ) + ,m_aMouseListeners( m_aMutex ) + ,m_aMouseMotionListeners( m_aMutex ) { DBG_CTOR(FmXGridCell,NULL); +} + +//----------------------------------------------------------------------------- +void FmXGridCell::init() +{ + Window* pEventWindow( getEventWindow() ); + if ( pEventWindow ) + pEventWindow->AddEventListener( LINK( this, FmXGridCell, OnWindowEvent ) ); +} +//----------------------------------------------------------------------------- +Window* FmXGridCell::getEventWindow() const +{ + if ( m_pCellControl ) + return &m_pCellControl->GetWindow(); + return NULL; } //----------------------------------------------------------------------------- @@ -3236,25 +3255,34 @@ void FmXGridCell::SetTextLineColor(const Color& _rColor) // XTypeProvider //------------------------------------------------------------------ -Sequence< sal_Int8 > SAL_CALL FmXGridCell::getImplementationId() throw(RuntimeException) -{ - static ::cppu::OImplementationId* pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); +Sequence< Type > SAL_CALL FmXGridCell::getTypes( ) throw (RuntimeException) +{ + Sequence< uno::Type > aTypes = ::comphelper::concatSequences( + ::cppu::OComponentHelper::getTypes(), + FmXGridCell_Base::getTypes() + ); + if ( m_pCellControl ) + aTypes = ::comphelper::concatSequences( + aTypes, + FmXGridCell_WindowBase::getTypes() + ); + return aTypes; } +//------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXGridCell ) + // OComponentHelper //----------------------------------------------------------------------------- void FmXGridCell::disposing() { + lang::EventObject aEvent( *this ); + m_aWindowListeners.disposeAndClear( aEvent ); + m_aFocusListeners.disposeAndClear( aEvent ); + m_aKeyListeners.disposeAndClear( aEvent ); + m_aMouseListeners.disposeAndClear( aEvent ); + m_aMouseMotionListeners.disposeAndClear( aEvent ); + OComponentHelper::disposing(); m_pColumn = NULL; DELETEZ(m_pCellControl); @@ -3263,12 +3291,13 @@ void FmXGridCell::disposing() //------------------------------------------------------------------ Any SAL_CALL FmXGridCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) { - Any aReturn = OComponentHelper::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast< ::com::sun::star::awt::XControl* >(this), - static_cast< ::com::sun::star::form::XBoundControl* >(this) - ); + Any aReturn = OComponentHelper::queryAggregation( _rType ); + + if ( !aReturn.hasValue() ) + aReturn = FmXGridCell_Base::queryInterface( _rType ); + + if ( !aReturn.hasValue() && ( m_pCellControl != NULL ) ) + aReturn = FmXGridCell_WindowBase::queryInterface( _rType ); return aReturn; } @@ -3305,6 +3334,231 @@ void FmXGridCell::setLock(sal_Bool _bLock) throw( RuntimeException ) } } +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::setPosSize( ::sal_Int32 _X, ::sal_Int32 _Y, ::sal_Int32 _Width, ::sal_Int32 _Height, ::sal_Int16 _Flags ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::setPosSize: not implemented" ); + (void)_X; + (void)_Y; + (void)_Width; + (void)_Height; + (void)_Flags; + // not allowed to tamper with this for a grid cell +} + +//------------------------------------------------------------------ +awt::Rectangle SAL_CALL FmXGridCell::getPosSize( ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::getPosSize: not implemented" ); + return awt::Rectangle(); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::setVisible( ::sal_Bool _Visible ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::setVisible: not implemented" ); + (void)_Visible; + // not allowed to tamper with this for a grid cell +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::setEnable( ::sal_Bool _Enable ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::setEnable: not implemented" ); + (void)_Enable; + // not allowed to tamper with this for a grid cell +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::setFocus( ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::setFocus: not implemented" ); + // not allowed to tamper with this for a grid cell +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException) +{ + m_aWindowListeners.addInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removeWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException) +{ + m_aWindowListeners.removeInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException) +{ + m_aFocusListeners.addInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removeFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException) +{ + m_aFocusListeners.removeInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException) +{ + m_aKeyListeners.addInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removeKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException) +{ + m_aKeyListeners.removeInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException) +{ + m_aMouseListeners.addInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removeMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException) +{ + m_aMouseListeners.removeInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException) +{ + m_aMouseMotionListeners.addInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException) +{ + m_aMouseMotionListeners.removeInterface( _rxListener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::addPaintListener( const Reference< awt::XPaintListener >& _rxListener ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::addPaintListener: not implemented" ); + (void)_rxListener; +} + +//------------------------------------------------------------------ +void SAL_CALL FmXGridCell::removePaintListener( const Reference< awt::XPaintListener >& _rxListener ) throw (RuntimeException) +{ + OSL_ENSURE( false, "FmXGridCell::removePaintListener: not implemented" ); + (void)_rxListener; +} + +//------------------------------------------------------------------ +IMPL_LINK( FmXGridCell, OnWindowEvent, VclWindowEvent*, _pEvent ) +{ + ENSURE_OR_THROW( _pEvent, "illegal event pointer" ); + ENSURE_OR_THROW( _pEvent->GetWindow(), "illegal window" ); + onWindowEvent( _pEvent->GetId(), *_pEvent->GetWindow(), _pEvent->GetData() ); + return 1L; +} + +//------------------------------------------------------------------------------ +void FmXGridCell::onFocusGained( const awt::FocusEvent& _rEvent ) +{ + m_aFocusListeners.notifyEach( &awt::XFocusListener::focusGained, _rEvent ); +} + +//------------------------------------------------------------------------------ +void FmXGridCell::onFocusLost( const awt::FocusEvent& _rEvent ) +{ + m_aFocusListeners.notifyEach( &awt::XFocusListener::focusLost, _rEvent ); +} + +//------------------------------------------------------------------------------ +void FmXGridCell::onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ) +{ + switch ( _nEventId ) + { + case VCLEVENT_CONTROL_GETFOCUS: + case VCLEVENT_WINDOW_GETFOCUS: + case VCLEVENT_CONTROL_LOSEFOCUS: + case VCLEVENT_WINDOW_LOSEFOCUS: + { + if ( ( _rWindow.IsCompoundControl() + && ( _nEventId == VCLEVENT_CONTROL_GETFOCUS + || _nEventId == VCLEVENT_CONTROL_LOSEFOCUS + ) + ) + || ( !_rWindow.IsCompoundControl() + && ( _nEventId == VCLEVENT_WINDOW_GETFOCUS + || _nEventId == VCLEVENT_WINDOW_LOSEFOCUS + ) + ) + ) + { + if ( !m_aFocusListeners.getLength() ) + break; + + bool bFocusGained = ( _nEventId == VCLEVENT_CONTROL_GETFOCUS ) || ( _nEventId == VCLEVENT_WINDOW_GETFOCUS ); + + awt::FocusEvent aEvent; + aEvent.Source = *this; + aEvent.FocusFlags = _rWindow.GetGetFocusFlags(); + aEvent.Temporary = sal_False; + + if ( bFocusGained ) + onFocusGained( aEvent ); + else + onFocusLost( aEvent ); + } + } + break; + case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: + case VCLEVENT_WINDOW_MOUSEBUTTONUP: + { + if ( !m_aMouseListeners.getLength() ) + break; + + const bool bButtonDown = ( _nEventId == VCLEVENT_WINDOW_MOUSEBUTTONDOWN ); + + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast< const ::MouseEvent* >( _pEventData ), *this ) ); + m_aMouseListeners.notifyEach( bButtonDown ? &awt::XMouseListener::mousePressed : &awt::XMouseListener::mouseReleased, aEvent ); + } + break; + case VCLEVENT_WINDOW_MOUSEMOVE: + { + const MouseEvent& rMouseEvent = *static_cast< const ::MouseEvent* >( _pEventData ); + if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() ) + { + if ( m_aMouseListeners.getLength() != 0 ) + { + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) ); + m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent ); + } + } + else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() ) + { + if ( m_aMouseMotionListeners.getLength() != 0 ) + { + awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) ); + aEvent.ClickCount = 0; + const bool bSimpleMove = ( ( rMouseEvent.GetMode() & MOUSE_SIMPLEMOVE ) != 0 ); + m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent ); + } + } + } + break; + case VCLEVENT_WINDOW_KEYINPUT: + case VCLEVENT_WINDOW_KEYUP: + { + if ( !m_aKeyListeners.getLength() ) + break; + + const bool bKeyPressed = ( _nEventId == VCLEVENT_WINDOW_KEYINPUT ); + awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( *static_cast< const ::KeyEvent* >( _pEventData ), *this ) ); + m_aKeyListeners.notifyEach( bKeyPressed ? &awt::XKeyListener::keyPressed: &awt::XKeyListener::keyReleased, aEvent ); + } + break; + } +} + /*************************************************************************/ TYPEINIT1(FmXDataCell, FmXGridCell); //------------------------------------------------------------------------------ @@ -3326,6 +3580,12 @@ void FmXDataCell::UpdateFromColumn() /*************************************************************************/ TYPEINIT1(FmXTextCell, FmXDataCell); +FmXTextCell::FmXTextCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXDataCell( pColumn, _rControl ) + ,m_bFastPaint( sal_True ) +{ +} + //------------------------------------------------------------------------------ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect, @@ -3372,15 +3632,16 @@ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, DBG_NAME(FmXEditCell); //------------------------------------------------------------------------------ -FmXEditCell::FmXEditCell(DbGridColumn* pColumn, DbCellControl* pControl) - :FmXTextCell(pColumn, pControl) +FmXEditCell::FmXEditCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXTextCell( pColumn, _rControl ) ,m_aTextListeners(m_aMutex) + ,m_aChangeListeners( m_aMutex ) ,m_pEditImplementation( NULL ) ,m_bOwnEditImplementation( false ) { DBG_CTOR(FmXEditCell,NULL); - DbTextField* pTextField = PTR_CAST( DbTextField, pControl ); + DbTextField* pTextField = PTR_CAST( DbTextField, &_rControl ); if ( pTextField ) { @@ -3390,11 +3651,9 @@ FmXEditCell::FmXEditCell(DbGridColumn* pColumn, DbCellControl* pControl) } else { - m_pEditImplementation = new EditImplementation( *static_cast< Edit* >( pControl->GetControl() ) ); + m_pEditImplementation = new EditImplementation( static_cast< Edit& >( _rControl.GetWindow() ) ); m_bOwnEditImplementation = true; } - - m_pEditImplementation->SetModifyHdl( LINK( this, FmXEditCell, OnTextChanged ) ); } //------------------------------------------------------------------ @@ -3416,6 +3675,7 @@ void FmXEditCell::disposing() { ::com::sun::star::lang::EventObject aEvt(*this); m_aTextListeners.disposeAndClear(aEvt); + m_aChangeListeners.disposeAndClear(aEvt); m_pEditImplementation->SetModifyHdl( Link() ); if ( m_bOwnEditImplementation ) @@ -3428,27 +3688,26 @@ void FmXEditCell::disposing() //------------------------------------------------------------------ Any SAL_CALL FmXEditCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) { - Any aReturn = FmXDataCell::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast< ::com::sun::star::awt::XTextComponent* >(this) - ); + Any aReturn = FmXTextCell::queryAggregation( _rType ); + + if ( !aReturn.hasValue() ) + aReturn = FmXEditCell_Base::queryInterface( _rType ); + return aReturn; } //------------------------------------------------------------------------- Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXEditCell::getTypes( ) throw(RuntimeException) { - Sequence< ::com::sun::star::uno::Type > aTypes = OComponentHelper::getTypes(); - - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 2); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XControl >* >(NULL)); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XTextComponent >* >(NULL)); - - return aTypes; + return ::comphelper::concatSequences( + FmXTextCell::getTypes(), + FmXEditCell_Base::getTypes() + ); } +//------------------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXEditCell ) + // ::com::sun::star::awt::XTextComponent //------------------------------------------------------------------------------ void SAL_CALL FmXEditCell::addTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException ) @@ -3473,7 +3732,7 @@ void SAL_CALL FmXEditCell::setText( const ::rtl::OUString& aText ) throw( Runtim // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht. // ::com::sun::star::awt::Toolkit soll JAVA-komform sein... - OnTextChanged( NULL ); + onTextChanged(); } } @@ -3583,30 +3842,71 @@ void SAL_CALL FmXEditCell::setMaxTextLen( sal_Int16 nLen ) throw( RuntimeExcepti } //------------------------------------------------------------------------------ -IMPL_LINK( FmXEditCell, OnTextChanged, void*, EMPTYARG ) +void SAL_CALL FmXEditCell::addChangeListener( const Reference< form::XChangeListener >& _Listener ) throw (RuntimeException) { - if ( m_pEditImplementation ) + m_aChangeListeners.addInterface( _Listener ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL FmXEditCell::removeChangeListener( const Reference< form::XChangeListener >& _Listener ) throw (RuntimeException) +{ + m_aChangeListeners.removeInterface( _Listener ); +} + +//------------------------------------------------------------------------------ +void FmXEditCell::onTextChanged() +{ + ::com::sun::star::awt::TextEvent aEvent; + aEvent.Source = *this; + m_aTextListeners.notifyEach( &awt::XTextListener::textChanged, aEvent ); +} + +//------------------------------------------------------------------------------ +void FmXEditCell::onFocusGained( const awt::FocusEvent& _rEvent ) +{ + FmXTextCell::onFocusGained( _rEvent ); + m_sValueOnEnter = getText(); +} + +//------------------------------------------------------------------------------ +void FmXEditCell::onFocusLost( const awt::FocusEvent& _rEvent ) +{ + FmXTextCell::onFocusLost( _rEvent ); + + if ( getText() != m_sValueOnEnter ) { - ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners ); - ::com::sun::star::awt::TextEvent aEvt; - aEvt.Source = *this; - while( aIt.hasMoreElements() ) - ((::com::sun::star::awt::XTextListener *)aIt.next())->textChanged( aEvt ); + lang::EventObject aEvent( *this ); + m_aChangeListeners.notifyEach( &XChangeListener::changed, aEvent ); } - return 1; +} + +//------------------------------------------------------------------------------ +void FmXEditCell::onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ) +{ + switch ( _nEventId ) + { + case VCLEVENT_EDIT_MODIFY: + { + if ( m_pEditImplementation && m_aTextListeners.getLength() ) + onTextChanged(); + return; + } + break; + } + + FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData ); } /*************************************************************************/ DBG_NAME(FmXCheckBoxCell); //------------------------------------------------------------------------------ -FmXCheckBoxCell::FmXCheckBoxCell(DbGridColumn* pColumn, DbCellControl* pControl) - :FmXDataCell(pColumn, pControl) +FmXCheckBoxCell::FmXCheckBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXDataCell( pColumn, _rControl ) ,m_aItemListeners(m_aMutex) - ,m_pBox(&((CheckBoxControl*)pControl->GetControl())->GetBox()) + ,m_aActionListeners( m_aMutex ) + ,m_pBox( & static_cast< CheckBoxControl& >( _rControl.GetWindow() ).GetBox() ) { DBG_CTOR(FmXCheckBoxCell,NULL); - - ((CheckBoxControl*)pControl->GetControl())->SetClickHdl( LINK( this, FmXCheckBoxCell, OnClick ) ); } //------------------------------------------------------------------ @@ -3627,8 +3927,9 @@ void FmXCheckBoxCell::disposing() { ::com::sun::star::lang::EventObject aEvt(*this); m_aItemListeners.disposeAndClear(aEvt); + m_aActionListeners.disposeAndClear(aEvt); - ((CheckBoxControl*)m_pCellControl->GetControl())->SetClickHdl(Link()); + static_cast< CheckBoxControl& >( m_pCellControl->GetWindow() ).SetClickHdl(Link()); m_pBox = NULL; FmXDataCell::disposing(); @@ -3637,27 +3938,26 @@ void FmXCheckBoxCell::disposing() //------------------------------------------------------------------ Any SAL_CALL FmXCheckBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) { - Any aReturn = FmXDataCell::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast< ::com::sun::star::awt::XCheckBox* >(this) - ); + Any aReturn = FmXDataCell::queryAggregation( _rType ); + + if ( !aReturn.hasValue() ) + aReturn = FmXCheckBoxCell_Base::queryInterface( _rType ); + return aReturn; } //------------------------------------------------------------------------- Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXCheckBoxCell::getTypes( ) throw(RuntimeException) { - Sequence< ::com::sun::star::uno::Type > aTypes = OComponentHelper::getTypes(); - - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 2); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XControl >* >(NULL)); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XCheckBox >* >(NULL)); - - return aTypes; + return ::comphelper::concatSequences( + FmXDataCell::getTypes(), + FmXCheckBoxCell_Base::getTypes() + ); } +//------------------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXCheckBoxCell ) + //------------------------------------------------------------------ void SAL_CALL FmXCheckBoxCell::addItemListener( const Reference< ::com::sun::star::awt::XItemListener >& l ) throw( RuntimeException ) { @@ -3671,17 +3971,6 @@ void SAL_CALL FmXCheckBoxCell::removeItemListener( const Reference< ::com::sun:: } //------------------------------------------------------------------ -void SAL_CALL FmXCheckBoxCell::setLabel( const ::rtl::OUString& rLabel ) throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if (m_pBox) - { - UpdateFromColumn(); - m_pBox->SetText( rLabel ); - } -} - -//------------------------------------------------------------------ void SAL_CALL FmXCheckBoxCell::setState( short n ) throw( RuntimeException ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3716,42 +4005,89 @@ void SAL_CALL FmXCheckBoxCell::enableTriState( sal_Bool b ) throw( RuntimeExcept } //------------------------------------------------------------------ -IMPL_LINK( FmXCheckBoxCell, OnClick, void*, EMPTYARG ) +void SAL_CALL FmXCheckBoxCell::addActionListener( const Reference< awt::XActionListener >& _Listener ) throw (RuntimeException) { - if (m_pBox) + m_aActionListeners.addInterface( _Listener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXCheckBoxCell::removeActionListener( const Reference< awt::XActionListener >& _Listener ) throw (RuntimeException) +{ + m_aActionListeners.removeInterface( _Listener ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXCheckBoxCell::setLabel( const ::rtl::OUString& _Label ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( m_pColumn ) + { + DbGridControl& rGrid( m_pColumn->GetParent() ); + rGrid.SetColumnTitle( rGrid.GetColumnId( m_pColumn->GetFieldPos() ), _Label ); + } +} + +//------------------------------------------------------------------ +void SAL_CALL FmXCheckBoxCell::setActionCommand( const ::rtl::OUString& _Command ) throw (RuntimeException) +{ + m_aActionCommand = _Command; +} + +//------------------------------------------------------------------ +Window* FmXCheckBoxCell::getEventWindow() const +{ + return m_pBox; +} + +//------------------------------------------------------------------ +void FmXCheckBoxCell::onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ) +{ + switch ( _nEventId ) + { + case VCLEVENT_CHECKBOX_TOGGLE: { // check boxes are to be committed immediately (this holds for ordinary check box controls in // documents, and this must hold for check boxes in grid columns, too // 91210 - 22.08.2001 - frank.schoenheit@sun.com m_pCellControl->Commit(); - // notify our listeners - ::cppu::OInterfaceIteratorHelper aIt( m_aItemListeners ); - - ::com::sun::star::awt::ItemEvent aEvent; - aEvent.Source = *this; - aEvent.Highlighted = sal_False; - aEvent.Selected = m_pBox->GetState(); + Reference< XWindow > xKeepAlive( this ); + if ( m_aItemListeners.getLength() && m_pBox ) + { + awt::ItemEvent aEvent; + aEvent.Source = *this; + aEvent.Highlighted = sal_False; + aEvent.Selected = m_pBox->GetState(); + m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent ); + } + if ( m_aActionListeners.getLength() ) + { + awt::ActionEvent aEvent; + aEvent.Source = *this; + aEvent.ActionCommand = m_aActionCommand; + m_aActionListeners.notifyEach( &awt::XActionListener::actionPerformed, aEvent ); + } + } + break; - while ( aIt.hasMoreElements() ) - static_cast< awt::XItemListener* >( aIt.next() )->itemStateChanged( aEvent ); + default: + FmXDataCell::onWindowEvent( _nEventId, _rWindow, _pEventData ); + break; } - return 1; } /*************************************************************************/ DBG_NAME(FmXListBoxCell); //------------------------------------------------------------------------------ -FmXListBoxCell::FmXListBoxCell(DbGridColumn* pColumn, DbCellControl* pControl) - :FmXTextCell(pColumn, pControl) +FmXListBoxCell::FmXListBoxCell(DbGridColumn* pColumn, DbCellControl& _rControl) + :FmXTextCell( pColumn, _rControl ) ,m_aItemListeners(m_aMutex) ,m_aActionListeners(m_aMutex) - ,m_pBox((ListBox*)pControl->GetControl()) + ,m_pBox( &static_cast< ListBox& >( _rControl.GetWindow() ) ) { DBG_CTOR(FmXListBoxCell,NULL); - m_pBox->AddEventListener( LINK( this, FmXListBoxCell, OnSelect ) ); m_pBox->SetDoubleClickHdl( LINK( this, FmXListBoxCell, OnDoubleClick ) ); } @@ -3786,26 +4122,25 @@ void FmXListBoxCell::disposing() Any SAL_CALL FmXListBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) { Any aReturn = FmXTextCell::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast< ::com::sun::star::awt::XListBox* >(this) - ); + + if ( !aReturn.hasValue() ) + aReturn = FmXListBoxCell_Base::queryInterface( _rType ); + return aReturn; } //------------------------------------------------------------------------- Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXListBoxCell::getTypes( ) throw(RuntimeException) { - Sequence< ::com::sun::star::uno::Type > aTypes = OComponentHelper::getTypes(); - - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 2); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XControl >* >(NULL)); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XListBox >* >(NULL)); - - return aTypes; + return ::comphelper::concatSequences( + FmXTextCell::getTypes(), + FmXListBoxCell_Base::getTypes() + ); } +//------------------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXListBoxCell ) + //------------------------------------------------------------------ void SAL_CALL FmXListBoxCell::addItemListener(const Reference< ::com::sun::star::awt::XItemListener >& l) throw( RuntimeException ) { @@ -4042,10 +4377,10 @@ void SAL_CALL FmXListBoxCell::makeVisible(sal_Int16 nEntry) throw( RuntimeExcept } //------------------------------------------------------------------ -IMPL_LINK(FmXListBoxCell, OnSelect, VclWindowEvent*, _pEvent ) +void FmXListBoxCell::onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ) { - if ( ( _pEvent->GetWindow() == m_pBox ) - && ( _pEvent->GetId() == VCLEVENT_LISTBOX_SELECT ) + if ( ( &_rWindow == m_pBox ) + && ( _nEventId == VCLEVENT_LISTBOX_SELECT ) ) { OnDoubleClick( NULL ); @@ -4059,8 +4394,10 @@ IMPL_LINK(FmXListBoxCell, OnSelect, VclWindowEvent*, _pEvent ) ? m_pBox->GetSelectEntryPos() : 0xFFFF; m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent ); + return; } - return 1; + + FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData ); } @@ -4083,6 +4420,203 @@ IMPL_LINK( FmXListBoxCell, OnDoubleClick, void*, EMPTYARG ) /*************************************************************************/ + +DBG_NAME( FmXComboBoxCell ); + +//------------------------------------------------------------------------------ +FmXComboBoxCell::FmXComboBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXTextCell( pColumn, _rControl ) + ,m_aItemListeners( m_aMutex ) + ,m_aActionListeners( m_aMutex ) + ,m_pComboBox( &static_cast< ComboBox& >( _rControl.GetWindow() ) ) +{ + DBG_CTOR( FmXComboBoxCell, NULL ); +} + +//------------------------------------------------------------------------------ +FmXComboBoxCell::~FmXComboBoxCell() +{ + if ( !OComponentHelper::rBHelper.bDisposed ) + { + acquire(); + dispose(); + } + + DBG_DTOR( FmXComboBoxCell, NULL ); +} + +//----------------------------------------------------------------------------- +void FmXComboBoxCell::disposing() +{ + ::com::sun::star::lang::EventObject aEvt(*this); + m_aItemListeners.disposeAndClear(aEvt); + m_aActionListeners.disposeAndClear(aEvt); + + FmXTextCell::disposing(); +} + +//------------------------------------------------------------------ +Any SAL_CALL FmXComboBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) +{ + Any aReturn = FmXTextCell::queryAggregation(_rType); + + if ( !aReturn.hasValue() ) + aReturn = FmXComboBoxCell_Base::queryInterface( _rType ); + + return aReturn; +} + +//------------------------------------------------------------------------- +Sequence< Type > SAL_CALL FmXComboBoxCell::getTypes( ) throw(RuntimeException) +{ + return ::comphelper::concatSequences( + FmXTextCell::getTypes(), + FmXComboBoxCell_Base::getTypes() + ); +} + +//------------------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXComboBoxCell ) + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::addItemListener(const Reference< awt::XItemListener >& l) throw( RuntimeException ) +{ + m_aItemListeners.addInterface( l ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::removeItemListener(const Reference< awt::XItemListener >& l) throw( RuntimeException ) +{ + m_aItemListeners.removeInterface( l ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::addActionListener(const Reference< awt::XActionListener >& l) throw( RuntimeException ) +{ + m_aActionListeners.addInterface( l ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::removeActionListener(const Reference< awt::XActionListener >& l) throw( RuntimeException ) +{ + m_aActionListeners.removeInterface( l ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::addItem( const ::rtl::OUString& _Item, sal_Int16 _Pos ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pComboBox ) + m_pComboBox->InsertEntry( _Item, _Pos ); +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::addItems( const Sequence< ::rtl::OUString >& _Items, sal_Int16 _Pos ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pComboBox ) + { + sal_uInt16 nP = _Pos; + for ( sal_uInt16 n = 0; n < _Items.getLength(); n++ ) + { + m_pComboBox->InsertEntry( _Items.getConstArray()[n], nP ); + if ( _Pos != -1 ) + nP++; + } + } +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::removeItems( sal_Int16 _Pos, sal_Int16 _Count ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pComboBox ) + { + for ( sal_uInt16 n = _Count; n; ) + m_pComboBox->RemoveEntry( _Pos + (--n) ); + } +} + +//------------------------------------------------------------------ +sal_Int16 SAL_CALL FmXComboBoxCell::getItemCount() throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return m_pComboBox ? m_pComboBox->GetEntryCount() : 0; +} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL FmXComboBoxCell::getItem( sal_Int16 _Pos ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + String sItem; + if ( m_pComboBox ) + sItem = m_pComboBox->GetEntry( _Pos ); + return sItem; +} +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL FmXComboBoxCell::getItems() throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Sequence< ::rtl::OUString > aItems; + if ( m_pComboBox ) + { + sal_uInt16 nEntries = m_pComboBox->GetEntryCount(); + aItems.realloc( nEntries ); + ::rtl::OUString* pItem = aItems.getArray(); + for ( sal_uInt16 n=0; n<nEntries; ++n, ++pItem ) + *pItem = m_pComboBox->GetEntry( n ); + } + return aItems; +} + +//------------------------------------------------------------------ +sal_Int16 SAL_CALL FmXComboBoxCell::getDropDownLineCount() throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int16 nLines = 0; + if ( m_pComboBox ) + nLines = m_pComboBox->GetDropDownLineCount(); + + return nLines; +} + +//------------------------------------------------------------------ +void SAL_CALL FmXComboBoxCell::setDropDownLineCount(sal_Int16 nLines) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pComboBox ) + m_pComboBox->SetDropDownLineCount( nLines ); +} + +//------------------------------------------------------------------------------ +void FmXComboBoxCell::onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ) +{ + + switch ( _nEventId ) + { + case VCLEVENT_COMBOBOX_SELECT: + { + awt::ItemEvent aEvent; + aEvent.Source = *this; + aEvent.Highlighted = sal_False; + + // Bei Mehrfachselektion 0xFFFF, sonst die ID + aEvent.Selected = ( m_pComboBox->GetSelectEntryCount() == 1 ) + ? m_pComboBox->GetSelectEntryPos() + : 0xFFFF; + m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent ); + } + break; + + default: + FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData ); + break; + } +} + +/*************************************************************************/ TYPEINIT1(FmXFilterCell, FmXGridCell); //------------------------------------------------------------------------------ @@ -4093,8 +4627,8 @@ Reference< XInterface > FmXFilterCell_CreateInstance(const Reference< ::com::su DBG_NAME(FmXFilterCell); //------------------------------------------------------------------------------ -FmXFilterCell::FmXFilterCell(DbGridColumn* pColumn, DbCellControl* pControl) - :FmXGridCell(pColumn, pControl) +FmXFilterCell::FmXFilterCell(DbGridColumn* pColumn, DbCellControl* pControl ) + :FmXGridCell( pColumn, pControl ) ,m_aTextListeners(m_aMutex) { DBG_CTOR(FmXFilterCell,NULL); @@ -4180,26 +4714,25 @@ void FmXFilterCell::disposing() Any SAL_CALL FmXFilterCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException) { Any aReturn = FmXGridCell::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast< ::com::sun::star::awt::XTextComponent* >(this) - ); + + if ( !aReturn.hasValue() ) + aReturn = FmXFilterCell_Base::queryInterface( _rType ); + return aReturn; } //------------------------------------------------------------------------- Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXFilterCell::getTypes( ) throw(RuntimeException) { - Sequence< ::com::sun::star::uno::Type > aTypes = OComponentHelper::getTypes(); - - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 2); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XControl >* >(NULL)); - aTypes.getArray()[nLen++] = ::getCppuType(static_cast< Reference< ::com::sun::star::awt::XTextComponent >* >(NULL)); - - return aTypes; + return ::comphelper::concatSequences( + FmXGridCell::getTypes(), + FmXFilterCell_Base::getTypes() + ); } +//------------------------------------------------------------------------------ +IMPLEMENT_GET_IMPLEMENTATION_ID( FmXFilterCell ) + // ::com::sun::star::awt::XTextComponent //------------------------------------------------------------------------------ void SAL_CALL FmXFilterCell::addTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException ) diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index d968342d6ef5..ccce6b50ee20 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -190,7 +190,7 @@ using namespace ::svxform; case FormComponentType::IMAGECONTROL: nClassNameResourceId = RID_STR_PROPTITLE_IMAGECONTROL; break; case FormComponentType::HIDDENCONTROL: - nClassNameResourceId = RID_STR_HIDDEN_CLASSNAME; break; + nClassNameResourceId = RID_STR_PROPTITLE_HIDDEN; break; case FormComponentType::SCROLLBAR: nClassNameResourceId = RID_STR_PROPTITLE_SCROLLBAR; break; case FormComponentType::SPINBUTTON: @@ -199,7 +199,7 @@ using namespace ::svxform; nClassNameResourceId = RID_STR_PROPTITLE_NAVBAR; break; case FormComponentType::CONTROL: default: - nClassNameResourceId = RID_STR_CONTROL_CLASSNAME; break; + nClassNameResourceId = RID_STR_CONTROL; break; } if ( !nClassNameResourceId ) @@ -218,6 +218,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding :SfxFloatingWindow(_pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE) ) ,SfxControllerItem(SID_FM_PROPERTY_CONTROL, *_pBindings) ,m_bInitialStateChange(sal_True) + ,m_bInStateChange( false ) ,m_xORB(_xORB) { DBG_CTOR(FmPropBrw,NULL); @@ -668,11 +669,12 @@ void FmPropBrw::impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell ) //----------------------------------------------------------------------- void FmPropBrw::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) { + if (!pState || SID_FM_PROPERTY_CONTROL != nSID) + return; + + m_bInStateChange = true; try { - if (!pState || SID_FM_PROPERTY_CONTROL != nSID) - return; - if (eState >= SFX_ITEM_AVAILABLE) { FmFormShell* pShell = PTR_CAST(FmFormShell,((SfxObjectItem*)pState)->GetShell()); @@ -719,5 +721,5 @@ void FmPropBrw::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPool { DBG_ERROR("FmPropBrw::StateChanged: Exception occured!"); } - + m_bInStateChange = false; } diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx index 935bdbc74fe8..48db5acbb01e 100644 --- a/svx/source/form/fmctrler.cxx +++ b/svx/source/form/fmctrler.cxx @@ -129,6 +129,7 @@ struct ColumnInfo Reference< XColumn > xColumn; sal_Int32 nNullable; sal_Bool bAutoIncrement; + sal_Bool bReadOnly; ::rtl::OUString sName; // information about the control(s) bound to this column @@ -148,6 +149,7 @@ struct ColumnInfo :xColumn() ,nNullable( ColumnValue::NULLABLE_UNKNOWN ) ,bAutoIncrement( sal_False ) + ,bReadOnly( sal_False ) ,sName() ,xFirstControlWithInputRequired() ,xFirstGridWithInputRequiredColumn() @@ -202,6 +204,7 @@ ColumnInfoCache::ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSup OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_ISNULLABLE ) >>= aColInfo.nNullable ); OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_AUTOINCREMENT ) >>= aColInfo.bAutoIncrement ); OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_NAME ) >>= aColInfo.sName ); + OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_ISREADONLY ) >>= aColInfo.bReadOnly ); m_aColumns.push_back( aColInfo ); } @@ -227,6 +230,7 @@ namespace OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_INPUT_REQUIRED ) >>= bInputRequired ); return ( bInputRequired != sal_False ); } + void lcl_resetColumnControlInfo( ColumnInfo& _rColInfo ) { _rColInfo.xFirstControlWithInputRequired.clear(); @@ -2956,7 +2960,6 @@ void FmXFormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) aRow[(*iter).xText] = sCriteria; } } - break; } } } @@ -3502,6 +3505,9 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const RowChangeEvent& _rEv if ( rColInfo.bAutoIncrement ) continue; + if ( rColInfo.bReadOnly ) + continue; + if ( !rColInfo.xFirstControlWithInputRequired.is() && !rColInfo.xFirstGridWithInputRequiredColumn.is() ) continue; diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index b4a5b209956f..ed4cd890ec9e 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -38,6 +38,7 @@ #include "fmprop.hrc" #include "fmservs.hxx" #include "fmobj.hxx" +#include "formcontrolfactory.hxx" #include "svditer.hxx" #include "fmresids.hrc" #include "svx/dbtoolsclient.hxx" @@ -551,18 +552,12 @@ Reference< ::com::sun::star::form::XForm > FmFormPageImpl::findPlaceInFormCompo xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType)); Reference< ::com::sun::star::container::XNameAccess > xNamedSet( getForms(), UNO_QUERY ); - ::rtl::OUString aName; - if ((CommandType::TABLE == nCommandType) || (CommandType::QUERY == nCommandType)) - { - // Namen der ::com::sun::star::form ueber den Titel der CursorSource setzen - aName = getUniqueName(rCursorSource, xNamedSet); - } - else - // ansonsten StandardformName verwenden - aName = getUniqueName(::rtl::OUString(String(SVX_RES(RID_STR_STDFORMNAME))), xNamedSet); + const bool bTableOrQuery = ( CommandType::TABLE == nCommandType ) || ( CommandType::QUERY == nCommandType ); + ::rtl::OUString sName = FormControlFactory::getUniqueName( xNamedSet, + bTableOrQuery ? rCursorSource : ::rtl::OUString( String( SVX_RES( RID_STR_STDFORMNAME ) ) ) ); - xFormProps->setPropertyValue(FM_PROP_NAME, makeAny(aName)); + xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) ); if( bUndo ) { @@ -574,7 +569,7 @@ Reference< ::com::sun::star::form::XForm > FmFormPageImpl::findPlaceInFormCompo xContainer->getCount())); } - getForms()->insertByName(aName, makeAny(xForm)); + getForms()->insertByName( sName, makeAny( xForm ) ); if( bUndo ) pModel->EndUndo(); @@ -672,7 +667,6 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource( //------------------------------------------------------------------------------ ::rtl::OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xFormComponent, const Reference< XForm > & xControls) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::setUniqueName" ); #if OSL_DEBUG_LEVEL > 0 try { @@ -696,9 +690,10 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource( // setzen eines default Namens ueber die ClassId sal_Int16 nClassId( FormComponentType::CONTROL ); xSet->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId; - Reference< XServiceInfo > xSI( xSet, UNO_QUERY ); - ::rtl::OUString sDefaultName = getDefaultName( nClassId, xControls, xSI ); + ::rtl::OUString sDefaultName = FormControlFactory::getDefaultUniqueName_ByComponentType( + Reference< XNameAccess >( xControls, UNO_QUERY ), xSet ); + // bei Radiobuttons, die einen Namen haben, diesen nicht ueberschreiben! if (!sName.getLength() || nClassId != ::com::sun::star::form::FormComponentType::RADIOBUTTON) { @@ -711,78 +706,6 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource( return sName; } - -UniString FmFormPageImpl::getDefaultName( sal_Int16 _nClassId, const Reference< XServiceInfo >& _rxObject ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getDefaultName" ); - sal_uInt16 nResId; - - switch (_nClassId) - { - case FormComponentType::COMMANDBUTTON: nResId = RID_STR_BUTTON_CLASSNAME; break; - case FormComponentType::RADIOBUTTON: nResId = RID_STR_RADIOBUTTON_CLASSNAME; break; - case FormComponentType::CHECKBOX: nResId = RID_STR_CHECKBOX_CLASSNAME; break; - case FormComponentType::LISTBOX: nResId = RID_STR_LISTBOX_CLASSNAME; break; - case FormComponentType::COMBOBOX: nResId = RID_STR_COMBOBOX_CLASSNAME; break; - case FormComponentType::GROUPBOX: nResId = RID_STR_GROUPBOX_CLASSNAME; break; - case FormComponentType::IMAGEBUTTON: nResId = RID_STR_IMAGE_CLASSNAME; break; - case FormComponentType::FIXEDTEXT: nResId = RID_STR_FIXEDTEXT_CLASSNAME; break; - case FormComponentType::GRIDCONTROL: nResId = RID_STR_GRID_CLASSNAME; break; - case FormComponentType::FILECONTROL: nResId = RID_STR_FILECONTROL_CLASSNAME; break; - case FormComponentType::DATEFIELD: nResId = RID_STR_DATEFIELD_CLASSNAME; break; - case FormComponentType::TIMEFIELD: nResId = RID_STR_TIMEFIELD_CLASSNAME; break; - case FormComponentType::NUMERICFIELD: nResId = RID_STR_NUMERICFIELD_CLASSNAME; break; - case FormComponentType::CURRENCYFIELD: nResId = RID_STR_CURRENCYFIELD_CLASSNAME; break; - case FormComponentType::PATTERNFIELD: nResId = RID_STR_PATTERNFIELD_CLASSNAME; break; - case FormComponentType::IMAGECONTROL: nResId = RID_STR_IMAGECONTROL_CLASSNAME; break; - case FormComponentType::HIDDENCONTROL: nResId = RID_STR_HIDDEN_CLASSNAME; break; - case FormComponentType::SCROLLBAR: nResId = RID_STR_CLASSNAME_SCROLLBAR; break; - case FormComponentType::SPINBUTTON: nResId = RID_STR_CLASSNAME_SPINBUTTON; break; - case FormComponentType::NAVIGATIONBAR: nResId = RID_STR_NAVBAR_CLASSNAME; break; - - case FormComponentType::TEXTFIELD: - nResId = RID_STR_EDIT_CLASSNAME; - if ( _rxObject.is() && _rxObject->supportsService( FM_SUN_COMPONENT_FORMATTEDFIELD ) ) - nResId = RID_STR_FORMATTED_CLASSNAME; - break; - - default: - nResId = RID_STR_CONTROL_CLASSNAME; break; - } - - return SVX_RES(nResId); -} - -//------------------------------------------------------------------------------ -::rtl::OUString FmFormPageImpl::getDefaultName( - sal_Int16 _nClassId, const Reference< XForm >& _rxControls, const Reference< XServiceInfo >& _rxObject ) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getDefaultName" ); - ::rtl::OUString aClassName=getDefaultName( _nClassId, _rxObject ); - - Reference< ::com::sun::star::container::XNameAccess > xNamedSet( _rxControls, UNO_QUERY ); - return getUniqueName(aClassName, xNamedSet); -} - -//------------------------------------------------------------------ -::rtl::OUString FmFormPageImpl::getUniqueName(const ::rtl::OUString& rName, const Reference< ::com::sun::star::container::XNameAccess > & xNamedSet) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getUniqueName" ); - Reference< ::com::sun::star::container::XIndexAccess > xIndexSet(xNamedSet, UNO_QUERY); - ::rtl::OUString sName( rName ); - - if ( !xIndexSet.is() ) - return sName; - - sal_Int32 n = 0; - ::rtl::OUString sClassName = rName; - - while ( xNamedSet->hasByName( sName ) ) - sName = sClassName + ::rtl::OUString::valueOf(++n); - - return sName; -} - //------------------------------------------------------------------ void FmFormPageImpl::formObjectInserted( const FmFormObj& _object ) { diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 87149994839b..8c5ca61f6691 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -785,7 +785,7 @@ void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( Ru void FmXFormShell::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::disposing" ); - OSL_TRACE( "--- FmXFormShell::disposing : %p, ........, ........\n", this ); + OSL_TRACE( "--- FmXFormShell::disposing : %p, ........, ........", this ); impl_checkDisposed(); FmXFormShell_BASE::disposing(); @@ -3936,7 +3936,7 @@ void FmXFormShell::SetWizardUsing(sal_Bool _bUseThem) void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController /* = sal_True */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewDeactivated" ); - OSL_TRACE( "--- FmXFormShell::viewDeactivated: %p, %p, ........\n", this, &_rCurrentView ); + OSL_TRACE( "--- FmXFormShell::viewDeactivated: %p, %p, ........", this, &_rCurrentView ); if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() ) { @@ -3971,7 +3971,7 @@ void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeacti // remove callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::resetHandler : %p, ........, %p\n", this, pPage ); + OSL_TRACE( "--- FmXFormShell::resetHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( Link() ); } UpdateForms( sal_True ); @@ -4010,7 +4010,7 @@ IMPL_LINK( FmXFormShell, OnFormsCreated, FmFormPage*, /*_pPage*/ ) void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction /* = sal_False */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewActivated" ); - OSL_TRACE( "--- FmXFormShell::viewActivated : %p, %p, ........\n", this, &_rCurrentView ); + OSL_TRACE( "--- FmXFormShell::viewActivated : %p, %p, ........", this, &_rCurrentView ); FmFormPage* pPage = _rCurrentView.GetCurPage(); @@ -4040,7 +4040,7 @@ void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncActi // set callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::setHandler : %p, ........, %p\n", this, pPage ); + OSL_TRACE( "--- FmXFormShell::setHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( LINK( this, FmXFormShell, OnFormsCreated ) ); } diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src index 2572c2ed2239..8b42ccadc6a6 100644 --- a/svx/source/form/fmstring.src +++ b/svx/source/form/fmstring.src @@ -84,107 +84,16 @@ Resource RID_RSC_TABWIN_PREFIX }; String RID_STR_FORMSHELL { - Text [ en-US ] = "Form"; + Text = "Form Shell"; }; String RID_STR_STDFORMNAME { - Text = "Standard"; -}; -String RID_STR_FORMATTED_CLASSNAME -{ - Text = "FormattedField"; -}; -String RID_STR_CONTROL_CLASSNAME -{ - Text = "Control"; -}; -String RID_STR_CHECKBOX_CLASSNAME -{ - Text = "CheckBox"; -}; -String RID_STR_RADIOBUTTON_CLASSNAME -{ - Text = "OptionButton"; -}; -String RID_STR_BUTTON_CLASSNAME -{ - Text = "PushButton"; -}; -String RID_STR_FIXEDTEXT_CLASSNAME -{ - Text = "LabelField"; -}; -String RID_STR_IMAGE_CLASSNAME -{ - Text = "ImageButton"; -}; -String RID_STR_GRID_CLASSNAME -{ - Text = "TableControl"; -}; -String RID_STR_GROUPBOX_CLASSNAME -{ - Text = "GroupBox"; -}; -String RID_STR_LISTBOX_CLASSNAME -{ - Text = "ListBox"; -}; -String RID_STR_COMBOBOX_CLASSNAME -{ - Text = "ComboBox"; -}; -String RID_STR_EDIT_CLASSNAME -{ - Text = "TextBox"; + Text [ en-US ]= "Form"; }; -String RID_STR_FILECONTROL_CLASSNAME +String RID_STR_PROPTITLE_HIDDEN { - Text = "FileSelection"; + Text [ en-US ] = "Hidden Control"; }; -String RID_STR_DATEFIELD_CLASSNAME -{ - Text = "DateField"; -}; -String RID_STR_TIMEFIELD_CLASSNAME -{ - Text = "TimeField"; -}; -String RID_STR_NUMERICFIELD_CLASSNAME -{ - Text = "NumericalField"; -}; -String RID_STR_CURRENCYFIELD_CLASSNAME -{ - Text = "CurrencyField"; -}; -String RID_STR_PATTERNFIELD_CLASSNAME -{ - Text = "PatternField"; -}; -String RID_STR_IMAGECONTROL_CLASSNAME -{ - Text = "ImageControl"; -}; -String RID_STR_HIDDEN_CLASSNAME -{ - Text = "HiddenControl"; -}; -String RID_STR_NAVBAR_CLASSNAME -{ - Text [ en-US ] = "NavigationBar"; -}; - -String RID_STR_CLASSNAME_SCROLLBAR -{ - Text [ en-US ] = "Scrollbar"; -}; - -String RID_STR_CLASSNAME_SPINBUTTON -{ - Text [ en-US ] = "SpinButton"; -}; - String RID_STR_CONTROL { Text [ en-US ] = "Control"; @@ -282,7 +191,7 @@ String RID_STR_TIME }; String RID_STR_PROPTITLE_PUSHBUTTON { - Text [ en-US ] = "Button"; + Text [ en-US ] = "Push Button"; }; String RID_STR_PROPTITLE_RADIOBUTTON { @@ -294,7 +203,7 @@ String RID_STR_PROPTITLE_CHECKBOX }; String RID_STR_PROPTITLE_FIXEDTEXT { - Text [ en-US ] = "Label field"; + Text [ en-US ] = "Label Field"; }; String RID_STR_PROPTITLE_GROUPBOX { diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 94ce048f4ed2..222407a36021 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -342,7 +342,7 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync ) //------------------------------------------------------------------------ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) { - OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p\n", this, pPage ); + OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); SdrPageView* pPV = E3dView::ShowSdrPage(pPage); @@ -380,7 +380,7 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) //------------------------------------------------------------------------ void FmFormView::HideSdrPage() { - OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p\n", this, GetCurPage() ); + OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); // --- 1. deactivate controls if ( !IsDesignMode() ) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 50434af4917b..de1a7d76b526 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -35,6 +35,7 @@ #include "fmcontrollayout.hxx" #include "fmprop.hrc" #include "fmresids.hrc" +#include "fmservs.hxx" #include "svx/dialmgr.hxx" #include "svx/svdouno.hxx" @@ -739,6 +740,75 @@ namespace svxform } } + //------------------------------------------------------------------------------ + ::rtl::OUString FormControlFactory::getDefaultName( sal_Int16 _nClassId, const Reference< XServiceInfo >& _rxObject ) + { + sal_uInt16 nResId(0); + + switch ( _nClassId ) + { + case FormComponentType::COMMANDBUTTON: nResId = RID_STR_PROPTITLE_PUSHBUTTON; break; + case FormComponentType::RADIOBUTTON: nResId = RID_STR_PROPTITLE_RADIOBUTTON; break; + case FormComponentType::CHECKBOX: nResId = RID_STR_PROPTITLE_CHECKBOX; break; + case FormComponentType::LISTBOX: nResId = RID_STR_PROPTITLE_LISTBOX; break; + case FormComponentType::COMBOBOX: nResId = RID_STR_PROPTITLE_COMBOBOX; break; + case FormComponentType::GROUPBOX: nResId = RID_STR_PROPTITLE_GROUPBOX; break; + case FormComponentType::IMAGEBUTTON: nResId = RID_STR_PROPTITLE_IMAGEBUTTON; break; + case FormComponentType::FIXEDTEXT: nResId = RID_STR_PROPTITLE_FIXEDTEXT; break; + case FormComponentType::GRIDCONTROL: nResId = RID_STR_PROPTITLE_DBGRID; break; + case FormComponentType::FILECONTROL: nResId = RID_STR_PROPTITLE_FILECONTROL; break; + case FormComponentType::DATEFIELD: nResId = RID_STR_PROPTITLE_DATEFIELD; break; + case FormComponentType::TIMEFIELD: nResId = RID_STR_PROPTITLE_TIMEFIELD; break; + case FormComponentType::NUMERICFIELD: nResId = RID_STR_PROPTITLE_NUMERICFIELD; break; + case FormComponentType::CURRENCYFIELD: nResId = RID_STR_PROPTITLE_CURRENCYFIELD; break; + case FormComponentType::PATTERNFIELD: nResId = RID_STR_PROPTITLE_PATTERNFIELD; break; + case FormComponentType::IMAGECONTROL: nResId = RID_STR_PROPTITLE_IMAGECONTROL; break; + case FormComponentType::HIDDENCONTROL: nResId = RID_STR_PROPTITLE_HIDDEN; break; + case FormComponentType::SCROLLBAR: nResId = RID_STR_PROPTITLE_SCROLLBAR; break; + case FormComponentType::SPINBUTTON: nResId = RID_STR_PROPTITLE_SPINBUTTON; break; + case FormComponentType::NAVIGATIONBAR: nResId = RID_STR_PROPTITLE_NAVBAR; break; + + case FormComponentType::TEXTFIELD: + nResId = RID_STR_PROPTITLE_EDIT; + if ( _rxObject.is() && _rxObject->supportsService( FM_SUN_COMPONENT_FORMATTEDFIELD ) ) + nResId = RID_STR_PROPTITLE_FORMATTED; + break; + + default: + nResId = RID_STR_CONTROL; break; + } + + return String( SVX_RES( nResId ) ); + } + + //------------------------------------------------------------------------------ + ::rtl::OUString FormControlFactory::getDefaultUniqueName_ByComponentType( const Reference< XNameAccess >& _rxContainer, + const Reference< XPropertySet >& _rxObject ) + { + sal_Int16 nClassId = FormComponentType::CONTROL; + OSL_VERIFY( _rxObject->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); + ::rtl::OUString sBaseName = getDefaultName( nClassId, Reference< XServiceInfo >( _rxObject, UNO_QUERY ) ); + + return getUniqueName( _rxContainer, sBaseName ); + } + + //------------------------------------------------------------------------------ + ::rtl::OUString FormControlFactory::getUniqueName( const Reference< XNameAccess >& _rxContainer, const ::rtl::OUString& _rBaseName ) + { + sal_Int32 n = 0; + ::rtl::OUString sName; + do + { + ::rtl::OUStringBuffer aBuf( _rBaseName ); + aBuf.appendAscii( " " ); + aBuf.append( ++n ); + sName = aBuf.makeStringAndClear(); + } + while ( _rxContainer->hasByName( sName ) ); + + return sName; + } + //........................................................................ } // namespace svxform //........................................................................ diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index b57863ffd5ae..f90f0d8c2ce4 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1573,7 +1573,7 @@ namespace svxform aBaseName = SVX_RES( RID_STR_STDFORMNAME ); else if( pEntryData->ISA(FmControlData) ) - aBaseName = SVX_RES( RID_STR_CONTROL_CLASSNAME ); + aBaseName = SVX_RES( RID_STR_CONTROL ); ////////////////////////////////////////////////////////////////////// // Neuen Namen erstellen diff --git a/svx/source/inc/fmPropBrw.hxx b/svx/source/inc/fmPropBrw.hxx index 6d7e6bde0259..285cb90320d2 100644 --- a/svx/source/inc/fmPropBrw.hxx +++ b/svx/source/inc/fmPropBrw.hxx @@ -57,6 +57,7 @@ class FmFormShell; class FmPropBrw : public SfxFloatingWindow, public SfxControllerItem { sal_Bool m_bInitialStateChange; + bool m_bInStateChange; ::rtl::OUString m_sLastActivePage; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xInspectorContext; diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx index 350fbedd709e..880ecb21d7e5 100644 --- a/svx/source/inc/fmpgeimp.hxx +++ b/svx/source/inc/fmpgeimp.hxx @@ -133,21 +133,8 @@ protected: sal_Int32 nCommandType ); - ::rtl::OUString getDefaultName( - sal_Int16 _nClassId, - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _rxControls, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject - ) const; - public: - - static UniString getDefaultName( - sal_Int16 nClassId, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject - ); - ::rtl::OUString setUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xFormComponent, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& xControls); - ::rtl::OUString getUniqueName(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& xNamedSet) const; void formObjectInserted( const FmFormObj& _object ); void formObjectRemoved( const FmFormObj& _object ); diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc index e9f39396cca6..95a478fc5aee 100644 --- a/svx/source/inc/fmresids.hrc +++ b/svx/source/inc/fmresids.hrc @@ -214,29 +214,29 @@ #define RID_STR_SVT_SQL_SYNTAX_COLUMN (RID_FORMS_START + 98) #define RID_STR_PROPTITLE_SCROLLBAR (RID_FORMS_START + 99) #define RID_STR_PROPTITLE_SPINBUTTON (RID_FORMS_START + 100) -#define RID_STR_EDIT_CLASSNAME (RID_FORMS_START + 101) -#define RID_STR_BUTTON_CLASSNAME (RID_FORMS_START + 102) -#define RID_STR_FIXEDTEXT_CLASSNAME (RID_FORMS_START + 103) -#define RID_STR_CHECKBOX_CLASSNAME (RID_FORMS_START + 104) -#define RID_STR_RADIOBUTTON_CLASSNAME (RID_FORMS_START + 105) -#define RID_STR_LISTBOX_CLASSNAME (RID_FORMS_START + 106) -#define RID_STR_COMBOBOX_CLASSNAME (RID_FORMS_START + 107) -#define RID_STR_FORMATTED_CLASSNAME (RID_FORMS_START + 108) -#define RID_STR_GROUPBOX_CLASSNAME (RID_FORMS_START + 109) -#define RID_STR_CONTROL_CLASSNAME (RID_FORMS_START + 110) -#define RID_STR_IMAGE_CLASSNAME (RID_FORMS_START + 111) -#define RID_STR_GRID_CLASSNAME (RID_FORMS_START + 112) -#define RID_STR_FILECONTROL_CLASSNAME (RID_FORMS_START + 113) -#define RID_STR_DATEFIELD_CLASSNAME (RID_FORMS_START + 114) -#define RID_STR_TIMEFIELD_CLASSNAME (RID_FORMS_START + 115) -#define RID_STR_NUMERICFIELD_CLASSNAME (RID_FORMS_START + 116) -#define RID_STR_CURRENCYFIELD_CLASSNAME (RID_FORMS_START + 117) -#define RID_STR_PATTERNFIELD_CLASSNAME (RID_FORMS_START + 118) -#define RID_STR_IMAGECONTROL_CLASSNAME (RID_FORMS_START + 119) -#define RID_STR_HIDDEN_CLASSNAME (RID_FORMS_START + 120) -#define RID_STR_CLASSNAME_SCROLLBAR (RID_FORMS_START + 121) -#define RID_STR_CLASSNAME_SPINBUTTON (RID_FORMS_START + 122) -#define RID_STR_NAVBAR_CLASSNAME (RID_FORMS_START + 123) +#define RID_STR_PROPTITLE_HIDDEN (RID_FORMS_START + 101) + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE #define RID_STR_DATANAVIGATOR (RID_FORMS_START + 124) #define RID_STR_DATANAV_SUBM_PARENT (RID_FORMS_START + 125) #define RID_STR_DATANAV_SUBM_ID (RID_FORMS_START + 126) diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx index 2868308d6f7c..432ad25bdea0 100644 --- a/svx/source/inc/formcontrolfactory.hxx +++ b/svx/source/inc/formcontrolfactory.hxx @@ -37,6 +37,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/util/XNumberFormats.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameAccess.hpp> /** === end UNO includes === **/ #include <memory> @@ -94,6 +96,21 @@ namespace svxform const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats ); + static ::rtl::OUString getDefaultName( + const sal_Int16 nClassId, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject + ); + + static ::rtl::OUString getDefaultUniqueName_ByComponentType( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject + ); + + static ::rtl::OUString getUniqueName( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::rtl::OUString& _rBaseName + ); + private: ::std::auto_ptr< FormControlFactory_Data > m_pData; }; diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 6a552da6edb7..cb747e3a894c 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -42,20 +42,24 @@ #include <com/sun/star/form/XBoundControl.hpp> #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XComboBox.hpp> #include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XButton.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/form/XChangeBroadcaster.hpp> /** === end UNO includes === **/ -#include <tools/rtti.hxx> - #include <comphelper/propmultiplex.hxx> #include <comphelper/componentcontext.hxx> - #include <cppuhelper/component.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> +#include <tools/diagnose_ex.h> +#include <tools/rtti.hxx> class DbCellControl; class Edit; @@ -282,7 +286,11 @@ public: virtual ~DbCellControl(); - Window* GetControl() const { return m_pWindow; } + Window& GetWindow() const + { + ENSURE_OR_THROW( m_pWindow, "no window" ); + return *m_pWindow; + } // control alignment inline sal_Bool isAlignedController() const { return m_bAlignedController; } @@ -732,20 +740,34 @@ protected: //================================================================== // Base class providing the access to a grid cell //================================================================== -class FmXGridCell : public ::cppu::OComponentHelper, - public ::com::sun::star::awt::XControl, - public ::com::sun::star::form::XBoundControl +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XControl + , ::com::sun::star::form::XBoundControl + > FmXGridCell_Base; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XWindow + > FmXGridCell_WindowBase; +class FmXGridCell :public ::cppu::OComponentHelper + ,public FmXGridCell_Base + ,public FmXGridCell_WindowBase { protected: - ::osl::Mutex m_aMutex; - DbGridColumn* m_pColumn; - DbCellControl* m_pCellControl; + ::osl::Mutex m_aMutex; + DbGridColumn* m_pColumn; + DbCellControl* m_pCellControl; + +private: + ::cppu::OInterfaceContainerHelper m_aWindowListeners; + ::cppu::OInterfaceContainerHelper m_aFocusListeners; + ::cppu::OInterfaceContainerHelper m_aKeyListeners; + ::cppu::OInterfaceContainerHelper m_aMouseListeners; + ::cppu::OInterfaceContainerHelper m_aMouseMotionListeners; +protected: virtual ~FmXGridCell(); + public: TYPEINFO(); - FmXGridCell(DbGridColumn* pColumn, DbCellControl* pControl); - + FmXGridCell( DbGridColumn* pColumn, DbCellControl* pControl ); + void init(); DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); @@ -754,6 +776,7 @@ public: void SetTextLineColor(const Color& _rColor); // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); // OComponentHelper @@ -781,6 +804,25 @@ public: virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException); + // XWindow + virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setVisible( ::sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setEnable( ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + sal_Bool Commit() {return m_pCellControl->Commit();} void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ) { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); } @@ -788,6 +830,17 @@ public: sal_Bool isAlignedController() const { return m_pCellControl->isAlignedController(); } void AlignControl(sal_Int16 nAlignment) { m_pCellControl->AlignControl(nAlignment);} + +protected: + virtual Window* getEventWindow() const; + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + + // default implementations call our focus listeners, don't forget to call them if you override this + virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ); + virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ); + +private: + DECL_LINK( OnWindowEvent, VclWindowEvent* ); }; //================================================================== @@ -795,7 +848,10 @@ class FmXDataCell : public FmXGridCell { public: TYPEINFO(); - FmXDataCell(DbGridColumn* pColumn, DbCellControl* pControl):FmXGridCell(pColumn, pControl){} + FmXDataCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXGridCell( pColumn, &_rControl ) + { + } virtual void PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect, @@ -831,11 +887,7 @@ protected: public: TYPEINFO(); - FmXTextCell( DbGridColumn* pColumn, DbCellControl* pControl ) - :FmXDataCell( pColumn, pControl ) - ,m_bFastPaint( sal_True ) - { - } + FmXTextCell( DbGridColumn* pColumn, DbCellControl& _rControl ); virtual void PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect, @@ -849,23 +901,31 @@ public: }; //================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent + , ::com::sun::star::form::XChangeBroadcaster + > FmXEditCell_Base; class FmXEditCell : public FmXTextCell, - public ::com::sun::star::awt::XTextComponent + public FmXEditCell_Base { +private: + ::rtl::OUString m_sValueOnEnter; + protected: ::cppu::OInterfaceContainerHelper m_aTextListeners; + ::cppu::OInterfaceContainerHelper m_aChangeListeners; ::svt::IEditImplementation* m_pEditImplementation; bool m_bOwnEditImplementation; virtual ~FmXEditCell(); public: - FmXEditCell(DbGridColumn* pColumn, DbCellControl* pControl); + FmXEditCell( DbGridColumn* pColumn, DbCellControl& _rControl ); DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); // XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); // OComponentHelper virtual void SAL_CALL disposing(); @@ -884,26 +944,43 @@ public: virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException); virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException); + // XChangeBroadcaster + virtual void SAL_CALL addChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + protected: - DECL_LINK( OnTextChanged, void* ); + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + + virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ); + virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ); + +private: + void onTextChanged(); }; //================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XCheckBox + , ::com::sun::star::awt::XButton + > FmXCheckBoxCell_Base; class FmXCheckBoxCell : public FmXDataCell, - public ::com::sun::star::awt::XCheckBox + public FmXCheckBoxCell_Base { ::cppu::OInterfaceContainerHelper m_aItemListeners; + ::cppu::OInterfaceContainerHelper m_aActionListeners; + ::rtl::OUString m_aActionCommand; CheckBox* m_pBox; + protected: virtual ~FmXCheckBoxCell(); -public: - FmXCheckBoxCell(DbGridColumn* pColumn, DbCellControl* pControl); +public: + FmXCheckBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); // UNO DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); // OComponentHelper virtual void SAL_CALL disposing(); @@ -916,26 +993,37 @@ public: virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL enableTriState(sal_Bool b) throw(::com::sun::star::uno::RuntimeException); + // XButton + virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw (::com::sun::star::uno::RuntimeException); + protected: - DECL_LINK( OnClick, void* ); + virtual Window* getEventWindow() const; + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); }; //================================================================== -class FmXListBoxCell : public FmXTextCell, - public ::com::sun::star::awt::XListBox +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XListBox + > FmXListBoxCell_Base; +class FmXListBoxCell :public FmXTextCell + ,public FmXListBoxCell_Base { ::cppu::OInterfaceContainerHelper m_aItemListeners, m_aActionListeners; ListBox* m_pBox; + protected: virtual ~FmXListBoxCell(); -public: - FmXListBoxCell(DbGridColumn* pColumn, DbCellControl* pControl); +public: + FmXListBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); // OComponentHelper virtual void SAL_CALL disposing(); @@ -965,14 +1053,60 @@ public: virtual void SAL_CALL SAL_CALL makeVisible(sal_Int16 nEntry) throw(::com::sun::star::uno::RuntimeException); protected: - DECL_LINK( OnSelect, VclWindowEvent* ); + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + DECL_LINK( OnDoubleClick, void* ); }; //================================================================== +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XComboBox + > FmXComboBoxCell_Base; +class FmXComboBoxCell :public FmXTextCell + ,public FmXComboBoxCell_Base +{ +private: + ::cppu::OInterfaceContainerHelper m_aItemListeners, + m_aActionListeners; + ComboBox* m_pComboBox; + +protected: + virtual ~FmXComboBoxCell(); + +public: + FmXComboBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XComboBox + virtual void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItem( const ::rtl::OUString& _Item, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _Items, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItems( ::sal_Int16 nPos, ::sal_Int16 nCount ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getItemCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItem( ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getDropDownLineCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDropDownLineCount( ::sal_Int16 _Lines ) throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); +}; + +//================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent + , ::com::sun::star::lang::XUnoTunnel + > FmXFilterCell_Base; class FmXFilterCell :public FmXGridCell - ,public ::com::sun::star::awt::XTextComponent - ,public ::com::sun::star::lang::XUnoTunnel + ,public FmXFilterCell_Base { ::cppu::OInterfaceContainerHelper m_aTextListeners; protected: @@ -985,6 +1119,7 @@ public: DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); |