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

New commits:
commit 6fdd5e3ec95712d03b30fc32acffa358b7fef46e
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Tue Jan 14 14:35:11 2020 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Fri Mar 6 10:42:46 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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90069
    Tested-by: Jenkins
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 53900c16aa76..0162856b0e36 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -382,6 +382,33 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 
         if (comphelper::LibreOfficeKit::isActive() && mpViewShell && 
!pOldRegion && pOutWin)
         {
+            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);
+                pPolyPoly.reset();
+                return;
+            }
+
             pOutWin->Push(PushFlags::MAPMODE);
             if (pOutWin->GetMapMode().GetMapUnit() == MapUnit::MapTwip)
             {
@@ -1743,6 +1770,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 2108f1c9dd8d..2702bb2705f1 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1500,6 +1500,9 @@ void ScTextWnd::InitEditEngine()
     mpEditView = std::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 );
@@ -2016,6 +2019,8 @@ void ScTextWnd::MakeDialogEditView()
     mpEditEngine->SetUpdateMode( true );
 
     mpEditView = std::make_unique<EditView>(mpEditEngine.get(), this);
+    if (comphelper::LibreOfficeKit::isActive())
+        mpEditView->RegisterViewShell(mpViewShell);
     mpEditEngine->InsertView( mpEditView.get(), EE_APPEND );
 
     Resize();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to