Author: steve_y
Date: Mon Jan  6 07:40:48 2014
New Revision: 1555694

URL: http://svn.apache.org/r1555694
Log:
Bug 123629 - [ia2] Calc: Invalid focus event fired after editing cell

Some Coverity issues fixes

Modified:
    openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleCell.cxx
    openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleDocument.cxx
    openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
    openoffice/trunk/main/sc/source/ui/inc/AccessibleCell.hxx
    openoffice/trunk/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx
    openoffice/trunk/main/sc/source/ui/inc/tabvwsh.hxx
    openoffice/trunk/main/sc/source/ui/view/cellsh4.cxx
    openoffice/trunk/main/sc/source/ui/view/tabview3.cxx
    openoffice/trunk/main/sc/source/ui/view/tabvwsh4.cxx

Modified: openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleCell.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleCell.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleCell.cxx 
(original)
+++ openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleCell.cxx Mon Jan 
 6 07:40:48 2014
@@ -510,7 +510,7 @@ void ScAccessibleCell::AddRelation(const
 }
 
 uno::Any SAL_CALL ScAccessibleCell::getExtendedAttributes() 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) 
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException) 
 {
        uno::Any strRet;
        if (mpViewShell)

Modified: 
openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleDocument.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleDocument.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleDocument.cxx 
(original)
+++ openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleDocument.cxx Mon 
Jan  6 07:40:48 2014
@@ -257,12 +257,12 @@ public:
 
        virtual ::accessibility::AccessibleControlShape* 
GetAccControlShapeFromModel
                (::com::sun::star::beans::XPropertySet* pSet) 
-               throw (::com::sun::star::uno::RuntimeException);
+               throw (::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException);
        virtual  ::com::sun::star::uno::Reference<
             ::com::sun::star::accessibility::XAccessible>
         GetAccessibleCaption (const ::com::sun::star::uno::Reference<
             ::com::sun::star::drawing::XShape>& xShape)
-                       throw (::com::sun::star::uno::RuntimeException);
+                       throw (::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException);
     ///=====  Internal  
========================================================
     void SetDrawBroadcaster();
 
@@ -483,7 +483,7 @@ sal_Bool ScChildrenShapes::ReplaceChild 
     return bResult;
 }
 
-::accessibility::AccessibleControlShape * 
ScChildrenShapes::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet*
 pSet) throw (::com::sun::star::uno::RuntimeException)
+::accessibility::AccessibleControlShape * 
ScChildrenShapes::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet*
 pSet) throw (::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException)
 {
        sal_Int32 count = GetCount();
        for (sal_Int32 index=0;index<count;index++)
@@ -504,7 +504,7 @@ sal_Bool ScChildrenShapes::ReplaceChild 
 }
 ::com::sun::star::uno::Reference < 
::com::sun::star::accessibility::XAccessible >
 ScChildrenShapes::GetAccessibleCaption (const ::com::sun::star::uno::Reference 
< ::com::sun::star::drawing::XShape>& xShape)
-                       throw (::com::sun::star::uno::RuntimeException)
+                       throw (::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException)
 {
        sal_Int32 count = GetCount();
        for (sal_Int32 index=0;index<count;index++)
@@ -1014,10 +1014,13 @@ sal_Bool ScChildrenShapes::FindSelectedS
             ++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;

Modified: 
openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
(original)
+++ openoffice/trunk/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
Mon Jan  6 07:40:48 2014
@@ -480,7 +480,7 @@ void ScAccessibleSpreadsheet::Notify( Sf
                                                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
@@ -1490,7 +1490,7 @@ Rectangle ScAccessibleSpreadsheet::GetVi
                return Rectangle();
 }
 sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectRow( sal_Int32 row ) 
-throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 
+               throw (lang::IndexOutOfBoundsException, uno::RuntimeException, 
ucb::CommandFailedException, ucb::ContentCreationException) 
 {
        if (IsFormulaMode())
        {
@@ -1506,7 +1506,7 @@ throw (lang::IndexOutOfBoundsException, 
 }
 
 sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectColumn( sal_Int32 column ) 
-               throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+               throw (lang::IndexOutOfBoundsException, uno::RuntimeException, 
ucb::CommandFailedException, ucb::ContentCreationException) 
 {
        if (IsFormulaMode())
        {
@@ -1522,7 +1522,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadshee
 }
 
 sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectRow( sal_Int32 row ) 
-               throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+               throw (lang::IndexOutOfBoundsException, uno::RuntimeException, 
ucb::CommandFailedException, ucb::ContentCreationException) 
 {      
        if (IsFormulaMode())
        {
@@ -1539,7 +1539,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadshee
 }
 
 sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectColumn( sal_Int32 column ) 
-               throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+               throw (lang::IndexOutOfBoundsException, uno::RuntimeException, 
ucb::CommandFailedException, ucb::ContentCreationException) 
 {      
        if (IsFormulaMode())
        {

Modified: openoffice/trunk/main/sc/source/ui/inc/AccessibleCell.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/inc/AccessibleCell.hxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/inc/AccessibleCell.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/inc/AccessibleCell.hxx Mon Jan  6 
07:40:48 2014
@@ -35,6 +35,7 @@
 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
 #endif
+#include <com/sun/star/ucb/CommandFailedException.hpp>
 
 class ScTabViewShell;
 class ScAccessibleDocument;
@@ -142,7 +143,7 @@ public:
         throw (::com::sun::star::uno::RuntimeException);
 
     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) ;
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
com::sun::star::ucb::CommandFailedException) ;
 
        // Override this method to handle cell's ParaIndent attribute specially.
     virtual ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( 
sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 
aRequestedAttributes ) 

Modified: openoffice/trunk/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx Mon Jan  6 
07:40:48 2014
@@ -28,6 +28,9 @@
 #include "AccessibleTableBase.hxx"
 #include "viewdata.hxx"
 
+#include <com/sun/star/ucb/CommandFailedException.hpp>
+#include <com/sun/star/ucb/ContentCreationException.hpp>
+
 #include <vector>
 
 #include "rangelst.hxx"
@@ -243,13 +246,13 @@ public:
         throw (com::sun::star::uno::RuntimeException);
        //=====  XAccessibleTableSelection  
============================================
        virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) ;
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
::com::sun::star::ucb::CommandFailedException, 
com::sun::star::ucb::ContentCreationException) ;
     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) ;
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
::com::sun::star::ucb::CommandFailedException, 
com::sun::star::ucb::ContentCreationException) ;
     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) ;
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
::com::sun::star::ucb::CommandFailedException, 
com::sun::star::ucb::ContentCreationException) ;
     virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
