[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - 54 commits - accessibility/source android/source avmedia/source basctl/source basegfx/source canvas/source chart2/source configure.ac connectivity/source cui/source dbaccess/source editeng/source external/owncloud-android-lib filter/source framework/qa include/editeng include/filter include/LibreOfficeKit include/svl include/svtools include/svx include/tools include/vcl libreofficekit/Executable_gtktiledviewer.mk libreofficekit/Library_libreofficekitgtk.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa libreofficekit/source logerrit oox/source package/source qadevOOo/runner qadevOOo/tests readlicense_oo/license sc/inc sc/qa scripting/source sc/source sd/source sfx2/qa sfx2/source svl/source svtools/source svx/source sw/inc sw/qa sw/source toolkit/qa ucb/source vcl/generic vcl/headless vcl/inc vcl/Library_vcl.mk vcl/osx vcl/qa vcl/quartz vcl/source vcl/unx vcl/win writerfilter/source xmloff/source

Pranav Kant pranavk at gnome.org
Thu Jun 11 02:23:50 PDT 2015


Rebased ref, commits from common ancestor:
commit 709b6ba8ad40a8c92149000365cdbf59a4b3d325
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jun 10 20:59:18 2015 +0530

    gtktiledviewer: Replace deprecated Gtk functions
    
    Change-Id: I354aa987f8e732945fb552d855a3416c782bb508

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b1fd637..3b3645f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -57,7 +57,7 @@ const float fZooms[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0 };
 
 static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
 {
-    const char *sName = gtk_tool_button_get_stock_id( GTK_TOOL_BUTTON(pButton) );
+    const char *sName = gtk_tool_button_get_icon_name( GTK_TOOL_BUTTON(pButton) );
 
     float fZoom = 0;
     float fCurrentZoom = 0;
@@ -67,7 +67,7 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
         fCurrentZoom = lok_doc_view_get_zoom( LOK_DOC_VIEW(pDocView) );
     }
 
-    if ( strcmp(sName, "gtk-zoom-in") == 0)
+    if ( strcmp(sName, "zoom-in-symbolic") == 0)
     {
         for ( unsigned int i = 0; i < sizeof( fZooms ) / sizeof( fZooms[0] ); i++ )
         {
@@ -78,11 +78,11 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
             }
         }
     }
-    else if ( strcmp(sName, "gtk-zoom-100") == 0)
+    else if ( strcmp(sName, "zoom-original-symbolic") == 0)
     {
         fZoom = 1;
     }
-    else if ( strcmp(sName, "gtk-zoom-out") == 0)
+    else if ( strcmp(sName, "zoom-out-symbolic") == 0)
     {
         for ( unsigned int i = 0; i < sizeof( fZooms ) / sizeof( fZooms[0] ); i++ )
         {
@@ -351,22 +351,25 @@ int main( int argc, char* argv[] )
     gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768);
     g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL );
 
-    pVBox = gtk_vbox_new( FALSE, 0 );
+    pVBox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
     gtk_container_add( GTK_CONTAINER(pWindow), pVBox );
 
     // Toolbar
     GtkWidget* pToolbar = gtk_toolbar_new();
     gtk_toolbar_set_style( GTK_TOOLBAR(pToolbar), GTK_TOOLBAR_ICONS );
 
-    GtkToolItem* pZoomIn = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_IN );
+    GtkToolItem* pZoomIn = gtk_tool_button_new( NULL, NULL );
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomIn), "zoom-in-symbolic");
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomIn, 0);
     g_signal_connect( G_OBJECT(pZoomIn), "clicked", G_CALLBACK(changeZoom), NULL );
 
-    GtkToolItem* pZoom1 = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_100 );
+    GtkToolItem* pZoom1 = gtk_tool_button_new( NULL, NULL );
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoom1), "zoom-original-symbolic");
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoom1, -1);
     g_signal_connect( G_OBJECT(pZoom1), "clicked", G_CALLBACK(changeZoom), NULL );
 
-    GtkToolItem* pZoomOut = gtk_tool_button_new_from_stock( GTK_STOCK_ZOOM_OUT );
+    GtkToolItem* pZoomOut = gtk_tool_button_new( NULL, NULL );
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pZoomOut), "zoom-out-symbolic");
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pZoomOut, -1);
     g_signal_connect( G_OBJECT(pZoomOut), "clicked", G_CALLBACK(changeZoom), NULL );
 
@@ -389,27 +392,38 @@ int main( int argc, char* argv[] )
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
 
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1);
-    pEnableEditing = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_EDIT);
+    pEnableEditing = gtk_toggle_tool_button_new();
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pEnableEditing), "insert-text-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pEnableEditing, -1);
     g_signal_connect(G_OBJECT(pEnableEditing), "toggled", G_CALLBACK(toggleEditing), NULL);
-    GtkToolItem* pFindButton = gtk_tool_button_new_from_stock(GTK_STOCK_FIND);
+
+    GtkToolItem* pFindButton = gtk_tool_button_new( NULL, NULL);
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindButton), "edit-find-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pFindButton, -1);
     g_signal_connect(G_OBJECT(pFindButton), "clicked", G_CALLBACK(toggleFindbar), NULL);
 
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1);
-    pBold = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_BOLD);
+
+    pBold = gtk_toggle_tool_button_new();
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pBold), "format-text-bold-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pBold, -1);
     g_signal_connect(G_OBJECT(pBold), "toggled", G_CALLBACK(toggleToolItem), NULL);
     lcl_registerToolItem(pBold, ".uno:Bold");
-    pItalic = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_ITALIC);
+
+    pItalic = gtk_toggle_tool_button_new();
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pItalic), "format-text-italic-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pItalic, -1);
     g_signal_connect(G_OBJECT(pItalic), "toggled", G_CALLBACK(toggleToolItem), NULL);
     lcl_registerToolItem(pItalic, ".uno:Italic");
-    pUnderline = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_UNDERLINE);
+
+    pUnderline = gtk_toggle_tool_button_new();
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pUnderline), "format-text-underline-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pUnderline, -1);
     g_signal_connect(G_OBJECT(pUnderline), "toggled", G_CALLBACK(toggleToolItem), NULL);
     lcl_registerToolItem(pUnderline, ".uno:Underline");
-    pStrikethrough = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_STRIKETHROUGH);
+
+    pStrikethrough = gtk_toggle_tool_button_new ();
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pStrikethrough), "format-text-strikethrough-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), pStrikethrough, -1);
     g_signal_connect(G_OBJECT(pStrikethrough), "toggled", G_CALLBACK(toggleToolItem), NULL);
     lcl_registerToolItem(pStrikethrough, ".uno:Strikeout");
@@ -420,7 +434,8 @@ int main( int argc, char* argv[] )
     pFindbar = gtk_toolbar_new();
     gtk_toolbar_set_style(GTK_TOOLBAR(pFindbar), GTK_TOOLBAR_ICONS);
 
-    GtkToolItem* pFindbarClose = gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE);
+    GtkToolItem* pFindbarClose = gtk_tool_button_new( NULL, NULL);
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarClose), "window-close-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarClose, -1);
     g_signal_connect(G_OBJECT(pFindbarClose), "clicked", G_CALLBACK(toggleFindbar), NULL);
 
@@ -430,10 +445,13 @@ int main( int argc, char* argv[] )
     g_signal_connect(pFindbarEntry, "key-press-event", G_CALLBACK(signalFindbar), 0);
     gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pEntryContainer, -1);
 
-    GtkToolItem* pFindbarNext = gtk_tool_button_new_from_stock(GTK_STOCK_GO_DOWN);
+    GtkToolItem* pFindbarNext = gtk_tool_button_new( NULL, NULL);
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarNext), "go-down-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarNext, -1);
     g_signal_connect(G_OBJECT(pFindbarNext), "clicked", G_CALLBACK(signalSearchNext), NULL);
-    GtkToolItem* pFindbarPrev = gtk_tool_button_new_from_stock(GTK_STOCK_GO_UP);
+
+    GtkToolItem* pFindbarPrev = gtk_tool_button_new( NULL, NULL);
+    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pFindbarPrev), "go-up-symbolic");
     gtk_toolbar_insert(GTK_TOOLBAR(pFindbar), pFindbarPrev, -1);
     g_signal_connect(G_OBJECT(pFindbarPrev), "clicked", G_CALLBACK(signalSearchPrev), NULL);
 
@@ -463,8 +481,7 @@ int main( int argc, char* argv[] )
     gtk_widget_set_vexpand (pScrolledWindow, TRUE);
     gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow);
 
-    // DocView doesn't have scrolling capability, so need a viewport
-    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pScrolledWindow), pDocView);
+    gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView);
 
     gtk_widget_show_all( pWindow );
     // Hide the findbar by default.
commit dabd63b0803d672e5ea8d5584203447c424bbcba
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jun 10 16:57:19 2015 +0530

    lokdocview, gtktiledviewer: Remove gtk version checks
    
    We already have the global ENABLE_GTK3 guard for RHEL5 baseline.
    
    Change-Id: Id814a4063861a1e750952b44686ed24864c0394f

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f389f7d..b1fd637 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -40,12 +40,9 @@ std::map<GtkToolItem*, std::string> g_aToolItemCommandNames;
 std::map<std::string, GtkToolItem*> g_aCommandNameToolItems;
 bool g_bToolItemBroadcast = true;
 static GtkWidget* pVBox;
-// GtkComboBox requires gtk 2.24 or later
-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
 static GtkComboBoxText* pPartSelector;
 /// Should the part selector avoid calling lok::Document::setPart()?
 static bool g_bPartSelectorBroadcast = true;
-#endif
 GtkWidget* pFindbar;
 GtkWidget* pFindbarEntry;
 GtkWidget* pFindbarLabel;
@@ -117,7 +114,6 @@ static void toggleEditing(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 /// Toggle the visibility of the findbar.
 static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 {
-#if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible()
     if (gtk_widget_get_visible(pFindbar))
     {
         gtk_widget_hide(pFindbar);
@@ -127,7 +123,6 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
         gtk_widget_show_all(pFindbar);
         gtk_widget_grab_focus(pFindbarEntry);
     }
-#endif
 }
 
 /// Get the visible area of the scrolled window
@@ -151,13 +146,11 @@ static void getVisibleAreaTwips(GdkRectangle* pArea)
 static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData)
 {
     LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView);
-#if GTK_CHECK_VERSION(2,18,0) // we need gtk_widget_get_visible()
     if (!gtk_widget_get_visible(pFindbar) && bool(lok_doc_view_get_edit(pLOKDocView)))
         {
             lok_doc_view_post_key(pWidget, pEvent, pData);
             return TRUE;
         }
-#endif
     return FALSE;
 }
 
