[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 30 05:11:56 PDT 2014
sc/qa/unit/ucalc.cxx | 15 +++++++++++++++
sc/source/core/data/table4.cxx | 1 +
sc/source/ui/inc/gridwin.hxx | 2 +-
sc/source/ui/view/gridwin.cxx | 26 +++++++++++++-------------
4 files changed, 30 insertions(+), 14 deletions(-)
New commits:
commit 6e53a179bbaaba2c7ad8ad06890a94f9eaf8943a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 29 19:57:26 2014 +0200
fix wrong calculation for text size, fdo#81499
Change-Id: Ifd9e09dd9e1d843728e1874c48efdd127bffe11e
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 17b02f8..ed066b2 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 5b7528c..bf777ae 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);
commit 7bff8e93eb98be4b621c3902de227a3c313cf5b4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 29 18:52:50 2014 +0200
the range has to be in the correct order, fdo#81803
Change-Id: Ia3907701857e22c11a2cefa5d35437c8f8219ff6
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 02d1664..0a90209 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1134,6 +1134,7 @@ void ScTable::FillFormulaVertical(
SCCOLROW nRowStart = -1, nRowEnd = -1;
std::vector<sc::RowSpan> aSpans;
+ PutInOrder(nRow1, nRow2);
for (rInner = nRow1; rInner <= nRow2; ++rInner)
{
if (rInner > nHiddenLast)
commit 896390d79133199910f857cf85004466171ca405
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 29 18:52:14 2014 +0200
add test case for fdo#81803
Change-Id: I00c52bd1a8d949e3fd874c2dedbd9e2345aca74e
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 02950cf..ee5a0d8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4576,6 +4576,21 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,4,0)));
CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,5,0)));
+ // test that filling formulas vertically up does the right thing
+ for(SCROW nRow = 0; nRow < 10; ++nRow)
+ m_pDoc->SetValue(100, 100 + nRow, 0, 1);
+
+ m_pDoc->SetString(100, 110, 0, "=A111");
+
+ m_pDoc->Fill(100, 110, 100, 110, NULL, aMarkData, 10, FILL_TO_TOP, FILL_AUTO);
+ for(SCROW nRow = 110; nRow >= 100; --nRow)
+ {
+ OUString aExpected = OUString("=A") + OUString::number(nRow +1);
+ OUString aFormula;
+ m_pDoc->GetFormula(100, nRow, 0, aFormula);
+ CPPUNIT_ASSERT_EQUAL(aExpected, aFormula);
+ }
+
m_pDoc->DeleteTab(0);
}
More information about the Libreoffice-commits
mailing list