diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-12-05 16:34:01 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-12-05 16:35:48 -0500 |
commit | 1d5ec29f4ce11bf273e554c97a65191372ff87bd (patch) | |
tree | 45948bbcaf85c34b3b43abf74042a2d1469d4471 | |
parent | 233d840bd2f56ea50e0a26b96e42c2fae802c427 (diff) |
Don't forget to set focus handler for the reference edit boxes.
Or else the reference mode wouldn't work at all. Also rename the
pointer that holds the current reference edit box instance, to be
consistent with our other reference edit dialogs.
Change-Id: I72e98b5a81b4c313d41c5bd0e429781997cf78b2
-rw-r--r-- | sc/source/ui/dbgui/pvlaydlg.cxx | 40 | ||||
-rw-r--r-- | sc/source/ui/inc/pvlaydlg.hxx | 4 |
2 files changed, 25 insertions, 19 deletions
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index 3dfa58e3413f..3ef8e0bc9cb8 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -116,7 +116,7 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window mxDlgDPObject( new ScDPObject( rDPObject ) ), mpViewData( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData() ), mpDoc( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument() ), - mpActiveEdit(NULL), + mpRefInputEdit(NULL), maStrUndefined(SC_RESSTR(SCSTR_UNDEFINED)), maStrNewTable(SC_RESSTR(SCSTR_NEWTABLE)), @@ -185,6 +185,12 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window maBtnOk.SetClickHdl( LINK( this, ScPivotLayoutDlg, OkHdl ) ); maBtnCancel.SetClickHdl( LINK( this, ScPivotLayoutDlg, CancelHdl ) ); + // Set focus handler for the reference edit text boxes. + Link aGetFocusLink = LINK(this, ScPivotLayoutDlg, GetFocusHdl); + if (maEdInPos.IsEnabled()) + maEdInPos.SetGetFocusHdl(aGetFocusLink); + maEdOutPos.SetGetFocusHdl(aGetFocusLink); + if ( mpViewData && mpDoc ) { /* @@ -1597,23 +1603,23 @@ sal_uInt8 ScPivotLayoutDlg::GetNextDupCount( void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDoc ) { - if ( !mbRefInputMode || !mpActiveEdit ) + if (!mbRefInputMode || !mpRefInputEdit) return; if ( rRef.aStart != rRef.aEnd ) - RefInputStart( mpActiveEdit ); + RefInputStart(mpRefInputEdit); - if ( mpActiveEdit == &maEdInPos ) + if (mpRefInputEdit == &maEdInPos) { rtl::OUString aRefStr; rRef.Format( aRefStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); - mpActiveEdit->SetRefString( aRefStr ); + mpRefInputEdit->SetRefString(aRefStr); } - else if ( mpActiveEdit == &maEdOutPos ) + else if (mpRefInputEdit == &maEdOutPos) { rtl::OUString aRefStr; rRef.aStart.Format( aRefStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() ); - mpActiveEdit->SetRefString( aRefStr ); + mpRefInputEdit->SetRefString(aRefStr); } } @@ -1626,12 +1632,12 @@ void ScPivotLayoutDlg::SetActive() { if ( mbRefInputMode ) { - if ( mpActiveEdit ) - mpActiveEdit->GrabFocus(); + if (mpRefInputEdit) + mpRefInputEdit->GrabFocus(); - if ( mpActiveEdit == &maEdInPos ) + if (mpRefInputEdit == &maEdInPos) EdInModifyHdl( NULL ); - else if ( mpActiveEdit == &maEdOutPos ) + else if (mpRefInputEdit == &maEdOutPos) EdOutModifyHdl( NULL ); } else @@ -1906,13 +1912,13 @@ IMPL_LINK_NOARG(ScPivotLayoutDlg, SelAreaHdl) return 0; } -IMPL_LINK( ScPivotLayoutDlg, GetFocusHdl, Control*, pCtrl ) +IMPL_LINK( ScPivotLayoutDlg, GetFocusHdl, formula::RefEdit*, pEdit ) { - mpActiveEdit = NULL; - if ( pCtrl == &maEdInPos ) - mpActiveEdit = &maEdInPos; - else if ( pCtrl == &maEdOutPos ) - mpActiveEdit = &maEdOutPos; + if (pEdit == &maEdInPos) + mpRefInputEdit = &maEdInPos; + else if (pEdit == &maEdOutPos) + mpRefInputEdit = &maEdOutPos; + else mpRefInputEdit = NULL; return 0; } diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx index 9b1ce0ad87bc..678ccbaba486 100644 --- a/sc/source/ui/inc/pvlaydlg.hxx +++ b/sc/source/ui/inc/pvlaydlg.hxx @@ -204,7 +204,7 @@ private: DECL_LINK( EdOutModifyHdl, void * ); DECL_LINK( EdInModifyHdl, void * ); DECL_LINK( SelAreaHdl, void * ); - DECL_LINK( GetFocusHdl, Control* ); + DECL_LINK( GetFocusHdl, formula::RefEdit* ); private: struct FieldRect @@ -257,7 +257,7 @@ private: ScViewData* mpViewData; ScDocument* mpDoc; - ::formula::RefEdit* mpActiveEdit; + formula::RefEdit* mpRefInputEdit; const rtl::OUString maStrUndefined; const rtl::OUString maStrNewTable; |