@@ -263,11 +256,9 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint
 
 static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/)
 {
-#if GTK_CHECK_VERSION(2,24,0)
     g_bPartSelectorBroadcast = false;
     gtk_combo_box_set_active(GTK_COMBO_BOX(pPartSelector), nPart);
     g_bPartSelectorBroadcast = true;
-#endif
 }
 
 /// User clicked on a cmmand button -> inform LOKDocView.
@@ -283,8 +274,6 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
     }
 }
 
-// GtkComboBox requires gtk 2.24 or later
-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
 static void populatePartSelector()
 {
     gtk_list_store_clear( GTK_LIST_STORE(
@@ -342,7 +331,6 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
         lok_doc_view_set_partmode( LOK_DOC_VIEW(pDocView), ePartMode );
     }
 }
-#endif
 
 int main( int argc, char* argv[] )
 {
@@ -385,8 +373,6 @@ int main( int argc, char* argv[] )
     GtkToolItem* pSeparator1 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1);
 
-// GtkComboBox requires gtk 2.24 or later
-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new();
     GtkWidget* pComboBox = gtk_combo_box_text_new();
     gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox );
@@ -401,7 +387,6 @@ int main( int argc, char* argv[] )
     GtkWidget* pPartModeComboBox = gtk_combo_box_text_new();
     gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
-#endif
 
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), gtk_separator_tool_item_new(), -1);
     pEnableEditing = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_EDIT);
@@ -490,15 +475,11 @@ int main( int argc, char* argv[] )
         g_error("main: lok_doc_view_open_document() failed");
     assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)));
 
-    // GtkComboBox requires gtk 2.24 or later
-#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     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);
-#endif
 
     gtk_main();
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 028953c..ca7996f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -651,7 +651,6 @@ gboolean LOKDocView_Impl::renderOverlay(GtkWidget* /*widget*/, cairo_t *cr, gpoi
 
 gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo)
 {
-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_widget_get_window()
     if (m_bEdit && m_bCursorVisible && m_bCursorOverlayVisible && !isEmptyRectangle(m_aVisibleCursor))
     {
         if (m_aVisibleCursor.width < 30)
@@ -713,7 +712,6 @@ gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo)
         renderGraphicHandle(pCairo, m_aGraphicSelection, m_pGraphicHandle);
     }
 
-#endif
     return FALSE;
 }
 
@@ -1017,9 +1015,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
     case LOK_CALLBACK_HYPERLINK_CLICKED:
     {
         GError* pError = NULL;
-#if GTK_CHECK_VERSION(2,14,0)
         gtk_show_uri(NULL, pCallback->m_aPayload.c_str(), GDK_CURRENT_TIME, &pError);
-#endif
     }
     break;
     case LOK_CALLBACK_STATE_CHANGED:
@@ -1070,22 +1066,16 @@ void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
 {
     LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView);
     g_info("lok_doc_view_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload);
-#if GTK_CHECK_VERSION(2,12,0)
     gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback);
-#endif
 }
 
 void LOKDocView_Impl::globalCallbackWorkerImpl(int nType, const char* pPayload)
 {
     LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView);
     g_info("LOKDocView_Impl::globalCallbackWorkerImpl: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload);
-#if GTK_CHECK_VERSION(2,12,0)
     gdk_threads_add_idle(LOKDocView_Impl::globalCallback, pCallback);
-#endif
 }
 
-
-
 void LOKDocView_Impl::commandChanged(const std::string& rString)
 {
     g_signal_emit(m_pDocView, doc_view_signals[COMMAND_CHANGED], 0, rString.c_str());
commit ed3d4a2c4db2d2334a9773d1eb8dc9a921d1af59
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jun 10 16:28:45 2015 +0530

    lokdocview: Port to gtk3; 'expose-event' -> 'draw'
    
    Change-Id: I8d2541f5cbd2b908c2b0dc52cccf9b936bbc307a

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 33d46ac..f389f7d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -474,6 +474,8 @@ int main( int argc, char* argv[] )
 
     // Scrolled window for DocView
     pScrolledWindow = gtk_scrolled_window_new(0, 0);
+    gtk_widget_set_hexpand (pScrolledWindow, TRUE);
+    gtk_widget_set_vexpand (pScrolledWindow, TRUE);
     gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow);
 
     // DocView doesn't have scrolling capability, so need a viewport
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 046852f..028953c 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -116,8 +116,10 @@ struct LOKDocView_Impl
     ~LOKDocView_Impl();
     /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl.
     static void destroy(LOKDocView* pDocView, gpointer pData);
-    /// Connected to the expose-event of the GtkDrawingArea
-    static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
+    /// Connected to the draw of the GtkDrawingArea
+    static gboolean renderDocument(GtkWidget *widget, cairo_t *cr, gpointer user_data);
+    /// Implementation of draw event handler, invoked by renderDocument().
+    gboolean renderDocumentImpl(cairo_t* cr);
     /// Receives a key press or release event.
     void signalKey(GdkEventKey* pEvent);
     /*
@@ -138,9 +140,9 @@ struct LOKDocView_Impl
     /// Implementation of motion event handler, invoked by signalMotion().
     gboolean signalMotionImpl(GdkEventButton* pEvent);
     /// Receives an expose event.
-    static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, LOKDocView* pDocView);
+    static gboolean renderOverlay(GtkWidget* pWidget, cairo_t* cr, gpointer userdata);
     /// Implementation of expose event handler (renders cursor and selection overlay), invoked by renderOverlay().
-    gboolean renderOverlayImpl(GtkWidget* pEventBox);
+    gboolean renderOverlayImpl(cairo_t *cr);
     /// Is rRectangle empty?
     static bool isEmptyRectangle(const GdkRectangle& rRectangle);
     /*
@@ -154,8 +156,6 @@ struct LOKDocView_Impl
     static gboolean handleTimeout(gpointer pData);
     /// Implementation of the timeout handler, invoked by handleTimeout().
     gboolean handleTimeoutImpl();
-    /// Implementation of expose event handler, invoked by onExposed().
-    void onExposedImpl(GdkEventExpose* event);
     /// Returns the GdkRectangle of a x,y,width,height string.
     GdkRectangle payloadToRectangle(const char* pPayload);
     /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string.
@@ -320,21 +320,22 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
     delete pDocView->m_pImpl;
 }
 
-void LOKDocView_Impl::onExposed(GtkWidget* /*widget*/, GdkEventExpose* event, gpointer userdata)
+gboolean LOKDocView_Impl::renderDocument(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata)
 {
     LOKDocView *pDocView = LOK_DOC_VIEW (userdata);
-    pDocView->m_pImpl->onExposedImpl(event);
+    return pDocView->m_pImpl->renderDocumentImpl(cr);
 }
 
-void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event)
+gboolean LOKDocView_Impl::renderDocumentImpl(cairo_t *pCairo)
 {
     long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom);
     long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom);
     // Total number of rows / columns in this document.
     guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
-    GdkRectangle aVisibleArea = event->area;
-    cairo_t *pcairo = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(m_pDocView)));
+    GdkRectangle aVisibleArea;
+
+    gdk_cairo_get_clip_rectangle (pCairo, &aVisibleArea);
 
     aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom);
     aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom);
@@ -374,16 +375,14 @@ void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event)
             {
                 Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom);
                 GdkPixbuf* pPixBuf = currentTile.getBuffer();
-
-                gdk_cairo_set_source_pixbuf (pcairo, pPixBuf,
+                gdk_cairo_set_source_pixbuf (pCairo, pPixBuf,
                                              twipToPixel(aTileRectangleTwips.x, m_fZoom),
                                              twipToPixel(aTileRectangleTwips.y, m_fZoom));
-                cairo_paint(pcairo);
+                cairo_paint(pCairo);
             }
         }
     }
-
-    cairo_destroy(pcairo);
+    return FALSE;
 }
 
 void LOKDocView_Impl::signalKey(GdkEventKey* pEvent)
@@ -644,16 +643,15 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent)
     return FALSE;
 }
 
-gboolean LOKDocView_Impl::renderOverlay(GtkWidget* pEventBox, GdkEventExpose* /*pEvent*/, LOKDocView* pDocView)
+gboolean LOKDocView_Impl::renderOverlay(GtkWidget* /*widget*/, cairo_t *cr, gpointer userdata)
 {
-    return pDocView->m_pImpl->renderOverlayImpl(pEventBox);
+    LOKDocView *pDocView = LOK_DOC_VIEW (userdata);
+    return pDocView->m_pImpl->renderOverlayImpl(cr);
 }
 
-gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget)
+gboolean LOKDocView_Impl::renderOverlayImpl(cairo_t *pCairo)
 {
 #if GTK_CHECK_VERSION(2,14,0) // we need gtk_widget_get_window()
-    cairo_t* pCairo = gdk_cairo_create(gtk_widget_get_window(pWidget));
-
     if (m_bEdit && m_bCursorVisible && m_bCursorOverlayVisible && !isEmptyRectangle(m_aVisibleCursor))
     {
         if (m_aVisibleCursor.width < 30)
@@ -715,7 +713,6 @@ gboolean LOKDocView_Impl::renderOverlayImpl(GtkWidget* pWidget)
         renderGraphicHandle(pCairo, m_aGraphicSelection, m_pGraphicHandle);
     }
 
-    cairo_destroy(pCairo);
 #endif
     return FALSE;
 }
