[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - 140 commits - basctl/source basegfx/source basic/inc basic/qa basic/source bin/gbuild-to-ide canvas/README canvas/source canvas/workben chart2/inc chart2/source comphelper/inc comphelper/qa comphelper/source compilerplugins/clang connectivity/source cui/source cui/uiconfig dbaccess/source desktop/source editeng/source embeddedobj/test external/bzip2 extras/source filter/qa filter/source formula/source fpicker/source fpicker/uiconfig framework/inc framework/source helpcontent2 include/basic include/comphelper include/editeng include/formula include/LibreOfficeKit include/oox include/osl include/sax include/sfx2 include/svl include/svtools include/vbahelper include/vcl include/xmloff jurt/com libreofficekit/qa libreofficekit/source lingucomponent/source lotuswordpro/source odk/examples officecfg/registry onlineupdate/Executable_mar.mk onlineupdate/Executable_updater.mk onlineupdate/source oox/inc oox/source pyuno/source qadevOO o/runner qadevOOo/tests reportdesign/inc reportdesign/source RepositoryExternal.mk sal/inc sal/Library_sal.mk sal/osl sal/rtl sax/source scaddins/source sc/inc sc/qa scripting/source sc/source sc/uiconfig sd/inc sd/Library_sd.mk sd/sdi sd/source sfx2/sdi sfx2/source solenv/bin starmath/inc starmath/source stoc/source svl/source svtools/source svx/sdi svx/source svx/workben sw/inc sw/qa sw/source toolkit/source ucb/source unotools/source vbahelper/source vcl/inc vcl/osx vcl/source vcl/unx vcl/workben winaccessibility/source wizards/com writerfilter/inc writerfilter/source xmloff/source xmlsecurity/source

Pranav Kant pranavk at gnome.org
Wed Jul 22 08:03:35 PDT 2015


Rebased ref, commits from common ancestor:
commit 0ec64ce1d2ffbbf6e17026b069d4b47bb905a9d3
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jul 22 20:25:36 2015 +0530

    lokdocview, tilebuffer: Add DOxygen comments
    
    Change-Id: I27377f0a758729a7877cfc6a56ea1b4bb3d1c3c9

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0e51b13..2259d5b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -36,6 +36,7 @@
 // Number of handles around a graphic selection.
 #define GRAPHIC_HANDLE_COUNT 8
 
+/// Private struct used by this GObject type
 struct _LOKDocViewPrivate
 {
     gchar* m_aLOPath;
@@ -162,6 +163,7 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA,
 
 static GThreadPool* lokThreadPool;
 
+/// Helper struct used to pass the data from soffice thread -> main thread.
 struct CallbackData
 {
     int m_nType;
@@ -174,8 +176,16 @@ struct CallbackData
           m_pDocView(pDocView) {}
 };
 
+/**
+   A struct that we use to store the data about the LOK call.
+
+   Object of this type is passed with all the LOK calls,
+   so that they can be idenitified. Additionally, it also contains
+   the data that LOK call needs.
+*/
 struct LOEvent
 {
+    /// To identify the type of LOK call
     int m_nType;
     const gchar* m_pCommand;
     const gchar* m_pArguments;
@@ -187,6 +197,8 @@ struct LOEvent
     int m_nCharCode;
     int m_nKeyCode;
 
+
+    /// Constructor to easily instantiate an object for LOK call of `type' type.
     LOEvent(int type)
         : m_nType(type) {}
 
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index 50de72d..40fb2ab 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -131,6 +131,11 @@ class TileBuffer
     Tile m_DummyTile;
 };
 
+/**
+   Helper struct used to pass the data from main thread to spawned threads.
+   Spawned threads are responsible for calling paintTile, and store the result
+   in tile buffer.
+*/
 struct GetTileCallbackData
 {
     int m_nX;
commit 8b3d8aee24c05fc3d999d58d6587c6e52f43a761
Author: Pranav Kant <pranavk at gnome.org>
Date:   Sun Jul 19 01:03:56 2015 +0530

    lokdocview: Make paintTile() async
    
    Change-Id: I57db9e3adf26996e6e1e105b8b95f53e88e7760f

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 8054c8e..0e51b13 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -520,7 +520,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle)
 
     for (int i = aStart.x; i < aEnd.x; i++)
         for (int j = aStart.y; j < aEnd.y; j++)
-            priv->m_aTileBuffer.setInvalid(i, j);
+            priv->m_aTileBuffer.setInvalid(i, j, priv->m_fZoom);
 }
 
 static gboolean
@@ -741,6 +741,12 @@ renderGraphicHandle(LOKDocView* pDocView,
     }
 }
 
+static void
+renderDocumentCallback(GObject* source_object, GAsyncResult*, gpointer)
+{
+    LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
+    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+}
 
 static gboolean
 renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
@@ -790,7 +796,9 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
 
             if (bPaint)
             {
-                Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom);
+                GTask* task = g_task_new(pDocView, NULL, renderDocumentCallback, NULL);
+                Tile& currentTile = priv->m_aTileBuffer.getTile(nRow, nColumn, priv->m_fZoom, task);
+
                 GdkPixbuf* pPixBuf = currentTile.getBuffer();
                 gdk_cairo_set_source_pixbuf (pCairo, pPixBuf,
                                              twipToPixel(aTileRectangleTwips.x, priv->m_fZoom),
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 60aa16f..d488f8b 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -27,6 +27,42 @@ float twipToPixel(float fInput, float zoom)
     return fInput / 1440.0f * DPI * zoom;
 }
 
+static void getTileFunc(GTask*, gpointer, gpointer task_data, GCancellable*)
+{
+    GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
+    GetTileCallbackData* pCallback = static_cast<GetTileCallbackData*>(task_data);
+    TileBuffer* buffer = pCallback->m_pBuffer;
+    int index = pCallback->m_nX * buffer->m_nWidth + pCallback->m_nY;
+    if (!pPixBuf)
+    {
+        g_info ("Error allocating memory to pixbuf");
+        return;
+    }
+
+    unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
+    GdkRectangle aTileRectangle;
+    aTileRectangle.x = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nY;
+    aTileRectangle.y = pixelToTwip(nTileSizePixels, pCallback->m_fZoom) * pCallback->m_nX;
+
+    g_test_timer_start();
+    buffer->m_pLOKDocument->pClass->paintTile(buffer->m_pLOKDocument,
+                                      pBuffer,
+                                      nTileSizePixels, nTileSizePixels,
+                                      aTileRectangle.x, aTileRectangle.y,
+                                      pixelToTwip(nTileSizePixels, pCallback->m_fZoom),
+                                      pixelToTwip(nTileSizePixels, pCallback->m_fZoom));
+
+    double elapsedTime = g_test_timer_elapsed();
+    g_info ("Rendered (%d, %d) in %f seconds",
+            pCallback->m_nX,
+            pCallback->m_nY,
+            elapsedTime);
+
+    //create a mapping for it
+    buffer->m_mTiles[index].setPixbuf(pPixBuf);
+    buffer->m_mTiles[index].valid = true;
+}
+
 /* ----------------------------
    Tile class member functions
    ----------------------------
@@ -56,55 +92,42 @@ void TileBuffer::resetAllTiles()
     std::map<int, Tile>::iterator it = m_mTiles.begin();
     for (; it != m_mTiles.end(); ++it)
     {
-        it->second.release();
+        it->second.valid = false;
     }
-    m_mTiles.clear();
 }
 
-void TileBuffer::setInvalid(int x, int y)
+void TileBuffer::setInvalid(int x, int y, float fZoom)
 {
     int index = x * m_nWidth + y;
     g_info("Setting tile invalid (%d, %d)", x, y);
     if (m_mTiles.find(index) != m_mTiles.end())
     {
         m_mTiles[index].valid = false;
-        m_mTiles[index].release();
-        m_mTiles.erase(index);
+        GTask* task = g_task_new(this, NULL, NULL, NULL);
+        GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, fZoom, this);
+        g_task_set_task_data(task, pCallback, g_free);
+        g_task_run_in_thread(task, getTileFunc);
     }
 }
 
-Tile& TileBuffer::getTile(int x, int y, float aZoom)
+Tile& TileBuffer::getTile(int x, int y, float aZoom, GTask* task)
 {
     int index = x * m_nWidth + y;
-    if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid)
-    {
 
-        GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
-        if (!pPixBuf)
-        {
-            g_info ("Error allocating memory to pixbuf");
-            return m_mTiles[index];
-        }
-
-        unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
-        GdkRectangle aTileRectangle;
-        aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y;
-        aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x;
-
-        g_test_timer_start();
-        m_pLOKDocument->pClass->paintTile(m_pLOKDocument,
-                                          pBuffer,
-                                          nTileSizePixels, nTileSizePixels,
-                                          aTileRectangle.x, aTileRectangle.y,
-                                          pixelToTwip(nTileSizePixels, aZoom),
-                                          pixelToTwip(nTileSizePixels, aZoom));
-
-        double elapsedTime = g_test_timer_elapsed();
-        g_info ("Rendered (%d, %d) in %f seconds", x, y, elapsedTime);
-
-        //create a mapping for it
-        m_mTiles[index].setPixbuf(pPixBuf);
-        m_mTiles[index].valid = true;
+    if (m_mTiles.find(index) != m_mTiles.end() && !m_mTiles[index].valid)
+    {
+        GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this);
+        g_task_set_task_data(task, pCallback, g_free);
+        g_task_run_in_thread(task, getTileFunc);
+        return m_mTiles[index];
+    }
+    else if(m_mTiles.find(index) == m_mTiles.end())
+    {
+        GetTileCallbackData* pCallback = new GetTileCallbackData(x, y, aZoom, this);
+        g_task_set_task_data(task, pCallback, g_free);
+        g_info ("running in thread new tile");
+        g_task_run_in_thread(task, getTileFunc);
+        return m_DummyTile;
     }
 
     return m_mTiles[index];
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index 6e6c0be..50de72d 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -86,7 +86,10 @@ class TileBuffer
             int columns)
      : m_pLOKDocument(document)
         , m_nWidth(columns)
-    {  }
+    {
+        GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
+        m_DummyTile.setPixbuf(pPixBuf);
+    }
 
     ~TileBuffer() {}
 
@@ -104,7 +107,7 @@ class TileBuffer
 
        @return the tile at the mentioned position (x, y)
      */
-    Tile& getTile(int x, int y, float aZoom);
+    Tile& getTile(int x, int y, float aZoom, GTask*);
     /// Destroys all the tiles in the tile buffer; also frees the memory allocated
     /// for all the Tile objects.
     void resetAllTiles();
@@ -115,17 +118,34 @@ class TileBuffer
        @param x the position of tile along x-axis
        @param y the position of tile along y-axis
      */
-    void setInvalid(int x, int y);
+    void setInvalid(int x, int y, float zoom);
+
 
- private:
     /// Contains the reference to the LOK Document that this tile buffer is for.
     LibreOfficeKitDocument *m_pLOKDocument;
     /// Stores all the tiles cached by this tile buffer.
     std::map<int, Tile> m_mTiles;
     /// Width of the current tile buffer (number of columns)
     int m_nWidth;
+    /// Dummy tile
+    Tile m_DummyTile;
 };
 
+struct GetTileCallbackData
+{
+    int m_nX;
+    int m_nY;
+    float m_fZoom;
+    TileBuffer* m_pBuffer;
+
+    GetTileCallbackData(int x, int y, float zoom, TileBuffer* buffer)
+        : m_nX(x),
+          m_nY(y),
+          m_fZoom(zoom),
+          m_pBuffer(buffer) { }
+};
+
+
 #endif // INCLUDED_TILEBUFFER_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 47734f666e7f4a37465f1fa53e5a5f1d093eafcb
Author: Pranav Kant <pranavk at gnome.org>
Date:   Sun Jul 12 23:22:51 2015 +0530

    lokdocview: Use a thread pool for most LOK calls
    
    This is a thread pool with just single thread because LOK is
    single threaded; using multiple threads in this case would be
    useless.
    
    Primary reason we are using a thread pool here is to avoid the
    overhead in spawning a new thread for each LOK call.
    
    Change-Id: Ibbfdb7cb0a8ef9f07bcc659e65ce8997716aa245

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 3f56f08..02789ad 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -81,8 +81,8 @@ gboolean                       lok_doc_view_get_edit               (LOKDocView*
 
 /// Posts the .uno: command to the LibreOfficeKit.
 void                           lok_doc_view_post_command           (LOKDocView* pDocView,
-                                                                    const char* pCommand,
-                                                                    const char* pArguments);
+                                                                    const gchar* pCommand,
+                                                                    const gchar* pArguments);
 
 float                          lok_doc_view_pixel_to_twip          (LOKDocView* pDocView,
                                                                     float fInput);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5517dc4..8054c8e 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -134,6 +134,16 @@ enum
     PROP_CAN_ZOOM_OUT
 };
 
+enum
+{
+    LOK_LOAD_DOC,
+    LOK_POST_COMMAND,
+    LOK_SET_EDIT,
+    LOK_SET_PARTMODE,
+    LOK_SET_PART,
+    LOK_POST_KEY
+};
+
 static guint doc_view_signals[LAST_SIGNAL] = { 0 };
 
 static void lok_doc_view_initable_iface_init (GInitableIface *iface);
@@ -150,6 +160,7 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA,
 #pragma GCC diagnostic pop
 #endif
 
+static GThreadPool* lokThreadPool;
 
 struct CallbackData
 {
@@ -163,6 +174,40 @@ struct CallbackData
           m_pDocView(pDocView) {}
 };
 
+struct LOEvent
+{
+    int m_nType;
+    const gchar* m_pCommand;
+    const gchar* m_pArguments;
+    gchar* m_pPath;
+    gboolean m_bEdit;
+    int m_nPartMode;
+    int m_nPart;
+    int m_nKeyEvent;
+    int m_nCharCode;
+    int m_nKeyCode;
+
+    LOEvent(int type)
+        : m_nType(type) {}
+
+    LOEvent(int type, const gchar* pCommand, const gchar* pArguments)
+        : m_nType(type),
+          m_pCommand(pCommand),
+          m_pArguments(pArguments) {}
+
+    LOEvent(int type, const gchar* pPath)
+        : m_nType(type)
+    {
+        m_pPath = g_strdup(pPath);
+    }
+
+    LOEvent(int type, int nKeyEvent, int nCharCode, int nKeyCode)
+        : m_nType(type),
+          m_nKeyEvent(nKeyEvent),
+          m_nCharCode(nCharCode),
+          m_nKeyCode(nKeyCode) {}
+};
+
 static void
 payloadToSize(const char* pPayload, long& rWidth, long& rHeight)
 {
@@ -225,6 +270,20 @@ isEmptyRectangle(const GdkRectangle& rRectangle)
     return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0;
 }
 
+static void
+postKeyEventInThread(gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    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->postKeyEvent(priv->m_pDocument,
+                                            pLOEvent->m_nKeyEvent,
+                                            pLOEvent->m_nCharCode,
+                                            pLOEvent->m_nKeyCode);
+}
+
 static gboolean
 signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
 {
@@ -281,10 +340,23 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
     if (pEvent->state & GDK_SHIFT_MASK)
         nKeyCode |= KEY_SHIFT;
 
+
     if (pEvent->type == GDK_KEY_RELEASE)
-        priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode);
+    {
+        GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+        LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode);
+        g_task_set_task_data(task, pLOEvent, g_free);
+        g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+        g_object_unref(task);
+    }
     else
-        priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode);
+    {
+        GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+        LOEvent* pLOEvent = new LOEvent(LOK_POST_KEY, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode);
+        g_task_set_task_data(task, pLOEvent, g_free);
+        g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+        g_object_unref(task);
+    }
 
     return FALSE;
 }
@@ -1013,6 +1085,143 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent)
     return FALSE;
 }
 
+static void
+lok_doc_view_open_document_in_thread (gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+
+    if ( priv->m_pDocument )
+    {
+        priv->m_pDocument->pClass->destroy( priv->m_pDocument );
+        priv->m_pDocument = 0;
+    }
+
+    priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
+    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
+    if ( !priv->m_pDocument )
+    {
+        // FIXME: should have a GError parameter and populate it.
+        char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
+        fprintf( stderr, "Error opening document '%s'\n", pError );
+        g_task_return_new_error(task, 0, 0, pError);
+    }
+    else
+    {
+        priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument);
+        priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView);
+        priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
+        g_timeout_add(600, handleTimeout, pDocView);
+
+        float zoom = priv->m_fZoom;
+        long nDocumentWidthTwips = priv->m_nDocumentWidthTwips;
+        long nDocumentHeightTwips = priv->m_nDocumentHeightTwips;
+        long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom);
+        long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom);
+        // Total number of columns in this document.
+        guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
+
+
+        priv->m_aTileBuffer = TileBuffer(priv->m_pDocument,
+                                         nColumns);
+        gtk_widget_set_size_request(GTK_WIDGET(pDocView),
+                                    nDocumentWidthPixels,
+                                    nDocumentHeightPixels);
+        gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE);
+        gtk_widget_grab_focus(GTK_WIDGET(pDocView));
+        g_task_return_boolean (task, true);
+    }
+}
+
+static void
+lok_doc_view_set_part_in_thread(gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
+    int nPart = pLOEvent->m_nPart;
+
+    priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart );
+}
+
+static void
+lok_doc_view_set_partmode_in_thread(gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
+    int nPartMode = pLOEvent->m_nPartMode;
+
+    priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode );
+}
+
+static void
+lok_doc_view_set_edit_in_thread(gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
+    gboolean bWasEdit = priv->m_bEdit;
+    gboolean bEdit = pLOEvent->m_bEdit;
+
+    if (!priv->m_bEdit && bEdit)
+        g_info("lok_doc_view_set_edit: entering edit mode");
+    else if (priv->m_bEdit && !bEdit)
+    {
+        g_info("lok_doc_view_set_edit: leaving edit mode");
+        priv->m_pDocument->pClass->resetSelection(priv->m_pDocument);
+    }
+    priv->m_bEdit = bEdit;
+    g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit);
+    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+}
+
+static void
+lok_doc_view_post_command_in_thread (gpointer data)
+{
+    GTask* task = G_TASK(data);
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
+    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->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments);
+}
+
+static void
+lokThreadFunc(gpointer data, gpointer /*user_data*/)
+{
+    GTask* task = G_TASK(data);
+    LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
+
+    switch (pLOEvent->m_nType)
+    {
+    case LOK_LOAD_DOC:
+        lok_doc_view_open_document_in_thread (task);
+        break;
+    case LOK_POST_COMMAND:
+        lok_doc_view_post_command_in_thread (task);
+        break;
+    case LOK_SET_EDIT:
+        lok_doc_view_set_edit_in_thread(task);
+        break;
+    case LOK_SET_PART:
+        lok_doc_view_set_part_in_thread(task);
+        break;
+    case LOK_SET_PARTMODE:
+        lok_doc_view_set_partmode_in_thread(task);
+        break;
+    case LOK_POST_KEY:
+        postKeyEventInThread(task);
+        break;
+    }
+
+    g_object_unref(task);
+}
+
 static void lok_doc_view_init (LOKDocView* pDocView)
 {
     LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
@@ -1392,6 +1601,12 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                      g_cclosure_marshal_VOID__STRING,
                      G_TYPE_NONE, 1,
                      G_TYPE_STRING);
+
+    lokThreadPool = g_thread_pool_new(lokThreadFunc,
+                                      NULL,
+                                      1,
+                                      FALSE,
+                                      NULL);
 }
 
 /**
@@ -1423,60 +1638,13 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr
     GTask* task = G_TASK(res);
 
     g_return_val_if_fail(g_task_is_valid(res, pDocView), false);
-    //FIXME: make source_tag workx
+    //FIXME: make source_tag work
     //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
     g_return_val_if_fail(error == NULL || *error == NULL, false);
 
     return g_task_propagate_boolean(task, error);
 }
 
-static void
-lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer /*task_data*/, GCancellable* /*cancellable*/)
-{
-    LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
-    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
-
-    if ( priv->m_pDocument )
-    {
-        priv->m_pDocument->pClass->destroy( priv->m_pDocument );
-        priv->m_pDocument = 0;
-    }
-
-    priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
-    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
-    if ( !priv->m_pDocument )
-    {
-        // FIXME: should have a GError parameter and populate it.
-        char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
-        fprintf( stderr, "Error opening document '%s'\n", pError );
-        g_task_return_new_error(task, 0, 0, pError);
-    }
-    else
-    {
-        priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument);
-        priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pDocView);
-        priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
-        g_timeout_add(600, handleTimeout, pDocView);
-
-        float zoom = priv->m_fZoom;
-        long nDocumentWidthTwips = priv->m_nDocumentWidthTwips;
-        long nDocumentHeightTwips = priv->m_nDocumentHeightTwips;
-        long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips, zoom);
-        long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips, zoom);
-        // Total number of columns in this document.
-        guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
-
-
-        priv->m_aTileBuffer = TileBuffer(priv->m_pDocument,
-                                         nColumns);
-        gtk_widget_set_size_request(GTK_WIDGET(pDocView),
-                                    nDocumentWidthPixels,
-                                    nDocumentHeightPixels);
-        gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE);
-        gtk_widget_grab_focus(GTK_WIDGET(pDocView));
-        g_task_return_boolean (task, true);
-    }
-}
 
 /**
  * lok_doc_view_open_document:
@@ -1492,15 +1660,13 @@ lok_doc_view_open_document (LOKDocView* pDocView,
                             GAsyncReadyCallback callback,
                             gpointer userdata)
 {
-    GTask *task;
+    GTask* task = g_task_new(pDocView, cancellable, callback, userdata);
+    LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC, pPath);
     LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
     priv->m_aDocPath = g_strdup(pPath);
+    g_task_set_task_data(task, pLOEvent, g_free);
 
-    task = g_task_new(pDocView, cancellable, callback, userdata);
-    // FIXME: Use source_tag to check the task.
-    //g_task_set_source_tag(task, lok_doc_view_open_document);
-
-    g_task_run_in_thread(task, lok_doc_view_open_document_func);
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
     g_object_unref(task);
 }
 
@@ -1572,8 +1738,13 @@ lok_doc_view_get_part (LOKDocView* pDocView)
 SAL_DLLPUBLIC_EXPORT void
 lok_doc_view_set_part (LOKDocView* pDocView, int nPart)
 {
-    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
-    priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart );
+    GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+    LOEvent* pLOEvent = new LOEvent(LOK_SET_PART);
+    pLOEvent->m_nPart = nPart;
+    g_task_set_task_data(task, pLOEvent, g_free);
+
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+    g_object_unref(task);
 }
 
 SAL_DLLPUBLIC_EXPORT char*
@@ -1587,8 +1758,13 @@ SAL_DLLPUBLIC_EXPORT void
 lok_doc_view_set_partmode(LOKDocView* pDocView,
                           int nPartMode)
 {
-    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
-    priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode );
+    GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+    LOEvent* pLOEvent = new LOEvent(LOK_SET_PARTMODE);
+    pLOEvent->m_nPartMode = nPartMode;
+    g_task_set_task_data(task, pLOEvent, g_free);
+
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+    g_object_unref(task);
 }
 
 SAL_DLLPUBLIC_EXPORT void
@@ -1610,19 +1786,13 @@ SAL_DLLPUBLIC_EXPORT void
 lok_doc_view_set_edit(LOKDocView* pDocView,
                       gboolean bEdit)
 {
-    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
-    gboolean bWasEdit = priv->m_bEdit;
+    GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+    LOEvent* pLOEvent = new LOEvent(LOK_SET_EDIT);
+    pLOEvent->m_bEdit = bEdit;
+    g_task_set_task_data(task, pLOEvent, g_free);
 
-    if (!priv->m_bEdit && bEdit)
-        g_info("lok_doc_view_set_edit: entering edit mode");
-    else if (priv->m_bEdit && !bEdit)
-    {
-        g_info("lok_doc_view_set_edit: leaving edit mode");
-        priv->m_pDocument->pClass->resetSelection(priv->m_pDocument);
-    }
-    priv->m_bEdit = bEdit;
-    g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit);
-    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+    g_object_unref(task);
 }
 
 /**
@@ -1648,11 +1818,16 @@ lok_doc_view_get_edit (LOKDocView* pDocView)
 */
 SAL_DLLPUBLIC_EXPORT void
 lok_doc_view_post_command (LOKDocView* pDocView,
-                           const char* pCommand,
-                           const char* pArguments)
+                           const gchar* pCommand,
+                           const gchar* pArguments)
 {
-    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
-    priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pCommand, pArguments);
+
+    GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+    LOEvent* pLOEvent = new LOEvent(LOK_POST_COMMAND, pCommand, pArguments);
+    g_task_set_task_data(task, pLOEvent, g_free);
+
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), NULL);
+    g_object_unref(task);
 }
 
 /**
commit 9c8040dc061c8fbfc7e0ec3cd8ce802c77cec96e
Author: Pranav Kant <pranavk at gnome.org>
Date:   Sat Jul 11 21:29:53 2015 +0530

    gtktiledviewer: Fill whole statusbar with progressbar
    
    We don't have anything yet to put in statusbar. Let progressbar
    fill the whole width of statusbar for now.
    
    Change-Id: I4cd8745e997a0d2b917bc5baf358b097174d0df9

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index e8091a7..46d3176 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -370,6 +370,11 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
     }
 }
 
+static void removeChildrenFromStatusbar(GtkWidget* children, gpointer)
+{
+    gtk_container_remove(GTK_CONTAINER(pStatusBar), children);
+}
+
 static void populatePartModeSelector( GtkComboBoxText* pSelector )
 {
     gtk_combo_box_text_append_text( pSelector, "Standard" );
@@ -577,8 +582,10 @@ int main( int argc, char* argv[] )
     g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar);
 
     pStatusBar = gtk_statusbar_new ();
+    gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, NULL);
     gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar);
     gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar);
+    gtk_widget_set_hexpand(pProgressBar, true);
 
     gtk_widget_show_all( pWindow );
     // Hide the findbar by default.
commit 0ccca9309d60056fa254a2e5aa39cb94f332bf1f
Author: Pranav Kant <pranavk at gnome.org>
Date:   Tue Jul 7 21:16:45 2015 +0530

    lokdocview: Emit load-changed signal showing load progress
    
    Change-Id: I69b4c05d12c0c0b2ca6b7d1ad76ed74cc1f4346a

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index a208051..e8091a7 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -30,6 +30,7 @@ static int help()
 }
 
 static GtkWidget* pDocView;
+static GtkWidget* pStatusBar;
 static GtkToolItem* pEnableEditing;
 static GtkToolItem* pBold;
 static GtkToolItem* pItalic;
@@ -286,6 +287,12 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer
     }
 }
 
+static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData)
+{
+    GtkWidget* pProgressBar = GTK_WIDGET (pData);
+    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pProgressBar), fValue);
+}
+
 /// LOKDocView found no search matches -> set the search label accordingly.
 static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpointer /*pData*/)
 {
@@ -403,6 +410,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
 
     focusChain = g_list_append( focusChain, pDocView1 );
     gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+
+    gtk_widget_hide (pStatusBar);
 }
 
 int main( int argc, char* argv[] )
@@ -555,6 +564,7 @@ int main( int argc, char* argv[] )
     g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL);
     g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL);
 
+
     // Scrolled window for DocView
     pScrolledWindow = gtk_scrolled_window_new(0, 0);
     gtk_widget_set_hexpand (pScrolledWindow, TRUE);
@@ -563,6 +573,13 @@ int main( int argc, char* argv[] )
 
     gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView);
 
+    GtkWidget* pProgressBar = gtk_progress_bar_new ();
+    g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar);
+
+    pStatusBar = gtk_statusbar_new ();
+    gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar);
+    gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar);
+
     gtk_widget_show_all( pWindow );
     // Hide the findbar by default.
     gtk_widget_hide(pFindbar);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index b6b00afd..5517dc4 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -40,7 +40,7 @@ struct _LOKDocViewPrivate
 {
     gchar* m_aLOPath;
     gchar* m_aDocPath;
-    guint m_nLoadProgress;
+    gdouble m_nLoadProgress;
     gboolean m_bIsLoading;
     gboolean m_bCanZoomIn;
     gboolean m_bCanZoomOut;
@@ -108,6 +108,7 @@ struct _LOKDocViewPrivate
 
 enum
 {
+    LOAD_CHANGED,
     EDIT_CHANGED,
     COMMAND_CHANGED,
     SEARCH_NOT_FOUND,
@@ -341,17 +342,20 @@ globalCallback (gpointer pData)
     {
     case LOK_CALLBACK_STATUS_INDICATOR_START:
     {
-        priv->m_nLoadProgress = 0;
+        priv->m_nLoadProgress = 0.0;
+        g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 0.0);
     }
     break;
     case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
     {
-        priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload);
+        priv->m_nLoadProgress = static_cast<gdouble>(std::stoi(pCallback->m_aPayload)/100.0);
+        g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, priv->m_nLoadProgress);
     }
     break;
     case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
     {
-        priv->m_nLoadProgress = 100;
+        priv->m_nLoadProgress = 1.0;
+        g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 1.0);
     }
     break;
     default:
@@ -1069,7 +1073,7 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
         g_value_set_boolean (value, priv->m_bEdit);
         break;
     case PROP_LOAD_PROGRESS:
-        g_value_set_uint (value, priv->m_nLoadProgress);
+        g_value_set_double (value, priv->m_nLoadProgress);
         break;
     case PROP_ZOOM:
         g_value_set_float (value, priv->m_fZoom);
@@ -1210,11 +1214,11 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
      */
     g_object_class_install_property (pGObjectClass,
           PROP_LOAD_PROGRESS,
-          g_param_spec_int("load-progress",
-                           "Estimated Load Progress",
-                           "Whether the content is in edit mode or not",
-                           0, 100, 0,
-                           G_PARAM_READABLE));
+          g_param_spec_double("load-progress",
+                              "Estimated Load Progress",
+                              "Shows the progress of the document load operation",
+                              0.0, 1.0, 0.0,
+                              G_PARAM_READABLE));
 
     /**
      * LOKDocView:zoom-level:
@@ -1300,6 +1304,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                                                        | G_PARAM_STATIC_STRINGS)));
 
     /**
+     * LOKDocView::load-changed:
+     * @pDocView: the #LOKDocView on which the signal is emitted
+     * @fLoadProgress: the new progress value
+     */
+    doc_view_signals[LOAD_CHANGED] =
+        g_signal_new("load-changed",
+                     G_TYPE_FROM_CLASS (pGObjectClass),
+                     G_SIGNAL_RUN_FIRST,
+                     0,
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__DOUBLE,
+                     G_TYPE_NONE, 1,
+                     G_TYPE_DOUBLE);
+
+    /**
      * LOKDocView::edit-changed:
      * @pDocView: the #LOKDocView on which the signal is emitted
      * @bEdit: the new edit value of the view
@@ -1403,16 +1422,16 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr
 {
     GTask* task = G_TASK(res);
 
-    g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL);
+    g_return_val_if_fail(g_task_is_valid(res, pDocView), false);
     //FIXME: make source_tag workx
     //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
-    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
+    g_return_val_if_fail(error == NULL || *error == NULL, false);
 
     return g_task_propagate_boolean(task, error);
 }
 
 static void
-lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable)
+lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer /*task_data*/, GCancellable* /*cancellable*/)
 {
     LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
     LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
commit 339491c173e02fdf21836f6868bc1a75ad729c08
Author: Pranav Kant <pranavk at gnome.org>
Date:   Mon Jul 6 22:01:30 2015 +0530

    lokdocview: Call open_document in another thread
    
    This is to keep the widget responsive during document load.
    
    Change-Id: I81acaffc75ca7deddd6cc2de6abae22d009d40cd

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index b98a856..3f56f08 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -45,8 +45,15 @@ GtkWidget*                     lok_doc_view_new                    (const gchar*
                                                                     GCancellable *cancellable,
                                                                     GError **error);
 
-gboolean                       lok_doc_view_open_document          (LOKDocView* pDocView,
-                                                                    const gchar* pPath);
+void                           lok_doc_view_open_document          (LOKDocView* pDocView,
+                                                                    const gchar* pPath,
+                                                                    GCancellable* cancellable,
+                                                                    GAsyncReadyCallback callback,
+                                                                    gpointer userdata);
+
+gboolean                       lok_doc_view_open_document_finish   (LOKDocView* pDocView,
+                                                                    GAsyncResult* res,
+                                                                    GError** error);
 
 /// Gets the document the viewer displays.
 LibreOfficeKitDocument*        lok_doc_view_get_document           (LOKDocView* pDocView);
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 6c0de39..a208051 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -41,6 +41,7 @@ std::map<std::string, GtkToolItem*> g_aCommandNameToolItems;
 bool g_bToolItemBroadcast = true;
 static GtkWidget* pVBox;
 static GtkComboBoxText* pPartSelector;
+static GtkWidget* pPartModeComboBox;
 /// Should the part selector avoid calling lok::Document::setPart()?
 static bool g_bPartSelectorBroadcast = true;
 GtkWidget* pFindbar;
@@ -291,6 +292,7 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint
     gtk_label_set_text(GTK_LABEL(pFindbarLabel), "Search key not found");
 }
 
+
 static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/)
 {
     g_bPartSelectorBroadcast = false;
@@ -381,6 +383,28 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
     }
 }
 
+static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer /*userdata*/)
+{
+    LOKDocView* pDocView1 = LOK_DOC_VIEW (source_object);
+    GError* error = NULL;
+    GList *focusChain = NULL;
+
+    if (!lok_doc_view_open_document_finish(pDocView1, res, &error))
+    {
+        g_warning ("Error occurred while opening the document : %s", error->message);
+        g_error_free (error);
+    }
+
+    populatePartSelector();
+    populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
+    // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode.
+    g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0);
+    g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0);
+
+    focusChain = g_list_append( focusChain, pDocView1 );
+    gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+}
+
 int main( int argc, char* argv[] )
 {
     if( argc < 3 ||
@@ -436,7 +460,7 @@ int main( int argc, char* argv[] )
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
 
     GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new();
-    GtkWidget* pPartModeComboBox = gtk_combo_box_text_new();
+    pPartModeComboBox = gtk_combo_box_text_new();
     gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
 
@@ -543,21 +567,7 @@ int main( int argc, char* argv[] )
     // Hide the findbar by default.
     gtk_widget_hide(pFindbar);
 
-    int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] );
-    if (!bOpened)
-        g_error("main: lok_doc_view_open_document() failed");
-    assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)));
-
-    populatePartSelector();
-    populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
-    // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode.
-    g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0);
-    g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0);
-
-    // Make only LOKDocView widget as focussable
-    GList *focusChain = NULL;
-    focusChain = g_list_append( focusChain, pDocView );
-    gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+    lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView );
 
     gtk_main();
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 3823e94..b6b00afd 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -108,8 +108,6 @@ struct _LOKDocViewPrivate
 
 enum
 {
-    LOAD_CHANGED,
-    LOAD_FAILED,
     EDIT_CHANGED,
     COMMAND_CHANGED,
     SEARCH_NOT_FOUND,
@@ -337,19 +335,23 @@ static gboolean
 globalCallback (gpointer pData)
 {
     CallbackData* pCallback = static_cast<CallbackData*>(pData);
+    LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pCallback->m_pDocView));
 
     switch (pCallback->m_nType)
     {
     case LOK_CALLBACK_STATUS_INDICATOR_START:
     {
+        priv->m_nLoadProgress = 0;
     }
     break;
     case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
     {
+        priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload);
     }
     break;
     case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
     {
+        priv->m_nLoadProgress = 100;
     }
     break;
     default:
@@ -1389,15 +1391,30 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
 }
 
 /**
- * lok_doc_view_open_document:
+ * lok_doc_view_open_document_finish:
  * @pDocView: The #LOKDocView instance
- * @pPath: The path of the document that #LOKDocView widget should try to open
+ * @res:
+ * @error:
  *
  * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise
  */
 SAL_DLLPUBLIC_EXPORT gboolean
-lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
+lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GError** error)
+{
+    GTask* task = G_TASK(res);
+
+    g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL);
+    //FIXME: make source_tag workx
+    //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
+    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
+
+    return g_task_propagate_boolean(task, error);
+}
+
+static void
+lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable)
 {
+    LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
     LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
 
     if ( priv->m_pDocument )
@@ -1407,13 +1424,13 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
     }
 
     priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
-    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, pPath );
+    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
     if ( !priv->m_pDocument )
     {
         // FIXME: should have a GError parameter and populate it.
         char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
         fprintf( stderr, "Error opening document '%s'\n", pError );
-        return FALSE;
+        g_task_return_new_error(task, 0, 0, pError);
     }
     else
     {
@@ -1438,8 +1455,34 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
                                     nDocumentHeightPixels);
         gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE);
         gtk_widget_grab_focus(GTK_WIDGET(pDocView));
+        g_task_return_boolean (task, true);
     }
-    return TRUE;
+}
+
+/**
+ * lok_doc_view_open_document:
+ * @pDocView: The #LOKDocView instance
+ * @pPath: The path of the document that #LOKDocView widget should try to open
+ *
+ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise
+ */
+SAL_DLLPUBLIC_EXPORT void
+lok_doc_view_open_document (LOKDocView* pDocView,
+                            const gchar* pPath,
+                            GCancellable* cancellable,
+                            GAsyncReadyCallback callback,
+                            gpointer userdata)
+{
+    GTask *task;
+    LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+    priv->m_aDocPath = g_strdup(pPath);
+
+    task = g_task_new(pDocView, cancellable, callback, userdata);
+    // FIXME: Use source_tag to check the task.
+    //g_task_set_source_tag(task, lok_doc_view_open_document);
+
+    g_task_run_in_thread(task, lok_doc_view_open_document_func);
+    g_object_unref(task);
 }
 
 /**
commit b1760dc3320bfb44568243359124d2615e69e18d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 22 15:36:08 2015 +0100

    Resolves: tdf#92148 SmElementsControl invalidates itself from paint endlessly
    
    Change-Id: Id9cd7fbe9e433005cc27b2e8e3417a5e289b94e3

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 6877d81..7cf8abb 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -106,6 +106,10 @@ class SmElementsControl : public Control
 
     void build();
 
+    //if pContext is not NULL, then draw, otherwise
+    //just layout
+    void LayoutOrPaintContents(vcl::RenderContext *pContext = NULL);
+
 public:
     SmElementsControl(vcl::Window *pParent);
     virtual ~SmElementsControl();
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 93bd504..62a9093 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -253,10 +253,8 @@ void SmElementsControl::setVerticalMode(bool bVerticalMode)
     mbVerticalMode = bVerticalMode;
 }
 
-void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
+void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
 {
-    rRenderContext.Push();
-
     bool bOldVisibleState = mxScroll->IsVisible();
 
     sal_Int32 nScrollbarWidth = bOldVisibleState ? GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
@@ -300,7 +298,8 @@ void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangl
                 Rectangle aSelectionRectangle(x + 5 - 1, y + 5,
                                               x + 5 + 1, nControlHeight - 5);
 
-                rRenderContext.DrawRect(PixelToLogic(aSelectionRectangle));
+                if (pContext)
+                    pContext->DrawRect(PixelToLogic(aSelectionRectangle));
                 x += 10;
             }
             else
@@ -311,14 +310,15 @@ void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangl
                 Rectangle aSelectionRectangle(x + 5, y + 5 - 1,
                                               nControlWidth - 5, y + 5 + 1);
 
-                rRenderContext.DrawRect(PixelToLogic(aSelectionRectangle));
+                if (pContext)
+                    pContext->DrawRect(PixelToLogic(aSelectionRectangle));
                 y += 10;
             }
         }
         else
         {
-            Size aSizePixel = rRenderContext.LogicToPixel(Size(element->getNode()->GetWidth(),
-                                                               element->getNode()->GetHeight()));
+            Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(),
+                                                element->getNode()->GetHeight()));
             if (mbVerticalMode)
             {
                 if (y + boxY > nControlHeight)
@@ -336,20 +336,21 @@ void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangl
                 }
             }
 
-            if (mpCurrentElement == element)
+            if (mpCurrentElement == element && pContext)
             {
-                rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
-                rRenderContext.SetFillColor(Color(230, 230, 230));
-                rRenderContext.SetLineColor(Color(230, 230, 230));
+                pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+                pContext->SetFillColor(Color(230, 230, 230));
+                pContext->SetLineColor(Color(230, 230, 230));
 
-                rRenderContext.DrawRect(PixelToLogic(Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
-                rRenderContext.Pop();
+                pContext->DrawRect(PixelToLogic(Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
+                pContext->Pop();
             }
 
             Point location(x + ((boxX - aSizePixel.Width()) / 2),
                            y + ((boxY - aSizePixel.Height()) / 2));
 
-            SmDrawingVisitor(rRenderContext, PixelToLogic(location), element->getNode().get());
+            if (pContext)
+                SmDrawingVisitor(*pContext, PixelToLogic(location), element->getNode().get());
 
             element->mBoxLocation = Point(x,y);
             element->mBoxSize = Size(boxX, boxY);
@@ -361,26 +362,29 @@ void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangl
         }
     }
 
-    sal_Int32 nTotalControlHeight = y + boxY + mxScroll->GetThumbPos();
-
-    if (nTotalControlHeight > GetOutputSizePixel().Height())
+    if (!pContext)
     {
-        mxScroll->SetRangeMax(nTotalControlHeight);
-        mxScroll->SetPosSizePixel(Point(nControlWidth, 0), Size(nScrollbarWidth, nControlHeight));
-        mxScroll->SetVisibleSize(nControlHeight);
-        mxScroll->Show();
-    }
-    else
-    {
-        mxScroll->SetThumbPos(0);
-        mxScroll->Hide();
-    }
+        sal_Int32 nTotalControlHeight = y + boxY + mxScroll->GetThumbPos();
 
-    // If scrollbar visibility changed, we have to go through the
-    // calculation once more, see nScrollbarWidth
-    if (bOldVisibleState != mxScroll->IsVisible())
-        Invalidate();
+        if (nTotalControlHeight > GetOutputSizePixel().Height())
+        {
+            mxScroll->SetRangeMax(nTotalControlHeight);
+            mxScroll->SetPosSizePixel(Point(nControlWidth, 0), Size(nScrollbarWidth, nControlHeight));
+            mxScroll->SetVisibleSize(nControlHeight);
+            mxScroll->Show();
+        }
+        else
+        {
+            mxScroll->SetThumbPos(0);
+            mxScroll->Hide();
+        }
+    }
+}
 
+void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
+{
+    rRenderContext.Push();
+    LayoutOrPaintContents(&rRenderContext);
     rRenderContext.Pop();
 }
 
@@ -399,6 +403,7 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
                 if (mpCurrentElement != element)
                 {
                     mpCurrentElement = element;
+                    LayoutOrPaintContents();
                     Invalidate();
                     tooltip = element->getHelpText();
                 }
@@ -449,6 +454,7 @@ void SmElementsControl::DoScroll(long nDelta)
     aRect.Right() -= mxScroll->GetSizePixel().Width();
     Scroll( 0, -nDelta, aRect );
     mxScroll->SetPosPixel(aNewPoint);
+    LayoutOrPaintContents();
     Invalidate();
 }
 
@@ -629,6 +635,7 @@ void SmElementsControl::build()
         }
         break;
     }
+    LayoutOrPaintContents();
     Invalidate();
 }
 
commit 6c2f0c1001b0586b3092e80d63866ae018f09eb8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jul 22 16:26:31 2015 +0200

    ListBox in grid: properly set selection on change from model
    
    In particular when changing row.
    
    1) Teach DbCellControl about "SelectedItems" as known value property.
    
    2) Fix DbListBox::updateFromModel to actually use the SelectedItems
       it reads from the model, as opposed to throwing it away.
    
    Change-Id: I7074c13b3d271bf2362aa059378aa857682a040b

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index fe76271..8208231 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -572,6 +572,7 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn, bool /*_bText*/ )
         implDoPropertyListening( FM_PROP_STATE, false );
         implDoPropertyListening( FM_PROP_TEXT, false );
         implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, false );
+        implDoPropertyListening( FM_PROP_SELECT_SEQ, false );
 
         // be listener at the bound field as well
         try
@@ -676,6 +677,7 @@ void DbCellControl::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(R
         ||  _rEvent.PropertyName == FM_PROP_STATE
         ||  _rEvent.PropertyName == FM_PROP_TEXT
         ||  _rEvent.PropertyName == FM_PROP_EFFECTIVE_VALUE
+        ||  _rEvent.PropertyName == FM_PROP_SELECT_SEQ
         )
     {   // it was one of the known "value" properties
         if ( !isValuePropertyLocked() )
@@ -2645,7 +2647,7 @@ void DbListBox::updateFromModel( Reference< XPropertySet > _rxModel )
     OSL_ENSURE( _rxModel.is() && m_pWindow, "DbListBox::updateFromModel: invalid call!" );
 
     Sequence< sal_Int16 > aSelection;
-    _rxModel->getPropertyValue( FM_PROP_SELECT_SEQ );
+    _rxModel->getPropertyValue( FM_PROP_SELECT_SEQ ) >>= aSelection;
 
     sal_Int16 nSelection = -1;
     if ( aSelection.getLength() > 0 )
commit 3b9e66fdcade5a222a9dc99ad74627473b1fd4e7
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jul 22 16:25:28 2015 +0200

    tdf#92725 FormattedField: when model value is NULL, force empty display string
    
    as opposed to implicitly keeping whatever unrelated string was there before.
    
    Change-Id: Ifaf1b41e951e97f209ecb617b32ec4f7522b1d08

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 9a5a28d..fe76271 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1576,7 +1576,7 @@ void DbFormattedField::updateFromModel( Reference< XPropertySet > _rxModel )
 
     OUString sText;
     Any aValue = _rxModel->getPropertyValue( FM_PROP_EFFECTIVE_VALUE );
-    if ( aValue >>= sText )
+    if ( !aValue.hasValue() || (aValue >>= sText) )
     {   // our effective value is transferred as string
         pFormattedWindow->SetTextFormatted( sText );
         pFormattedWindow->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
commit a37df351c447373bb893ba154bd124d33e43c040
Author: Matthew J. Francis <mjay.francis at gmail.com>
Date:   Fri Jul 10 15:29:22 2015 +0800

    Fix logic in the fast path of Implementation::inspect()
    
    - Merge TypeCache and ClassCache
    - Don't fill SupportedClassSeq before the fast exit for a
      cache hit
    - Do query XPropertySet blind in the degenerate interface case
    
    Change-Id: I3fd8ab4a215f4c217e1a687af679aef4a21b68b9
    Reviewed-on: https://gerrit.libreoffice.org/16921
    Reviewed-by: Matthew Francis <mjay.francis at gmail.com>
    Tested-by: Matthew Francis <mjay.francis at gmail.com>

diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 497d9e2..a74a729 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -197,7 +197,6 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject
 
     // Flags which indicate if various interfaces are present
     bool mbFastPropSet;
-    bool mbPropertySet;
     bool mbElementAccess;
     bool mbNameAccess;
     bool mbNameContainer;
@@ -270,7 +269,6 @@ IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlR
     maPropertyConceptSeq.realloc( ARRAY_SIZE_STEP );
 
     mbFastPropSet = false;
-    mbPropertySet = false;
     mbElementAccess = false;
     mbNameAccess = false;
     mbNameContainer = false;
@@ -1499,55 +1497,6 @@ OUString ImplIntrospectionAccess::getExactName( const OUString& rApproximateName
     return aRetStr;
 }
 
-struct ClassKey {
-    ClassKey(
-        css::uno::Reference<css::beans::XPropertySetInfo> const & theProperties,
-        css::uno::Reference<css::reflection::XIdlClass> const &
-            theImplementation,
-        css::uno::Sequence< css::uno::Reference<css::reflection::XIdlClass> >
-            const & theClasses):
-        properties(theProperties), implementation(theImplementation),
-        classes(theClasses)
-    {}
-
-    css::uno::Reference<css::beans::XPropertySetInfo> properties;
-    css::uno::Reference<css::reflection::XIdlClass> implementation;
-    css::uno::Sequence< css::uno::Reference<css::reflection::XIdlClass> >
-        classes;
-};
-
-struct ClassKeyLess {
-    bool operator ()(ClassKey const & key1, ClassKey const & key2) const {
-        if (key1.properties.get() < key2.properties.get()) {
-            return true;
-        }
-        if (key1.properties.get() > key2.properties.get()) {
-            return false;
-        }
-        if (key1.implementation.get() < key2.implementation.get()) {
-            return true;
-        }
-        if (key1.implementation.get() > key2.implementation.get()) {
-            return false;
-        }
-        if (key1.classes.getLength() < key2.classes.getLength()) {
-            return true;
-        }
-        if (key1.classes.getLength() > key2.classes.getLength()) {
-            return false;
-        }
-        for (sal_Int32 i = 0; i != key1.classes.getLength(); ++i) {
-            if (key1.classes[i].get() < key2.classes[i].get()) {
-                return true;
-            }
-            if (key1.classes[i].get() > key2.classes[i].get()) {
-                return false;
-            }
-        }
-        return false;
-    }
-};
-
 struct TypeKey {
     TypeKey(
         css::uno::Reference<css::beans::XPropertySetInfo> const & theProperties,
@@ -1653,7 +1602,6 @@ private:
     virtual void SAL_CALL disposing() SAL_OVERRIDE {
         osl::MutexGuard g(m_aMutex);
         reflection_.clear();
-        classCache_.clear();
         typeCache_.clear();
     }
 
@@ -1679,7 +1627,6 @@ private:
         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     css::uno::Reference<css::reflection::XIdlReflection> reflection_;
-    Cache<ClassKey, ClassKeyLess> classCache_;
     Cache<TypeKey, TypeKeyLess> typeCache_;
 };
 
@@ -1731,10 +1678,8 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
     Sequence< Reference<XIdlClass> >    SupportedClassSeq;
     Sequence< Type >                    SupportedTypesSeq;
     Reference<XTypeProvider>            xTypeProvider;
-    Reference<XIdlClass>                xImplClass;
     Reference<XPropertySetInfo>            xPropSetInfo;
     Reference<XPropertySet>                xPropSet;
-    bool                                bHasPropertySet = false;
 
     // Look for interfaces XTypeProvider and PropertySet
     if( eType == TypeClass_INTERFACE )
@@ -1746,66 +1691,46 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
             sal_Int32 nTypeCount = SupportedTypesSeq.getLength();
             if( nTypeCount )
             {
-                SupportedClassSeq.realloc( nTypeCount );
-                Reference<XIdlClass>* pClasses = SupportedClassSeq.getArray();
-
                 const Type* pTypes = SupportedTypesSeq.getConstArray();
                 for( sal_Int32 i = 0 ; i < nTypeCount ; i++ )
                 {
-                    OUString typeName( pTypes[i].getTypeName() );
-                    pClasses[i] = reflection->forName( typeName );
-                    if( !bHasPropertySet && typeName == "com.sun.star.beans.XPropertySet" )
-                        bHasPropertySet = true;
+                    if( pTypes[i].getTypeName() == "com.sun.star.beans.XPropertySet" )
+                    {
+                        xPropSet = Reference<XPropertySet>::query( x );
+                        break;
+                    }
                 }
-                // TODO: Caching!
             }
         } else {
             SAL_WARN(
                 "stoc",
                 "object of type \"" << aToInspectObj.getValueTypeName()
                     << "\" lacks XTypeProvider");
-            xImplClass = reflection->forName(aToInspectObj.getValueTypeName());
-            SupportedClassSeq.realloc(1);
-            SupportedClassSeq[0] = xImplClass;
+            SupportedTypesSeq = Sequence<Type>(&aToInspectObj.getValueType(), 1);
+            xPropSet = Reference<XPropertySet>::query( x );
         }
 
-        if ( bHasPropertySet )
-            xPropSet = Reference<XPropertySet>::query( x );
         // Now try to get the PropertySetInfo
         if( xPropSet.is() )
             xPropSetInfo = xPropSet->getPropertySetInfo();
+
     } else {
-        xImplClass = reflection->forName(aToInspectObj.getValueTypeName());
+        SupportedTypesSeq = Sequence<Type>(&aToInspectObj.getValueType(), 1);
     }
 
-    if (xTypeProvider.is()) {
-        TypeKey key(xPropSetInfo, SupportedTypesSeq);
-
+    {
         osl::MutexGuard g(m_aMutex);
         if (rBHelper.bDisposed || rBHelper.bInDispose) {
             throw css::lang::DisposedException(
                 getImplementationName(), static_cast<OWeakObject *>(this));
         }
+        TypeKey key(xPropSetInfo, SupportedTypesSeq);
         pAccess = typeCache_.find(key);
         if (pAccess.is()) {
             return new ImplIntrospectionAccess(aToInspectObj, pAccess);
         }
         pAccess = new IntrospectionAccessStatic_Impl(reflection);
         typeCache_.insert(key, pAccess);
-    } else if (xImplClass.is()) {
-        ClassKey key(xPropSetInfo, xImplClass, SupportedClassSeq);
-
-        osl::MutexGuard g(m_aMutex);
-        if (rBHelper.bDisposed || rBHelper.bInDispose) {
-            throw css::lang::DisposedException(
-                getImplementationName(), static_cast<OWeakObject *>(this));
-        }
-        pAccess = classCache_.find(key);
-        if (pAccess.is()) {
-            return new ImplIntrospectionAccess(aToInspectObj, pAccess);
-        }
-        pAccess = new IntrospectionAccessStatic_Impl(reflection);
-        classCache_.insert(key, pAccess);
     }
 
     // No access cached -> create new
@@ -1816,11 +1741,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
     sal_Int32* pPropertyConceptArray;
     sal_Int32 i;
 
-    if( !pAccess.is() )
-        pAccess = new IntrospectionAccessStatic_Impl( reflection );
-
-    pAccess->mbPropertySet = bHasPropertySet;
-
     // References to important data from pAccess
     sal_Int32& rPropCount = pAccess->mnPropCount;
     IntrospectionNameMap& rPropNameMap = pAccess->maPropertyNameMap;
@@ -1839,6 +1759,17 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
 
     if( eType == TypeClass_INTERFACE )
     {
+        sal_Int32 nTypeCount = SupportedTypesSeq.getLength();
+        if( nTypeCount )
+        {
+            SupportedClassSeq.realloc( nTypeCount );
+            Reference<XIdlClass>* pClasses = SupportedClassSeq.getArray();
+
+            const Type* pTypes = SupportedTypesSeq.getConstArray();
+            for( i = 0 ; i < nTypeCount ; i++ )
+                pClasses[i] = reflection->forName( pTypes[i].getTypeName() );
+        }
+
         // First look for particular interfaces that are of particular
         // importance to the introspection
 
commit a64c48f523d148cd4750bc9bd26d2349fc8a3c7c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 22 14:52:58 2015 +0100

    read block in one swoop, rather than char by char
    
    Change-Id: Ic879c096c6b3167a123cee352361da6c39e57de2

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 1dc8806..0c2ad80 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3889,13 +3889,8 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
                 {
                     if (pExtraArray)
                     {
-                        ww::bytes extraData;
-                        for (sal_uInt16 j = 0; j < nExtraLen; ++j)
-                        {
-                            sal_uInt8 iTmp(0);
-                            rStrm.ReadUChar( iTmp );
-                            extraData.push_back(iTmp);
-                        }
+                        ww::bytes extraData(nExtraLen);
+                        rStrm.Read(extraData.data(), nExtraLen);
                         pExtraArray->push_back(extraData);
                     }
                     else
@@ -3950,13 +3945,8 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
                 {
                     if (pExtraArray)
                     {
-                        ww::bytes extraData;
-                        for (sal_uInt16 i=0;i < nExtraLen;++i)
-                        {
-                            sal_uInt8 iTmp(0);
-                            rStrm.ReadUChar( iTmp );
-                            extraData.push_back(iTmp);
-                        }
+                        ww::bytes extraData(nExtraLen);
+                        rStrm.Read(extraData.data(), nExtraLen);
                         pExtraArray->push_back(extraData);
                     }
                     else
commit cbea6a709f33babfb490ab1bd07cde8cc08114ac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 22 13:51:19 2015 +0100

    xstUsrInitl contains max 9 chars
    
    Change-Id: Ia40d037d7af6cd3a283aa12948e4c5565dcb2ae6

diff --git a/sw/qa/core/data/ww8/pass/crash-1.doc b/sw/qa/core/data/ww8/pass/crash-1.doc
new file mode 100644
index 0000000..9f6b253
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/crash-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4d82b50..02d26f4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2170,15 +2170,18 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
         if (pA)
             sAuthor = *pA;
         else
-            sAuthor = OUString(pDescri->xstUsrInitl + 1, pDescri->xstUsrInitl[0],
-                RTL_TEXTENCODING_MS_1252);
+        {
+            const sal_uInt8 nLen = std::min<sal_uInt8>(pDescri->xstUsrInitl[0],
+                                                       SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1);
+            sAuthor = OUString(pDescri->xstUsrInitl + 1, nLen, RTL_TEXTENCODING_MS_1252);
+        }
     }
     else
     {
         const WW8_ATRD* pDescri = static_cast<const WW8_ATRD*>(pSD->GetData());
-
         {
-            const sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]);
+            const sal_uInt16 nLen = std::min<sal_uInt16>(SVBT16ToShort(pDescri->xstUsrInitl[0]),
+                                                         SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1);
             OUStringBuffer aBuf;
             aBuf.setLength(nLen);
             for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx)
commit 96d44c9b077a6cc8068067a795dc63248ab90fea
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jul 22 10:20:03 2015 +0200

    loplugin:unusedmethods sc
    
    Change-Id: I7bdb1889a942d63370731764a58f4ab524dedd8a
    Reviewed-on: https://gerrit.libreoffice.org/17287
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index 692e91e..c22c1db 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -74,13 +74,31 @@ public:
     bool VisitVarDecl( const VarDecl* );
 };
 
-static std::string niceName(const FunctionDecl* functionDecl)
+/**
+ * We need to include the template params when we are building the set
+ * of functions we have walked already, because we need to rewalk anything instantiated with different params
+ */
+enum class NiceNameIncludeTemplateParams { NO, YES };
+static std::string niceName(const FunctionDecl* functionDecl, NiceNameIncludeTemplateParams eIncludeTemplateParams = NiceNameIncludeTemplateParams::NO)
 {
     std::string s =
         compat::getReturnType(*functionDecl).getCanonicalType().getAsString()
         + " ";
     if (isa<CXXMethodDecl>(functionDecl)) {
-        s += dyn_cast<CXXMethodDecl>(functionDecl)->getParent()->getQualifiedNameAsString() + "::";
+        const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
+        s += recordDecl->getQualifiedNameAsString();
+        if (eIncludeTemplateParams == NiceNameIncludeTemplateParams::YES
+            && isa<ClassTemplateSpecializationDecl>(recordDecl))
+        {
+            const ClassTemplateSpecializationDecl* templateDecl = dyn_cast<ClassTemplateSpecializationDecl>(recordDecl);
+            s += "<";
+            for(size_t i=0; i < templateDecl->getTemplateArgs().size(); i++)
+            {
+                s += " ," + templateDecl->getTemplateArgs()[i].getAsType().getAsString();
+            }
+            s += ">";
+        }
+        s += "::";
     }
     s += functionDecl->getNameAsString() + "(";
     bool bFirst = true;
@@ -164,7 +182,7 @@ bool UnusedMethods::VisitCallExpr(CallExpr* expr)
     // if the function is templated. However, if we are inside a template function,
     // calling another function on the same template, the same problem occurs.
     // Rather than tracking all of that, just traverse anything we have not already traversed.
-    if (traversedFunctionSet.insert(niceName(calleeFunctionDecl)).second)
+    if (traversedFunctionSet.insert(niceName(calleeFunctionDecl, NiceNameIncludeTemplateParams::YES)).second)
         TraverseFunctionDecl(calleeFunctionDecl);
 
     logCallToRootMethods(calleeFunctionDecl);
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index 640b42c..f8c5ae2 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -56,6 +56,7 @@ exclusionSet = set([
     "_Bool connectivity::OColumn::isWritable() const",
     "_Bool IDocumentLinksAdministration::GetData(const class rtl::OUString &,const class rtl::OUString &,class com::sun::star::uno::Any &) const",
     "_Bool IDocumentLinksAdministration::SetData(const class rtl::OUString &,const class rtl::OUString &,const class com::sun::star::uno::Any &)",
+    "_Bool ScImportExport::ImportData(const class rtl::OUString &,const class com::sun::star::uno::Any &)",
     # instantiated from templates, not sure why it is not being picked up
     "class basegfx::B2DPolygon OutputDevice::PixelToLogic(const class basegfx::B2DPolygon &,const class MapMode &) const",
     "type-parameter-0-0 * detail::cloner::clone(type-parameter-0-0 *const)",
diff --git a/sc/inc/addincfg.hxx b/sc/inc/addincfg.hxx
index 74e86c9..f99c8ed 100644
--- a/sc/inc/addincfg.hxx
+++ b/sc/inc/addincfg.hxx
@@ -25,8 +25,6 @@
 class ScAddInCfg : public utl::ConfigItem
 {
 private:
-    com::sun::star::uno::Sequence<OUString> GetPropertyNames();
-
     virtual void    ImplCommit() SAL_OVERRIDE;
 
 public:
diff --git a/sc/inc/clkernelthread.hxx b/sc/inc/clkernelthread.hxx
index 358da11..ef53a5e 100644
--- a/sc/inc/clkernelthread.hxx
+++ b/sc/inc/clkernelthread.hxx
@@ -34,8 +34,6 @@ public:
     CLBuildKernelThread();
     virtual ~CLBuildKernelThread();
 
-    void finish();
-
     void push(CLBuildKernelWorkItem item);
 
     osl::Condition maCompilationDoneCondition;
@@ -47,8 +45,6 @@ private:
     osl::Mutex maQueueMutex;
     osl::Condition maQueueCondition;
     std::queue<CLBuildKernelWorkItem> maQueue;
-    static void produce();
-    static void consume();
 };
 
 }
diff --git a/sc/inc/convuno.hxx b/sc/inc/convuno.hxx
index 6c2c5ec..f2c4c20 100644
--- a/sc/inc/convuno.hxx
+++ b/sc/inc/convuno.hxx
@@ -50,27 +50,15 @@ public:
     static inline void  FillApiRange(
                             ::com::sun::star::table::CellRangeAddress& rApiRange,
                             const ScRange& rScRange );
-    // CellAddress -> CellRangeAddress
-    static inline void  FillApiRange(
-                            ::com::sun::star::table::CellRangeAddress& rApiRange,
-                            const ::com::sun::star::table::CellAddress& rApiAddress );
     // CellRangeAddress-Start -> CellAddress
     static inline void  FillApiStartAddress(
                             ::com::sun::star::table::CellAddress& rApiAddress,
                             const ::com::sun::star::table::CellRangeAddress& rApiRange );
-    // CellRangeAddress-End -> CellAddress
-    static inline void  FillApiEndAddress(
-                            ::com::sun::star::table::CellAddress& rApiAddress,
-                            const ::com::sun::star::table::CellRangeAddress& rApiRange );
 
     /** Returns true, if the passed ranges have at least one common cell. */
     static inline bool  Intersects(
                             const ::com::sun::star::table::CellRangeAddress& rApiARange1,
                             const ::com::sun::star::table::CellRangeAddress& rApiARange2 );
-    /** Returns true, if the passed address rApiInner is inside the passed range rApiOuter. */
-    static inline bool  Contains(
-                            const ::com::sun::star::table::CellRangeAddress& rApiOuter,
-                            const ::com::sun::star::table::CellAddress& rApiInner );
     /** Returns true, if the passed range rApiInner is completely inside the passed range rApiOuter. */
     static inline bool  Contains(
                             const ::com::sun::star::table::CellRangeAddress& rApiOuter,
@@ -112,15 +100,6 @@ inline void ScUnoConversion::FillApiRange(
     rApiRange.EndRow = rScRange.aEnd.Row();
 }
 
-inline void ScUnoConversion::FillApiRange(
-        ::com::sun::star::table::CellRangeAddress& rApiRange,
-        const ::com::sun::star::table::CellAddress& rApiAddress )
-{
-    rApiRange.StartColumn = rApiRange.EndColumn = rApiAddress.Column;
-    rApiRange.StartRow = rApiRange.EndRow = rApiAddress.Row;
-    rApiRange.Sheet = rApiAddress.Sheet;
-}
-
 inline void ScUnoConversion::FillApiStartAddress(
         ::com::sun::star::table::CellAddress& rApiAddress,
         const ::com::sun::star::table::CellRangeAddress& rApiRange )
@@ -130,15 +109,6 @@ inline void ScUnoConversion::FillApiStartAddress(
     rApiAddress.Sheet = rApiRange.Sheet;
 }
 
-inline void ScUnoConversion::FillApiEndAddress(
-        ::com::sun::star::table::CellAddress& rApiAddress,
-        const ::com::sun::star::table::CellRangeAddress& rApiRange )
-{
-    rApiAddress.Column = rApiRange.EndColumn;
-    rApiAddress.Row = rApiRange.EndRow;
-    rApiAddress.Sheet = rApiRange.Sheet;
-}
-
 inline bool ScUnoConversion::Intersects(
         const ::com::sun::star::table::CellRangeAddress& rApiRange1,
         const ::com::sun::star::table::CellRangeAddress& rApiRange2 )
@@ -150,15 +120,6 @@ inline bool ScUnoConversion::Intersects(
 
 inline bool ScUnoConversion::Contains(
         const ::com::sun::star::table::CellRangeAddress& rApiOuter,
-        const ::com::sun::star::table::CellAddress& rApiInner )
-{
-    return (rApiOuter.Sheet == rApiInner.Sheet) &&
-        (rApiOuter.StartColumn <= rApiInner.Column) && (rApiInner.Column <= rApiOuter.EndColumn) &&
-        (rApiOuter.StartRow <= rApiInner.Row) && (rApiInner.Row <= rApiOuter.EndRow);
-}
-
-inline bool ScUnoConversion::Contains(
-        const ::com::sun::star::table::CellRangeAddress& rApiOuter,
         const ::com::sun::star::table::CellRangeAddress& rApiInner )
 {
     return (rApiOuter.Sheet == rApiInner.Sheet) &&
diff --git a/sc/inc/filtopt.hxx b/sc/inc/filtopt.hxx
index a9381ce..ee188c4 100644
--- a/sc/inc/filtopt.hxx
+++ b/sc/inc/filtopt.hxx
@@ -42,10 +42,6 @@ public:
     virtual void    Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames ) SAL_OVERRIDE;
 
     bool        GetWK3Flag() const          { return bWK3Flag; }
-    double      GetExcelColScale() const    { return fExcelColScale; }
-    double      GetExcelRowScale() const    { return fExcelRowScale; }
-
-    //  values are never modified by office
 };
 
 #endif
diff --git a/sc/inc/grouparealistener.hxx b/sc/inc/grouparealistener.hxx
index 71de7ee..d19c9fec 100644
--- a/sc/inc/grouparealistener.hxx
+++ b/sc/inc/grouparealistener.hxx
@@ -60,10 +60,6 @@ public:
     void collectFormulaCells( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScFormulaCell*>& rCells ) const;
     void collectFormulaCells( SCROW nRow1, SCROW nRow2, std::vector<ScFormulaCell*>& rCells ) const;
 
-    ScAddress getTopCellPos() const;
-    const ScRange& getRange() const;
-    SCROW getGroupLength() const;
-
 private:
     void notifyCellChange( const SfxHint& rHint, const ScAddress& rPos );
     void notifyBulkChange( const BulkDataHint& rHint );
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 3fcedfc..aab5be0 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -217,7 +217,6 @@ public:
     virtual bool    GetRenameTable          () const = 0;
     virtual void    GetTabNameString( OUString& rString ) const = 0;
     virtual void    SetForceCopyTable       () = 0;
-    virtual void    EnableCopyTable         (bool bFlag=true) = 0;
     virtual void    EnableRenameTable       (bool bFlag=true) = 0;
 };
 
@@ -231,7 +230,6 @@ class AbstractScNamePasteDlg : public VclAbstractDialog
 {
 public:
     virtual std::vector<OUString> GetSelectedNames() const = 0;
-    virtual bool                IsAllSelected() const = 0;
 };
 
 class AbstractScPivotFilterDlg : public VclAbstractDialog
diff --git a/sc/inc/simpleformulacalc.hxx b/sc/inc/simpleformulacalc.hxx
index 340c9d8..2d20f6d 100644
--- a/sc/inc/simpleformulacalc.hxx
+++ b/sc/inc/simpleformulacalc.hxx
@@ -46,7 +46,6 @@ public:
     double GetValue();
     svl::SharedString GetString();
     short GetFormatType() const { return mnFormatType; }
-    sal_uLong GetFormatIndex() const { return mnFormatIndex; }
 
     bool HasColRowName();
 
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 829c127..b95331c 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -197,27 +197,6 @@ inline std::string print(const ScAddress& rAddr)
     return str.str();
 }
 
-namespace CppUnit {
-
-template<>
-struct assertion_traits<ScRange>
-{
-    static bool equal( const ScRange& x, const ScRange& y )
-    {
-        return x == y;
-    }
-
-    static std::string toString( const ScRange& x )
-    {
-        std::stringstream str;
-        str << "Start: " << print(x.aStart);
-        str << "\nEnd: " << print(x.aEnd);
-        return str.str();
-    }
-};
-
-}
-
 class SCQAHELPER_DLLPUBLIC ScBootstrapFixture : public test::BootstrapFixture
 {
     static const FileFormat aFileFormats[];
diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx
index 6c5afc0..9a83a1e 100644
--- a/sc/source/core/tool/clkernelthread.cxx
+++ b/sc/source/core/tool/clkernelthread.cxx
@@ -76,22 +76,6 @@ void CLBuildKernelThread::push(CLBuildKernelWorkItem item)
     sc::FormulaGroupInterpreter::getStatic();
 }
 
-void CLBuildKernelThread::produce()
-{
-}
-
-void CLBuildKernelThread::consume()
-{
-}
-
-void CLBuildKernelThread::finish()
-{
-    SAL_INFO("sc.opencl", "telling thread to finish");
-    CLBuildKernelWorkItem aWorkItem;
-    aWorkItem.meWhatToDo = CLBuildKernelWorkItem::FINISH;
-    push(aWorkItem);
-}
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index ac9ea7f..82a7204 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -325,12 +325,6 @@ void FormulaGroupAreaListener::collectFormulaCells(
     }
 }
 
-ScAddress FormulaGroupAreaListener::getTopCellPos() const
-{
-    const ScFormulaCell* p = getTopCell();
-    return p ? p->aPos : ScAddress();
-}
-
 const ScFormulaCell* FormulaGroupAreaListener::getTopCell() const
 {
     size_t nBlockSize = 0;
@@ -339,16 +333,6 @@ const ScFormulaCell* FormulaGroupAreaListener::getTopCell() const
     return pp ? *pp : NULL;
 }
 
-const ScRange& FormulaGroupAreaListener::getRange() const
-{
-    return maRange;
-}
-
-SCROW FormulaGroupAreaListener::getGroupLength() const
-{
-    return mnGroupLen;
-}
-
 void FormulaGroupAreaListener::notifyCellChange( const SfxHint& rHint, const ScAddress& rPos )
 {
     // Determine which formula cells within the group need to be notified of this change.
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index a140fa9..3f3cac7 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -326,11 +326,6 @@ ScUserList::iterator ScUserList::begin()
     return maData.begin();
 }
 
-ScUserList::const_iterator ScUserList::begin() const
-{
-    return maData.begin();
-}
-
 void ScUserList::clear()
 {
     maData.clear();
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 78b4b32..9b4b081 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -185,12 +185,11 @@ void XclExpPCItem::WriteBody( XclExpStream& rStrm )
 }
 
 XclExpPCField::XclExpPCField(
-        const XclExpRoot& rRoot, const XclExpPivotCache& rPCache, sal_uInt16 nFieldIdx,
+        const XclExpRoot& rRoot, sal_uInt16 nFieldIdx,
         const ScDPObject& rDPObj, const ScRange& rRange ) :
     XclExpRecord( EXC_ID_SXFIELD ),
     XclPCField( EXC_PCFIELD_STANDARD, nFieldIdx ),
     XclExpRoot( rRoot ),
-    mrPCache( rPCache ),
     mnTypeFlags( 0 )
 {
     // general settings for the standard field, insert all items from source range
@@ -221,12 +220,11 @@ XclExpPCField::XclExpPCField(
 }
 
 XclExpPCField::XclExpPCField(
-        const XclExpRoot& rRoot, const XclExpPivotCache& rPCache, sal_uInt16 nFieldIdx,
+        const XclExpRoot& rRoot, sal_uInt16 nFieldIdx,
         const ScDPObject& rDPObj, const ScDPSaveGroupDimension& rGroupDim, const XclExpPCField& rBaseField ) :
     XclExpRecord( EXC_ID_SXFIELD ),
     XclPCField( EXC_PCFIELD_STDGROUP, nFieldIdx ),
     XclExpRoot( rRoot ),
-    mrPCache( rPCache ),
     mnTypeFlags( 0 )
 {
     // add base field info (always using first base field, not predecessor of this field) ***
@@ -750,7 +748,7 @@ void XclExpPivotCache::AddStdFields( const ScDPObject& rDPObj )
         aColRange.aStart.SetCol( nScCol );
         aColRange.aEnd.SetCol( nScCol );
         maFieldList.AppendNewRecord( new XclExpPCField(
-            GetRoot(), *this, GetFieldCount(), rDPObj, aColRange ) );
+            GetRoot(), GetFieldCount(), rDPObj, aColRange ) );
     }
 }
 
