Kaydet (Commit) 8e43393c authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 6e57e691
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment