[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-02-22 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit bcaee2b0149651173cc93763231c47ff2f5a55c2
Author: Pranav Kant 
Date:   Sun Feb 14 20:44:00 2016 +0530

lokdocview: Center the widget vertically inside the allocation

Change-Id: I891519d54212ecd99273a54aca2a44e2d54c1933
Reviewed-on: https://gerrit.libreoffice.org/22517
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 655d73a..11589dd 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2508,6 +2508,7 @@ lok_doc_view_new (const gchar* pPath, GCancellable 
*cancellable, GError **error)
 return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error,
"lopath", pPath == nullptr ? LOK_PATH : 
pPath,
"halign", GTK_ALIGN_CENTER,
+   "valign", GTK_ALIGN_CENTER,
nullptr));
 }
 
@@ -2519,6 +2520,7 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* 
lok_doc_view_new_from_widget(LOKDocView* pOldLOK
"lopointer", 
pOldPriv->m_pOffice,
"docpointer", 
pOldPriv->m_pDocument,
"halign", 
GTK_ALIGN_CENTER,
+   "valign", 
GTK_ALIGN_CENTER,
nullptr));
 
 // No documentLoad(), just a createView().
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-21 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 3763ab42fa88d9f2a2248eba1854f3d97fcfbde8
Author: Pranav Kant 
Date:   Wed Jan 20 14:49:29 2016 +0530

lokdocview: Center the widget inside the allocation

Change-Id: I8d7f8ffb1c5ddd07ccf7d56bdf0ccc866c927401
Reviewed-on: https://gerrit.libreoffice.org/21624
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 
(cherry picked from commit 070bfedb7c0bc01ada0c0b95622543472ccb4a1c)
Reviewed-on: https://gerrit.libreoffice.org/21638
Reviewed-by: Miklos Vajna 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 2ece638..4dff498 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2406,14 +2406,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* 
pClass)
 SAL_DLLPUBLIC_EXPORT GtkWidget*
 lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError 
**error)
 {
-return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, 
"lopath", pPath == NULL ? LOK_PATH : pPath, NULL));
+return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error,
+   "lopath", pPath == nullptr ? LOK_PATH : 
pPath,
+   "halign", GTK_ALIGN_CENTER,
+   nullptr));
 }
 
 SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* 
pOldLOKDocView)
 {
 LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView);
 GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, 
/*cancellable=*/nullptr, /*error=*/nullptr,
-   "lopath", 
pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", 
pOldPriv->m_pDocument, NULL));
+   "lopath", 
pOldPriv->m_aLOPath,
+   "lopointer", 
pOldPriv->m_pOffice,
+   "docpointer", 
pOldPriv->m_pDocument,
+   "halign", 
GTK_ALIGN_CENTER,
+   nullptr));
 
 // No documentLoad(), just a createView().
 LibreOfficeKitDocument* pDocument = 
lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-12 Thread Debarshi Ray
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f6cb113a9a6a55de34bf2fab6da757275ead6ea
Author: Debarshi Ray 
Date:   Fri Jan 8 18:06:18 2016 +0100

lokdocview: Fix WARNING when creating an error

A GError needs a valid GQuark as the domain. Passing 0 leads to:
  GLib-WARNING **: (gerror.c:408):g_error_new_valist: runtime check
failed: (domain != 0)