@@ -771,7 +769,7 @@ void XclExpPivotCache::AddGroupFields( const ScDPObject& rDPObj )
                     {
                         // insert the new grouping field
                         XclExpPCFieldRef xNewGroupField( new XclExpPCField(
-                            GetRoot(), *this, GetFieldCount(), rDPObj, *pGroupDim, *pCurrStdField ) );
+                            GetRoot(), GetFieldCount(), rDPObj, *pGroupDim, *pCurrStdField ) );
                         maFieldList.AppendRecord( xNewGroupField );
 
                         // register new grouping field at current grouping field, building a chain
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index fa649ee..bbd768d 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -781,11 +781,6 @@ static ScRange lcl_ToRange( const XclRange& rRange )
     return aRange;
 }
 
-OString XclXmlUtils::ToOString( const XclRange& rRange )
-{
-    return ToOString( lcl_ToRange( rRange ) );
-}
-
 OString XclXmlUtils::ToOString( const XclRangeList& rRanges )
 {
     ScRangeList aRanges;
diff --git a/sc/source/filter/excel/xltoolbar.hxx b/sc/source/filter/excel/xltoolbar.hxx
index 3a9658c..892ec61 100644
--- a/sc/source/filter/excel/xltoolbar.hxx
+++ b/sc/source/filter/excel/xltoolbar.hxx
@@ -53,7 +53,6 @@ class ScCTB : public TBBase
     std::vector<TBVisualData> rVisualData;
     sal_uInt32 ectbid;
     std::vector< ScTBC > rTBC;
-    bool ImportCustomToolBar_Impl( ScCTBWrapper&, CustomToolBarImportHelper& );
 public:
     ScCTB(sal_uInt16);
     virtual ~ScCTB(){}
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index df1e4d7..cff08cf 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -74,13 +74,8 @@ public:
     virtual                     ~XclExpUserBViewList();
 
     inline iterator begin () { return aViews.begin(); }
-
     inline iterator end () { return aViews.end(); }
 
-    inline const_iterator begin () const { return aViews.begin(); }
-
-    inline const_iterator end () const { return aViews.end(); }
-
     virtual void                Save( XclExpStream& rStrm ) SAL_OVERRIDE;
 };
 
diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx
index bf7801d..ce80abd 100644
--- a/sc/source/filter/inc/XclImpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclImpChangeTrack.hxx
@@ -79,8 +79,6 @@ private:
     SCTAB                       ReadTabNum();
     void                        ReadDateTime( DateTime& rDateTime );
 
-    inline void                 ReadString( OUString& rString );
-
     bool                        CheckRecord( sal_uInt16 nOpCode );
 
     void                        ReadFormula(
@@ -144,11 +142,6 @@ inline void XclImpChangeTrack::Read2DRange( ScRange& rRange )
     rRange.aEnd.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
 }
 
-inline void XclImpChangeTrack::ReadString( OUString& rString )
-{
-    rString = pStrm->ReadUniString();
-}
-
 // derived class for special 3D ref handling
 
 class XclImpChTrFmlConverter : public ExcelToSc8
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index 27f060b..abe6aec 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -137,18 +137,6 @@ struct BinRange
     inline explicit     BinRange( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {}
     inline explicit     BinRange( const ::com::sun::star::table::CellRangeAddress& rRange ) : maFirst( rRange.StartColumn, rRange.StartRow ), maLast( rRange.EndColumn, rRange.EndRow ) {}
 
-    inline void         set( const BinAddress& rFirst, const BinAddress& rLast )
-                            { maFirst = rFirst; maLast = rLast; }
-    inline void         set( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 )
-                            { maFirst.set( nCol1, nRow1 ); maLast.set( nCol2, nRow2 ); }
-    inline void         set( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast )
-                            { maFirst.set( rFirst ); maLast.set( rLast ); }
-    inline void         set( const ::com::sun::star::table::CellRangeAddress& rRange )
-                            { maFirst.set( rRange.StartColumn, rRange.StartRow ); maLast.set( rRange.EndColumn, rRange.EndRow ); }
-
-    inline sal_Int32    getColCount() const { return maLast.mnCol - maFirst.mnCol + 1; }
-    inline sal_Int32    getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; }
-
     void                read( SequenceInputStream& rStrm );
     void                read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
 };
