diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-01 13:54:45 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-12-05 12:11:17 +0100 |
commit | 6d9db952e8b3cff75ace140a4d51e41e975861d5 (patch) | |
tree | 2eda467e8cc177a484e9c817e080f4e3ee817f19 /sfx2 | |
parent | 0b28b6015c52753fa3f8f081c65cb07d396bf8d7 (diff) |
lokdialog: Simplify; make the LOK dialog API more generic
Merge the dialog floating window callbacks and function calls into one.
Unique window ids across vcl::Window is enough to distinguish between
them.
Floating windows don't have a LOK notifier as they are created in the
vcl itself (so we can't access them from sfx2). Use the parent LOK
notifier in that case (which would be a dialog).
This API should also help in autopopup filter tunneling later.
Change-Id: I63a2c97ffdd84695dc967e14c793089a7c50b41b
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 5 |
4 files changed, 6 insertions, 23 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 97d3c1c8b45e..0fd2abc9ba8e 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -185,6 +185,7 @@ short SfxModalDialog::Execute() SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back(std::make_pair("type", "dialog")); aItems.emplace_back(std::make_pair("size", aSize.toString())); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } @@ -279,6 +280,7 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) // Check GetSizePixel() ? const Size aOptimalSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back(std::make_pair("type", "dialog")); aItems.emplace_back(std::make_pair("size", aOptimalSize.toString())); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } @@ -545,6 +547,7 @@ bool SfxFloatingWindow::Close() pBindings->GetDispatcher_Impl()->ExecuteList( pImpl->pMgr->GetType(), SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue }); + return true; } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 23113c7836ea..c9f1577f691b 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -526,6 +526,7 @@ short SfxTabDialog::Execute() SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back(std::make_pair("type", "dialog")); aItems.emplace_back(std::make_pair("size", aSize.toString())); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index d39c3ac2cacb..d28e5a835dd6 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -139,8 +139,7 @@ void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId, if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) return; - - OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nLOKWindowId) + OString("\""); + OString aPayload = OString("{ \"id\": \"") + OString::number(nLOKWindowId) + OString("\""); aPayload += OString(", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() + OString("\""); for (const auto& rItem: rPayload) @@ -154,22 +153,7 @@ void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId, aPayload += "}"; if (SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG, aPayload.getStr()); -} - -void SfxLokHelper::notifyWindowChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos) -{ - if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) - return; - - - const OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nLOKWindowId) + - OString("\", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() + - OString("\", \"position\": \"") + OString::number(rPos.getX()) + OString(", ") + OString::number(rPos.getY()) + - + "\" }"; - - if (SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DIALOG_CHILD, aPayload.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_WINDOW, aPayload.getStr()); } void SfxLokHelper::notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 78c43ed863f2..23b3237e4c83 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2041,11 +2041,6 @@ void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAct SfxLokHelper::notifyWindow(nDialogId, rAction, rPayload); } -void SfxViewShell::notifyWindowChild(vcl::LOKWindowId nDialogId, const OUString& rAction, const Point& rPos) const -{ - SfxLokHelper::notifyWindowChild(nDialogId, rAction, rPos); -} - uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier() { uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier; |