-               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException) ;
+               throw (::com::sun::star::lang::IndexOutOfBoundsException, 
::com::sun::star::uno::RuntimeException, 
::com::sun::star::ucb::CommandFailedException, 
com::sun::star::ucb::ContentCreationException) ;
 
 protected:
     ///        Return the object's current bounding box relative to the 
desktop.

Modified: openoffice/trunk/main/sc/source/ui/inc/tabvwsh.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/inc/tabvwsh.hxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/inc/tabvwsh.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/inc/tabvwsh.hxx Mon Jan  6 07:40:48 2014
@@ -177,6 +177,8 @@ private:
        static const int                MASTERENUMCOMMANDS = 6;
     String                                     aCurrShapeEnumCommand[ 
MASTERENUMCOMMANDS ];
 
+       sal_Bool        bForceFocusOnCurCell; // i123629
+
 private:
        void    Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
 
@@ -426,6 +428,10 @@ public:
        sal_Bool IsActive(){ return bIsActive; }
        rtl::OUString GetFormula(ScAddress& rAddress);
        const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface > & GetForms() const;
+
+       // i123629
+       sal_Bool        GetForceFocusOnCurCell(){return bForceFocusOnCurCell;}
+       void            SetForceFocusOnCurCell(sal_Bool 
bFlag){bForceFocusOnCurCell=bFlag;}
 };
 
 //==================================================================

Modified: openoffice/trunk/main/sc/source/ui/view/cellsh4.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/view/cellsh4.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/view/cellsh4.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/view/cellsh4.cxx Mon Jan  6 07:40:48 2014
@@ -95,6 +95,12 @@ void ScCellShell::ExecuteCursor( SfxRequ
        // einmal extra, damit der Cursor bei ExecuteInputDirect nicht zuoft 
gemalt wird:
        pTabViewShell->HideAllCursors();
 
+       // i123629
+       if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing )
+               pTabViewShell->SetForceFocusOnCurCell(sal_True);
+       else
+               pTabViewShell->SetForceFocusOnCurCell(sal_False);
+
        //OS: einmal fuer alle wird doch reichen!
        pTabViewShell->ExecuteInputDirect();
        switch ( nSlotId )

Modified: openoffice/trunk/main/sc/source/ui/view/tabview3.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/view/tabview3.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/view/tabview3.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/view/tabview3.cxx Mon Jan  6 07:40:48 
2014
@@ -911,6 +911,10 @@ void ScTabView::MoveCursorAbs( SCsCOL nC
        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;

Modified: openoffice/trunk/main/sc/source/ui/view/tabvwsh4.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/view/tabvwsh4.cxx?rev=1555694&r1=1555693&r2=1555694&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/view/tabvwsh4.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/view/tabvwsh4.cxx Mon Jan  6 07:40:48 
2014
@@ -1588,6 +1588,7 @@ FASTBOOL __EXPORT ScTabViewShell::KeyInp
        pScSbxObject(NULL),                     \
        /*bChartDlgIsEdit(sal_False),*/         \
        bChartAreaValid(sal_False),             \
+       bForceFocusOnCurCell(sal_False),        \
     nCurRefDlgId(0),            \
        pAccessibilityBroadcaster(NULL)
 


Reply via email to