diff options
-rw-r--r-- | svx/inc/rubydialog.hxx | 10 | ||||
-rw-r--r-- | svx/source/dialog/rubydialog.cxx | 60 |
2 files changed, 65 insertions, 5 deletions
diff --git a/svx/inc/rubydialog.hxx b/svx/inc/rubydialog.hxx index 156bfe070da9..55320051d843 100644 --- a/svx/inc/rubydialog.hxx +++ b/svx/inc/rubydialog.hxx @@ -2,9 +2,9 @@ * * $RCSfile: rubydialog.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: os $ $Date: 2001-06-19 10:30:34 $ + * last change: $Author: os $ $Date: 2001-07-17 08:17:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -111,10 +111,13 @@ class SvxRubyChildWindow : public SfxChildWindow struct SvxRubyData_Impl; class RubyEdit : public Edit { + Link aScrollHdl; virtual void GetFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); public: RubyEdit(Window* pParent, const ResId& rResId) : Edit(pParent, rResId){} + void SetScrollHdl(Link& rLink) {aScrollHdl = rLink;} }; @@ -133,7 +136,7 @@ class SvxRubyDialog : public SfxModelessDialog RubyEdit aLeft4ED; RubyEdit aRight4ED; - Edit* aEditArr[8]; + RubyEdit* aEditArr[8]; ScrollBar aScrollSB; CheckBox aAutoDetectionCB; @@ -171,6 +174,7 @@ class SvxRubyDialog : public SfxModelessDialog DECL_LINK(AdjustHdl_Impl, ListBox*); DECL_LINK(CharStyleHdl_Impl, ListBox*); DECL_LINK(EditModifyHdl_Impl, Edit*); + DECL_LINK(EditScrollHdl_Impl, sal_Int32*); void SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight); void GetText(); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 35945e1548b7..d640643926c7 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: rubydialog.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: pb $ $Date: 2001-07-05 08:25:05 $ + * last change: $Author: os $ $Date: 2001-07-17 08:17:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -219,8 +219,13 @@ SvxRubyDialog::SvxRubyDialog( SfxBindings *pBind, SfxChildWindow *pCW, #endif Link aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl)); + Link aScrollLk(LINK(this, SvxRubyDialog, EditScrollHdl_Impl)); for(USHORT i = 0; i < 8; i++) + { aEditArr[i]->SetModifyHdl(aEditLk); + if(!i || 7 == i) + aEditArr[i]->SetScrollHdl(aScrollLk); + } } /* -----------------------------09.01.01 17:17-------------------------------- @@ -637,6 +642,36 @@ IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit*, pEdit) aPreviewWin.Invalidate(); return 0; } +/* -----------------------------17.07.01 09:11-------------------------------- + + ---------------------------------------------------------------------------*/ +IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam) +{ + long nRet = 0; + if(aScrollSB.IsEnabled()) + { + //scroll forward + if(*pParam > 0 && aEditArr[7]->HasFocus()) + { + if(aScrollSB.GetRangeMax() > aScrollSB.GetThumbPos()) + { + aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() + 1); + aEditArr[6]->GrabFocus(); + nRet = 1; + } + } + //scroll backward + else if(aScrollSB.GetThumbPos() && aEditArr[0]->HasFocus()) + { + aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() - 1); + aEditArr[1]->GrabFocus(); + nRet = 1; + } + if(nRet) + ScrollHdl_Impl(&aScrollSB); + } + return nRet; +} /* -----------------------------19.06.01 11:33-------------------------------- ---------------------------------------------------------------------------*/ @@ -801,5 +836,26 @@ void RubyEdit::GetFocus() GetModifyHdl().Call(this); Edit::GetFocus(); } +/* -----------------------------17.07.01 09:00-------------------------------- + ---------------------------------------------------------------------------*/ +long RubyEdit::PreNotify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + const KeyCode& rKeyCode = pKEvt->GetKeyCode(); + USHORT nMod = rKeyCode.GetModifier(); + if(rKeyCode.GetCode() == KEY_TAB && (!nMod || KEY_SHIFT == nMod)) + { + sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1; + if(aScrollHdl.IsSet() && aScrollHdl.Call(&nParam)) + nHandled = 1; + } + } + if(!nHandled) + nHandled = Edit::PreNotify(rNEvt); + return nHandled; +} |