@@ -1154,10 +1151,10 @@ static void lok_doc_view_init (LOKDocView* pDocView)
     pDocView->m_pImpl = new LOKDocView_Impl(pDocView);
 
     g_signal_connect(G_OBJECT(pDocView),
-                     "expose-event",
-                     G_CALLBACK(LOKDocView_Impl::onExposed), pDocView);
+                     "draw",
+                     G_CALLBACK(LOKDocView_Impl::renderDocument), pDocView);
     g_signal_connect(G_OBJECT(pDocView),
-                     "expose-event",
+                     "draw",
                      G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView);
     gtk_widget_add_events(GTK_WIDGET(pDocView),
                            GDK_BUTTON_PRESS_MASK
commit 87a96bf2d1d2aa414b857c9a910a59b80639a02d
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jun 10 16:18:06 2015 +0530

    lokdocview, gtktiledviewer: Port to gtk3
    
    Change-Id: I57f2d7b9383790e5c34fc517a905dd537519598f

diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk
index 8a52068..31028a6 100644
--- a/libreofficekit/Executable_gtktiledviewer.mk
+++ b/libreofficekit/Executable_gtktiledviewer.mk
@@ -16,7 +16,14 @@ $(eval $(call gb_Executable_set_include,gtktiledviewer,\
 
 $(eval $(call gb_Executable_use_externals,gtktiledviewer,\
     boost_headers \
-    gtk \
+))
+
+$(eval $(call gb_Executable_add_cxxflags,gtktiledviewer,\
+    $$(GTK3_CFLAGS) \
+))
+
+$(eval $(call gb_Executable_add_libs,gtktiledviewer,\
+    $(GTK3_LIBS) \
 ))
 
 $(eval $(call gb_Executable_use_libraries,gtktiledviewer,\
diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk
index 9240953..71a77e9 100644
--- a/libreofficekit/Library_libreofficekitgtk.mk
+++ b/libreofficekit/Library_libreofficekitgtk.mk
@@ -11,15 +11,19 @@ $(eval $(call gb_Library_Library,libreofficekitgtk))
 
 $(eval $(call gb_Library_use_sdk_api,libreofficekitgtk))
 
-$(eval $(call gb_Library_use_externals,libreofficekitgtk,\
-    gtk \
-))
-
 $(eval $(call gb_Library_add_exception_objects,libreofficekitgtk,\
     libreofficekit/source/gtk/lokdocview \
     libreofficekit/source/gtk/tilebuffer \
 ))
 
+$(eval $(call gb_Library_add_cxxflags,libreofficekitgtk,\
+    $$(GTK3_CFLAGS) \
+))
+
+$(eval $(call gb_Library_add_libs,libreofficekitgtk,\
+    $(GTK3_LIBS) \
+))
+
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_libs,libreofficekitgtk,\
     -ldl \
diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk
index 000c2fe..217ecb2 100644
--- a/libreofficekit/Module_libreofficekit.mk
+++ b/libreofficekit/Module_libreofficekit.mk
@@ -15,7 +15,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,libreofficekit,\
     CppunitTest_libreofficekit_tiledrendering \
 ))
 
-ifneq ($(ENABLE_GTK),)
+ifneq ($(ENABLE_GTK3),)
 $(eval $(call gb_Module_add_targets,libreofficekit,\
     Library_libreofficekitgtk \
     Executable_gtktiledviewer \
@@ -24,7 +24,7 @@ $(eval $(call gb_Module_add_targets,libreofficekit,\
 $(eval $(call gb_Module_add_targets,libreofficekit,\
     Executable_tilebench \
 ))
-endif # ($(ENABLE_GTK),)
+endif # ($(ENABLE_GTK3),)
 
 endif # ($(OS),LINUX)
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 4f74583..33d46ac 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -14,9 +14,7 @@
 #include <map>
 
 #include <boost/property_tree/json_parser.hpp>
-#include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
 
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -206,13 +204,13 @@ static gboolean signalFindbar(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpoin
     gtk_label_set_text(GTK_LABEL(pFindbarLabel), "");
     switch(pEvent->keyval)
     {
-        case GDK_Return:
+        case GDK_KEY_Return:
         {
             // Search forward.
             doSearch(/*bBackwards=*/false);
             return TRUE;
         }
-        case GDK_Escape:
+        case GDK_KEY_Escape:
         {
             // Hide the findbar.
             gtk_widget_hide(pFindbar);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 44398c4..046852f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -13,8 +13,6 @@
 #include <vector>
 #include <string>
 
-#include <gdk/gdkkeysyms.h>
-
 #include <com/sun/star/awt/Key.hpp>
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKit.h>
@@ -336,7 +334,7 @@ void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event)
     guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
     GdkRectangle aVisibleArea = event->area;
-    cairo_t *pcairo = gdk_cairo_create(GTK_WIDGET(m_pDocView)->window);
+    cairo_t *pcairo = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(m_pDocView)));
 
     aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom);
     aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom);
@@ -401,33 +399,33 @@ void LOKDocView_Impl::signalKey(GdkEventKey* pEvent)
 
     switch (pEvent->keyval)
     {
-    case GDK_BackSpace:
+    case GDK_KEY_BackSpace:
         nKeyCode = com::sun::star::awt::Key::BACKSPACE;
         break;
-    case GDK_Return:
+    case GDK_KEY_Return:
         nKeyCode = com::sun::star::awt::Key::RETURN;
         break;
-    case GDK_Escape:
+    case GDK_KEY_Escape:
         nKeyCode = com::sun::star::awt::Key::ESCAPE;
         break;
-    case GDK_Tab:
+    case GDK_KEY_Tab:
         nKeyCode = com::sun::star::awt::Key::TAB;
         break;
-    case GDK_Down:
+    case GDK_KEY_Down:
         nKeyCode = com::sun::star::awt::Key::DOWN;
         break;
-    case GDK_Up:
+    case GDK_KEY_Up:
         nKeyCode = com::sun::star::awt::Key::UP;
         break;
-    case GDK_Left:
+    case GDK_KEY_Left:
         nKeyCode = com::sun::star::awt::Key::LEFT;
         break;
-    case GDK_Right:
+    case GDK_KEY_Right:
         nKeyCode = com::sun::star::awt::Key::RIGHT;
         break;
     default:
-        if (pEvent->keyval >= GDK_F1 && pEvent->keyval <= GDK_F26)
-            nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_F1);
+        if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26)
+            nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1);
         else
             nCharCode = gdk_keyval_to_unicode(pEvent->keyval);
     }
commit 00f0ca599b7bb17b324121257807a1725ee1a99d
Author: Pranav Kant <pranavk at gnome.org>
Date:   Wed Jun 10 16:10:19 2015 +0530

    lokdocview: Create LOK context inside of lok_doc_view_new
    
    Change-Id: I675192d6bd6d10e6c7974a5de6f488f9a087ac32

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 24c577e..bdd2e9a 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -46,7 +46,7 @@ struct _LOKDocViewClass
 
 GType                          lok_doc_view_get_type               (void) G_GNUC_CONST;
 
-GtkWidget*                     lok_doc_view_new                    (LibreOfficeKit* pOffice );
+GtkWidget*                     lok_doc_view_new                    (const char* pPath);
 
 gboolean                       lok_doc_view_open_document          (LOKDocView* pDocView,
                                                                     char* pPath);
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c8b47f7..4f74583 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -19,7 +19,6 @@
 #include <gtk/gtk.h>
 
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
-#include <LibreOfficeKit/LibreOfficeKitInit.h>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #ifndef g_info
@@ -53,8 +52,6 @@ GtkWidget* pFindbar;
 GtkWidget* pFindbarEntry;
 GtkWidget* pFindbarLabel;
 
-static LibreOfficeKit* pOffice;
-
 static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName)
 {
     g_aToolItemCommandNames[pItem] = rName;
@@ -361,10 +358,6 @@ int main( int argc, char* argv[] )
         return 1;
     }
 
-    pOffice = lok_init( argv[1] );
-    if ( pOffice == NULL )
-        return 1;
-
     gtk_init( &argc, &argv );
 
     GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
@@ -469,7 +462,9 @@ int main( int argc, char* argv[] )
     gtk_box_pack_end(GTK_BOX(pVBox), pFindbar, FALSE, FALSE, 0);
 
     // Docview
-    pDocView = lok_doc_view_new( pOffice );
+    pDocView = lok_doc_view_new(argv[1]);
+    if (pDocView == NULL)
+        g_error ("Error while creating LOKDocView widget");
     g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL);
     g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL);
     g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL);
@@ -492,7 +487,7 @@ int main( int argc, char* argv[] )
 
     int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] );
     if (!bOpened)
-        g_error("main: lok_doc_view_open_document() failed with '%s'", pOffice->pClass->getError(pOffice));
+        g_error("main: lok_doc_view_open_document() failed");
     assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)));
 
     // GtkComboBox requires gtk 2.24 or later
@@ -507,8 +502,6 @@ int main( int argc, char* argv[] )
 
     gtk_main();
 
-    pOffice->pClass->destroy( pOffice );
-
     return 0;
 }
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index d3d14a2..44398c4 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/awt/Key.hpp>
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKit.h>
+#include <LibreOfficeKit/LibreOfficeKitInit.h>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
 #include <rsc/rsc-vcl-shared-types.hxx>
@@ -308,7 +309,10 @@ LOKDocView_Impl::~LOKDocView_Impl()
 {
     if (m_pDocument)
         m_pDocument->pClass->destroy(m_pDocument);
+    if (m_pOffice)
+        m_pOffice->pClass->destroy(m_pOffice);
     m_pDocument = 0;
+    m_pOffice = 0;
 }
 
 void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
@@ -1177,14 +1181,16 @@ static void lok_doc_view_init (LOKDocView* pDocView)
 
 /**
  * lok_doc_view_new:
- * @pOffice: The LibreOfficeKit context.
+ * @pPath: LibreOffice install path.
  *
  * Returns: The #LOKDocView widget instance.
  */
-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice )
+SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new(const char* pPath)
 {
-    LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type()));
-    pDocView->m_pImpl->m_pOffice = pOffice;
+    LOKDocView* pDocView = LOK_DOC_VIEW(g_object_new(LOK_TYPE_DOC_VIEW, NULL));
+    pDocView->m_pImpl->m_pOffice = lok_init (pPath);
+    if (pDocView->m_pImpl->m_pOffice == NULL)
+        return NULL;
     return GTK_WIDGET( pDocView );
 }
 
commit 2a0787f1989a23b3f948e03363ad333b77d10ae0
Author: Pranav Kant <pranavk at gnome.org>
Date:   Tue Jun 9 18:08:59 2015 +0530

    lokdocview: Make this GObject class introspectable
    
    ... so that this widget can be used from other languages.
    
    Change-Id: Icd7d6df6aa587ffdb018af0b911300dc81ec6560

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5f642d9..d3d14a2 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -121,7 +121,7 @@ struct LOKDocView_Impl
     static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
     /// Receives a key press or release event.
     void signalKey(GdkEventKey* pEvent);
-    /**
+    /*
      * The user drags the handle, which is below the cursor, but wants to move the
      * cursor accordingly.
      *
@@ -144,7 +144,7 @@ struct LOKDocView_Impl
     gboolean renderOverlayImpl(GtkWidget* pEventBox);
     /// Is rRectangle empty?
     static bool isEmptyRectangle(const GdkRectangle& rRectangle);
-    /**
+    /*
      * Renders pHandle below an rCursor rectangle on pCairo.
      * @param rRectangle output parameter, the rectangle that contains the rendered handle.
      */
@@ -1175,6 +1175,12 @@ static void lok_doc_view_init (LOKDocView* pDocView)
     g_signal_connect(G_OBJECT(pDocView), "destroy", G_CALLBACK(LOKDocView_Impl::destroy), 0);
 }
 
+/**
+ * lok_doc_view_new:
+ * @pOffice: The LibreOfficeKit context.
+ *
+ * Returns: The #LOKDocView widget instance.
+ */
 SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice )
 {
     LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type()));
@@ -1182,6 +1188,13 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice )
     return GTK_WIDGET( pDocView );
 }
 
+/**
+ * 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 gboolean lok_doc_view_open_document( LOKDocView* pDocView, char* pPath )
 {
     if ( pDocView->m_pImpl->m_pDocument )
@@ -1226,11 +1239,24 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView,
     return TRUE;
 }
 
+/**
+ * lok_doc_view_get_document:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: The #LibreOfficeKitDocument instance the widget is currently showing
+ */
 SAL_DLLPUBLIC_EXPORT LibreOfficeKitDocument* lok_doc_view_get_document(LOKDocView* pDocView)
 {
     return pDocView->m_pImpl->m_pDocument;
 }
 
