sc/source/ui/app/inputwin.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
New commits: commit 5c21b86c9e46f26955ac19552b673290c420ee84 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri May 7 18:30:13 2021 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri May 7 19:07:06 2021 +0200 LOK: Render correctly sized input bar Change-Id: I7c319be56ba59a002207a631f2b81136f806f84e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115243 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 3b7626e8566c..47138fb4c717 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -44,6 +44,7 @@ #include <svl/stritem.hxx> #include <vcl/svapp.hxx> #include <vcl/weldutils.hxx> +#include <vcl/virdev.hxx> #include <unotools/charclass.hxx> #include <inputwin.hxx> @@ -1290,7 +1291,27 @@ void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl } } - WeldEditView::Paint(rRenderContext, rRect); + if (comphelper::LibreOfficeKit::isActive() && m_xEditEngine) + { + // in LOK somehow text is rendered very overscaled so render the original content first + // on a virtual device then redraw with correct scale to the target device + + ScopedVclPtrInstance<VirtualDevice> pDevice; + + tools::Long aPaperWidth = m_xEditEngine->GetPaperSize().getWidth(); + double fRatio = static_cast<double>(rRect.GetSize().getHeight()) / rRect.GetSize().getWidth(); + + tools::Rectangle aPaperRect(Point(0, 0), Size(aPaperWidth, aPaperWidth * fRatio)); + aPaperRect = pDevice->PixelToLogic(aPaperRect); + + pDevice->SetOutputSize(aPaperRect.GetSize()); + + WeldEditView::Paint(*pDevice, aPaperRect); + + rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(), Point(0,0), aPaperRect.GetSize(), *pDevice); + } + else + WeldEditView::Paint(rRenderContext, rRect); } EditView* ScTextWnd::GetEditView() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits