[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sc/source winaccessibility/source

Steve Yin steve_y at apache.org
Mon Jan 6 00:09:14 PST 2014


 sc/source/ui/Accessibility/AccessibleCell.cxx        |    2 +-
 sc/source/ui/Accessibility/AccessibleDocument.cxx    |   17 ++++++++++-------
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |   10 +++++-----
 sc/source/ui/inc/AccessibleCell.hxx                  |    3 ++-
 sc/source/ui/inc/AccessibleSpreadsheet.hxx           |   11 +++++++----
 sc/source/ui/inc/tabvwsh.hxx                         |    6 ++++++
 sc/source/ui/view/cellsh4.cxx                        |    6 ++++++
 sc/source/ui/view/tabview3.cxx                       |    4 ++++
 sc/source/ui/view/tabvwsh4.cxx                       |    1 +
 winaccessibility/source/UAccCOM/MAccessible.cpp      |    1 +
 10 files changed, 43 insertions(+), 18 deletions(-)

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

    Bug 123629 - [ia2] Calc: Invalid focus event fired after editing cell
    
    Some Coverity issues fixes

diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 084b420..c7d0c29 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -510,7 +510,7 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange,
 }
 
 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)
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 8a8c93a..d127a47 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -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 (::accessibility::AccessibleShape* pCurr
     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 (::accessibility::AccessibleShape* pCurr
 }
 ::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::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 26c6798..b5d1a80 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -480,7 +480,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
@@ -1490,7 +1490,7 @@ Rectangle ScAccessibleSpreadsheet::GetVisCells(const Rectangle& rVisArea)
         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, uno::RuntimeException)
 }
 
 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 ScAccessibleSpreadsheet::selectColumn( sal_Int32 column )
 }
 
 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 ScAccessibleSpreadsheet::unselectRow( sal_Int32 row )
 }
 
 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())
     {
diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx
index 92a8ae0..b47f7da 100644
--- a/sc/source/ui/inc/AccessibleCell.hxx
+++ b/sc/source/ui/inc/AccessibleCell.hxx
@@ -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 )
diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 926ed95..7d44025 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -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.
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a51d177..f593985 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -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;}
 };
 
 //==================================================================
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index e508432..65cec4d 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -95,6 +95,12 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
     // 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 )
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index ffb4ebc..50bbfba 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -911,6 +911,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 dff0dac..78af02a 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1588,6 +1588,7 @@ FASTBOOL __EXPORT ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent )
     pScSbxObject(NULL),         \
     /*bChartDlgIsEdit(sal_False),*/     \
     bChartAreaValid(sal_False),     \
+    bForceFocusOnCurCell(sal_False),    \
     nCurRefDlgId(0),            \
     pAccessibilityBroadcaster(NULL)
 
commit 795b3bb9e59c9bf049d27538c860cd66633dddcf
Author: Steve Yin <steve_y at apache.org>
Date:   Mon Jan 6 07:08:05 2014 +0000

    Initialize m_containedObjects

diff --git a/winaccessibility/source/UAccCOM/MAccessible.cpp b/winaccessibility/source/UAccCOM/MAccessible.cpp
index 155c3af..943fb40 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cpp
+++ b/winaccessibility/source/UAccCOM/MAccessible.cpp
@@ -216,6 +216,7 @@ pUNOInterface(NULL)
     m_sLocation.m_dWidth=0;
     m_sLocation.m_dHeight=0;
     CEnumVariant::Create(&m_pEnumVar);
+    m_containedObjects.clear();
 }
 
 CMAccessible::~CMAccessible()


More information about the Libreoffice-commits mailing list