+/**
+ * lok_doc_view_set_zoom:
+ * @pDocView: The #LOKDocView instance
+ * @fZoom: The new zoom level that pDocView must set it into.
+ *
+ * Sets the new zoom level for the widget.
+ */
 SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZoom )
 {
     pDocView->m_pImpl->m_fZoom = fZoom;
@@ -1246,6 +1272,12 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ
                                 nDocumentHeightPixels);
 }
 
+/**
+ * lok_doc_view_get_zoom:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: The current zoom factor value in float for pDocView
+ */
 SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView )
 {
     return pDocView->m_pImpl->m_fZoom;
@@ -1277,6 +1309,13 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView,
     pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode );
 }
 
+/**
+ * lok_doc_view_set_edit:
+ * @pDocView: The #LOKDocView instance
+ * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise
+ *
+ * Sets the edit-mode for pDocView
+ */
 SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView,
                                                 gboolean bEdit )
 {
@@ -1294,6 +1333,12 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView,
     gtk_widget_queue_draw(GTK_WIDGET(pDocView));
 }
 
+/**
+ * lok_doc_view_get_edit:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Returns: %TRUE if the given pDocView is in edit mode.
+ */
 SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView)
 {
     return pDocView->m_pImpl->m_bEdit;
@@ -1310,11 +1355,29 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent
     pDocView->m_pImpl->signalKey(pEvent);
 }
 
+/**
+ * lok_doc_view_pixel_to_twip:
+ * @pDocView: The #LOKDocView instance
+ * @fInput: The value in pixels to convert to twips
+ *
+ * Converts the value in pixels to twips according to zoom level.
+ *
+ * Returns: The corresponding value in twips
+ */
 SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput)
 {
     return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom);
 }
 
+/**
+ * lok_doc_view_twip_to_pixel:
+ * @pDocView: The #LOKDocView instance
+ * @fInput: The value in twips to convert to pixels
+ *
+ * Converts the value in twips to pixels according to zoom level.
+ *
+ * Returns: The corresponding value in pixels
+ */
 SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput)
 {
     return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom);
commit a5e767e7a3d63cb4eb8235b904a85728600a170b
Author: Pranav Kant <pranavk at gnome.org>
Date:   Tue Jun 9 16:27:37 2015 +0530

    lokdocview: Change parent class to GtkDrawingArea
    
    It is not the job of the widget to provide the scroll bars.
    
    Change-Id: Iafc5724ed5b21717d711bb8f7e1a076dd1288b76

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index e84feee..24c577e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -31,21 +31,23 @@ typedef struct _LOKDocViewClass  LOKDocViewClass;
 
 struct _LOKDocView
 {
-    GtkScrolledWindow aScrollWindow;
+    GtkDrawingArea aDrawingArea;
     struct LOKDocView_Impl* m_pImpl;
 };
 
 struct _LOKDocViewClass
 {
-  GtkScrolledWindowClass parent_class;
-  void (* edit_changed)  (LOKDocView* pView, gboolean was_edit);
-  void (* command_changed) (LOKDocView* pView, char* new_state);
-  void (* search_not_found) (LOKDocView* pView, char* new_state);
-  void (* part_changed) (LOKDocView* pView, int new_part);
+    GtkDrawingAreaClass parent_class;
+    void (* edit_changed)  (LOKDocView* pView, gboolean was_edit);
+    void (* command_changed) (LOKDocView* pView, char* new_state);
+    void (* search_not_found) (LOKDocView* pView, char* new_state);
+    void (* part_changed) (LOKDocView* pView, int new_part);
 };
 
 GType                          lok_doc_view_get_type               (void) G_GNUC_CONST;
+
 GtkWidget*                     lok_doc_view_new                    (LibreOfficeKit* pOffice );
+
 gboolean                       lok_doc_view_open_document          (LOKDocView* pDocView,
                                                                     char* pPath);
 
@@ -80,9 +82,11 @@ void                           lok_doc_view_post_key               (GtkWidget* p
                                                                     GdkEventKey* pEvent,
                                                                     gpointer pData);
 
-/// Get the visible area of the document (in twips).
-void                           lok_doc_view_get_visarea            (LOKDocView* pThis,
-                                                                    GdkRectangle* pArea);
+float                          lok_doc_view_pixel_to_twip          (LOKDocView* pDocView,
+                                                                    float fInput);
+
+float                          lok_doc_view_twip_to_pixel          (LOKDocView* pDocView,
+                                                                    float fInput);
 
 G_END_DECLS
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 38b29ee..c8b47f7 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -38,6 +38,7 @@ static GtkToolItem* pBold;
 static GtkToolItem* pItalic;
 static GtkToolItem* pUnderline;
 static GtkToolItem* pStrikethrough;
+static GtkWidget* pScrolledWindow;
 std::map<GtkToolItem*, std::string> g_aToolItemCommandNames;
 std::map<std::string, GtkToolItem*> g_aCommandNameToolItems;
 bool g_bToolItemBroadcast = true;
@@ -134,6 +135,23 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
 #endif
 }
 
+/// Get the visible area of the scrolled window
+static void getVisibleAreaTwips(GdkRectangle* pArea)
+{
+    GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+    GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+
+    pArea->x      = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+                                               gtk_adjustment_get_value(pHAdjustment));
+    pArea->y      = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+                                               gtk_adjustment_get_value(pVAdjustment));
+    pArea->width  = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+                                               gtk_adjustment_get_page_size(pHAdjustment));
+    pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
+                                               gtk_adjustment_get_page_size(pVAdjustment));
+}
+
+
 /// Handles the key-press-event of the window.
 static gboolean signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer pData)
 {
@@ -161,7 +179,7 @@ static void doSearch(bool bBackwards)
 
     LOKDocView* pLOKDocView = LOK_DOC_VIEW(pDocView);
     GdkRectangle aArea;
-    lok_doc_view_get_visarea(pLOKDocView, &aArea);
+    getVisibleAreaTwips(&aArea);
     aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/type", '/'), "long");
     aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointX/value", '/'), aArea.x);
     aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchStartPointY/type", '/'), "long");
@@ -461,7 +479,12 @@ int main( int argc, char* argv[] )
     g_signal_connect(pWindow, "key-press-event", G_CALLBACK(signalKey), pDocView);
     g_signal_connect(pWindow, "key-release-event", G_CALLBACK(signalKey), pDocView);
 
-    gtk_container_add( GTK_CONTAINER(pVBox), pDocView );
+    // Scrolled window for DocView
+    pScrolledWindow = gtk_scrolled_window_new(0, 0);
+    gtk_container_add(GTK_CONTAINER(pVBox), pScrolledWindow);
+
+    // DocView doesn't have scrolling capability, so need a viewport
+    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pScrolledWindow), pDocView);
 
     gtk_widget_show_all( pWindow );
     // Hide the findbar by default.
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index ed3fc5c..5f642d9 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -41,7 +41,6 @@
 struct LOKDocView_Impl
 {
     LOKDocView* m_pDocView;
-    GtkWidget *m_pDrawingArea;
     TileBuffer m_aTileBuffer;
 
     float m_fZoom;
@@ -119,7 +118,7 @@ struct LOKDocView_Impl
     /// Connected to the destroy signal of LOKDocView, deletes its LOKDocView_Impl.
     static void destroy(LOKDocView* pDocView, gpointer pData);
     /// Connected to the expose-event of the GtkDrawingArea
-    static void on_exposed(GtkWidget *widget, GdkEvent *event, gpointer user_data);
+    static void onExposed(GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
     /// Receives a key press or release event.
     void signalKey(GdkEventKey* pEvent);
     /**
@@ -156,16 +155,8 @@ struct LOKDocView_Impl
     static gboolean handleTimeout(gpointer pData);
     /// Implementation of the timeout handler, invoked by handleTimeout().
     gboolean handleTimeoutImpl();
-    /**
-     * Renders the document to a number of visible tiles.
-     *
-     * This method is invoked only manually, not when some Gtk signal is
-     * emitted.
-     *
-     * @param pPartial if 0, then the full visible document is rendered, otherwise only
-     * the tiles that intersect with pPartial.
-     */
-    void renderDocument(GdkRectangle* pPartial);
+    /// Implementation of expose event handler, invoked by onExposed().
+    void onExposedImpl(GdkEventExpose* event);
     /// Returns the GdkRectangle of a x,y,width,height string.
     GdkRectangle payloadToRectangle(const char* pPayload);
     /// Returns the GdkRectangles of a x1,y1,w1,h1;x2,y2,w2,h2;... string.
@@ -213,7 +204,7 @@ SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type();
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-function"
 #endif
-G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE(LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA)
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
@@ -279,7 +270,6 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo
 
 LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
     : m_pDocView(pDocView),
-      m_pDrawingArea(gtk_drawing_area_new()),
       m_aTileBuffer(TileBuffer(0,0)),
       m_fZoom(1),
       m_pOffice(0),
@@ -328,10 +318,70 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
     delete pDocView->m_pImpl;
 }
 
-void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata)
+void LOKDocView_Impl::onExposed(GtkWidget* /*widget*/, GdkEventExpose* event, gpointer userdata)
 {
     LOKDocView *pDocView = LOK_DOC_VIEW (userdata);
-    pDocView->m_pImpl->renderDocument(0);
+    pDocView->m_pImpl->onExposedImpl(event);
+}
+
+void LOKDocView_Impl::onExposedImpl(GdkEventExpose* event)
+{
+    long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom);
+    long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom);
+    // Total number of rows / columns in this document.
+    guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
+    guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
+    GdkRectangle aVisibleArea = event->area;
+    cairo_t *pcairo = gdk_cairo_create(GTK_WIDGET(m_pDocView)->window);
+
+    aVisibleArea.x = pixelToTwip (aVisibleArea.x, m_fZoom);
+    aVisibleArea.y = pixelToTwip (aVisibleArea.y, m_fZoom);
+    aVisibleArea.width = pixelToTwip (aVisibleArea.width, m_fZoom);
+    aVisibleArea.height = pixelToTwip (aVisibleArea.height, m_fZoom);
+
+    // Render the tiles.
+    for (guint nRow = 0; nRow < nRows; ++nRow)
+    {
+        for (guint nColumn = 0; nColumn < nColumns; ++nColumn)
+        {
+            GdkRectangle aTileRectangleTwips, aTileRectanglePixels;
+            bool bPaint = true;
+
+            // Determine size of the tile: the rightmost/bottommost tiles may
+            // be smaller, and we need the size to decide if we need to repaint.
+            if (nColumn == nColumns - 1)
+                aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels;
+            else
+                aTileRectanglePixels.width = nTileSizePixels;
+            if (nRow == nRows - 1)
+                aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels;
+            else
+                aTileRectanglePixels.height = nTileSizePixels;
+
+            // Determine size and position of the tile in document coordinates,
+            // so we can decide if we can skip painting for partial rendering.
+            aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn;
+            aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow;
+            aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom);
+            aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom);
+
+            if (!gdk_rectangle_intersect(&aVisibleArea, &aTileRectangleTwips, 0))
+                bPaint = false;
+
+            if (bPaint)
+            {
+                Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom);
+                GdkPixbuf* pPixBuf = currentTile.getBuffer();
+
+                gdk_cairo_set_source_pixbuf (pcairo, pPixBuf,
+                                             twipToPixel(aTileRectangleTwips.x, m_fZoom),
+                                             twipToPixel(aTileRectangleTwips.y, m_fZoom));
+                cairo_paint(pcairo);
+            }
+        }
+    }
+
+    cairo_destroy(pcairo);
 }
 
 void LOKDocView_Impl::signalKey(GdkEventKey* pEvent)
@@ -798,75 +848,12 @@ gboolean LOKDocView_Impl::handleTimeoutImpl()
             m_bCursorOverlayVisible = false;
         else
             m_bCursorOverlayVisible = true;
-        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDocView));
     }
 
     return G_SOURCE_CONTINUE;
 }
 
-void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
-{
-    GdkRectangle visibleArea;
-    lok_doc_view_get_visarea (m_pDocView, &visibleArea);
-
-    long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips, m_fZoom);
-    long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips, m_fZoom);
-    // Total number of rows / columns in this document.
-    guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
-    guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
-
-    cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window);
-
-    // Render the tiles.
-    for (guint nRow = 0; nRow < nRows; ++nRow)
-    {
-        for (guint nColumn = 0; nColumn < nColumns; ++nColumn)
-        {
-            GdkRectangle aTileRectangleTwips, aTileRectanglePixels;
-            bool bPaint = true;
-
-            // Determine size of the tile: the rightmost/bottommost tiles may
-            // be smaller, and we need the size to decide if we need to repaint.
-            if (nColumn == nColumns - 1)
-                aTileRectanglePixels.width = nDocumentWidthPixels - nColumn * nTileSizePixels;
-            else
-                aTileRectanglePixels.width = nTileSizePixels;
-            if (nRow == nRows - 1)
-                aTileRectanglePixels.height = nDocumentHeightPixels - nRow * nTileSizePixels;
-            else
-                aTileRectanglePixels.height = nTileSizePixels;
-
-            // Determine size and position of the tile in document coordinates,
-            // so we can decide if we can skip painting for partial rendering.
-            aTileRectangleTwips.x = pixelToTwip(nTileSizePixels, m_fZoom) * nColumn;
-            aTileRectangleTwips.y = pixelToTwip(nTileSizePixels, m_fZoom) * nRow;
-            aTileRectangleTwips.width = pixelToTwip(aTileRectanglePixels.width, m_fZoom);
-            aTileRectangleTwips.height = pixelToTwip(aTileRectanglePixels.height, m_fZoom);
-            if (pPartial && !gdk_rectangle_intersect(pPartial, &aTileRectangleTwips, 0))
-                bPaint = false;
-
-            if (!gdk_rectangle_intersect(&visibleArea, &aTileRectangleTwips, 0))
-                bPaint = false;
-
-            if (bPaint)
-            {
-                //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn);
-
-                Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn, m_fZoom);
-                GdkPixbuf* pPixBuf = currentTile.getBuffer();
-
-                gdk_cairo_set_source_pixbuf (pcairo, pPixBuf,
-                                             twipToPixel(aTileRectangleTwips.x, m_fZoom),
-                                             twipToPixel(aTileRectangleTwips.y, m_fZoom));
-                cairo_paint(pcairo);
-            }
-        }
-    }
-
-    cairo_destroy(pcairo);
-}
-
-
 GdkRectangle LOKDocView_Impl::payloadToRectangle(const char* pPayload)
 {
     GdkRectangle aRet;
@@ -978,14 +965,14 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
         else
             m_aTileBuffer.resetAllTiles();
 
-        gtk_widget_queue_draw(m_pDrawingArea);
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDocView));
     }
     break;
     case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
     {
         m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str());
         m_bCursorOverlayVisible = true;
-        gtk_widget_queue_draw(m_pDrawingArea);
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDocView));
     }
     break;
     case LOK_CALLBACK_TEXT_SELECTION:
@@ -1025,7 +1012,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
             m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str());
         else
             memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection));
-        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDocView));
     }
     break;
     case LOK_CALLBACK_HYPERLINK_CLICKED:
@@ -1049,7 +1036,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
     case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
     {
         payloadToSize(pCallback->m_aPayload.c_str(), m_nDocumentWidthTwips, m_nDocumentHeightTwips);
-        gtk_widget_set_size_request(m_pDrawingArea,
+        gtk_widget_set_size_request(GTK_WIDGET(m_pDocView),
                                     twipToPixel(m_nDocumentWidthTwips, m_fZoom),
                                     twipToPixel(m_nDocumentHeightTwips, m_fZoom));
     }
@@ -1113,7 +1100,6 @@ void LOKDocView_Impl::searchNotFound(const std::string& rString)
 void LOKDocView_Impl::setPart(const std::string& rString)
 {
     g_signal_emit(m_pDocView, doc_view_signals[PART_CHANGED], 0, std::stoi(rString));
-    renderDocument(0);
 }
 
 static void lok_doc_view_class_init (LOKDocViewClass* pClass)
@@ -1163,34 +1149,26 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
 
 static void lok_doc_view_init (LOKDocView* pDocView)
 {
-    // Gtk ScrolledWindow is apparently not fully initialised yet, we specifically
-    // have to set the [hv]adjustment to prevent GTK assertions from firing, see
-    // https://bugzilla.gnome.org/show_bug.cgi?id=438114 for more info.
-    gtk_scrolled_window_set_hadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL );
-    gtk_scrolled_window_set_vadjustment( GTK_SCROLLED_WINDOW( pDocView ), NULL );
-
     pDocView->m_pImpl = new LOKDocView_Impl(pDocView);
-    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView),
-                                           pDocView->m_pImpl->m_pDrawingArea );
 
-    g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
+    g_signal_connect(G_OBJECT(pDocView),
                      "expose-event",
-                     G_CALLBACK(LOKDocView_Impl::on_exposed), pDocView);
-    g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
+                     G_CALLBACK(LOKDocView_Impl::onExposed), pDocView);
+    g_signal_connect(G_OBJECT(pDocView),
                      "expose-event",
                      G_CALLBACK(LOKDocView_Impl::renderOverlay), pDocView);
-    gtk_widget_add_events(pDocView->m_pImpl->m_pDrawingArea,
+    gtk_widget_add_events(GTK_WIDGET(pDocView),
                            GDK_BUTTON_PRESS_MASK
                           |GDK_BUTTON_RELEASE_MASK
                           |GDK_BUTTON_MOTION_MASK);
 
-    g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
+    g_signal_connect(G_OBJECT(pDocView),
                      "button-press-event",
                      G_CALLBACK(LOKDocView_Impl::signalButton), pDocView);
-    g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
+    g_signal_connect(G_OBJECT(pDocView),
                      "button-release-event",
                      G_CALLBACK(LOKDocView_Impl::signalButton), pDocView);
-    g_signal_connect(G_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
+    g_signal_connect(G_OBJECT(pDocView),
                      "motion-notify-event",
                      G_CALLBACK(LOKDocView_Impl::signalMotion), pDocView);
 
@@ -1240,10 +1218,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView,
 
         pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
                                                       nColumns);
-        gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
+        gtk_widget_set_size_request(GTK_WIDGET(pDocView),
                                     nDocumentWidthPixels,
                                     nDocumentHeightPixels);
-        pDocView->m_pImpl->renderDocument(0);
     }
 
     return TRUE;
@@ -1264,12 +1241,9 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ
 
     pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
                                                   nColumns);
-    gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
+    gtk_widget_set_size_request(GTK_WIDGET(pDocView),
                                 nDocumentWidthPixels,
                                 nDocumentHeightPixels);
-
-    if ( pDocView->m_pImpl->m_pDocument )
-        pDocView->m_pImpl->renderDocument(0);
 }
 
 SAL_DLLPUBLIC_EXPORT float lok_doc_view_get_zoom ( LOKDocView* pDocView )
@@ -1301,7 +1275,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_partmode( LOKDocView* pDocView,
                                                     int nPartMode )
 {
     pDocView->m_pImpl->m_pDocument->pClass->setPartMode( pDocView->m_pImpl->m_pDocument, nPartMode );
-    pDocView->m_pImpl->renderDocument(0);
 }
 
 SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView,
@@ -1318,7 +1291,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_edit( LOKDocView* pDocView,
     }
     pDocView->m_pImpl->m_bEdit = bEdit;
     g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit);
-    gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea));
+    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
 }
 
 SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_get_edit(LOKDocView* pDocView)
@@ -1337,17 +1310,15 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent
     pDocView->m_pImpl->signalKey(pEvent);
 }
 
-SAL_DLLPUBLIC_EXPORT void lok_doc_view_get_visarea(LOKDocView* pThis, GdkRectangle* pArea)
+SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput)
 {
-#if GTK_CHECK_VERSION(2,14,0) // we need gtk_adjustment_get_page_size()
-    float zoom = pThis->m_pImpl->m_fZoom;
-    GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pThis));
-    pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment),zoom);
-    pArea->width = pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment), zoom);
-    GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pThis));
-    pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom);
-    pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom);
-#endif
+    return pixelToTwip(fInput, pDocView->m_pImpl->m_fZoom);
 }
 
+SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput)
+{
+    return twipToPixel(fInput, pDocView->m_pImpl->m_fZoom);
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a6f4fde8baf3eeb36820d18ffad84192e995145f
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Jun 10 18:08:48 2015 -0400

    sw tiled rendering: Ignore window size check.
    
    In the tiled rendering case it does not need to check
    if the window size is (0,0). But it still has to trigger
    LOKit LOK_CALLBACK_INVALIDATE_TILES
    
    Change-Id: I4c458edfd6e44599b8c8148e0f8543fb0563e627

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d2c42ae..95e8b37 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6203,7 +6203,9 @@ void SwEditWin::LogicInvalidate(const Rectangle* pRectangle)
         sRectangle = "EMPTY";
     else
         sRectangle = pRectangle->toString();
-    m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
+
+    if ( m_rView.GetWrtShellPtr() )
+        m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
 }
 
 void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e89ef6d..4f7731a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3157,15 +3157,6 @@ void SwXTextDocument::initializeForTiledRendering()
     SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
     pViewShell->setTiledRendering(true);
 
