From 110069adbba4d272450b30fa03c56efbd478e84c Mon Sep 17 00:00:00 2001 From: gokaysatir Date: Tue, 15 Sep 2020 11:35:16 +0300 Subject: Online: Show input help on Online / Core part. Change-Id: I9d10179f266a725b770fdae50045fdb5d77178ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102708 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar --- include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 +++++++++ libreofficekit/source/gtk/lokdocview.cxx | 1 + sc/source/ui/inc/gridwin.hxx | 1 + sc/source/ui/view/gridwin.cxx | 13 +++++++++++++ sc/source/ui/view/tabview3.cxx | 1 + 5 files changed, 25 insertions(+) diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 86ca9de556af..cabea69a29be 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -766,6 +766,13 @@ typedef enum * and row-groups data have changed. */ LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY = 50, + + /** + * When for the current cell is defined an input help text. + * + * The payload format is JSON: { "title": "title text", "content": "content text" } + */ + LOK_CALLBACK_VALIDITY_INPUT_HELP = 51, } LibreOfficeKitCallbackType; @@ -870,6 +877,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_WINDOW"; case LOK_CALLBACK_VALIDITY_LIST_BUTTON: return "LOK_CALLBACK_VALIDITY_LIST_BUTTON"; + case LOK_CALLBACK_VALIDITY_INPUT_HELP: + return "LOK_CALLBACK_VALIDITY_INPUT_HELP"; case LOK_CALLBACK_CLIPBOARD_CHANGED: return "LOK_CALLBACK_CLIPBOARD_CHANGED"; case LOK_CALLBACK_CONTEXT_CHANGED: diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 2b2e4b85e89c..4ebcd6806d19 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1372,6 +1372,7 @@ callback (gpointer pData) case LOK_CALLBACK_DOCUMENT_PASSWORD: case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY: case LOK_CALLBACK_VALIDITY_LIST_BUTTON: + case LOK_CALLBACK_VALIDITY_INPUT_HELP: case LOK_CALLBACK_SIGNATURE_STATUS: case LOK_CALLBACK_CONTEXT_MENU: case LOK_CALLBACK_PROFILE_FRAME: diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 3d0050d12212..3a2a41d556ab 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -471,6 +471,7 @@ public: virtual FactoryFunction GetUITestFactory() const override; void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const; + void updateLOKInputHelp(const OUString& title, const OUString& content) const; protected: void ImpCreateOverlayObjects(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index ec67eab92d28..e8b1bba90bf4 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4704,6 +4704,19 @@ void ScGridWindow::UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange) } } +void ScGridWindow::updateLOKInputHelp(const OUString& title, const OUString& content) const +{ + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + + boost::property_tree::ptree aTree; + aTree.put("title", title); + aTree.put("content", content); + + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_INPUT_HELP, aStream.str().c_str()); +} + void ScGridWindow::updateLOKValListButton( bool bVisible, const ScAddress& rPos ) const { SCCOL nX = rPos.Col(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index f512e8dd9127..01c363903004 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -816,6 +816,7 @@ void ScTabView::TestHintWindow() if (pWindow == pWin) { xOverlayManager->add(*pOverlay); + pWindow->updateLOKInputHelp(aTitle, aMessage); } else { -- cgit