sc/source/ui/view/tabcont.cxx  |   13 ++++++++++---
 sd/source/ui/view/drviews1.cxx |   15 ++++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit 50787b48a8378a555a71cc2c6b0966debb2e5104
Author: Miklos Vajna <[email protected]>
Date:   Wed Jun 15 16:30:15 2016 +0200

    sc, sd: add per-view support to recently added LOK_CALLBACK_SET_PART calls
    
    These caushed an assertion failure when opening a Calc or Impress
    document in gtktiledviewer.
    
    Change-Id: If9cf1ef6c5a9d8e1b0d578b20dd3f513989b669b
    Reviewed-on: https://gerrit.libreoffice.org/26311
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins <[email protected]>

diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index f61e32a..dbc4af7 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -35,6 +35,7 @@
 #include "markdata.hxx"
 #include <gridwin.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData )
     : TabBar(pParent, WB_3DLOOK | WB_MINSCROLL | WB_SCROLL | WB_RANGESELECT | 
WB_MULTISELECT | WB_DRAG)
@@ -414,9 +415,15 @@ void ScTabControl::SwitchToPageId(sal_uInt16 nId)
                 SelectPage( i, i==nId );
             Select();
 
-            // notify LibreOfficeKit about changed page
-            OString aPayload = OString::number(nId - 1);
-            
pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART,
 aPayload.getStr());
+            if (comphelper::LibreOfficeKit::isActive())
+            {
+                // notify LibreOfficeKit about changed page
+                OString aPayload = OString::number(nId - 1);
+                if (comphelper::LibreOfficeKit::isViewCallback())
+                    
pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, 
aPayload.getStr());
+                else
+                    
pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART,
 aPayload.getStr());
+            }
         }
     }
 }
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index b120be8..b2711f2 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -925,9 +925,18 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
         // never at a masterpage)
         GetDoc()->SetSelected(mpActualPage, true);
 
-        // notify LibreOfficeKit about changed page
-        OString aPayload = OString::number(nSelectedPage);
-        GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, 
aPayload.getStr());
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            // notify LibreOfficeKit about changed page
+            OString aPayload = OString::number(nSelectedPage);
+            if (comphelper::LibreOfficeKit::isViewCallback())
+            {
+                if (SfxViewShell* pViewShell = GetViewShell())
+                    
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, 
aPayload.getStr());
+            }
+            else
+                GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, 
aPayload.getStr());
+        }
 
         rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( 
GetDoc() ) );
         if( !xSlideshow.is() || !xSlideshow->isRunning() || ( 
xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to