-    if ( pViewShell->GetWin() )
-    {
-        // Check initial window size and set minimal size (1,1)
-        Size aSize( pViewShell->GetWin()->GetOutputSizePixel() );
-        if ( aSize.Width() == 0 || aSize.Height() == 0 )
-            pViewShell->GetWin()->SetOutputSizePixel(Size( std::max( aSize.Width() , long(1)),
-                                                           std::max( aSize.Height(), long(1)) ));
-    }
-
     bool      bBookMode = false;
     sal_Int16 nColumns = 1;
 
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 1dcf72a..ae29766 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -31,6 +31,7 @@
 #include <salgdi.hxx>
 #include <salframe.hxx>
 #include <svdata.hxx>
+#include <comphelper/lok.hxx>
 
 #define IMPL_PAINT_PAINT            ((sal_uInt16)0x0001)
 #define IMPL_PAINT_PAINTALL         ((sal_uInt16)0x0002)
@@ -1132,7 +1133,7 @@ vcl::Region Window::GetPaintRegion() const
 
 void Window::Invalidate( InvalidateFlags nFlags )
 {
-    if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+    if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )
         return;
 
     ImplInvalidate( NULL, nFlags );
@@ -1141,7 +1142,7 @@ void Window::Invalidate( InvalidateFlags nFlags )
 
 void Window::Invalidate( const Rectangle& rRect, InvalidateFlags nFlags )
 {
-    if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+    if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )
         return;
 
     OutputDevice *pOutDev = GetOutDev();
@@ -1157,7 +1158,7 @@ void Window::Invalidate( const Rectangle& rRect, InvalidateFlags nFlags )
 
 void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
 {
-    if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+    if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )
         return;
 
     if ( rRegion.IsNull() )
@@ -1180,7 +1181,7 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
 void Window::Validate( ValidateFlags nFlags )
 {
 
-    if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+    if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) )
         return;
 
     ImplValidate( NULL, nFlags );
commit 0c87f8bf42ba0338dbf6516dc9539223a5dedf4c
Author: Mox Soini <mox at iki.fi>
Date:   Tue Jun 2 23:52:56 2015 +0300

    Cleanup crossplatform cairo
    
    Mac / Win cairo is not built / used, this cairo code can be removed to
    reduce code bloat.
    
    4th Revised version with Android fixes
    
    Change-Id: I6e56850f535ca13b77839b7d67e227c5f39d388e
    Reviewed-on: https://gerrit.libreoffice.org/16218
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 35e98c7..6f53264 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -26,15 +26,6 @@
 
 #include <vcl/metric.hxx>
 #include <vcl/virdev.hxx>
-
-#ifdef WNT
-#ifdef max
-#undef max
-#endif
-#ifdef min
-#undef min
-#endif
-#endif
 #include <vcl/sysdata.hxx>
 
 #include <basegfx/matrix/b2dhommatrix.hxx>
@@ -45,21 +36,12 @@
 #include "cairo_textlayout.hxx"
 #include "cairo_spritecanvas.hxx"
 
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
-#include <cairo-quartz.h>
-#elif defined CAIRO_HAS_WIN32_SURFACE
-# include "cairo_win32_cairo.hxx"
-# include <cairo-win32.h>
-#elif defined CAIRO_HAS_FT_FONT
+#if defined CAIRO_HAS_FT_FONT
 # include <cairo-ft.h>
 #else
 # error Native API needed.
 #endif
 
-#ifdef IOS
-#include <CoreText/CoreText.h>
-#endif
-
 using namespace ::cairo;
 using namespace ::com::sun::star;
 
@@ -309,7 +291,7 @@ namespace cairocanvas
    **/
     bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
     {
-#if defined UNX && !defined MACOSX && !defined IOS
+#if defined CAIRO_HAS_FT_FONT
         // is font usable?
         if (!aSysFontData.nFontId)
             return false;
@@ -325,46 +307,6 @@ namespace cairocanvas
         return true;
     }
 
-#ifdef CAIRO_HAS_WIN32_SURFACE
-    namespace
-    {
-        /**
-         * cairo::ucs4toindex: Convert ucs4 char to glyph index
-         * @param ucs4 an ucs4 char
-         * @param hfont current font
-         *
-         * @return true if successful
-         **/
-        unsigned long ucs4toindex(unsigned int ucs4, HFONT hfont)
-        {
-            wchar_t unicode[2];
-            WORD glyph_index;
-            HDC hdc = NULL;
-
-            hdc = CreateCompatibleDC (NULL);
-
-            if (!hdc) return 0;
-            if (!SetGraphicsMode (hdc, GM_ADVANCED))
-            {
-                DeleteDC (hdc);
-                return 0;
-            }
-
-            SelectObject (hdc, hfont);
-            SetMapMode (hdc, MM_TEXT);
-
-            unicode[0] = ucs4;
-            unicode[1] = 0;
-            if (GetGlyphIndicesW (hdc, unicode, 1, &glyph_index, 0) == GDI_ERROR)
-            {
-                glyph_index = 0;
-            }
-
-            DeleteDC (hdc);
-            return glyph_index;
-        }
-    }
-#endif
 
   /**
    * TextLayout::draw
@@ -385,9 +327,6 @@ namespace cairocanvas
     {
         ::osl::MutexGuard aGuard( m_aMutex );
         SystemTextLayoutData aSysLayoutData;
-#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
-        LOGFONTW logfont;
-#endif
         setupLayoutMode( rOutDev, mnTextDirection );
 
         // TODO(P2): cache that
@@ -484,11 +423,6 @@ namespace cairocanvas
 
                 cairo_glyph_t aGlyph;
                 aGlyph.index = systemGlyph.index;
-#ifdef CAIRO_HAS_WIN32_SURFACE
-                // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars.
-                // Convert to standard indexes
-                aGlyph.index = ucs4toindex((unsigned int) aGlyph.index, rSysFontData.hFont);
-#endif
                 aGlyph.x = systemGlyph.x;
                 aGlyph.y = systemGlyph.y;
                 cairo_glyphs.push_back(aGlyph);
@@ -502,24 +436,7 @@ namespace cairocanvas
              **/
             cairo_font_face_t* font_face = NULL;
 
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
-# ifdef MACOSX
-            // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
-            //       when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
-            font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
-# else // iOS
-            font_face = cairo_quartz_font_face_create_for_cgfont( CTFontCopyGraphicsFont( rSysFontData.rCTFont, NULL ) );
-# endif
-
-#elif defined CAIRO_HAS_WIN32_SURFACE
-# if (OSL_DEBUG_LEVEL > 1)
-            GetObjectW( rSysFontData.hFont, sizeof(logfont), &logfont );
-# endif
-            // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero.
-            // VCL always has non-zero value for lfWidth
-            font_face = cairo_win32_font_face_create_for_hfont(rSysFontData.hFont);
-
-#elif defined CAIRO_HAS_FT_FONT
+#if defined CAIRO_HAS_FT_FONT
             font_face = cairo_ft_font_face_create_for_ft_face(static_cast<FT_Face>(rSysFontData.nFontId),
                                                               rSysFontData.nFontFlags);
 #else
@@ -567,11 +484,6 @@ namespace cairocanvas
 
             cairo_set_font_matrix(pSCairo.get(), &m);
 
-#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
-# define TEMP_TRACE_FONT OUString(reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName))
-#else
-# define TEMP_TRACE_FONT aFont.GetName()
-#endif
             SAL_INFO(
                 "canvas.cairo",
                 "Size:(" << aFont.GetWidth() << "," << aFont.GetHeight()
@@ -586,9 +498,8 @@ namespace cairocanvas
                     << (rSysFontData.bAntialias ? "AA " : "")
                     << (rSysFontData.bFakeBold ? "FB " : "")
                     << (rSysFontData.bFakeItalic ? "FI " : "") << " || Name:"
-                    << TEMP_TRACE_FONT << " - "
+                    << aFont.GetName() << " - "
                     << maText.Text.copy(maText.StartPosition, maText.Length));
-#undef TEMP_TRACE_FONT
 
             cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
 
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index a525f77..57217df 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -23,6 +23,8 @@
 #include <vector>
 #include <cstddef>
 
+#include <config_cairo_canvas.h>
+
 #ifdef MACOSX
 // predeclare the native classes to avoid header/include problems
 typedef struct CGContext *CGContextRef;
@@ -200,13 +202,12 @@ struct SystemGlyphData
     int                  fallbacklevel;
 };
 
+#if ENABLE_CAIRO_CANVAS
+
 struct SystemFontData
 {
     unsigned long   nSize;          // size in bytes of this structure
-#if defined( WNT )
-    HFONT           hFont;          // native font object
-#elif defined( MACOSX )
-#elif defined( UNX )
+#if defined( UNX )
     void*           nFontId;        // native font id
     int             nFontFlags;     // native font flags
 #endif
@@ -217,10 +218,7 @@ struct SystemFontData
 
     SystemFontData()
         : nSize( sizeof( SystemFontData ) )
-#if defined( WNT )
-        , hFont( 0 )
-#elif defined( MACOSX )
-#elif defined( UNX )
+#if defined( UNX )
         , nFontId( NULL )
         , nFontFlags( 0 )
 #endif
@@ -232,6 +230,8 @@ struct SystemFontData
     }
 };
 
+#endif // ENABLE_CAIRO_CANVAS
+
 typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
 
 struct SystemTextLayoutData
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7c99bed..0ce40d3 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -499,7 +499,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/osx/PictToBmpFlt \
     vcl/osx/clipboard \
     vcl/osx/service_entry \
-    vcl/quartz/cairo_quartz_cairo \
     $(vcl_quartz_code) \
     vcl/quartz/salgdiutils \
     vcl/osx/salnativewidgets \
@@ -669,7 +668,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/win/source/app/salinst \
     vcl/win/source/app/salshl \
     vcl/win/source/app/saltimer \
-    vcl/win/source/gdi/cairo_win32_cairo \
     vcl/win/source/gdi/gdiimpl \
     vcl/win/source/gdi/salbmp \
     vcl/win/source/gdi/salgdi \
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index e6df236..cdb41f8 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -40,6 +40,7 @@
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/sysdata.hxx>
+#include <config_cairo_canvas.h>
 
 #include "fontsubset.hxx"
 #include "generic/geninst.h"
@@ -1209,6 +1210,8 @@ SystemGraphicsData GenPspGraphics::GetGraphicsData() const
     return SystemGraphicsData();
 }
 
+#if ENABLE_CAIRO_CANVAS
+
 bool GenPspGraphics::SupportsCairo() const
 {
     return false;
@@ -1239,6 +1242,8 @@ SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
     return SystemFontData();
 }
 
