summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/layout/layout.cxx9
-rw-r--r--sw/source/core/layout/newfrm.cxx4
-rw-r--r--sw/source/core/layout/trvlfrm.cxx12
3 files changed, 17 insertions, 8 deletions
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index a1f805d42bd9..6b54065d9e88 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2841,6 +2841,7 @@ void SwLayoutWriter::testBtlrCell()
CPPUNIT_ASSERT_LESS(nFirstParaBottom, rCharRect.Top());
// Test that pressing "up" at the start of the cell goes to the next character position.
+ sal_uLong nNodeIndex = pWrtShell->GetCursor()->Start()->nNode.GetIndex();
sal_Int32 nIndex = pWrtShell->GetCursor()->Start()->nContent.GetIndex();
KeyEvent aKeyEvent(0, KEY_UP);
SwEditWin& rEditWin = pShell->GetView()->GetEditWin();
@@ -2849,6 +2850,14 @@ void SwLayoutWriter::testBtlrCell()
// Without the accompanying fix in place, this test would have failed: "up" was interpreted as
// logical "left", which does nothing if you're at the start of the text anyway.
CPPUNIT_ASSERT_EQUAL(nIndex + 1, pWrtShell->GetCursor()->Start()->nContent.GetIndex());
+
+ // Test that pressing "right" goes to the next paragraph (logical "down").
+ aKeyEvent = KeyEvent(0, KEY_RIGHT);
+ rEditWin.KeyInput(aKeyEvent);
+ Scheduler::ProcessEventsToIdle();
+ // Without the accompanying fix in place, this test would have failed: the cursor went to the
+ // paragraph after the table.
+ CPPUNIT_ASSERT_EQUAL(nNodeIndex + 1, pWrtShell->GetCursor()->Start()->nNode.GetIndex());
#endif
}
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 94e016434e47..bfaf62657091 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -275,9 +275,9 @@ static SwRectFnCollection aVerticalLeftToRightBottomToTop = {
/*.fnSetPos =*/&SwRect::SetLowerLeftCorner,
/*.fnMakePos =*/&SwFrame::MakeRightPos,
- /*.fnXDiff =*/&FirstMinusSecond,
+ /*.fnXDiff =*/&SecondMinusFirst,
/*.fnYDiff =*/&FirstMinusSecond,
- /*.fnXInc =*/&SwIncrement,
+ /*.fnXInc =*/&SwDecrement,
/*.fnYInc =*/&SwIncrement,
/*.fnSetLeftAndWidth =*/&SwRect::SetBottomAndHeight,
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a434a20567c2..912cbafbb43e 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -757,8 +757,8 @@ static bool lcl_UpDown( SwPaM *pPam, const SwContentFrame *pStart,
while ( pCell && !pCell->IsCellFrame() )
pCell = pCell->GetUpper();
OSL_ENSURE( pCell, "could not find the cell" );
- nX = aRectFnSet.GetLeft(pCell->getFrameArea()) +
- aRectFnSet.GetWidth(pCell->getFrameArea()) / 2;
+ nX = aRectFnSet.XInc(aRectFnSet.GetLeft(pCell->getFrameArea()),
+ aRectFnSet.GetWidth(pCell->getFrameArea()) / 2);
//The flow leads from one table to the next. The X-value needs to be
//corrected based on the middle of the starting cell by the amount
@@ -778,14 +778,14 @@ static bool lcl_UpDown( SwPaM *pPam, const SwContentFrame *pStart,
const long nPrtLeft = bRTL ?
aRectFnSet.GetPrtRight(*pTable) :
aRectFnSet.GetPrtLeft(*pTable);
- if ( bRTL != (nX < nPrtLeft) )
+ if (bRTL != (aRectFnSet.XDiff(nPrtLeft, nX) > 0))
nX = nPrtLeft;
else
{
const long nPrtRight = bRTL ?
aRectFnSet.GetPrtLeft(*pTable) :
aRectFnSet.GetPrtRight(*pTable);
- if ( bRTL != (nX > nPrtRight) )
+ if (bRTL != (aRectFnSet.XDiff(nX, nPrtRight) > 0))
nX = nPrtRight;
}
}
@@ -884,7 +884,7 @@ static bool lcl_UpDown( SwPaM *pPam, const SwContentFrame *pStart,
if ( aRectFnSet.IsVert() )
{
if ( nTmpTop )
- --nTmpTop;
+ nTmpTop = aRectFnSet.XInc(nTmpTop, -1);
aInsideCell = Point( nTmpTop, nX );
}
@@ -896,7 +896,7 @@ static bool lcl_UpDown( SwPaM *pPam, const SwContentFrame *pStart,
if ( aRectFnSet.IsVert() )
{
if ( nTmpTop )
- --nTmpTop;
+ nTmpTop = aRectFnSet.XInc(nTmpTop, -1);
aInsideCnt = Point( nTmpTop, nX );
}