@@ -280,13 +268,6 @@ public:
     inline const ::com::sun::star::table::CellAddress&
                         getMaxAddress() const { return maMaxPos; }
 
-    /** Returns the column overflow status. */
-    inline bool         isColOverflow() const { return mbColOverflow; }
-    /** Returns the row overflow status. */
-    inline bool         isRowOverflow() const { return mbRowOverflow; }
-    /** Returns the sheet overflow status. */
-    inline bool         isTabOverflow() const { return mbTabOverflow; }
-
     /** Checks if the passed column index is valid.
 
         @param nCol  The column index to check.
diff --git a/sc/source/filter/inc/autofilterbuffer.hxx b/sc/source/filter/inc/autofilterbuffer.hxx
index 5a10a2d..65ae36b 100644
--- a/sc/source/filter/inc/autofilterbuffer.hxx
+++ b/sc/source/filter/inc/autofilterbuffer.hxx
@@ -172,9 +172,6 @@ public:
     inline FilterSettingsBase& createFilterSettings()
         { mxSettings.reset( new FilterSettingsType( *this ) ); return *mxSettings; }
 
-    /** Returns the index of the column in the filtered range this object is related to. */
-    inline sal_Int32    getColumnId() const { return mnColId; }
-
     /** Returns converted UNO API filter settings representing all filter
         settings of this column. */
     ApiFilterSettings   finalizeImport( sal_Int32 nMaxCount );
diff --git a/sc/source/filter/inc/biff.hxx b/sc/source/filter/inc/biff.hxx
index 088382e..9d3ca7b 100644
--- a/sc/source/filter/inc/biff.hxx
+++ b/sc/source/filter/inc/biff.hxx
@@ -29,23 +29,19 @@
 // Stream wrapper class
 class ScBiffReader
 {
-    protected:
+protected:
     sal_uInt16 mnId;
     sal_uInt16 mnLength;
     sal_uInt32 mnOffset;
     SvStream *mpStream;
     bool mbEndOfFile;
 
-    public:
+public:
     ScBiffReader( SfxMedium& rMedium );
     ~ScBiffReader();
     bool recordsLeft() { return mpStream && !mpStream->IsEof(); }
     bool IsEndOfFile() { return mbEndOfFile; }
-    void SetEof( bool bValue ){ mbEndOfFile = bValue; }
     bool nextRecord();
-    sal_uInt16 getId() { return mnId; }
-    sal_uInt16 getLength() { return mnLength; }
-    SvStream& getStream() { return *mpStream; }
 };
 #endif
 
diff --git a/sc/source/filter/inc/biffinputstream.hxx b/sc/source/filter/inc/biffinputstream.hxx
index 7eb816a..74c1c890 100644
--- a/sc/source/filter/inc/biffinputstream.hxx
+++ b/sc/source/filter/inc/biffinputstream.hxx
@@ -36,13 +36,8 @@ class BiffInputRecordBuffer
 public:
     explicit            BiffInputRecordBuffer( BinaryInputStream& rInStrm );
 
-    /** Returns the wrapped binary base stream. */
-    inline const BinaryInputStream& getBaseStream() const { return mrInStrm; }
-
     /** Sets a decoder object and decrypts buffered record data. */
     void                setDecoder( const BiffDecoderRef& rxDecoder );
-    /** Returns the current decoder object. */
-    inline BiffDecoderRef getDecoder() const { return mxDecoder; }
     /** Enables/disables usage of current decoder. */
     void                enableDecoder( bool bEnable );
 
@@ -63,8 +58,6 @@ public:
     inline sal_uInt16   getRecId() const { return mnRecId; }
     /** Returns the current record size. */
     inline sal_uInt16   getRecSize() const { return mnRecSize; }
-    /** Returns the current read position in the current record body. */
-    inline sal_uInt16   getRecPos() const { return mnRecPos; }
     /** Returns the number of remaining bytes in the current record body. */
     inline sal_uInt16   getRecLeft() const { return mnRecSize - mnRecPos; }
 
diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index 4177543..187a46a 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -114,7 +114,6 @@ public:
     void                createNameObject( sal_Int32 nIndex );
     /** Converts the formula string or BIFF token array for this defined name. */
     void                convertFormula();
-    ApiTokenSequence    getTokens();
     std::unique_ptr<ScTokenArray> getScTokens();
     /** Returns true, if this defined name is global in the document. */
     inline bool         isGlobalName() const { return mnCalcSheet < 0; }
@@ -135,12 +134,6 @@ public:
     bool                getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const;
 
 private:
-    /** Imports the OOXML or BIFF12 definition of the name. */
-    void                implImportOoxFormula();
-    /** Imports the BIFF definition of the name. */
-    void                implImportBiffFormula();
-
-private:
     typedef ::std::unique_ptr< StreamDataSequence >   StreamDataSeqPtr;
     typedef ::std::unique_ptr< BiffInputStreamPos >   BiffStreamPosPtr;
 
@@ -150,7 +143,6 @@ private:
     sal_Unicode         mcBuiltinId;        /// Identifier for built-in defined names.
     StreamDataSeqPtr    mxFormula;          /// Formula data for BIFF12 import.
     BiffStreamPosPtr    mxBiffStrm;         /// Cached BIFF stream for formula import.
-    sal_uInt16          mnFmlaSize;         /// Cached BIFF formula size for formula import.
 };
 
 typedef std::shared_ptr< DefinedName > DefinedNameRef;
diff --git a/sc/source/filter/inc/drawingmanager.hxx b/sc/source/filter/inc/drawingmanager.hxx
index 021127a..129a1f9 100644
--- a/sc/source/filter/inc/drawingmanager.hxx
+++ b/sc/source/filter/inc/drawingmanager.hxx
@@ -60,18 +60,9 @@ public:
     explicit            BiffDrawingBase( const WorksheetHelper& rHelper,
                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage );
 
-    /** Sets the object with the passed identifier to be skipped on import. */
-    void                setSkipObj( sal_uInt16 nObjId );
-
     /** Final processing after import of the all drawing objects. */
     void                finalizeImport();
 
-    /** Derived classes may want to know that a shape has been inserted. Will
-        be called from the convertAndInsert() implementation. */
-    virtual void        notifyShapeInserted(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
-                            const ::com::sun::star::awt::Rectangle& rShapeRect ) = 0;
-
 private:
     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
                         mxDrawPage;         /// UNO draw page used to insert the shapes.
@@ -83,10 +74,6 @@ class BiffSheetDrawing : public BiffDrawingBase
 public:
     explicit            BiffSheetDrawing( const WorksheetHelper& rHelper );
 
-    /** Called when a new UNO shape has been inserted into the draw page. */
-    virtual void        notifyShapeInserted(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
-                            const ::com::sun::star::awt::Rectangle& rShapeRect ) SAL_OVERRIDE;
 };
 
 } // namespace xls
diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx
index b8e32b7..e50cfd4 100644
--- a/sc/source/filter/inc/excimp8.hxx
+++ b/sc/source/filter/inc/excimp8.hxx
@@ -55,7 +55,6 @@ public:
     void                    ReadBasic();              // 0xD3
     void                    Labelsst();               // 0xFD
 
-    void                    Hlink();                  // 0x01B8
     void                    FeatHdr();                // 0x0867
     void                    Feat();                   // 0x0868
 
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index edfb231..6a12db8 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -360,7 +360,6 @@ public:
                             ~ExcFilterCondition();
 
     inline bool             IsEmpty() const     { return (nType == EXC_AFTYPE_NOTUSED); }
-    inline bool             HasEqual() const    { return (nOper == EXC_AFOPER_EQUAL); }
     sal_uLong               GetTextBytes() const;
 
     void                    SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, OUString* pT );
diff --git a/sc/source/filter/inc/externallinkbuffer.hxx b/sc/source/filter/inc/externallinkbuffer.hxx
index 28633b7..08a2ff8 100644
--- a/sc/source/filter/inc/externallinkbuffer.hxx
+++ b/sc/source/filter/inc/externallinkbuffer.hxx
@@ -86,9 +86,6 @@ public:
     /** Imports the DDEITEM_STRING record containing a string in a link result. */
     void                importDdeItemString( SequenceInputStream& rStrm );
 
-    /** Returns true, if the name refers to an OLE object. */
-    inline bool         isOleObject() const { return maExtNameModel.mbOleObj; }
-
 #if 0
     /** Returns the sheet cache index if this is a sheet-local external name. */
     sal_Int32           getSheetCacheIndex() const;
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 2fb7040..35a2c85 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -117,12 +117,11 @@ protected:
     sal_Int32               nBytesLeft;
 
     inline void         Ignore( const long nSeekRel );
-    inline void         Read( sal_Char& nByte );
     inline void         Read( sal_uInt8& nByte );
     inline void         Read( sal_uInt16& nUINT16 );
     inline void         Read( sal_Int16& nINT16 );
     inline void         Read( double& fDouble );
-        inline void                     Read( sal_uInt32& nUINT32 );
+    inline void         Read( sal_uInt32& nUINT32 );
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list