sw/source/uibase/uiview/viewport.cxx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
New commits: commit 56139f43ee6ca1ba255410b6d2b5f7e1db6b6ef2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Aug 4 18:40:24 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Aug 4 20:48:17 2022 +0200 tdf#150265: properly handle empty rectangle in SwView::CalcVisArea Use PixelToLogic taking Rectangle for this job, that does everything required in this case. Before commit 9426e90c2c339b16487c48cd885a3e4586e1e1f3 Author Mike Kaganski <mike.kagan...@collabora.com> Date Thu Jul 21 09:29:32 2022 +0200 Cleanup restoring last position headless import always returned early from SwView::ReadUserDataSequence, because either !bGotVisibleBottom, or nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) was true. Thus, SetZoom wasn't called, and SwView::CalcVisArea wasn't called from it. After the change, in SetZoom, the empty rectangle created from passed zero Size got converted from pixels to logic, using transformation loosing its empty state. That resulted in some non-empty VisArea, and later in DOCX export of the table, WW8TableInfo::processSwTableByLayout got garbage from aTableCellInfo.getRect. Using proper Window::PixelToLogic overload allows to simplify and fix it all. Change-Id: Ib5e6d5bda10bf0f8dcb93ff6a46ca6cb81ff5a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137807 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index e145e0ec6b18..e2fbefaabb2a 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -778,13 +778,7 @@ void SwView::CalcVisArea( const Size &rOutPixel ) { Point aTopLeft; tools::Rectangle aRect( aTopLeft, rOutPixel ); - aTopLeft = GetEditWin().PixelToLogic( aTopLeft ); - Point aBottomRight( GetEditWin().PixelToLogic( aRect.BottomRight() ) ); - - aRect.SetLeft( aTopLeft.X() ); - aRect.SetTop( aTopLeft.Y() ); - aRect.SetRight( aBottomRight.X() ); - aRect.SetBottom( aBottomRight.Y() ); + aRect = GetEditWin().PixelToLogic(aRect); // The shifts to the right and/or below can now be incorrect // (e.g. change zoom level, change view size).