+#endif // ENABLE_CAIRO_CANVAS
+
 bool GenPspGraphics::supportsOperation( OutDevSupportType ) const
 {
     return false;
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 0f184fd..13f93cf 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -25,6 +25,7 @@
 #include "saldatabasic.hxx"
 
 #include <vcl/sysdata.hxx>
+#include <config_cairo_canvas.h>
 #include <basegfx/range/b2drange.hxx>
 #include <basegfx/range/b2ibox.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -735,6 +736,8 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
 
 #endif
 
+#if ENABLE_CAIRO_CANVAS
+
 bool SvpSalGraphics::SupportsCairo() const
 {
     return false;
@@ -760,4 +763,6 @@ css::uno::Any SvpSalGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& /*
     return css::uno::Any();
 }
 
+#endif // ENABLE_CAIRO_CANVAS
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 1651a3a..9eb39f26 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -20,6 +20,7 @@
 #include <sal/types.h>
 #include <basegfx/range/b2ibox.hxx>
 #include "headless/svpgdi.hxx"
+#include <config_cairo_canvas.h>
 
 sal_uInt16 SvpSalGraphics::SetFont( FontSelectPattern* pIFSD, int nFallbackLevel )
 {
@@ -123,11 +124,15 @@ void SvpSalGraphics::SetTextColor( SalColor nSalColor )
     m_xTextRenderImpl->SetTextColor(nSalColor);
 }
 
+#if ENABLE_CAIRO_CANVAS
+
 SystemFontData SvpSalGraphics::GetSysFontData( int nFallbacklevel ) const
 {
     return m_xTextRenderImpl->GetSysFontData(nFallbacklevel);
 }
 
+#endif // ENABLE_CAIRO_CANVAS
+
 void SvpSalGraphics::BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask,
                                     const basegfx::B2IPoint &rDstPoint)
 {
diff --git a/vcl/headless/svptextrender.cxx b/vcl/headless/svptextrender.cxx
index af28eb3..a2acf00 100644
--- a/vcl/headless/svptextrender.cxx
+++ b/vcl/headless/svptextrender.cxx
@@ -28,6 +28,7 @@
 #include <rtl/instance.hxx>
 #include <tools/debug.hxx>
 #include <vcl/sysdata.hxx>
+#include <config_cairo_canvas.h>
 
 #include "generic/geninst.h"
 #include "generic/genpspgraphics.h"
@@ -447,6 +448,8 @@ void SvpTextRender::SetTextColor( SalColor nSalColor )
     m_aTextColor = basebmp::Color( nSalColor );
 }
 
+#if ENABLE_CAIRO_CANVAS
+
 SystemFontData SvpTextRender::GetSysFontData( int nFallbackLevel ) const
 {
     SystemFontData aSysFontData;
@@ -468,6 +471,8 @@ SystemFontData SvpTextRender::GetSysFontData( int nFallbackLevel ) const
     return aSysFontData;
 }
 
+#endif // ENABLE_CAIRO_CANVAS
+
 void SvpTextRender::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice )
 {
     // determine matching bitmap format for masks
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index 8b78faa..5173c65 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -21,6 +21,7 @@
 #define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
 
 #include <vcl/vclenum.hxx>
+#include <config_cairo_canvas.h>
 
 #include "fontmanager.hxx"
 #include "salgdi.hxx"
@@ -201,6 +202,8 @@ public:
                                            sal_uInt8 nTransparency ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
+
+#if ENABLE_CAIRO_CANVAS
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
     virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
@@ -208,6 +211,7 @@ public:
     virtual css::uno::Any   GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const SAL_OVERRIDE;
 
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
+#endif // ENABLE_CAIRO_CANVAS
 
     virtual void BeginPaint() SAL_OVERRIDE { };
     virtual void EndPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 297d28a..cd2c993 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -24,6 +24,7 @@
 #include <basebmp/color.hxx>
 #include <vcl/sysdata.hxx>
 #include <vcl/metric.hxx>
+#include <config_cairo_canvas.h>
 
 #include "salgdi.hxx"
 #include "sallayout.hxx"
@@ -199,6 +200,8 @@ public:
     virtual bool        drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
+
+#if ENABLE_CAIRO_CANVAS
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
     virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
@@ -207,6 +210,8 @@ public:
 
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
+#endif // ENABLE_CAIRO_CANVAS
+
     virtual void            BeginPaint() SAL_OVERRIDE { };
     virtual void            EndPaint() SAL_OVERRIDE { };
 };
diff --git a/vcl/inc/headless/svptextrender.hxx b/vcl/inc/headless/svptextrender.hxx
index 13d99f4..7c2ca03 100644
--- a/vcl/inc/headless/svptextrender.hxx
+++ b/vcl/inc/headless/svptextrender.hxx
@@ -23,6 +23,7 @@
 #include "textrender.hxx"
 #include <vcl/region.hxx>
 #include <deque>
+#include <config_cairo_canvas.h>
 
 class VCL_DLLPUBLIC SvpTextRender : public TextRenderImpl
 {
@@ -74,7 +75,9 @@ public:
     virtual bool                GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) SAL_OVERRIDE;
     virtual SalLayout*          GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) SAL_OVERRIDE;
     virtual void                DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
+#if ENABLE_CAIRO_CANVAS
     virtual SystemFontData      GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
+#endif // ENABLE_CAIRO_CANVAS
 };
 
 #endif // INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 12c3144..7292479 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -414,12 +414,6 @@ public:
 
     virtual SystemGraphicsData
                             GetGraphicsData() const SAL_OVERRIDE;
-    virtual bool            SupportsCairo() const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const SAL_OVERRIDE;
-    virtual css::uno::Any   GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const SAL_OVERRIDE;
-    virtual SystemFontData  GetSysFontData( int /* nFallbacklevel */ ) const SAL_OVERRIDE;
 
     virtual void            BeginPaint() SAL_OVERRIDE { };
     virtual void            EndPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 50e5e5a..8c98d08 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -36,6 +36,8 @@
 #include <map>
 #include <set>
 
+#include <config_cairo_canvas.h>
+
 class PhysicalFontCollection;
 class SalBitmap;
 class FontSelectPattern;
@@ -49,7 +51,10 @@ class OpenGLContext;
 class OutputDevice;
 class ServerFontLayout;
 struct SystemGraphicsData;
+
+#if ENABLE_CAIRO_CANVAS
 struct SystemFontData;
+#endif // ENABLE_CAIRO_CANVAS
 
 namespace basegfx {
     class B2DVector;
@@ -438,6 +443,8 @@ public:
 
     virtual SystemGraphicsData  GetGraphicsData() const = 0;
 
+#if ENABLE_CAIRO_CANVAS
+
     /// Check whether cairo will work
     virtual bool                SupportsCairo() const = 0;
     /// Create Surface from given cairo surface
@@ -450,6 +457,8 @@ public:
 
     virtual SystemFontData      GetSysFontData( int nFallbacklevel ) const = 0;
 
+#endif // ENABLE_CAIRO_CANVAS
+
 protected:
     virtual bool                setClipRegion( const vcl::Region& ) = 0;
 
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index 12c47c3..c43ddc6 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -28,6 +28,7 @@
 #include "salgdi.hxx"
 #include "salglyphid.hxx"
 #include "fontsubset.hxx"
+#include <config_cairo_canvas.h>
 
 class PspSalPrinter;
 class PspSalInfoPrinter;
@@ -81,7 +82,9 @@ public:
     virtual bool                    GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) = 0;
     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0;
     virtual void                    DrawServerFontLayout( const ServerFontLayout& ) = 0;
+#if ENABLE_CAIRO_CANVAS
     virtual SystemFontData          GetSysFontData( int nFallbackLevel ) const = 0;
+#endif // ENABLE_CAIRO_CANVAS
 };
 
 #endif
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index fdd931c..504737a 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -448,12 +448,6 @@ public:
     virtual bool            IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
-    virtual bool               SupportsCairo() const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
-    virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const SAL_OVERRIDE;
-    virtual css::uno::Any      GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const SAL_OVERRIDE;
-    virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void               BeginPaint() SAL_OVERRIDE;
     virtual void               EndPaint() SAL_OVERRIDE;
