summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx21
-rw-r--r--sfx2/source/view/lokhelper.cxx2
2 files changed, 14 insertions, 9 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 271625f766bf..25f1c48eb37b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -106,6 +106,9 @@ struct _LOKDocViewPrivate
/// If we are in the middle of a drag of a graphic selection handle.
gboolean m_bInDragGraphicHandles[8];
///@}
+
+ /// View ID, returned by createView() or 0 by default.
+ int m_nViewId;
};
enum
@@ -240,6 +243,7 @@ postKeyEventInThread(gpointer data)
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
+ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument,
pLOEvent->m_nKeyEvent,
pLOEvent->m_nCharCode,
@@ -1847,18 +1851,19 @@ 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));
}
-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView)
+SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView)
{
- LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pLOKDocView));
- GtkWidget* pDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
- "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL));
+ LOKDocViewPrivate* pOldPriv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pOldLOKDocView));
+ GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
+ "lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL));
// No documentLoad(), just a createView().
- LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
- pDocument->pClass->createView(pDocument);
+ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView));
+ LOKDocViewPrivate* pNewPriv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(LOK_DOC_VIEW(pNewDocView)));
+ pNewPriv->m_nViewId = pDocument->pClass->createView(pDocument);
- postDocumentLoad(pDocView);
- return pDocView;
+ postDocumentLoad(pNewDocView);
+ return pNewDocView;
}
/**
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index f53d2b35b1bd..0beb06ddd956 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -46,7 +46,7 @@ void SfxLokHelper::setView(size_t nId)
SfxViewShell* pViewShell = rViewArr[nId];
if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame())
- pViewFrame->GetWindow().GrabFocus();
+ pViewFrame->MakeActive_Impl(false);
}
size_t SfxLokHelper::getView()