Blame SOURCES/0132-lokdocview-allow-not-calling-documentLoad.patch

135360
From c00540a0f89da14380cfb4e194206ecfb5ca0e7f Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Tue, 15 Sep 2015 14:23:53 +0200
135360
Subject: [PATCH 132/398] lokdocview: allow not calling documentLoad()
135360
135360
Change-Id: I2ff57c4be11cd3908bc951ebf572a2c02e2c4585
135360
(cherry picked from commit 4fd59356cb09e89324e8cd8ec84eef22a4c2031b)
135360
---
135360
 include/LibreOfficeKit/LibreOfficeKitGtk.h |  2 ++
135360
 libreofficekit/source/gtk/lokdocview.cxx   | 48 ++++++++++++++++++++++++++++++
135360
 2 files changed, 50 insertions(+)
135360
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
index 01009fb9eb40..f17925b4c53a 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
@@ -44,6 +44,8 @@ GtkWidget*                     lok_doc_view_new                    (const gchar*
135360
                                                                     GCancellable *cancellable,
135360
                                                                     GError **error);
135360
 
135360
+GtkWidget*                     lok_doc_view_new_from_widget        (LOKDocView* pDocView);
135360
+
135360
 void                           lok_doc_view_open_document          (LOKDocView* pDocView,
135360
                                                                     const gchar* pPath,
135360
                                                                     GCancellable* cancellable,
135360
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
135360
index 27d2e1df983a..3cce40a94217 100644
135360
--- a/libreofficekit/source/gtk/lokdocview.cxx
135360
+++ b/libreofficekit/source/gtk/lokdocview.cxx
135360
@@ -127,7 +127,9 @@ enum
135360
     PROP_0,
135360
 
135360
     PROP_LO_PATH,
135360
+    PROP_LO_POINTER,
135360
     PROP_DOC_PATH,
135360
+    PROP_DOC_POINTER,
135360
     PROP_EDITABLE,
135360
     PROP_LOAD_PROGRESS,
135360
     PROP_ZOOM,
135360
@@ -1388,9 +1390,15 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal
135360
     case PROP_LO_PATH:
135360
         priv->m_aLOPath = g_value_dup_string (value);
135360
         break;
135360
+    case PROP_LO_POINTER:
135360
+        priv->m_pOffice = static_cast<LibreOfficeKit*>(g_value_get_pointer(value));
135360
+        break;
135360
     case PROP_DOC_PATH:
135360
         priv->m_aDocPath = g_value_dup_string (value);
135360
         break;
135360
+    case PROP_DOC_POINTER:
135360
+        priv->m_pDocument = static_cast<LibreOfficeKitDocument*>(g_value_get_pointer(value));
135360
+        break;
135360
     case PROP_EDITABLE:
135360
         lok_doc_view_set_edit (pDocView, g_value_get_boolean (value));
135360
         break;
135360
@@ -1418,9 +1426,15 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
135360
     case PROP_LO_PATH:
135360
         g_value_set_string (value, priv->m_aLOPath);
135360
         break;
135360
+    case PROP_LO_POINTER:
135360
+        g_value_set_pointer(value, priv->m_pOffice);
135360
+        break;
135360
     case PROP_DOC_PATH:
135360
         g_value_set_string (value, priv->m_aDocPath);
135360
         break;
135360
+    case PROP_DOC_POINTER:
135360
+        g_value_set_pointer(value, priv->m_pDocument);
135360
+        break;
135360
     case PROP_EDITABLE:
135360
         g_value_set_boolean (value, priv->m_bEdit);
135360
         break;
135360
@@ -1531,6 +1545,20 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
135360
                                                        | G_PARAM_CONSTRUCT_ONLY)));
135360
 
135360
     /**
135360
+     * LOKDocView:lopointer:
135360
+     *
135360
+     * A LibreOfficeKit* in case lok_init() is already called
135360
+     * previously.
135360
+     */
135360
+    g_object_class_install_property (pGObjectClass,
135360
+          PROP_LO_POINTER,
135360
+          g_param_spec_pointer("lopointer",
135360
+                              "LO Pointer",
135360
+                              "A LibreOfficeKit* from lok_init()",
135360
+                              static_cast<GParamFlags>(G_PARAM_READWRITE
135360
+                                                       | G_PARAM_CONSTRUCT_ONLY)));
135360
+
135360
+    /**
135360
      * LOKDocView:docpath:
135360
      *
135360
      * The path of the document that is currently being viewed.
135360
@@ -1544,6 +1572,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
135360
                               static_cast<GParamFlags>(G_PARAM_READWRITE)));
135360
 
135360
     /**
135360
+     * LOKDocView:docpointer:
135360
+     *
135360
+     * A LibreOfficeKitDocument* in case documentLoad() is already called
135360
+     * previously.
135360
+     */
135360
+    g_object_class_install_property (pGObjectClass,
135360
+          PROP_DOC_POINTER,
135360
+          g_param_spec_pointer("docpointer",
135360
+                              "Document Pointer",
135360
+                              "A LibreOfficeKitDocument* from documentLoad()",
135360
+                              static_cast<GParamFlags>(G_PARAM_READWRITE)));
135360
+
135360
+    /**
135360
      * LOKDocView:editable:
135360
      *
135360
      * Whether the document loaded inside of #LOKDocView is editable or not.
135360
@@ -1795,6 +1836,13 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
135360
     return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL));
135360
 }
135360
 
135360
+SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView)
135360
+{
135360
+    LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pLOKDocView));
135360
+    return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
135360
+                                     "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL));
135360
+}
135360
+
135360
 /**
135360
  * lok_doc_view_open_document_finish:
135360
  * @pDocView: The #LOKDocView instance
135360
-- 
135360
2.12.0
135360