diff options
author | Oliver Specht <os@openoffice.org> | 2001-09-06 13:42:50 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2001-09-06 13:42:50 +0000 |
commit | 2013280cc55a93697e9c3f30a74f5d7d1dc89c74 (patch) | |
tree | 6a91538ed0f34c68e5375693f83797797756bf89 /svx | |
parent | bbafdb6d300ad6fee562d886a932178751e8ff2d (diff) |
#74124# key handling of ListBox/ComboBox controller changed
Diffstat (limited to 'svx')
-rw-r--r-- | svx/sdi/fmslots.sdi | 5 | ||||
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 50 | ||||
-rw-r--r-- | svx/source/tbxctrls/itemwin.cxx | 87 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 20 |
4 files changed, 108 insertions, 54 deletions
diff --git a/svx/sdi/fmslots.sdi b/svx/sdi/fmslots.sdi index e638dfd03436..5697e9f42842 100644 --- a/svx/sdi/fmslots.sdi +++ b/svx/sdi/fmslots.sdi @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------ $Workfile: FMSLOTS.SDI $ - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svx/sdi/fmslots.sdi,v 1.2 2000-10-20 16:16:42 fs Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svx/sdi/fmslots.sdi,v 1.3 2001-09-06 14:42:49 os Exp $ Beschreibung: IDL - File FormularShell (c) Copyright 1989 - 2000, Star Division GmbH, Hamburg @@ -435,6 +435,9 @@ shell FmFormShell /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.2 2000/10/20 16:16:42 fs + #79654# FmFormShell responsible for SID_FM_AUTOCONTROLFOCUS + Revision 1.1.1.1 2000/09/18 17:01:06 hr initial import diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index e7dd371b45d9..f94f7af37f3e 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fillctrl.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: obo $ $Date: 2001-01-16 11:48:16 $ + * last change: $Author: os $ $Date: 2001-09-06 14:42:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -689,7 +689,7 @@ IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) pLbFillType->Selected(); // release focus - if ( pBox && SfxViewShell::Current()->GetWindow() ) + if ( pBox && pLbFillType->IsRelease() && SfxViewShell::Current()->GetWindow() ) SfxViewShell::Current()->GetWindow()->GrabFocus(); } } @@ -706,17 +706,15 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) SfxObjectShell* pSh = SfxObjectShell::Current(); SfxDispatcher* pDisp = ( (SvxFillToolBoxControl*)GetData() )->GetBindings().GetDispatcher(); DBG_ASSERT( pDisp, "invalid Dispatcher" ); - - switch( eXFS ) + if(bAction) { - case XFILL_NONE: - if ( bAction ) + switch( eXFS ) + { + case XFILL_NONE: pDisp->Execute( SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L ); - break; + break; - case XFILL_SOLID: - { - if( bAction ) + case XFILL_SOLID: { // NEU //Eintrag wird auf temporaere Farbe geprueft @@ -732,12 +730,8 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) pDisp->Execute( SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, &aXFillStyleItem, 0L ); } - } - break; - - case XFILL_GRADIENT: - { - if( bAction ) + break; + case XFILL_GRADIENT: { USHORT nPos = pLbFillAttr->GetSelectEntryPos(); @@ -755,12 +749,9 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) } } } - } - break; + break; - case XFILL_HATCH: - { - if( bAction ) + case XFILL_HATCH: { USHORT nPos = pLbFillAttr->GetSelectEntryPos(); @@ -777,12 +768,9 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) } } } - } - break; + break; - case XFILL_BITMAP: - { - if( bAction ) + case XFILL_BITMAP: { USHORT nPos = pLbFillAttr->GetSelectEntryPos(); @@ -800,13 +788,13 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) } } } + break; } - break; + // release focus + if ( pLbFillAttr->IsRelease() && pBox && SfxViewShell::Current()->GetWindow() ) + SfxViewShell::Current()->GetWindow()->GrabFocus(); } - // release focus - if ( !pLbFillAttr->IsTravelSelect() && pBox && SfxViewShell::Current()->GetWindow() ) - SfxViewShell::Current()->GetWindow()->GrabFocus(); return 0; } diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 1b2b61cacf33..6bf36b19fd47 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: itemwin.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pb $ $Date: 2001-02-13 14:11:35 $ + * last change: $Author: os $ $Date: 2001-09-06 14:42:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,7 +109,8 @@ SvxLineBox::SvxLineBox( Window* pParent, SfxBindings& rBind, WinBits nBits ) : LineLB( pParent, nBits ), nCurPos ( 0 ), - rBindings ( rBind ) + rBindings ( rBind ), + bRelease ( TRUE ) { SetSizePixel( Size( 90, 260 ) ); @@ -206,9 +207,26 @@ long SvxLineBox::PreNotify( NotifyEvent& rNEvt ) { USHORT nType = rNEvt.GetType(); - if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) - nCurPos = GetSelectEntryPos(); - + switch(nType) + { + case EVENT_MOUSEBUTTONDOWN: + case EVENT_GETFOCUS: + nCurPos = GetSelectEntryPos(); + break; + case EVENT_LOSEFOCUS: + SelectEntryPos(nCurPos); + break; + case EVENT_KEYINPUT: + { + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + if( pKEvt->GetKeyCode().GetCode() == KEY_TAB) + { + bRelease = FALSE; + Select(); + } + } + break; + } return LineLB::PreNotify( rNEvt ); } @@ -243,6 +261,11 @@ long SvxLineBox::Notify( NotifyEvent& rNEvt ) void SvxLineBox::ReleaseFocus_Impl() { + if(!bRelease) + { + bRelease = TRUE; + return; + } Window* pShellWnd = SfxViewShell::Current()->GetWindow(); if ( pShellWnd ) @@ -259,7 +282,8 @@ SvxColorBox::SvxColorBox( Window* pParent, USHORT nSID, SfxBindings& rBind, WinB nCurPos ( 0 ), nId ( nSID ), - rBindings ( rBind ) + rBindings ( rBind ), + bRelease ( TRUE ) { SetSizePixel( Size( 100, 180 ) ); @@ -333,8 +357,26 @@ long SvxColorBox::PreNotify( NotifyEvent& rNEvt ) { USHORT nType = rNEvt.GetType(); - if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) - nCurPos = GetSelectEntryPos(); + switch(nType) + { + case EVENT_MOUSEBUTTONDOWN: + case EVENT_GETFOCUS: + nCurPos = GetSelectEntryPos(); + break; + case EVENT_LOSEFOCUS: + SelectEntryPos(nCurPos); + break; + case EVENT_KEYINPUT: + { + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + + if( pKEvt->GetKeyCode().GetCode() == KEY_TAB) + { + bRelease = FALSE; + Select(); + } + } + } return ColorLB::PreNotify( rNEvt ); } @@ -370,6 +412,11 @@ long SvxColorBox::Notify( NotifyEvent& rNEvt ) void SvxColorBox::ReleaseFocus_Impl() { + if(!bRelease) + { + bRelease = TRUE; + return; + } Window* pShellWnd = SfxViewShell::Current()->GetWindow(); if ( pShellWnd ) @@ -548,7 +595,8 @@ SvxFillTypeBox::SvxFillTypeBox( Window* pParent, WinBits nBits ) : FillTypeLB( pParent, nBits ), nCurPos ( 0 ), - bSelect ( FALSE ) + bSelect ( FALSE ), + bRelease(TRUE) { SetSizePixel( Size( 90, 100 ) ); @@ -593,12 +641,16 @@ long SvxFillTypeBox::Notify( NotifyEvent& rNEvt ) if ( rNEvt.GetType() == EVENT_KEYINPUT ) { const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - switch ( pKEvt->GetKeyCode().GetCode() ) { case KEY_RETURN: - ( (Link&)GetSelectHdl() ).Call( this ); nHandled = 1; + ( (Link&)GetSelectHdl() ).Call( this ); + break; + case KEY_TAB: + bRelease = FALSE; + ( (Link&)GetSelectHdl() ).Call( this ); + bRelease = TRUE; break; case KEY_ESCAPE: @@ -629,7 +681,8 @@ SvxFillAttrBox::SvxFillAttrBox( Window* pParent, WinBits nBits ) : FillAttrLB( pParent, nBits ), - nCurPos( 0 ) + nCurPos( 0 ), + bRelease( TRUE ) { SetPosPixel( Point( 90, 0 ) ); @@ -670,8 +723,12 @@ long SvxFillAttrBox::Notify( NotifyEvent& rNEvt ) case KEY_RETURN: ( (Link&)GetSelectHdl() ).Call( this ); nHandled = 1; - break; - + break; + case KEY_TAB: + bRelease = FALSE; + GetSelectHdl().Call( this ); + bRelease = TRUE; + break; case KEY_ESCAPE: SelectEntryPos( nCurPos ); ReleaseFocus_Impl(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 3aae73885660..1d9c6d7b1a01 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tbcontrl.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: os $ $Date: 2001-07-13 09:55:07 $ + * last change: $Author: os $ $Date: 2001-09-06 14:42:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -483,7 +483,6 @@ void SvxStyleBox::Select() ReleaseFocus(); } } - // ----------------------------------------------------------------------- void SvxStyleBox::SetFamily( SfxStyleFamily eNewFamily ) @@ -499,6 +498,8 @@ long SvxStyleBox::PreNotify( NotifyEvent& rNEvt ) if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) nCurSel = GetSelectEntryPos(); + else if(EVENT_LOSEFOCUS == nType) + SelectEntryPos(GetSavedValue()); return ListBox::PreNotify( rNEvt ); } @@ -519,8 +520,7 @@ long SvxStyleBox::Notify( NotifyEvent& rNEvt ) { if ( KEY_TAB == nCode ) bRelease = FALSE; - else - nHandled = 1; + nHandled = 1; Select(); break; } @@ -680,6 +680,9 @@ long SvxFontNameBox::Notify( NotifyEvent& rNEvt ) break; } } + else if(EVENT_LOSEFOCUS == rNEvt.GetType()) + SetText(GetSavedValue()); + return FontNameBox::Notify( rNEvt ); } @@ -817,8 +820,6 @@ void SvxFontSizeBox::Select() ReleaseFocus_Impl(); } } - - // ----------------------------------------------------------------------- void SvxFontSizeBox::StateChanged_Impl( SfxItemState eState, const SfxPoolItem* pState ) @@ -839,6 +840,7 @@ void SvxFontSizeBox::StateChanged_Impl( SfxItemState eState, const SfxPoolItem* SetValue( -1L ); SetText( String() ); } + SaveValue(); } // ----------------------------------------------------------------------- @@ -894,6 +896,8 @@ long SvxFontSizeBox::Notify( NotifyEvent& rNEvt ) break; } } + else if(EVENT_LOSEFOCUS == rNEvt.GetType()) + SetText(GetSavedValue()); return nHandled ? nHandled : FontSizeBox::Notify( rNEvt ); } @@ -1922,6 +1926,7 @@ void SvxStyleToolBoxControl::SelectStyle( const String& rStyleName ) } else pBox->SetNoSelection(); + pBox->SaveValue(); } } @@ -2096,6 +2101,7 @@ void SvxFontNameToolBoxControl::StateChanged( } else pBox->SetText( String() ); + pBox->SaveValue(); } rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); |