diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-11-14 18:45:02 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-11-15 13:46:16 +0100 |
commit | 43540adb76f764522344c5d66ebc63f7cb0f9c1c (patch) | |
tree | 23545b82a08ae2a17ee7b2f42aa9652391b7a5ea /vcl | |
parent | a088f9e729084f950ee58afb8f80e64d4d134144 (diff) |
lokdialog: Expose cursor visible status
Change the notifyDialog API a bit. Use a std::vector to keep track of
each payload item that needs to be fed to the resulting JSON.
Change-Id: If3229a88d2df5368e14290a0e80ebe6206780639
Reviewed-on: https://gerrit.libreoffice.org/44722
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/edit.cxx | 49 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 14 |
2 files changed, 47 insertions, 16 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index cf8a153ee256..add78c2f49b3 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -19,6 +19,7 @@ #include <comphelper/lok.hxx> +#include <vcl/IDialogRenderable.hxx> #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/cursor.hxx> @@ -1144,18 +1145,23 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) ); pCursor->SetSize( Size( nCursorWidth, nTextHeight ) ); pCursor->Show(); - } - if (comphelper::LibreOfficeKit::isActive()) - { - const long X = GetOutOffXPixel() + pCursor->GetPos().X(); - const long Y = GetOutOffYPixel() + pCursor->GetPos().Y(); - if (nCursorWidth == 0) - nCursorWidth = 2; - const tools::Rectangle aRect(Point(X, Y), Size(nCursorWidth, pCursor->GetHeight())); - Dialog* pParentDlg = GetParentDialog(); - if (pParentDlg) - pParentDlg->LOKCursorInvalidate(aRect); + if (comphelper::LibreOfficeKit::isActive()) + { + const long X = GetOutOffXPixel() + pCursor->GetPos().X(); + const long Y = GetOutOffYPixel() + pCursor->GetPos().Y(); + + if (nCursorWidth == 0) + nCursorWidth = 2; + const tools::Rectangle aRect(Point(X, Y), Size(nCursorWidth, pCursor->GetHeight())); + + std::vector<vcl::LOKPayloadItem> aPayload; + aPayload.push_back(std::make_pair("rectangle", aRect.toString())); + + Dialog* pParentDlg = GetParentDialog(); + if (pParentDlg) + pParentDlg->LOKCursor("cursor_invalidate", aPayload); + } } } @@ -1902,6 +1908,16 @@ void Edit::GetFocus() SetInputContext( InputContext( GetFont(), !IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) ); } + // notify dialog's cursor visible status + if (comphelper::LibreOfficeKit::isActive()) + { + std::vector<vcl::LOKPayloadItem> aPayload; + aPayload.push_back(std::make_pair(OString("visible"), OString("true"))); + Dialog* pParentDlg = GetParentDialog(); + if (pParentDlg) + pParentDlg->LOKCursor("cursor_visible", aPayload); + } + Control::GetFocus(); } @@ -1929,6 +1945,17 @@ void Edit::LoseFocus() ImplInvalidateOrRepaint(); // paint the selection } + + // notify dialog's cursor visible status + if (comphelper::LibreOfficeKit::isActive()) + { + std::vector<vcl::LOKPayloadItem> aPayload; + aPayload.push_back(std::make_pair(OString("visible"), OString("false"))); + Dialog* pParentDlg = GetParentDialog(); + if (pParentDlg) + pParentDlg->LOKCursor("cursor_visible", aPayload); + } + Control::LoseFocus(); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 8e6d5f101012..4db7c9674a83 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -596,7 +596,7 @@ void Dialog::dispose() if (comphelper::LibreOfficeKit::isActive() && mpDialogRenderable) { - mpDialogRenderable->notifyDialog(maID, "close", nullptr); + mpDialogRenderable->notifyDialog(maID, "close"); } SystemWindow::dispose(); @@ -973,7 +973,11 @@ void Dialog::LogicInvalidate(const tools::Rectangle* pRectangle) { if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty()) { - mpDialogRenderable->notifyDialog(maID, "invalidate", pRectangle); + std::vector<vcl::LOKPayloadItem> aPayload; + if (pRectangle) + aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString())); + + mpDialogRenderable->notifyDialog(maID, "invalidate", aPayload); } } @@ -1015,13 +1019,13 @@ void Dialog::LOKKeyUp(const KeyEvent& rKeyEvent) ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, &rKeyEvent); } -void Dialog::LOKCursorInvalidate(const tools::Rectangle& aRect) +void Dialog::LOKCursor(const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) { assert(comphelper::LibreOfficeKit::isActive()); if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty()) { - mpDialogRenderable->notifyDialog(maID, "cursor_invalidate", &aRect); + mpDialogRenderable->notifyDialog(maID, rAction, rPayload); } } @@ -1342,7 +1346,7 @@ void Dialog::Resize() // inform LOK clients if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable && !maID.isEmpty()) { - mpDialogRenderable->notifyDialog(maID, "invalidate", nullptr); + mpDialogRenderable->notifyDialog(maID, "invalidate"); } } |