diff options
author | Oliver Bolte <obo@openoffice.org> | 2007-06-12 04:29:28 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2007-06-12 04:29:28 +0000 |
commit | a687dc4315a85974d500f6189b22c5460ec83ea2 (patch) | |
tree | 19f009103a655e46c3aae0455ef615dc246cec9b /svtools/source | |
parent | 64411c3ab300af9efa1444259b48efe878357fea (diff) |
INTEGRATION: CWS dba23ui (1.28.100); FILE MERGED
2007/05/21 11:45:44 fs 1.28.100.1: #i72799#
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/contnr/svlbox.cxx | 101 |
1 files changed, 96 insertions, 5 deletions
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index e2790e09b6c0..1ec4941efcf2 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -4,9 +4,9 @@ * * $RCSfile: svlbox.cxx,v $ * - * $Revision: 1.28 $ + * $Revision: 1.29 $ * - * last change: $Author: obo $ $Date: 2006-09-17 14:34:48 $ + * last change: $Author: obo $ $Date: 2007-06-12 05:29:28 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -58,6 +58,9 @@ #ifndef _SV_ACCEL_HXX #include <vcl/accel.hxx> #endif +#ifndef _VCL_I18NHELP_HXX +#include <vcl/i18nhelp.hxx> +#endif #ifndef _SOT_FORMATS_HXX #include <sot/formats.hxx> #endif @@ -704,12 +707,22 @@ SvViewDataEntry::~SvViewDataEntry() } // *************************************************************** +// struct SvLBox_Impl +// *************************************************************** +SvLBox_Impl::SvLBox_Impl( SvLBox& _rBox ) + :m_bIsEmptyTextAllowed( true ) + ,m_bEntryMnemonicsEnabled( false ) + ,m_pLink( NULL ) + ,m_aMnemonicEngine( _rBox ) +{ +} + +// *************************************************************** // class SvLBox // *************************************************************** DBG_NAME(SvLBox); - SvLBox::SvLBox( Window* pParent, WinBits nWinStyle ) : Control( pParent, nWinStyle | WB_CLIPCHILDREN ), DropTargetHelper( this ), DragSourceHelper( this ) @@ -720,7 +733,7 @@ SvLBox::SvLBox( Window* pParent, WinBits nWinStyle ) : nImpFlags = 0; pTargetEntry = 0; nDragDropMode = 0; - pLBoxImpl = new SvLBox_Impl; + pLBoxImpl = new SvLBox_Impl( *this ); SvLBoxTreeList* pTempModel = new SvLBoxTreeList; pTempModel->SetRefCount( 0 ); SetModel( pTempModel ); @@ -745,7 +758,7 @@ SvLBox::SvLBox( Window* pParent, const ResId& rResId ) : pTargetEntry = 0; nImpFlags = 0; nWindowStyle = 0; - pLBoxImpl = new SvLBox_Impl; + pLBoxImpl = new SvLBox_Impl( *this ); nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK; nDragDropMode = 0; SvLBoxTreeList* pTempModel = new SvLBoxTreeList; @@ -813,6 +826,19 @@ void SvLBox::Clear() pModel->Clear(); // Model ruft SvLBox::ModelHasCleared() auf } +void SvLBox::EnableEntryMnemonics( bool _bEnable ) +{ + if ( _bEnable == IsEntryMnemonicsEnabled() ) + return; + + pLBoxImpl->m_bEntryMnemonicsEnabled = _bEnable; + Invalidate(); +} + +bool SvLBox::IsEntryMnemonicsEnabled() const +{ + return pLBoxImpl->m_bEntryMnemonicsEnabled; +} USHORT SvLBox::IsA() { @@ -1526,6 +1552,71 @@ void SvLBox::Command( const CommandEvent& ) DBG_CHKTHIS(SvLBox,0); } +void SvLBox::KeyInput( const KeyEvent& rKEvt ) +{ + bool bHandled = HandleKeyInput( rKEvt ); + if ( !bHandled ) + Control::KeyInput( rKEvt ); +} + +const void* SvLBox::FirstSearchEntry( String& _rEntryText ) +{ + SvLBoxEntry* pEntry = GetCurEntry(); + if ( pEntry ) + pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( NextSearchEntry( pEntry, _rEntryText ) ) ); + else + { + if ( !pEntry ) + pEntry = FirstSelected(); + if ( !pEntry ) + pEntry = First(); + } + + if ( pEntry ) + _rEntryText = GetEntryText( pEntry ); + + return pEntry; +} + +const void* SvLBox::NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) +{ + SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pCurrentSearchEntry ) ); + + pEntry = Next( pEntry ); + if ( !pEntry ) + pEntry = First(); + + if ( pEntry ) + _rEntryText = GetEntryText( pEntry ); + + return pEntry; +} + +void SvLBox::SelectSearchEntry( const void* _pEntry ) +{ + SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pEntry ) ); + DBG_ASSERT( pEntry, "SvLBox::SelectSearchEntry: invalid entry!" ); + if ( pEntry ) + return; + + SelectAll( FALSE ); + SetCurEntry( pEntry ); + Select( pEntry ); +} + +void SvLBox::ExecuteSearchEntry( const void* /*_pEntry*/ ) +{ + // nothing to do here, we have no "execution" +} + +bool SvLBox::HandleKeyInput( const KeyEvent& _rKEvt ) +{ + if ( !IsEntryMnemonicsEnabled() ) + return false; + + return pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt ); +} + SvLBoxEntry* SvLBox::GetEntry( const Point&, BOOL ) const { DBG_CHKTHIS(SvLBox,0); |