[Libreoffice-commits] core.git: sc/source

Steve Yin steve_y at apache.org
Mon Jan 6 02:46:50 PST 2014


 sc/source/ui/Accessibility/AccessibleDocument.cxx    |    9 ++++++---
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |    2 +-
 sc/source/ui/inc/tabvwsh.hxx                         |    8 ++++++--
 sc/source/ui/view/cellsh4.cxx                        |    6 ++++++
 sc/source/ui/view/tabview3.cxx                       |    4 ++++
 sc/source/ui/view/tabvwsh4.cxx                       |    1 +
 6 files changed, 24 insertions(+), 6 deletions(-)

New commits:
commit 296cd762c9730ead75767cf7bbc5f5845f18168b
Author: Steve Yin <steve_y at apache.org>
Date:   Mon Jan 6 07:40:48 2014 +0000

    Resolves: #i123629# [ia2] Invalid focus event fired after editing cell
    
    Some Coverity issues fixes
    (cherry picked from commit 5478c54be2de808663565e53250c8a4055b390c9)
    
    Conflicts:
    	sc/source/ui/inc/AccessibleCell.hxx
    	sc/source/ui/inc/tabvwsh.hxx
    	sc/source/ui/view/cellsh4.cxx
    	sc/source/ui/view/tabvwsh4.cxx
    
    Rolled back some coverity issue fixes for mac build
    
    (cherry picked from commit 15e6a8263ae6181ac4912b94af8cb63adc34a86d)
    
    Conflicts:
    	sc/source/ui/inc/AccessibleCell.hxx
    
    a727d3c7f819c8d0082a9fb017351d5307877fa6
    
    Change-Id: I03b63c655bd55e5fb92d95490eaa4bb081b8ee7d

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 8e0f3a4..47a5177 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1029,10 +1029,13 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin
             ++aDataItr;
     }
     bool bWinFocus=false;
-    ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
-    if (pWin)
+    if (mpViewShell)
     {
-        bWinFocus = pWin->HasFocus();
+        ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+        if (pWin)
+        {
+            bWinFocus = pWin->HasFocus();
+        }
     }
     const SdrMarkList* pMarkList = NULL;
     SdrObject* pMarkedObj = NULL;
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 5fa5740..9179488 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -455,7 +455,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
                         pAccDoc->CommitChange(aEvent);
                     }
                 }
-                sal_Bool bNewPosCell = (aNewCell != maActiveCell);
+                sal_Bool bNewPosCell = (aNewCell != maActiveCell) || mpViewShell->GetForceFocusOnCurCell(); // #i123629#
                 sal_Bool bNewPosCellFocus=sal_False;
                 if ( bNewPosCell && IsFocused() && aNewCell.Tab() == maActiveCell.Tab() )
                 {//single Focus
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a6d4f0e..083befe 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -165,7 +165,9 @@ private:
 
     SbxObject*              pScSbxObject;
 
-    sal_Bool                    bChartAreaValid;            // if chart is drawn
+    sal_Bool                bChartAreaValid; // if chart is drawn
+    sal_Bool                bForceFocusOnCurCell; // #i123629#
+
     OUString                aEditChartName;
     ScRangeListRef          aChartSource;
     Rectangle               aChartPos;
@@ -182,7 +184,6 @@ private:
     bool    mbInSwitch;
     OUString   maName;
     OUString   maScope;
-
 private:
     void    Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
 
@@ -418,6 +419,9 @@ public:
 
     // ugly hack to call Define Names from Manage Names
     void    SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
+    // #i123629#
+    sal_Bool    GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
+    void SetForceFocusOnCurCell(sal_Bool bFlag) { bForceFocusOnCurCell=bFlag; }
 };
 
 //==================================================================
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 945909c..ffeaad0 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -119,6 +119,12 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
     // once extra, so that the cursor will not be painted too often with ExecuteInputDirect:
     pTabViewShell->HideAllCursors();
 
+    // #i123629#
+    if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing )
+        pTabViewShell->SetForceFocusOnCurCell(sal_True);
+    else
+        pTabViewShell->SetForceFocusOnCurCell(sal_False);
+
     //OS: once for all should do, however!
     pTabViewShell->ExecuteInputDirect();
     switch ( nSlotId )
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index cedb9ba..57dfa8c 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -992,6 +992,10 @@ void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
     if (!bKeepOld)
         aViewData.ResetOldCursor();
 
+    // #i123629#
+    if( aViewData.GetViewShell()->GetForceFocusOnCurCell() )
+        aViewData.GetViewShell()->SetForceFocusOnCurCell( !ValidColRow(nCurX, nCurY) );
+
     if (nCurX < 0) nCurX = 0;
     if (nCurY < 0) nCurY = 0;
     if (nCurX > MAXCOL) nCurX = MAXCOL;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 2de2b0c..0421bb7 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1509,6 +1509,7 @@ bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
     bReadOnly(false),           \
     pScSbxObject(NULL),         \
     bChartAreaValid(false),     \
+    bForceFocusOnCurCell(false),\
     nCurRefDlgId(0),            \
     pAccessibilityBroadcaster(NULL), \
     mbInSwitch(false)


More information about the Libreoffice-commits mailing list