Change-Id: I2f252eaa83a1519b5d16c7ba22c8f593732807ca
Reviewed-on: https://gerrit.libreoffice.org/21261
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 
Reviewed-by: jan iversen 
(cherry picked from commit 3ba1b60c97b342c13593d37ccf2b97a919808dfc)
Reviewed-on: https://gerrit.libreoffice.org/21384
Reviewed-by: David Tardon 
Tested-by: David Tardon 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index fc58dd4..21232df 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1681,7 +1681,7 @@ openDocumentInThread (gpointer data)
 if ( !priv->m_pDocument )
 {
 char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
-g_task_return_new_error(task, 0, 0, "%s", pError);
+g_task_return_new_error(task, g_quark_from_static_string ("LOK 
error"), 0, "%s", pError);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-11 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 0056a61e17e0d8faf314431c701c00c3b6c8d5f9
Author: Pranav Kant 
Date:   Fri Dec 18 22:42:53 2015 +0530

tdf#96421: Return if no window is realized

Change-Id: I13de7e6eae4e73932e8441ba2e2ad3e4ff888f41
Reviewed-on: https://gerrit.libreoffice.org/20799
Tested-by: Jenkins 
Reviewed-by: David Tardon 
(cherry picked from commit 4200a678fb54f0fa5d2f0c26c655252f9267a527)
Reviewed-on: https://gerrit.libreoffice.org/21346
Reviewed-by: Michael Stahl 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 58747a5..fc58dd4 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -345,6 +345,8 @@ doSearch(LOKDocView* pDocView, const char* pText, bool 
bBackwards, bool highligh
 boost::property_tree::ptree aTree;
 GtkWidget* drawingWidget = GTK_WIDGET(pDocView);
 GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget);
+if (!drawingWindow)
+return;
 std::shared_ptr cairoVisRegion( 
gdk_window_get_visible_region(drawingWindow),
 cairo_region_destroy);
 cairo_rectangle_int_t cairoVisRect;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-11 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 1673606de9a520e615e1a32da94f28d55ebaea20
Author: Pranav Kant 
Date:   Sun Jan 10 22:50:46 2016 +0530

lokdocview: Use shared_ptr to fix a possible memory leak

Possible because boost::property_tree can throw an exception.

Change-Id: I68394ce3b30d448d40d8e22555bafdff1ffa6092
Reviewed-on: https://gerrit.libreoffice.org/21309
Reviewed-by: David Tardon 
Tested-by: David Tardon 
(cherry picked from commit 02b49890d51ec463d32846f1108344159664a9eb)
Reviewed-on: https://gerrit.libreoffice.org/21345
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index d091bb9..58747a5 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -344,13 +345,12 @@ doSearch(LOKDocView* pDocView, const char* pText, bool 
bBackwards, bool highligh
 boost::property_tree::ptree aTree;
 GtkWidget* drawingWidget = GTK_WIDGET(pDocView);
 GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget);
-cairo_region_t* cairoVisRegion = 
gdk_window_get_visible_region(drawingWindow);
+std::shared_ptr cairoVisRegion( 
gdk_window_get_visible_region(drawingWindow),
+cairo_region_destroy);
 cairo_rectangle_int_t cairoVisRect;
-int x, y;
-
-cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect);
-x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
-y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
+cairo_region_get_rectangle(cairoVisRegion.get(), 0, &cairoVisRect);
+int x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
+int y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
 
 
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/type",
 '/'), "string");
 
aTree.put(boost::property_tree::ptree::path_type("SearchItem.SearchString/value",
 '/'), pText);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-11 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0478825ba51d390486bfbecb410bf9aaa3a3ff59
Author: Pranav Kant 
Date:   Tue Dec 15 00:23:46 2015 +0530

lokdocview: Superfluous *_set_zoom() call on widget initialization

G_PARAM_CONSTRUCT implies that parameter will be set upon widget
initialization which means calling lok_doc_view_set_zoom() while
document still points to null.

Change-Id: Ib576ac3b32c2349be2b2df6067ae79a056a03028
Reviewed-on: https://gerrit.libreoffice.org/20775
Reviewed-by: David Tardon 
Tested-by: David Tardon 
(cherry picked from commit a2682e4b081a9a8c6814db768e4ee9e5390907ae)
Reviewed-on: https://gerrit.libreoffice.org/21264
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index e6356d8..16e13e1 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -760,6 +760,7 @@ static gboolean postDocumentLoad(gpointer pData)
 nDocumentHeightPixels);
 gtk_widget_set_can_focus(GTK_WIDGET(pLOKDocView), TRUE);
 gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView));
+lok_doc_view_set_zoom(pLOKDocView, 1.0);
 
 return G_SOURCE_REMOVE;
 }
@@ -2143,7 +2144,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* 
pClass)
  "The current zoom level of the content",
  0, 5.0, 1.0,
  static_cast(G_PARAM_READWRITE |
-  G_PARAM_CONSTRUCT |
   
G_PARAM_STATIC_STRINGS)));
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-11 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2bb2c450a741a539be69494b5308428d07c56adf
Author: Pranav Kant 
Date:   Sun Dec 13 10:48:45 2015 +0530

lokdocview: Remove an easy FIXME

Change-Id: I8305f3eb45330f457089ca0524a0df004410f59c
Reviewed-on: https://gerrit.libreoffice.org/20774
Reviewed-by: David Tardon 
Tested-by: David Tardon 
(cherry picked from commit 244aad533b0fd714136f4f62b5a07fc136c740f0)
Reviewed-on: https://gerrit.libreoffice.org/21263
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 3d01a62..e6356d8 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2430,8 +2430,7 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, 
GAsyncResult* res, GErr
 GTask* task = G_TASK(res);
 
 g_return_val_if_fail(g_task_is_valid(res, pDocView), false);
