From 835d054434d0000a5741a5bfa5f577e855594c40 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 15 Feb 2019 12:07:07 +0100 Subject: sw btlr writing mode layout: fix multiple paragraphs aVerticalLeftToRightBottomToTop was wrong, it mapped from physical to logical, and it should be the other way around. In practice this means that when SwTextFrame::AdjustFrame() is invoked for a second lower, then nAdd will be a small positive (and not a large negative) number, so the warn:legacy.osl:20827:20827:sw/source/core/text/frmform.cxx:479: Ey warning goes away and the second lower becomes visible. Change-Id: I894fef4a89b1feeb333537ff7d76793130007ed8 Reviewed-on: https://gerrit.libreoffice.org/67862 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/layout/data/btlr-cell.odt | Bin 9174 -> 9179 bytes sw/qa/extras/layout/layout.cxx | 7 +++- sw/source/core/layout/newfrm.cxx | 66 ++++++++++++++++----------------- 3 files changed, 39 insertions(+), 34 deletions(-) (limited to 'sw') diff --git a/sw/qa/extras/layout/data/btlr-cell.odt b/sw/qa/extras/layout/data/btlr-cell.odt index c010fa9f51b6..17a9c19eef25 100644 Binary files a/sw/qa/extras/layout/data/btlr-cell.odt and b/sw/qa/extras/layout/data/btlr-cell.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index bd720372dfb1..d29cc476f9cc 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2807,10 +2807,15 @@ void SwLayoutWriter::testBtlrCell() #if !defined(MACOSX) && !defined(_WIN32) // macOS fails with actual == 2662 for some reason. // Without the accompanying fix in place, this test would have failed with 'Expected: 1915; - // Actual : 1756', i.e. the AAA text was too close to the left cell border due to an ascent vs + // Actual : 1756', i.e. the AAA1 text was too close to the left cell border due to an ascent vs // descent mismatch when calculating the baseline offset of the text portion. assertXPath(pXmlDoc, "//textarray[1]", "x", "1915"); assertXPath(pXmlDoc, "//textarray[1]", "y", "2707"); + + // Without the accompanying fix in place, this test would have failed with 'Expected: 269; + // Actual : 0', i.e. the AAA2 frame was not visible due to 0 width. + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/txt[2]/infos/bounds", "width", "269"); #endif } diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 0971c2d95a8e..94e016434e47 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -226,62 +226,62 @@ static SwRectFnCollection aVerticalLeftToRight = { /** * This is the same as horizontal, but rotated counter-clockwise by 90 degrees. - * This means logical top is physical right, bottom is left, left is top, - * finally right is bottom. + * This means logical top is physical left, bottom is right, left is bottom, + * finally right is top. Values map from logical to physical. */ static SwRectFnCollection aVerticalLeftToRightBottomToTop = { - /*.fnGetTop =*/&SwRect::Right_, - /*.fnGetBottom =*/&SwRect::Left_, - /*.fnGetLeft =*/&SwRect::Top_, - /*.fnGetRight =*/&SwRect::Bottom_, + /*.fnGetTop =*/&SwRect::Left_, + /*.fnGetBottom =*/&SwRect::Right_, + /*.fnGetLeft =*/&SwRect::Bottom_, + /*.fnGetRight =*/&SwRect::Top_, /*.fnGetWidth =*/&SwRect::Height_, /*.fnGetHeight =*/&SwRect::Width_, - /*.fnGetPos =*/&SwRect::TopRight, + /*.fnGetPos =*/&SwRect::BottomLeft, /*.fnGetSize =*/&SwRect::SwappedSize, - /*.fnSetTop =*/&SwRect::Right_, - /*.fnSetBottom =*/&SwRect::Left_, - /*.fnSetLeft =*/&SwRect::Top_, - /*.fnSetRight =*/&SwRect::Bottom_, + /*.fnSetTop =*/&SwRect::Left_, + /*.fnSetBottom =*/&SwRect::Right_, + /*.fnSetLeft =*/&SwRect::Bottom_, + /*.fnSetRight =*/&SwRect::Top_, /*.fnSetWidth =*/&SwRect::Height_, /*.fnSetHeight =*/&SwRect::Width_, - /*.fnSubTop =*/&SwRect::AddRight, - /*.fnAddBottom =*/&SwRect::SubLeft, - /*.fnSubLeft =*/&SwRect::SubTop, - /*.fnAddRight =*/&SwRect::AddBottom, + /*.fnSubTop =*/&SwRect::SubLeft, + /*.fnAddBottom =*/&SwRect::AddRight, + /*.fnSubLeft =*/&SwRect::AddBottom, + /*.fnAddRight =*/&SwRect::SubTop, /*.fnAddWidth =*/&SwRect::AddHeight, /*.fnAddHeight =*/&SwRect::AddWidth, /*.fnSetPosX =*/&SwRect::SetPosY, /*.fnSetPosY =*/&SwRect::SetPosX, - /*.fnGetTopMargin =*/&SwFrame::GetRightMargin, - /*.fnGetBottomMargin =*/&SwFrame::GetLeftMargin, - /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin, - /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin, + /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin, + /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin, + /*.fnGetLeftMargin =*/&SwFrame::GetBottomMargin, + /*.fnGetRightMargin =*/&SwFrame::GetTopMargin, /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins, /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins, - /*.fnGetPrtTop =*/&SwFrame::GetPrtRight, - /*.fnGetPrtBottom =*/&SwFrame::GetPrtLeft, - /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop, - /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom, - /*.fnTopDist =*/&SwRect::GetRightDistance, - /*.fnBottomDist =*/&SwRect::GetLeftDistance, - /*.fnLeftDist =*/&SwRect::GetTopDistance, - /*.fnRightDist =*/&SwRect::GetBottomDistance, - /*.fnSetLimit =*/&SwFrame::SetMinLeft, - /*.fnOverStep =*/&SwRect::OverStepLeft, + /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft, + /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight, + /*.fnGetPrtLeft =*/&SwFrame::GetPrtBottom, + /*.fnGetPrtRight =*/&SwFrame::GetPrtTop, + /*.fnTopDist =*/&SwRect::GetLeftDistance, + /*.fnBottomDist =*/&SwRect::GetRightDistance, + /*.fnLeftDist =*/&SwRect::GetBottomDistance, + /*.fnRightDist =*/&SwRect::GetTopDistance, + /*.fnSetLimit =*/&SwFrame::SetMaxRight, + /*.fnOverStep =*/&SwRect::OverStepRight, - /*.fnSetPos =*/&SwRect::SetUpperRightCorner, - /*.fnMakePos =*/&SwFrame::MakeLeftPos, + /*.fnSetPos =*/&SwRect::SetLowerLeftCorner, + /*.fnMakePos =*/&SwFrame::MakeRightPos, /*.fnXDiff =*/&FirstMinusSecond, /*.fnYDiff =*/&FirstMinusSecond, /*.fnXInc =*/&SwIncrement, /*.fnYInc =*/&SwIncrement, - /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight, - /*.fnSetTopAndHeight =*/&SwRect::SetRightAndWidth + /*.fnSetLeftAndWidth =*/&SwRect::SetBottomAndHeight, + /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth }; SwRectFn fnRectHori = &aHorizontal; -- cgit