summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2014-01-06 07:40:48 +0000
committerSteve Yin <steve_y@apache.org>2014-01-06 07:40:48 +0000
commit5478c54be2de808663565e53250c8a4055b390c9 (patch)
tree235c1d6ad6d13a56ab6d0fea743c1eacaf016ecf /sc
parent795b3bb9e59c9bf049d27538c860cd66633dddcf (diff)
Bug 123629 - [ia2] Calc: Invalid focus event fired after editing cell
Some Coverity issues fixes
Notes
Notes: merged as: 296cd762c9730ead75767cf7bbc5f5845f18168b
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx17
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx10
-rw-r--r--sc/source/ui/inc/AccessibleCell.hxx3
-rw-r--r--sc/source/ui/inc/AccessibleSpreadsheet.hxx11
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx6
-rw-r--r--sc/source/ui/view/cellsh4.cxx6
-rw-r--r--sc/source/ui/view/tabview3.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx1
9 files changed, 42 insertions, 18 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 084b42094892..c7d0c2926a02 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 8a8c93a658bf..d127a470dfdd 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 26c679875426..b5d1a8017802 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 92a8ae06a584..b47f7daee832 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 926ed95c26d0..7d4402504c89 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 a51d177fa970..f593985ed2fb 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 e508432b37ac..65cec4dbb6f9 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 ffb4ebcd0cac..50bbfba1671c 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 dff0dac2d05f..78af02ae01e5 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)