[Libreoffice-commits] core.git: 2 commits - sc/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 19 08:25:28 UTC 2021


 sc/source/ui/app/inputwin.cxx |   43 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 3a84543c9b52f681304564ebfb00db8da6a1d407
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon May 10 10:11:53 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jul 19 10:25:07 2021 +0200

    LOK: inform when input bar has cursor and focus
    
    Now the cursor is rendered on the Drawing Area so
    we need to send special message to inform that
    cursor is shown. This fixes bug in online where
    without cursor instead of sending character to
    formula bar is was send to the spreadsheet and
    formula bar was loosing focus at that time.
    
    Change-Id: I0b1e03900bec855b1378da364f0391f50dbceccb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115310
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119153
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 3d87b97de754..7aa3084fe84e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1313,6 +1313,26 @@ void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl
     }
     else
         WeldEditView::Paint(rRenderContext, rRect);
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        bool bIsFocused = false;
+        if (HasFocus())
+        {
+            vcl::Cursor* pCursor = m_xEditView->GetCursor();
+            if (pCursor)
+                bIsFocused = true;
+        }
+
+        VclPtr<vcl::Window> pParent = mrGroupBar.GetVclParent().GetParentWithLOKNotifier();
+        if (!pParent)
+            return;
+
+        const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back("visible", bIsFocused ? "true" : "false");
+        pNotifier->notifyWindow(pParent->GetLOKWindowId(), "cursor_visible", aItems);
+    }
 }
 
 EditView* ScTextWnd::GetEditView() const
commit 4bd116b28e8266558e40a8e7bf303a53da6a5730
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri May 7 18:30:13 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jul 19 10:24:52 2021 +0200

    LOK: Render correctly sized input bar
    
    Change-Id: I7c319be56ba59a002207a631f2b81136f806f84e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115243
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119018
    Tested-by: Jenkins

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


More information about the Libreoffice-commits mailing list