[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 13:34:46 PST 2012


 sc/source/ui/dbgui/pvlaydlg.cxx |   40 +++++++++++++++++++++++-----------------
 sc/source/ui/inc/pvlaydlg.hxx   |    4 ++--
 2 files changed, 25 insertions(+), 19 deletions(-)

New commits:
commit 1d5ec29f4ce11bf273e554c97a65191372ff87bd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Dec 5 16:34:01 2012 -0500

    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

diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 3dfa58e..3ef8e0b 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 9b1ce0a..678ccba 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;


More information about the Libreoffice-commits mailing list