sc/source/ui/inc/gridwin.hxx | 4 +- sc/source/ui/view/gridwin.cxx | 57 +++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 35 deletions(-)
New commits: commit 80155798bc3c36531a4105df7c5f942ca540d308 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Oct 9 18:55:30 2013 -0400 Fix context menu launch on mis-spelled word in a cell. This was broken when the spell check handler was re-implemented after the cell storage rework. Change-Id: I4e7e718ffba45b2163bea4dd382f2a49f75fd5f9 diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 1fb0fc8..4cc2242 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -274,8 +274,8 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe bool GetEditUrl( const Point& rPos, OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 ); - bool GetEditUrlOrError( bool bSpellErr, const Point& rPos, - OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 ); + bool GetEditUrlOrError( + const Point& rPos, OUString* pName = NULL, OUString* pUrl = NULL, OUString* pTarget = NULL ); bool HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex = NULL, SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 62b1651..7a6a753 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2946,11 +2946,12 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) Point aPosPixel = rCEvt.GetMousePosPixel(); Point aMenuPos = aPosPixel; + SCsCOL nCellX = -1; + SCsROW nCellY = -1; + pViewData->GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY); + if ( bMouse ) { - SCsCOL nCellX = -1; - SCsROW nCellY = -1; - pViewData->GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY); ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); @@ -2978,10 +2979,12 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) sal_Bool bDone = false; sal_Bool bEdit = pViewData->HasEditView(eWhich); + bool bSpellError = mpSpellCheckCxt->isMisspelled(nCellX, nCellY); + if ( !bEdit ) { // Edit-Zelle mit Spelling-Errors ? - if ( bMouse && GetEditUrlOrError( sal_True, aPosPixel ) ) + if (bMouse && (GetEditUrlOrError(aPosPixel) || bSpellError)) { // GetEditUrlOrError hat den Cursor schon bewegt @@ -3015,7 +3018,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) // IsCursorAtWrongSpelledWord could be used for !bMouse // if there was a corresponding ExecuteSpellPopup call - if( pEditView->IsWrongSpelledWordAtPos( aMenuPos ) ) + if (bSpellError) { // Wenn man unter OS/2 neben das Popupmenue klickt, kommt MouseButtonDown // vor dem Ende des Menue-Execute, darum muss SetModified vorher kommen @@ -5112,11 +5115,11 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, sal_Bool bUp ) bool ScGridWindow::GetEditUrl( const Point& rPos, OUString* pName, OUString* pUrl, OUString* pTarget ) { - return GetEditUrlOrError( false, rPos, pName, pUrl, pTarget ); + return GetEditUrlOrError(rPos, pName, pUrl, pTarget); } -bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos, - OUString* pName, OUString* pUrl, OUString* pTarget ) +bool ScGridWindow::GetEditUrlOrError( + const Point& rPos, OUString* pName, OUString* pUrl, OUString* pTarget ) { //! nPosX/Y mit uebergeben? SCsCOL nPosX; @@ -5177,8 +5180,6 @@ bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos, } aDefault.Put( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) ); aEngine.SetDefaults( aDefault ); - if (bSpellErr) - aEngine.SetControlWord( aEngine.GetControlWord() | EE_CNTRL_ONLINESPELLING ); MapMode aEditMode = pViewData->GetLogicMode(eWhich); // ohne Drawing-Skalierung Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode ); @@ -5254,33 +5255,23 @@ bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos, MapMode aOld = GetMapMode(); SetMapMode(aEditMode); // kein return mehr - if (bSpellErr) // Spelling-Fehler suchen - { - bRet = aTempView.IsWrongSpelledWordAtPos( rPos ); - if ( bRet ) - pViewData->GetView()->SetCursor( nPosX, nPosY ); // Cursor setzen - } - else // URL suchen + const SvxFieldItem* pFieldItem = aTempView.GetFieldUnderMousePointer(); + if (pFieldItem) { - const SvxFieldItem* pFieldItem = aTempView.GetFieldUnderMousePointer(); - - if (pFieldItem) + const SvxFieldData* pField = pFieldItem->GetField(); + if ( pField && pField->ISA(SvxURLField) ) { - const SvxFieldData* pField = pFieldItem->GetField(); - if ( pField && pField->ISA(SvxURLField) ) + if ( pName || pUrl || pTarget ) { - if ( pName || pUrl || pTarget ) - { - const SvxURLField* pURLField = (const SvxURLField*)pField; - if (pName) - *pName = pURLField->GetRepresentation(); - if (pUrl) - *pUrl = pURLField->GetURL(); - if (pTarget) - *pTarget = pURLField->GetTargetFrame(); - } - bRet = sal_True; + const SvxURLField* pURLField = (const SvxURLField*)pField; + if (pName) + *pName = pURLField->GetRepresentation(); + if (pUrl) + *pUrl = pURLField->GetURL(); + if (pTarget) + *pTarget = pURLField->GetTargetFrame(); } + bRet = sal_True; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits