summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-08-10 16:44:06 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-10-02 11:01:39 +0530
commit3ebaaebf544be4f7f39b7fcbbbc377418a897442 (patch)
treeafc4a518aa954a7450d049344a4d733331380359
parent77bb77aedee4b4596f769df8e334b8063c5846b0 (diff)
Change CB_DIALOG_INVALIDATE to CB_DIALOG
We can specify whether it is an invalidation or something else in the payload. Change-Id: I95c5fc0a0a88b5277eaa93c8d1f9b937bddce7b3
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h2
-rw-r--r--include/sfx2/lokhelper.hxx4
-rw-r--r--include/vcl/IDialogRenderable.hxx2
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx2
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx18
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx2
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx15
-rw-r--r--sfx2/source/view/lokhelper.cxx8
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
-rw-r--r--vcl/source/window/dialog.cxx2
12 files changed, 36 insertions, 27 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c3f44114741b..48f08bb57ccd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -785,7 +785,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
case LOK_CALLBACK_SET_PART:
case LOK_CALLBACK_TEXT_VIEW_SELECTION:
case LOK_CALLBACK_INVALIDATE_HEADER:
- case LOK_CALLBACK_DIALOG_INVALIDATE:
+ case LOK_CALLBACK_DIALOG:
{
const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(),
[type] (const queue_type::value_type& elem) { return (elem.first == type); });
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 4c70560690da..62b9faf7ecb4 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -525,7 +525,7 @@ typedef enum
/**
* Dialog invalidation
*/
- LOK_CALLBACK_DIALOG_INVALIDATE = 36,
+ LOK_CALLBACK_DIALOG = 36,
/**
* Invalidation corresponding to dialog's children.
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 8cf1fc5cb89d..a4733c2d2854 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 with 'invalidate' action
- 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 3acd6b78e234..9fe49aaf350e 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 1bdb80c754ed..d2bfefcc089e 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -279,7 +279,7 @@ enum
PASSWORD_REQUIRED,
COMMENT,
RULER,
- DIALOG_INVALIDATE,
+ DIALOG,
DIALOG_CHILD,
LAST_SIGNAL
@@ -438,8 +438,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_COMMENT";
case LOK_CALLBACK_RULER_UPDATE:
return "LOK_CALLBACK_RULER_UPDATE";
- 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";
}
@@ -1414,8 +1414,9 @@ callback (gpointer pData)
break;
case LOK_CALLBACK_RULER_UPDATE:
g_signal_emit(pCallback->m_pDocView, doc_view_signals[RULER], 0, pCallback->m_aPayload.c_str());
- case LOK_CALLBACK_DIALOG_INVALIDATE:
- g_signal_emit(pCallback->m_pDocView, doc_view_signals[DIALOG_INVALIDATE], 0, pCallback->m_aPayload.c_str());
+ break;
+ 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());
@@ -3222,8 +3223,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 85b1815c57a8..702e88d09cf0 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 a803a6aa8e16..868dbabbcb72 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -442,7 +442,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 c148f09ef873..ec2d09c9d915 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3783,9 +3783,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 c34e9382d16e..7e5962645d9d 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -962,7 +962,7 @@ void Dialog::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
{
if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty())
{
- mpDialogRenderable->notifyDialogInvalidation(maID);
+ mpDialogRenderable->notifyDialog(maID, "invalidate");
}
}