diff --git a/vcl/quartz/cairo_quartz_cairo.cxx b/vcl/quartz/cairo_quartz_cairo.cxx
deleted file mode 100644
index 0b0835c..0000000
--- a/vcl/quartz/cairo_quartz_cairo.cxx
+++ /dev/null
@@ -1,260 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <config_cairo_canvas.h>
-
-#if ENABLE_CAIRO_CANVAS
-/************************************************************************
- * Mac OS X/Quartz and iOS surface backend for LibreOffice Cairo Canvas *
- ************************************************************************/
-
-#include <osl/diagnose.h>
-#include <vcl/sysdata.hxx>
-#include <vcl/bitmap.hxx>
-#include <vcl/virdev.hxx>
-
-#include "cairo_cairo.hxx"
-
-#include <config_cairo_canvas.h>
-
-#include "cairo_quartz_cairo.hxx"
-
-namespace cairo
-{
-    /**
-     * QuartzSurface::Surface:     Create generic Canvas surface using given Cairo Surface
-     *
-     * @param pSurface Cairo Surface
-     *
-     * This constructor only stores data, it does no processing.
-     * It is used with e.g. cairo_image_surface_create_for_data()
-     * and QuartzSurface::getSimilar()
-     *
-     * Set the mpSurface to the new surface or NULL
-     **/
-    QuartzSurface::QuartzSurface( const CairoSurfaceSharedPtr& pSurface ) :
-            mpView(NULL),
-            mpSurface( pSurface )
-    {
-        // Necessary, context is lost otherwise
-        CGContextRetain( getCGContext() ); //  == NULL for non-native surfaces
-    }
-
-    /**
-     * QuartzSurface::Surface:   Create Canvas surface from Window reference.
-     * @param NSView
-     * @param x horizontal location of the new surface
-     * @param y vertical location of the new surface
-     * @param width width of the new surface
-     * @param height height of the new surface
-     *
-     * pSysData contains the platform native Window reference.
-     * pSysData is used to create a surface on the Window
-     *
-     * Set the mpSurface to the new surface or NULL
-     **/
-    QuartzSurface::QuartzSurface( NSView* pView, int x, int y, int width, int height ) :
-            mpView(pView),
-            mpSurface()
-    {
-        OSL_TRACE("Canvas::cairo::Surface(NSView*, x:%d, y:%d, w:%d, h:%d): New Surface for window", x, y, width, height);
-
-        // on Mac OS X / Quartz we are not drawing directly to the screen, but via regular CGContextRef.
-        // The actual drawing to NSView (i.e. screen) is done in QuartzSurface::flush()
-
-        // HACK: currently initial size for windowsurface is 0x0, which is not possible for us.
-        if (width == 0 || height == 0) {
-            width = [mpView bounds].size.width;
-            height = [mpView bounds].size.height;
-            OSL_TRACE("Canvas::cairo::Surface(): BUG!! size is ZERO! fixing to %d x %d...", width, height);
-        }
-
-        // create a generic surface, NSView/Window is ARGB32.
-        mpSurface.reset(
-            cairo_quartz_surface_create(CAIRO_FORMAT_ARGB32, width, height),
-            &cairo_surface_destroy);
-
-        cairo_surface_set_device_offset( mpSurface.get(), x, y );
-    }
-
-    /**
-     * QuartzSurface::Surface:   Create Canvas surface from CGContextRef.
-     * @param CGContext Native graphics context
-     * @param x horizontal location of the new surface
-     * @param y vertical location of the new surface
-     * @param width width of the new surface
-     * @param height height of the new surface
-     *
-     * Set the mpSurface to the new surface or NULL
-     **/
-    QuartzSurface::QuartzSurface( CGContextRef rContext, int x, int y, int width, int height ) :
-            mpView(NULL),
-            mpSurface()
-    {
-        OSL_TRACE("Canvas::cairo::Surface(CGContext:%p, x:%d, y:%d, w:%d, h:%d): New Surface.", rContext, x, y, width, height);
-        // create surface based on CGContext
-
-        // ensure kCGBitmapByteOrder32Host flag, otherwise Cairo breaks (we are practically always using CGBitmapContext)
-        OSL_ASSERT ((CGBitmapContextGetBitsPerPixel(rContext) != 32) ||
-                    (CGBitmapContextGetBitmapInfo(rContext) & kCGBitmapByteOrderMask) == kCGBitmapByteOrder32Host);
-
-        mpSurface.reset(cairo_quartz_surface_create_for_cg_context(rContext, width, height),
-                        &cairo_surface_destroy);
-
-        cairo_surface_set_device_offset( mpSurface.get(), x, y );
-
-        // Necessary, context is lost otherwise
-        CGContextRetain(rContext);
-    }
-
-
-    /**
-     * QuartzSurface::getCairo:  Create Cairo (drawing object) for the Canvas surface
-     *
-     * @return new Cairo or NULL
-     **/
-    CairoSharedPtr QuartzSurface::getCairo() const
-    {
-        if (mpSurface.get())
-        {
-            return CairoSharedPtr( cairo_create(mpSurface.get()),
-                                   &cairo_destroy );
-        }
-        else
-        {
-            return CairoSharedPtr();
-        }
-    }
-
-    /**
-     * QuartzSurface::getSimilar:  Create new similar Canvas surface
-     * @param aContent format of the new surface (cairo_content_t from cairo/src/cairo.h)
-     * @param width width of the new surface
-     * @param height height of the new surface
-     *
-     * Creates a new Canvas surface. This normally creates platform native surface, even though
-     * generic function is used.
-     *
-     * Cairo surface from aContent (cairo_content_t)
-     *
-     * @return new surface or NULL
-     **/
-    SurfaceSharedPtr QuartzSurface::getSimilar( Content aContent, int width, int height ) const
-    {
-        return SurfaceSharedPtr(
-            new QuartzSurface(
-                CairoSurfaceSharedPtr(
-                    cairo_surface_create_similar( mpSurface.get(), aContent, width, height ),
-                    &cairo_surface_destroy )));
-    }
-
-    /**
-     * QuartzSurface::flush:  Draw the data to screen
-     **/
-    void QuartzSurface::flush() const
-    {
-        // can only flush surfaces with NSView
-        if( !mpView )
-            return;
-
-        OSL_TRACE("Canvas::cairo::QuartzSurface::flush(): flush to NSView");
-
-        CGContextRef mrContext = getCGContext();
-
-        if (!mrContext)
-            return;
-#ifndef IOS
-        [mpView lockFocus];
-#endif
-
-#ifndef IOS
-        /**
-         * This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() )
-         */
-        CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
-#else
-        // Just guessing for now...
-        CGContextRef rViewContext = UIGraphicsGetCurrentContext();
-#endif
-        CGImageRef xImage = CGBitmapContextCreateImage(mrContext);
-        CGContextDrawImage(rViewContext,
-                           CGRectMake( 0, 0,
-                                       CGImageGetWidth(xImage),
-                                       CGImageGetHeight(xImage)),
-                           xImage);
-        CGImageRelease( xImage );
-        CGContextFlush( rViewContext );
-#ifndef IOS
-        [mpView unlockFocus];
-#endif
-    }
-
-    /**
-     * QuartzSurface::getDepth:  Get the color depth of the Canvas surface.
-     *
-     * @return color depth
-     **/
-    int QuartzSurface::getDepth() const
-    {
-        if (mpSurface.get())
-        {
-            switch (cairo_surface_get_content (mpSurface.get()))
-            {
-                case CAIRO_CONTENT_ALPHA:       return 8;  break;
-                case CAIRO_CONTENT_COLOR:       return 24; break;
-                case CAIRO_CONTENT_COLOR_ALPHA: return 32; break;
-            }
-        }
-        OSL_TRACE("Canvas::cairo::QuartzSurface::getDepth(): ERROR - depth unspecified!");
-
-        return -1;
-    }
-
-    /**
-     * QuartzSurface::getCGContext: Get the native CGContextRef of the Canvas's cairo surface
-     *
-     * @return graphics context
-     **/
-    CGContextRef QuartzSurface::getCGContext() const
-    {
-        if (mpSurface.get())
-            return cairo_quartz_surface_get_cg_context(mpSurface.get());
-        else
-            return NULL;
-    }
-
-    /**
-     * cairo::createVirtualDevice:  Create a VCL virtual device for the CGContext in the cairo Surface
-     *
-     * @return The new virtual device
-     **/
-    VclPtr<VirtualDevice> QuartzSurface::createVirtualDevice() const
-    {
-        SystemGraphicsData aSystemGraphicsData;
-        aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
-        aSystemGraphicsData.rCGContext = getCGContext();
-        return VclPtr<VirtualDevice>(
-            VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), getDepth() ));
-    }
-
-}  // namespace cairo
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/cairo_quartz_cairo.hxx b/vcl/quartz/cairo_quartz_cairo.hxx
deleted file mode 100644
index 9c31c42..0000000
--- a/vcl/quartz/cairo_quartz_cairo.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_QUARTZ_CAIRO_HXX
-#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_QUARTZ_CAIRO_HXX
-
-#include "cairo_cairo.hxx"
-
-#include "premac.h"
-#include <TargetConditionals.h>
-#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
-# include <Cocoa/Cocoa.h>
-#else
-# include <UIKit/UIKit.h>
-# define NSView UIView
-#endif
-#include <cairo-quartz.h>
-#include "postmac.h"
-
-namespace cairo {
-
-    class QuartzSurface : public Surface
-    {
-        NSView*               mpView; // if NULL - bg surface
-        CairoSurfaceSharedPtr mpSurface;
-
-    public:
-        /// takes over ownership of passed cairo_surface
-        explicit QuartzSurface( const CairoSurfaceSharedPtr& pSurface );
-
-        /// create surface on subarea of given CGContext
-        explicit QuartzSurface( CGContextRef rContext, int x, int y, int width, int height );
-
-        /// create a offscreen surface for given NSView
-        QuartzSurface( NSView* pView, int x, int y, int width, int height );
-
-        // Surface interface
-        virtual CairoSharedPtr getCairo() const;
-        virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
-        virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const;
-
-        virtual VclPtr<VirtualDevice> createVirtualDevice() const;
-
-        virtual void flush() const;
-
-        int getDepth() const;
-
-        CGContextRef getCGContext() const;
-    };
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 6a1b18a..025d873 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -750,16 +750,6 @@ void AquaSalGraphics::FreeEmbedFontData( const void* pData, long /*nDataLen*/ )
     DBG_ASSERT( (pData!=NULL), "AquaSalGraphics::FreeEmbedFontData() is not implemented\n");
 }
 
-SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
-{
-    SystemFontData aSysFontData;
-    aSysFontData.nSize = sizeof( SystemFontData );
-
-    aSysFontData.bAntialias = !mbNonAntialiasedText;
-
-    return aSysFontData;
-}
-
 bool AquaSalGraphics::IsFlipped() const
 {
 #ifdef MACOSX
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 30f8086..9b42a22 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -39,11 +39,6 @@
 #include <vcl/sysdata.hxx>
 #endif
 
-#include <config_cairo_canvas.h>
-#if ENABLE_CAIRO_CANVAS
-#include "cairo_quartz_cairo.hxx"
-#endif
-
 #if defined(IOS) && defined(DBG_UTIL)
 
 // Variables in TiledView.m
@@ -1450,119 +1445,6 @@ SystemGraphicsData AquaSalGraphics::GetGraphicsData() const
     return aRes;
 }
 
-bool AquaSalGraphics::SupportsCairo() const
-{
-#if ENABLE_CAIRO_CANVAS
-    return true;
-#else
-    return false;
-#endif
-}
-
-/**
- * cairo::createSurface:     Create generic Canvas surface using given Cairo Surface
- *
- * @param rSurface Cairo Surface
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const
-{
-#if ENABLE_CAIRO_CANVAS
-    return cairo::SurfaceSharedPtr(new cairo::QuartzSurface(rSurface));
-#else
-    (void)rSurface;
-    return cairo::SurfaceSharedPtr();
-#endif
-}
-
-/**
- * cairo::createSurface:     Create Canvas surface using given VCL Window or Virtualdevice
- *
- * @param rSurface Cairo Surface
- *
- *  For VCL Window, use platform native system environment data (struct SystemEnvData in vcl/inc/sysdata.hxx)
- *  For VCL Virtualdevice, use platform native system graphics data (struct SystemGraphicsData in vcl/inc/sysdata.hxx)
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateSurface( const OutputDevice& rRefDevice,
-                                int x, int y, int width, int height ) const
-{
-    cairo::SurfaceSharedPtr surf;
-#if ENABLE_CAIRO_CANVAS
-    if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
-    {
-        const vcl::Window &rWindow = (const vcl::Window &) rRefDevice;
-        const SystemEnvData* pSysData = GetSysData(&rWindow);
-        if (pSysData)
-            surf = cairo::SurfaceSharedPtr(new cairo::QuartzSurface(pSysData->pView, x, y, width, height));
-    }
-    else if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
-    {
-        SystemGraphicsData aSysData = ((const VirtualDevice&) rRefDevice).GetSystemGfxData();
-
-        if (aSysData.rCGContext)
-            surf = cairo::SurfaceSharedPtr(new cairo::QuartzSurface(aSysData.rCGContext, x, y, width, height));
-    }
-#else
-    (void)rRefDevice;
-    (void)x;
-    (void)y;
-    (void)width;
-    (void)height;
-#endif
-    return surf;
-}
-
-/**
- * cairo::createBitmapSurface:   Create platform native Canvas surface from BitmapSystemData
- * @param OutputDevice (not used)
- * @param rData Platform native image data (struct BitmapSystemData in vcl/inc/bitmap.hxx)
- * @param rSize width and height of the new surface
- *
- * Create a surface based on image data on rData
- *
- * @return new surface or empty surface
- **/
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateBitmapSurface( const OutputDevice&     /* rRefDevice */,
-                                      const BitmapSystemData& rData,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list