svx/source/table/tablecontroller.cxx |   37 +++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

New commits:
commit 75f4372dd6a7ff1a1029231a6e3959bfe84f6445
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Jun 14 10:19:43 2016 +0200

    svx: implement per-view LOK_CALLBACK_TEXT_SELECTION
    
    To fix table shape selections.
    
    Change-Id: I85810c20b8cc51646d3c8a8b974d0e8a4f96d1ae
    Reviewed-on: https://gerrit.libreoffice.org/26242
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index dcdfe92..699fd14 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -72,6 +72,7 @@
 #include <o3tl/enumrange.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/lok.hxx>
+#include <sfx2/viewsh.hxx>
 
 using ::editeng::SvxBorderLine;
 using namespace sdr::table;
@@ -2168,9 +2169,21 @@ void SvxTableController::updateSelectionOverlay()
                     aSelection = OutputDevice::LogicToLogic(aSelection, 
MAP_100TH_MM, MAP_TWIP);
                 }
 
-                
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START,
 aSelectionStart.toString().getStr());
-                
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
aSelectionEnd.toString().getStr());
-                
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, 
aSelection.toString().getStr());
+                if (comphelper::LibreOfficeKit::isViewCallback())
+                {
+                    if(SfxViewShell* pViewShell = SfxViewShell::Current())
+                    {
+                        
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, 
aSelectionStart.toString().getStr());
+                        
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
aSelectionEnd.toString().getStr());
+                        
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
aSelection.toString().getStr());
+                    }
+                }
+                else
+                {
+                    
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START,
 aSelectionStart.toString().getStr());
+                    
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
aSelectionEnd.toString().getStr());
+                    
pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, 
aSelection.toString().getStr());
+                }
             }
         }
     }
@@ -2187,9 +2200,21 @@ void SvxTableController::destroySelectionOverlay()
         if (comphelper::LibreOfficeKit::isActive())
         {
             // Clear the LOK text selection so far provided by this table.
-            
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START,
 "EMPTY");
-            
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
"EMPTY");
-            
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, 
"EMPTY");
+            if (comphelper::LibreOfficeKit::isViewCallback())
+            {
+                if(SfxViewShell* pViewShell = SfxViewShell::Current())
+                {
+                    
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, 
"EMPTY");
+                    
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
"EMPTY");
+                    
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+                }
+            }
+            else
+            {
+                
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START,
 "EMPTY");
+                
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, 
"EMPTY");
+                
mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, 
"EMPTY");
+            }
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to