[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - editeng/source sc/source

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 09:19:15 UTC 2020


 editeng/source/editeng/impedit.cxx |   40 +++++++++++++++++++++++++++++++++++++
 sc/source/ui/app/inputwin.cxx      |    5 ++++
 2 files changed, 45 insertions(+)

New commits:
commit de2a7a66658e283021725eeaeb0961e2962151f9
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Tue Jan 14 14:35:11 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Jan 28 10:18:47 2020 +0100

    lok: calc: send text selection rectangles for the input bar
    
    Change-Id: I3caeaddd7a5ddc6e496650539b88e2fd81b37e6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86790
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 7b920638537c..c9ad00241a55 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -379,6 +379,33 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
 
         if (comphelper::LibreOfficeKit::isActive() && mpViewShell && !pOldRegion)
         {
+            VclPtr<vcl::Window> pParent = pOutWin->GetParentWithLOKNotifier();
+            if (pParent && pParent->GetLOKWindowId() != 0)
+            {
+                const long nX = pOutWin->GetOutOffXPixel() - pParent->GetOutOffXPixel();
+                const long nY = pOutWin->GetOutOffYPixel() - pParent->GetOutOffYPixel();
+
+                std::vector<tools::Rectangle> aRectangles;
+                pRegion->GetRegionRectangles(aRectangles);
+
+                std::vector<OString> v;
+                for (tools::Rectangle & rRectangle : aRectangles)
+                {
+                    rRectangle = pOutWin->LogicToPixel(rRectangle);
+                    rRectangle.Move(nX, nY);
+                    v.emplace_back(rRectangle.toString().getStr());
+                }
+                OString sRectangle = comphelper::string::join("; ", v);
+
+                const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
+                const OUString rAction("text_selection");
+                std::vector<vcl::LOKPayloadItem> aItems;
+                aItems.emplace_back("rectangles", sRectangle);
+                pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+                delete pPolyPoly;
+                return;
+            }
+
             pOutWin->Push(PushFlags::MAPMODE);
             if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip)
             {
@@ -1745,6 +1772,19 @@ void ImpEditView::DeselectAll()
     aNewSelection.Min() = aNewSelection.Max();
     SetEditSelection(aNewSelection);
     // const_cast<EditPaM&>(GetEditSelection().Min()) = GetEditSelection().Max();
+
+    if (comphelper::LibreOfficeKit::isActive() && mpViewShell)
+    {
+        VclPtr<vcl::Window> pParent = pOutWin->GetParentWithLOKNotifier();
+        if (pParent && pParent->GetLOKWindowId())
+        {
+            const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
+            const OUString rAction("text_selection");
+            std::vector<vcl::LOKPayloadItem> aItems;
+            aItems.emplace_back("rectangles", "");
+            pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+        }
+    }
 }
 
 bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 6591d121ea19..bacbe4b1ffbd 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1334,6 +1334,9 @@ void ScTextWnd::InitEditEngine()
     mpEditView = o3tl::make_unique<EditView>(mpEditEngine.get(), this);
     mpEditView->SetInsertMode(bIsInsertMode);
 
+    if (comphelper::LibreOfficeKit::isActive())
+        mpEditView->RegisterViewShell(mpViewShell);
+
     // Text from Clipboard is taken over as ASCII in a single row
     EVControlBits n = mpEditView->GetControlWord();
     mpEditView->SetControlWord( n | EVControlBits::SINGLELINEPASTE );
@@ -1855,6 +1858,8 @@ void ScTextWnd::MakeDialogEditView()
     mpEditEngine->SetUpdateMode( true );
 
     mpEditView = o3tl::make_unique<EditView>(mpEditEngine.get(), this);
+    if (comphelper::LibreOfficeKit::isActive())
+        mpEditView->RegisterViewShell(mpViewShell);
     mpEditEngine->InsertView( mpEditView.get(), EE_APPEND );
 
     Resize();


More information about the Libreoffice-commits mailing list