summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-05-07 18:30:13 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-07-19 10:24:52 +0200
commit4bd116b28e8266558e40a8e7bf303a53da6a5730 (patch)
tree65ec49d6e390dfe985e5a2e9771677f59e19314e /sc
parent14c778017f79370e07b8acb5b801980ae9c7af02 (diff)
LOK: Render correctly sized input bar
Change-Id: I7c319be56ba59a002207a631f2b81136f806f84e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115243 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119018 Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputwin.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index b9a5f567d251..3d87b97de754 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>
@@ -1291,7 +1292,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() const