include/LibreOfficeKit/LibreOfficeKit.h   |    8 +++-----
 include/LibreOfficeKit/LibreOfficeKit.hxx |    5 +++++
 libreofficekit/source/gtk/lokdocview.cxx  |   12 ++++++++++++
 sfx2/source/view/lokhelper.cxx            |    3 +++
 4 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit ffcfeada090b65a755f0e2d99cde713350df2f77
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Thu Sep 17 09:30:09 2015 +0200

    SfxLokHelper::setView: check if view is already current
    
    Change-Id: I9cf3a4887774657e0e205114688b088fc11c6822

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 646715e..f3731e7 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -45,6 +45,9 @@ void SfxLokHelper::setView(size_t nId)
         return;
 
     SfxViewShell* pViewShell = rViewArr[nId];
+    if (pViewShell->GetViewFrame() == SfxViewFrame::Current())
+        return;
+
     if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame())
         pViewFrame->MakeActive_Impl(false);
 }
commit 2b4fea22a18c4c520fc55b2b605bbdea2d9d209a
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Sep 16 14:46:39 2015 +0200

    lokdocview: set view before calling lok::Document member functions
    
    getTextSelection() is still to be done, but has to be moved to the
    widget first.
    
    Change-Id: I780a31f1dbce38b2b7398bfdacbbc1c40881229d

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 97ae136..4c3e1fa 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -158,7 +158,7 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::resetSelection
     void (*resetSelection) (LibreOfficeKitDocument* pThis);
 
-    /// @see lok::Document:getStyles
+    /// @see lok::Document::getCommandValues().
     char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* 
pCommand);
 
     /// @see lok::Document::createView().
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ee9ab9f..85dc29b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -391,6 +391,7 @@ static gboolean postDocumentLoad(gpointer pData)
     LOKDocView* pLOKDocView = static_cast<LOKDocView*>(pData);
     LOKDocViewPrivate* priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pLOKDocView));
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument);
     priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, 
callbackWorker, pLOKDocView);
     priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, 
&priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
@@ -1101,6 +1102,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, 
GdkEventMotion* pEvent)
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
     GdkPoint aPoint;
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     if (priv->m_bInDragMiddleHandle)
     {
         g_info("lcl_signalMotion: dragging the middle handle");
@@ -1183,6 +1185,7 @@ setGraphicSelectionInThread(gpointer data)
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->setGraphicSelection(priv->m_pDocument,
                                                    
pLOEvent->m_nSetGraphicSelectionType,
                                                    
pLOEvent->m_nSetGraphicSelectionX,
@@ -1243,6 +1246,7 @@ setPartInThread(gpointer data)
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
     int nPart = pLOEvent->m_nPart;
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart );
 }
 
@@ -1255,6 +1259,7 @@ setPartmodeInThread(gpointer data)
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
     int nPartMode = pLOEvent->m_nPartMode;
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode );
 }
 
@@ -1273,6 +1278,7 @@ setEditInThread(gpointer data)
     else if (priv->m_bEdit && !bEdit)
     {
         g_info("lok_doc_view_set_edit: leaving edit mode");
+        priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
         priv->m_pDocument->pClass->resetSelection(priv->m_pDocument);
     }
     priv->m_bEdit = bEdit;
@@ -1288,6 +1294,7 @@ postCommandInThread (gpointer data)
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, 
pLOEvent->m_pCommand, pLOEvent->m_pArguments);
 }
 
@@ -1316,6 +1323,7 @@ paintTileInThread (gpointer data)
     aTileRectangle.x = pixelToTwip(nTileSizePixels, 
pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileY;
     aTileRectangle.y = pixelToTwip(nTileSizePixels, 
pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileX;
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     g_test_timer_start();
     priv->m_pDocument->pClass->paintTile(priv->m_pDocument,
                                          pBuffer,
@@ -1974,6 +1982,7 @@ SAL_DLLPUBLIC_EXPORT int
 lok_doc_view_get_parts (LOKDocView* pDocView)
 {
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     return priv->m_pDocument->pClass->getParts( priv->m_pDocument );
 }
 
@@ -1981,6 +1990,7 @@ SAL_DLLPUBLIC_EXPORT int
 lok_doc_view_get_part (LOKDocView* pDocView)
 {
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     return priv->m_pDocument->pClass->getPart( priv->m_pDocument );
 }
 
@@ -2002,6 +2012,7 @@ SAL_DLLPUBLIC_EXPORT char*
 lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart)
 {
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart );
 }
 
commit 2ff8eb233e5365e626c3c40fec3f1d884ea6f207
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Sep 16 14:31:49 2015 +0200

    Add missing lok::Document::setPartMode() wrapper
    
    Change-Id: I5dd5f0cfb8b34621b18a35be682249e042d9b173

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index fc025ae..97ae136 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -93,10 +93,7 @@ struct _LibreOfficeKitDocumentClass
     char* (*getPartName) (LibreOfficeKitDocument* pThis,
                           int nPart);
 
-    /** Sets mode of the current part.
-     *
-     * @param nMode - element from the LibreOfficeKitPartMode enum.
-     */
+    /// @see lok::Document::setPartMode().
     void (*setPartMode) (LibreOfficeKitDocument* pThis,
                          int nMode);
 
@@ -118,6 +115,7 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::initializeForRendering().
     void (*initializeForRendering) (LibreOfficeKitDocument* pThis);
 
+    /// @see lok::Document::registerCallback().
     void (*registerCallback) (LibreOfficeKitDocument* pThis,
                               LibreOfficeKitCallback pCallback,
                               void* pData);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 45ace9d..7f96e19 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -94,6 +94,11 @@ public:
         return mpDoc->pClass->getPartName(mpDoc, nPart);
     }
 
+    inline void setPartMode(int nMode)
+    {
+        mpDoc->pClass->setPartMode(mpDoc, nMode);
+    }
+
     /**
      * Renders a subset of the document to a pre-allocated buffer.
      *
commit ea56b1e90cc5a774cc3d87d1feb0cb76185c5c5c
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Wed Sep 16 14:28:00 2015 +0200

    LOK: allow postMouseEvent() in multiple views
    
    Change-Id: Iafb08cb44a96dbc03d12367d21b4120063bd0222

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 25f1c48..ee9ab9f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1197,6 +1197,7 @@ postMouseEventInThread(gpointer data)
     LOKDocViewPrivate *priv = 
static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
 
+    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
     priv->m_pDocument->pClass->postMouseEvent(priv->m_pDocument,
                                               pLOEvent->m_nPostMouseEventType,
                                               pLOEvent->m_nPostMouseEventX,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to