diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-07-29 19:57:26 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-07-30 14:06:22 +0200 |
commit | 6e53a179bbaaba2c7ad8ad06890a94f9eaf8943a (patch) | |
tree | f4702aa6f82fb3e936c0c9e0cc8db79c47239715 | |
parent | 7bff8e93eb98be4b621c3902de227a3c313cf5b4 (diff) |
fix wrong calculation for text size, fdo#81499
Change-Id: Ifd9e09dd9e1d843728e1874c48efdd127bffe11e
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 17b02f8d5a3a..ed066b22becc 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -273,7 +273,7 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe bool GetEditUrl( const Point& rPos, OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 ); - bool IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol2, SCROW nRow ); + bool IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow ); 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 5b7528c80cd6..bf777ae03a20 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3010,7 +3010,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) if (bSpellError) { // Check and see if a misspelled word is under the mouse pointer. - bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, nCellX, nCellY); + bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, nCellY); } } @@ -5334,7 +5334,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, return false; } -bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol2, SCROW nRow ) +bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow ) { if (!mpSpellCheckCxt) return false; @@ -5359,17 +5359,6 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol if (rPos.Y() < aEditRect.Top()) return false; - Rectangle aEditRect2 = pViewData->GetEditArea(eWhich, nCol2, nRow, this, pPattern, false); - long nWidth = aEditRect2.Right() - aEditRect.Left(); - aEditRect.setWidth(nWidth); - - MapMode aEditMode = pViewData->GetLogicMode(eWhich); - Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode); - Point aLogicClick = PixelToLogic(rPos, aEditMode); - - if (!aLogicEdit.IsInside(aLogicClick)) - return false; - boost::shared_ptr<ScFieldEditEngine> pEngine = createEditEngine(pDocSh, *pPattern); Size aPaperSize = Size(1000000, 1000000); @@ -5380,6 +5369,17 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol else pEngine->SetText(aCell.mpString->getString()); + long nTextWidth = static_cast<long>(pEngine->CalcTextWidth()); + + MapMode aEditMode = pViewData->GetLogicMode(eWhich); + Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode); + Point aLogicClick = PixelToLogic(rPos, aEditMode); + + aLogicEdit.setWidth(nTextWidth + 1); + + if (!aLogicEdit.IsInside(aLogicClick)) + return false; + pEngine->SetControlWord(pEngine->GetControlWord() | EE_CNTRL_ONLINESPELLING); pEngine->SetAllMisspellRanges(*pRanges); |