summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx9
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx22
2 files changed, 31 insertions, 0 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 5983b7f77e5b..c3ee592a5463 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -403,6 +403,15 @@ void LOKDocViewSigHandlers::window(LOKDocView* pDocView, gchar* pPayload, gpoint
gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
{
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pWidget)));
+
+ gboolean isInit = false;
+ g_object_get(G_OBJECT(window->lokdocview), "is-initialized", &isInit, nullptr);
+ if (!isInit)
+ {
+ g_info("Ignoring configure event; document not yet ready");
+ return false;
+ }
+
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET)
{
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5243e3887514..8fa945ae2db7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -82,6 +82,7 @@ struct LOKDocViewPrivateImpl
std::string m_aRenderingArguments;
gdouble m_nLoadProgress;
gboolean m_bIsLoading;
+ gboolean m_bInit; // initializeForRendering() has been called
gboolean m_bCanZoomIn;
gboolean m_bCanZoomOut;
LibreOfficeKit* m_pOffice;
@@ -194,6 +195,7 @@ struct LOKDocViewPrivateImpl
LOKDocViewPrivateImpl()
: m_nLoadProgress(0),
m_bIsLoading(false),
+ m_bInit(false),
m_bCanZoomIn(true),
m_bCanZoomOut(true),
m_pOffice(nullptr),
@@ -292,6 +294,7 @@ enum
PROP_LOAD_PROGRESS,
PROP_ZOOM,
PROP_IS_LOADING,
+ PROP_IS_INITIALIZED,
PROP_DOC_WIDTH,
PROP_DOC_HEIGHT,
PROP_CAN_ZOOM_IN,
@@ -969,6 +972,9 @@ static gboolean postDocumentLoad(gpointer pData)
gtk_widget_grab_focus(GTK_WIDGET(pLOKDocView));
lok_doc_view_set_zoom(pLOKDocView, 1.0);
+ // we are completely loaded
+ priv->m_bInit = TRUE;
+
return G_SOURCE_REMOVE;
}
@@ -2574,6 +2580,9 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
case PROP_IS_LOADING:
g_value_set_boolean (value, priv->m_bIsLoading);
break;
+ case PROP_IS_INITIALIZED:
+ g_value_set_boolean (value, priv->m_bInit);
+ break;
case PROP_DOC_WIDTH:
g_value_set_long (value, priv->m_nDocumentWidthTwips);
break;
@@ -2844,6 +2853,19 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
G_PARAM_STATIC_STRINGS));
/**
+ * LOKDocView:is-initialized:
+ *
+ * Whether the requested document has completely loaded or not.
+ */
+ properties[PROP_IS_INITIALIZED] =
+ g_param_spec_boolean("is-initialized",
+ "Has initialized",
+ "Whether the view has completely initialized",
+ FALSE,
+ static_cast<GParamFlags>(G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
* LOKDocView:doc-width:
*
* The width of the currently loaded document in #LOKDocView in twips.