[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - 6 commits - include/LibreOfficeKit include/sfx2 include/vcl libreofficekit/qa libreofficekit/source sfx2/source sw/inc sw/source vcl/source
Pranav Kant
pranavk at collabora.co.uk
Tue Aug 15 13:14:24 UTC 2017
include/LibreOfficeKit/LibreOfficeKitEnums.h | 2
include/sfx2/lokhelper.hxx | 4
include/vcl/IDialogRenderable.hxx | 2
include/vcl/floatwin.hxx | 1
libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx | 2
libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx | 20 +-
libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx | 87 +++++-----
libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx | 2
libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx | 12 +
libreofficekit/source/gtk/lokdocview.cxx | 14 -
sfx2/source/view/lokhelper.cxx | 8
sw/inc/unotxdoc.hxx | 2
sw/source/ui/index/swuiidxmrk.cxx | 4
sw/source/uibase/uno/unotxdoc.cxx | 4
vcl/source/control/ctrl.cxx | 16 +
vcl/source/window/dialog.cxx | 13 +
vcl/source/window/floatwin.cxx | 12 +
17 files changed, 137 insertions(+), 68 deletions(-)
New commits:
commit d466cf526a2b5b2e48ec71a07cee5fbde100502c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 15 18:32:40 2017 +0530
lokdialog: Forward mouse button up/down events on border window
This now makes selection of items from list box possible.
Change-Id: I71d068aeb5a3933ef3cbec05eeccf39a87fc829a
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 5678121de7d2..161229f6b55c 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -909,7 +909,7 @@ void Dialog::LogicMouseButtonDownChild(const MouseEvent& rMouseEvent)
FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
{
- ImplWindowFrameProc(pFirstFloat, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonDown, &rMouseEvent);
}
}
@@ -921,7 +921,7 @@ void Dialog::LogicMouseButtonUpChild(const MouseEvent& rMouseEvent)
FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
{
- ImplWindowFrameProc(pFirstFloat, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseButtonUp, &rMouseEvent);
}
}
@@ -933,7 +933,7 @@ void Dialog::LogicMouseMoveChild(const MouseEvent& rMouseEvent)
FloatingWindow* pFirstFloat = pSVData->maWinData.mpFirstFloat;
if (pFirstFloat && pFirstFloat->GetParentDialog() == this)
{
- ImplWindowFrameProc(pFirstFloat, SalEvent::ExternalMouseMove, &rMouseEvent);
+ ImplWindowFrameProc(pFirstFloat->ImplGetBorderWindow(), SalEvent::ExternalMouseMove, &rMouseEvent);
}
}
commit a603125279560b398ecca2a4c73def5f2df9294b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 11 13:10:29 2017 +0100
Resolves: tdf#111571 crash on restarting writer with modeless biblio dialog
Change-Id: I2663f84c28721f61c1ed7c8d92a228cafa8f1177
Reviewed-on: https://gerrit.libreoffice.org/41036
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 13bef9bbd156..9f1c2e62f777 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1666,8 +1666,8 @@ SwAuthMarkFloatDlg::SwAuthMarkFloatDlg(SfxBindings* _pBindings,
{
Initialize(pInfo);
SwWrtShell* pWrtShell = ::GetActiveWrtShell();
- OSL_ENSURE(pWrtShell, "No shell?");
- m_aContent.ReInitDlg(*pWrtShell);
+ if (pWrtShell)
+ m_aContent.ReInitDlg(*pWrtShell);
}
void SwAuthMarkFloatDlg::Activate()
commit 5b687ef7c990b44fa8e22670e479612cc3ba09bf
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 15 14:23:26 2017 +0530
lokdialog: button press type debug info
Change-Id: I193e0ab82e998905b670f7de73daae784de3ef00
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 76be36f9f948..ec734a011a88 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -113,7 +113,14 @@ gtv_lok_dialog_signal_button(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(pDialog)));
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
- g_info("lok_dialog_signal_button: %d, %d (in twips: %d, %d)",
+ std::string aEventType = "unknown";
+ if (pEvent->type == GDK_BUTTON_PRESS)
+ aEventType = "BUTTON_PRESS";
+ else if (pEvent->type == GDK_BUTTON_RELEASE)
+ aEventType = "BUTTON_RELEASE";
+
+ g_info("lok_dialog_signal_button (type: %s): %d, %d (in twips: %d, %d)",
+ aEventType.c_str(),
(int)pEvent->x, (int)pEvent->y,
(int)pixelToTwip(pEvent->x),
(int)pixelToTwip(pEvent->y));
@@ -197,7 +204,7 @@ gtv_lok_dialog_signal_motion(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(pDialog)));
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
- g_info("lok_dialog_signal_button: %d, %d (in twips: %d, %d)",
+ g_info("lok_dialog_signal_motion: %d, %d (in twips: %d, %d)",
(int)pEvent->x, (int)pEvent->y,
(int)pixelToTwip(pEvent->x),
(int)pixelToTwip(pEvent->y));
@@ -478,7 +485,14 @@ gtv_lok_dialog_floating_win_signal_button(GtkWidget* pDialogChildDrawingArea, Gd
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(pDialog)));
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
- g_info("lok_dialog_floating_win_signal_button: %d, %d (in twips: %d, %d)",
+ std::string aEventType = "unknown";
+ if (pEvent->type == GDK_BUTTON_PRESS)
+ aEventType = "BUTTON_PRESS";
+ else if (pEvent->type == GDK_BUTTON_RELEASE)
+ aEventType = "BUTTON_RELEASE";
+
+ g_info("lok_dialog_floating_win_signal_button (type: %s): %d, %d (in twips: %d, %d)",
+ aEventType.c_str(),
(int)pEvent->x, (int)pEvent->y,
(int)pixelToTwip(pEvent->x),
(int)pixelToTwip(pEvent->y));
commit 4ee350b2c3bb1367c71663ba85e62c10d2aedc62
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 15 14:04:46 2017 +0530
lokdialog: Proper floating window invalidation on mouse move
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index fc7df3ada424..f0faa3c3e260 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -129,6 +129,7 @@ public:
SAL_DLLPRIVATE tools::Rectangle& ImplGetItemEdgeClipRect();
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
virtual void doDeferredInit(WinBits nBits) override;
+ virtual void LogicInvalidate(const tools::Rectangle* pRectangle) override;
public:
explicit FloatingWindow(vcl::Window* pParent, WinBits nStyle);
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 3bd877ea7162..38509814f5b0 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -23,6 +23,7 @@
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
#include <vcl/ctrl.hxx>
+#include <vcl/floatwin.hxx>
#include <vcl/decoview.hxx>
#include <vcl/dialog.hxx>
#include <vcl/salnativewidgets.hxx>
@@ -420,7 +421,20 @@ void Control::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
// ignore all of those
if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
{
- // For now just invalidate the whole dialog
+ // If parent is a floating window, trigger an invalidate there
+ vcl::Window* pWindow = this;
+ while (pWindow)
+ {
+ if (pWindow->ImplIsFloatingWindow())
+ {
+ dynamic_cast<FloatingWindow*>(pWindow)->LogicInvalidate(nullptr);
+ return;
+ }
+
+ pWindow = pWindow->GetParent();
+ }
+
+ // otherwise, for now, just invalidate the whole dialog
Dialog* pParentDlg = GetParentDialog();
if (pParentDlg)
pParentDlg->LogicInvalidate(nullptr);
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 44ce96c42843..2d117ca6e7e1 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -585,6 +585,17 @@ bool FloatingWindow::EventNotify( NotifyEvent& rNEvt )
return bRet;
}
+void FloatingWindow::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+{
+ Dialog* pParentDlg = GetParentDialog();
+ SAL_DEBUG("FloatingWindow::LogicInvalidate");
+ if (pParentDlg)
+ {
+ SAL_DEBUG("emitiign FloatingWindow::LogicInvalidate");
+ pParentDlg->InvalidateFloatingWindow(mpImplData->maPos);
+ }
+}
+
void FloatingWindow::StateChanged( StateChangedType nType )
{
if (nType == StateChangedType::InitShow)
@@ -593,7 +604,6 @@ void FloatingWindow::StateChanged( StateChangedType nType )
}
SystemWindow::StateChanged( nType );
-
if (nType == StateChangedType::InitShow && IsVisible())
{
Dialog* pParentDlg = GetParentDialog();
commit 7335403570831f210d16cdcb0a97eb8ef21753ce
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Aug 10 17:24:40 2017 +0530
lokdialog: Emit dialog close callback upon dialog close
Change-Id: I4ccef76cc3b2926dd8916f825671bb732e101027
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index cea063ecd728..11e0ac7a8bc9 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -291,8 +291,8 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, gchar* pPayload, gpoint
std::string aDialogId = aRoot.get<std::string>("dialogId");
std::string aAction = aRoot.get<std::string>("action");
- // we only understand 'invalidate' as of now
- if (aAction != "invalidate")
+ // we only understand 'invalidate' and 'close' as of now
+ if (aAction != "invalidate" && aAction != "close")
return;
// temporary hack to invalidate all open dialogs
@@ -300,43 +300,48 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, gchar* pPayload, gpoint
GList* pIt = nullptr;
for (pIt = pChildWins; pIt != nullptr; pIt = pIt->next)
{
- gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pIt->data));
+ if (aAction == "close")
+ {
+ gtk_widget_destroy(GTK_WIDGET(pIt->data));
+ }
+ else if (aAction == "invalidate")
+ gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pIt->data));
}
}
void LOKDocViewSigHandlers::dialogChild(LOKDocView* pDocView, gchar* pPayload, gpointer)
{
- GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
-
- std::stringstream aStream(pPayload);
- boost::property_tree::ptree aRoot;
- boost::property_tree::read_json(aStream, aRoot);
- std::string aDialogId = aRoot.get<std::string>("dialogId");
- std::string aAction = aRoot.get<std::string>("action");
- std::string aPos = aRoot.get<std::string>("position");
- gchar** ppCoordinates = g_strsplit(aPos.c_str(), ", ", 2);
- gchar** ppCoordinate = ppCoordinates;
- int nX = 0;
- int nY = 0;
-
- if (*ppCoordinate)
- nX = atoi(*ppCoordinate);
- ++ppCoordinate;
- if (*ppCoordinate)
- nY = atoi(*ppCoordinate);
-
- g_strfreev(ppCoordinates);
-
- // temporary hack to invalidate/close floating window of all opened dialogs
- GList* pChildWins = gtv_application_window_get_all_child_windows(window);
- GList* pIt = nullptr;
- for (pIt = pChildWins; pIt != nullptr; pIt = pIt->next)
- {
- if (aAction == "invalidate")
- gtv_lok_dialog_child_invalidate(GTV_LOK_DIALOG(pIt->data), nX, nY);
- else if (aAction == "close")
- gtv_lok_dialog_child_close(GTV_LOK_DIALOG(pIt->data));
- }
+ GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
+
+ std::stringstream aStream(pPayload);
+ boost::property_tree::ptree aRoot;
+ boost::property_tree::read_json(aStream, aRoot);
+ std::string aDialogId = aRoot.get<std::string>("dialogId");
+ std::string aAction = aRoot.get<std::string>("action");
+ std::string aPos = aRoot.get<std::string>("position");
+ gchar** ppCoordinates = g_strsplit(aPos.c_str(), ", ", 2);
+ gchar** ppCoordinate = ppCoordinates;
+ int nX = 0;
+ int nY = 0;
+
+ if (*ppCoordinate)
+ nX = atoi(*ppCoordinate);
+ ++ppCoordinate;
+ if (*ppCoordinate)
+ nY = atoi(*ppCoordinate);
+
+ g_strfreev(ppCoordinates);
+
+ // temporary hack to invalidate/close floating window of all opened dialogs
+ GList* pChildWins = gtv_application_window_get_all_child_windows(window);
+ GList* pIt = nullptr;
+ for (pIt = pChildWins; pIt != nullptr; pIt = pIt->next)
+ {
+ if (aAction == "invalidate")
+ gtv_lok_dialog_child_invalidate(GTV_LOK_DIALOG(pIt->data), nX, nY);
+ else if (aAction == "close")
+ gtv_lok_dialog_child_close(GTV_LOK_DIALOG(pIt->data));
+ }
}
gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfigure* /*pEvent*/, gpointer /*pData*/)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 7c86b283d497..9a92d126b011 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -285,6 +285,16 @@ void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
static gboolean deleteLokDialog(GtkWidget* pWidget, GdkEvent* /*event*/, gpointer userdata)
{
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(userdata);
+ g_info("deletLokDialog");
+ gtv_application_window_unregister_child_window(window, GTK_WINDOW(pWidget));
+
+ return FALSE;
+}
+
+static gboolean destroyLokDialog(GtkWidget* pWidget, gpointer userdata)
+{
+ GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(userdata);
+ g_info("destroyLokDialog");
gtv_application_window_unregister_child_window(window, GTK_WINDOW(pWidget));
return FALSE;
@@ -296,9 +306,11 @@ void openLokDialog( GtkWidget* pSelector, gpointer /*pItem*/ )
gchar* pDialogId = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(pSelector));
GtkWidget* pDialog = gtv_lok_dialog_new(LOK_DOC_VIEW(window->lokdocview), pDialogId);
gtv_application_window_register_child_window(window, GTK_WINDOW(pDialog));
+ g_signal_connect(pDialog, "destroy", G_CALLBACK(destroyLokDialog), window);
g_signal_connect(pDialog, "delete-event", G_CALLBACK(deleteLokDialog), window);
g_free(pDialogId);
+ g_info("openLokDialog");
gtk_window_set_resizable(GTK_WINDOW(pDialog), false);
gtk_widget_show_all(GTK_WIDGET(pDialog));
gtk_window_present(GTK_WINDOW(pDialog));
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 221d4949a378..5678121de7d2 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -580,6 +580,11 @@ void Dialog::dispose()
UITestLogger::getInstance().log("DialogClosed");
SystemWindow::dispose();
+
+ if (comphelper::LibreOfficeKit::isActive() && mpDialogRenderable)
+ {
+ mpDialogRenderable->notifyDialog(maID, "close");
+ }
}
IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl, void*, void)
commit 917ecb16eb84b08411359689d8f14ab57a9dfd3d
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Aug 10 16:44:06 2017 +0530
Change CB_DIALOG_INVALIDATE to CB_DIALOG
We can specify whether it is an invalidation or something else in the
payload.
Change-Id: I95c5fc0a0a88b5277eaa93c8d1f9b937bddce7b3
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 4744eb6a4084..b32dd9ebe963 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -508,7 +508,7 @@ typedef enum
/**
* Dialog invalidation
*/
- LOK_CALLBACK_DIALOG_INVALIDATE = 35,
+ LOK_CALLBACK_DIALOG = 35,
/**
* Invalidation corresponding to dialog's children.
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index b57f30a0ccba..432628c89132 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -40,8 +40,8 @@ public:
static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload);
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload);
- /// Emits a LOK_CALLBACK_DIALOG_INVALIDATE
- static void notifyDialogInvalidation(const OUString& rPayload);
+ /// Emits a LOK_CALLBACK_DIALOG
+ static void notifyDialog(const OUString& rPayload, const OUString& rAction);
/// Emits a LOK_CALLBACK_DIALOG_CHILD
static void notifyDialogChild(const OUString& rDialogID, const OUString& rAction, const Point& rPos);
/// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed.
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index 561f910987c6..02e959ea6fad 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -46,7 +46,7 @@ public:
int nCount, int nButtons, int nModifier) = 0;
// Callbacks
- virtual void notifyDialogInvalidation(const DialogID& rDialogID) = 0;
+ virtual void notifyDialog(const DialogID& rDialogID, const OUString& rAction) = 0;
virtual void notifyDialogChild(const DialogID& rDialogID, const OUString& rAction, const Point& rPos) = 0;
};
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 8a5ff9a56d37..85c5b38466af 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -314,7 +314,7 @@ static void setupDocView(GtvApplicationWindow* window)
g_signal_connect(window->lokdocview, "formula-changed", G_CALLBACK(LOKDocViewSigHandlers::formulaChanged), nullptr);
g_signal_connect(window->lokdocview, "password-required", G_CALLBACK(LOKDocViewSigHandlers::passwordRequired), nullptr);
g_signal_connect(window->lokdocview, "comment", G_CALLBACK(LOKDocViewSigHandlers::comment), nullptr);
- g_signal_connect(window->lokdocview, "dialog-invalidate", G_CALLBACK(LOKDocViewSigHandlers::dialogInvalidate), nullptr);
+ g_signal_connect(window->lokdocview, "dialog", G_CALLBACK(LOKDocViewSigHandlers::dialog), nullptr);
g_signal_connect(window->lokdocview, "dialog-child", G_CALLBACK(LOKDocViewSigHandlers::dialogChild), nullptr);
g_signal_connect(window->lokdocview, "configure-event", G_CALLBACK(LOKDocViewSigHandlers::configureEvent), nullptr);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 1dc1d3a38e23..cea063ecd728 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -281,10 +281,19 @@ void LOKDocViewSigHandlers::comment(LOKDocView* pDocView, gchar* pComment, gpoin
}
}
-void LOKDocViewSigHandlers::dialogInvalidate(LOKDocView* pDocView, gchar* pPayload, gpointer)
+void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, gchar* pPayload, gpointer)
{
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
-// GtkWindow* pDialog = gtv_application_window_get_child_window_by_id(window, pDialogId);
+
+ std::stringstream aStream(pPayload);
+ boost::property_tree::ptree aRoot;
+ boost::property_tree::read_json(aStream, aRoot);
+ std::string aDialogId = aRoot.get<std::string>("dialogId");
+ std::string aAction = aRoot.get<std::string>("action");
+
+ // we only understand 'invalidate' as of now
+ if (aAction != "invalidate")
+ return;
// temporary hack to invalidate all open dialogs
GList* pChildWins = gtv_application_window_get_all_child_windows(window);
@@ -293,11 +302,6 @@ void LOKDocViewSigHandlers::dialogInvalidate(LOKDocView* pDocView, gchar* pPaylo
{
gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pIt->data));
}
-/* if (pDialog)
- {
- gtv_lok_dialog_invalidate(GTV_LOK_DIALOG(pDialog));
- }
-*/
}
void LOKDocViewSigHandlers::dialogChild(LOKDocView* pDocView, gchar* pPayload, gpointer)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx
index a455c3f1fc4c..54f54b396bf3 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx
@@ -25,7 +25,7 @@ namespace LOKDocViewSigHandlers {
void formulaChanged(LOKDocView* pDocView, char* pPayload, gpointer);
void passwordRequired(LOKDocView* pDocView, char* pUrl, gboolean bModify, gpointer);
void comment(LOKDocView* pDocView, gchar* pComment, gpointer);
- void dialogInvalidate(LOKDocView* pDocView, gchar* pDialogId, gpointer);
+ void dialog(LOKDocView* pDocView, gchar* pDialogId, gpointer);
void dialogChild(LOKDocView* pDocView, gchar* pPayload, gpointer);
gboolean configureEvent(GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer pData);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 1259b221e4e8..52ae7c73d07f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -278,7 +278,7 @@ enum
TEXT_SELECTION,
PASSWORD_REQUIRED,
COMMENT,
- DIALOG_INVALIDATE,
+ DIALOG,
DIALOG_CHILD,
LAST_SIGNAL
@@ -435,8 +435,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
case LOK_CALLBACK_COMMENT:
return "LOK_CALLBACK_COMMENT";
- case LOK_CALLBACK_DIALOG_INVALIDATE:
- return "LOK_CALLBACK_DIALOG_INVALIDATE";
+ case LOK_CALLBACK_DIALOG:
+ return "LOK_CALLBACK_DIALOG";
case LOK_CALLBACK_DIALOG_CHILD:
return "LOK_CALLBACK_DIALOG_CHILD";
}
@@ -1409,8 +1409,8 @@ callback (gpointer pData)
case LOK_CALLBACK_COMMENT:
g_signal_emit(pCallback->m_pDocView, doc_view_signals[COMMENT], 0, pCallback->m_aPayload.c_str());
break;
- case LOK_CALLBACK_DIALOG_INVALIDATE:
- g_signal_emit(pCallback->m_pDocView, doc_view_signals[DIALOG_INVALIDATE], 0, pCallback->m_aPayload.c_str());
+ case LOK_CALLBACK_DIALOG:
+ g_signal_emit(pCallback->m_pDocView, doc_view_signals[DIALOG], 0, pCallback->m_aPayload.c_str());
break;
case LOK_CALLBACK_DIALOG_CHILD:
g_signal_emit(pCallback->m_pDocView, doc_view_signals[DIALOG_CHILD], 0, pCallback->m_aPayload.c_str());
@@ -3207,8 +3207,8 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
* @pDocView: the #LOKDocView on which the signal is emitted
* @pDialogId: The uno command for the dialog (dialog ID)
*/
- doc_view_signals[DIALOG_INVALIDATE] =
- g_signal_new("dialog-invalidate",
+ doc_view_signals[DIALOG] =
+ g_signal_new("dialog",
G_TYPE_FROM_CLASS(pGObjectClass),
G_SIGNAL_RUN_FIRST,
0,
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index c6e9d57027b2..08a89eac49a8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -144,15 +144,19 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
}
}
-void SfxLokHelper::notifyDialogInvalidation(const OUString& rDialogID)
+void SfxLokHelper::notifyDialog(const OUString& rDialogID, const OUString& rAction)
{
if (SfxLokHelper::getViewsCount() <= 0)
return;
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ const OString aPayload = OString("{ \"dialogId\": \"") + OUStringToOString(rDialogID, RTL_TEXTENCODING_UTF8).getStr() +
+ OString("\", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() +
+ + "\" }";
+
while (pViewShell)
{
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG_INVALIDATE, OUStringToOString(rDialogID, RTL_TEXTENCODING_UTF8).getStr());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG, aPayload.getStr());
pViewShell = SfxViewShell::GetNext(*pViewShell);
}
}
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 23e126321e69..ea84a8814e36 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -437,7 +437,7 @@ public:
void postDialogChildMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY,
int nCount, int nButtons, int nModifier) override;
- void notifyDialogInvalidation(const vcl::DialogID& rDialogID) override;
+ void notifyDialog(const vcl::DialogID& rDialogID, const OUString& rAction) override;
void notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos) override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 16c639a46f1a..45ed0de6e730 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3697,9 +3697,9 @@ void SwXTextDocument::postDialogChildMouseEvent(const vcl::DialogID& rDialogID,
}
}
-void SwXTextDocument::notifyDialogInvalidation(const vcl::DialogID& rDialogID)
+void SwXTextDocument::notifyDialog(const vcl::DialogID& rDialogID, const OUString& rAction)
{
- SfxLokHelper::notifyDialogInvalidation(rDialogID);
+ SfxLokHelper::notifyDialog(rDialogID, rAction);
}
void SwXTextDocument::notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos)
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 6edbbbbdc5b2..221d4949a378 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -954,7 +954,7 @@ void Dialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
{
if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty())
{
- mpDialogRenderable->notifyDialogInvalidation(maID);
+ mpDialogRenderable->notifyDialog(maID, "invalidate");
}
}
More information about the Libreoffice-commits
mailing list