-//FIXME: make source_tag work
-//g_return_val_if_fail(g_task_get_source_tag(task) == 
lok_doc_view_open_document, NULL);
+g_return_val_if_fail(g_task_get_source_tag(task) == 
lok_doc_view_open_document, false);
 g_return_val_if_fail(error == nullptr || *error == nullptr, false);
 
 return g_task_propagate_boolean(task, error);
@@ -2456,6 +2455,7 @@ lok_doc_view_open_document (LOKDocView* pDocView,
 if (pRenderingArguments)
 priv->m_aRenderingArguments = pRenderingArguments;
 g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
+g_task_set_source_tag(task, 
reinterpret_cast(lok_doc_view_open_document));
 
 g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
 if (error != nullptr)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2015-12-17 Thread Miklos Vajna
 libreofficekit/source/gtk/lokdocview.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e390b5f4f1267071245e452baa8dd63cdb556f1d
Author: Miklos Vajna 
Date:   Wed Dec 16 20:04:01 2015 +0100

tdf#96250 LOK: guard against 0 pRenderingArguments

(cherry picked from commit 032e34d0014d2154feaf97105d2dbe69b290b8c5)

Change-Id: Ifa3995ce92c31c891ffc1b9b1a297b00
Reviewed-on: https://gerrit.libreoffice.org/20743
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 139b5be..3d01a62 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2453,7 +2453,8 @@ lok_doc_view_open_document (LOKDocView* pDocView,
 pLOEvent->m_pPath = pPath;
 
 priv->m_aDocPath = pPath;
-priv->m_aRenderingArguments = pRenderingArguments;
+if (pRenderingArguments)
+priv->m_aRenderingArguments = pRenderingArguments;
 g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
 
 g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2015-12-11 Thread Pranav Kant
 libreofficekit/source/gtk/lokdocview.cxx |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 3f13961c45ea9a6f90c0bc268a2274634d9b8033
Author: Pranav Kant 
Date:   Thu Dec 10 21:10:16 2015 +0530

tdf#96384: Add a new signal 'text-selection' to lokdocview

To help client know when the user has selected a non-null text.

Change-Id: Ie939612fc5f38e2e50e9ad9792e04e89ae918886
Reviewed-on: https://gerrit.libreoffice.org/20621
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit ea5c99428f56e1d3a3e782505aa2f56f905038a4)
Signed-off-by: David Tardon 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index d7a72cd..139b5be 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -186,6 +186,7 @@ enum
 SEARCH_RESULT_COUNT,
 COMMAND_RESULT,
 FORMULA_CHANGED,
+TEXT_SELECTION,
 
 LAST_SIGNAL
 };
@@ -925,8 +926,9 @@ callback (gpointer pData)
 case LOK_CALLBACK_TEXT_SELECTION:
 {
 priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, 
pCallback->m_aPayload.c_str());
+gboolean bIsTextSelected = !priv->m_aTextSelectionRectangles.empty();
 // In case the selection is empty, then we get no 
LOK_CALLBACK_TEXT_SELECTION_START/END events.
-if (priv->m_aTextSelectionRectangles.empty())
+if (!bIsTextSelected)
 {
 memset(&priv->m_aTextSelectionStart, 0, 
sizeof(priv->m_aTextSelectionStart));
 memset(&priv->m_aHandleStartRect, 0, 
sizeof(priv->m_aHandleStartRect));
@@ -935,6 +937,8 @@ callback (gpointer pData)
 }
 else
 memset(&priv->m_aHandleMiddleRect, 0, 
sizeof(priv->m_aHandleMiddleRect));
+
+g_signal_emit(pDocView, doc_view_signals[TEXT_SELECTION], 0, 
bIsTextSelected);
 gtk_widget_queue_draw(GTK_WIDGET(pDocView));
 }
 break;
@@ -2382,6 +2386,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* 
pClass)
  g_cclosure_marshal_VOID__STRING,
  G_TYPE_NONE, 1,
  G_TYPE_STRING);
+
+/**
+ * LOKDocView::text-selection:
+ * @pDocView: the #LOKDocView on which the signal is emitted
+ * @bIsTextSelected: whether text selected is non-null
+ */
+doc_view_signals[TEXT_SELECTION] =
+g_signal_new("text-selection",
+ G_TYPE_FROM_CLASS(pGObjectClass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ nullptr, nullptr,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1,
+ G_TYPE_BOOLEAN);
 }
 
 SAL_DLLPUBLIC_EXPORT GtkWidget*
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits