diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-11-24 10:20:47 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-28 17:59:13 +0100 |
commit | 9df590be66324884e3e0e4eb9b255cd35103b06b (patch) | |
tree | 7b75e4d75eb11cd09b57cc8656129c22ddd430eb /sfx2 | |
parent | f003eba0e30f41d036bed6fe417520fe66a3335f (diff) |
lokdialog: Move the Notifier down to vcl::Window.
We need to tunnel more than just dialogs, so this is the 1st step to get the
Autofilter popup rendered.
Change-Id: I6523a39ddc7a6eb2a204e48ab364130a5822f548
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 14 |
4 files changed, 28 insertions, 28 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 1a20dcf2576e..8bd02f13ced5 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -170,8 +170,8 @@ void SfxModalDialog::dispose() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->notifyDialog(maID, "close"); - pViewShell->UnregisterDlg(maID); + pViewShell->notifyDialog(GetLOKWindowId(), "close"); + pViewShell->UnregisterDlg(GetLOKWindowId()); } ModalDialog::dispose(); @@ -182,12 +182,12 @@ short SfxModalDialog::Execute() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(maID, this); - registerDialogNotifier(static_cast<vcl::IDialogNotifier*>(pViewShell)); + pViewShell->RegisterDlg(GetLOKWindowId(), this); + SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back(std::make_pair("size", aSize.toString())); - pViewShell->notifyDialog(maID, "created", aItems); + pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems); } return ModalDialog::Execute(); @@ -254,14 +254,14 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(maID, this); - registerDialogNotifier(static_cast<vcl::IDialogNotifier*>(pViewShell)); + pViewShell->RegisterDlg(GetLOKWindowId(), this); + SetLOKNotifier(pViewShell); // Below method doesn't really give the exact dimensions, // Check GetSizePixel() ? const Size aOptimalSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back(std::make_pair("size", aOptimalSize.toString())); - pViewShell->notifyDialog(maID, "created", aItems); + pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems); } pImpl->bConstructed = true; @@ -397,8 +397,8 @@ void SfxModelessDialog::dispose() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->notifyDialog(maID, "close"); - pViewShell->UnregisterDlg(maID); + pViewShell->notifyDialog(GetLOKWindowId(), "close"); + pViewShell->UnregisterDlg(GetLOKWindowId()); } ModelessDialog::dispose(); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index b072efbcbbc9..54a4088313c6 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -408,8 +408,8 @@ void SfxTabDialog::dispose() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->notifyDialog(maID, "close"); - pViewShell->UnregisterDlg(maID); + pViewShell->notifyDialog(GetLOKWindowId(), "close"); + pViewShell->UnregisterDlg(GetLOKWindowId()); } TabDialog::dispose(); @@ -523,12 +523,12 @@ short SfxTabDialog::Execute() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(maID, this); - registerDialogNotifier(static_cast<vcl::IDialogNotifier*>(pViewShell)); + pViewShell->RegisterDlg(GetLOKWindowId(), this); + SetLOKNotifier(pViewShell); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back(std::make_pair("size", aSize.toString())); - pViewShell->notifyDialog(maID, "created", aItems); + pViewShell->notifyDialog(GetLOKWindowId(), "created", aItems); } return TabDialog::Execute(); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index eea6e2c1cefc..da6cd4ac16ee 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -132,15 +132,15 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS } } -void SfxLokHelper::notifyDialog(vcl::DialogID nDialogID, +void SfxLokHelper::notifyDialog(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) { - if (SfxLokHelper::getViewsCount() <= 0 || nDialogID == 0) + if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) return; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nDialogID) + OString("\""); + OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nLOKWindowId) + OString("\""); aPayload += OString(", \"action\": \"") + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8).getStr() + OString("\""); for (const auto& rItem: rPayload) @@ -160,13 +160,13 @@ void SfxLokHelper::notifyDialog(vcl::DialogID nDialogID, } } -void SfxLokHelper::notifyDialogChild(vcl::DialogID nDialogID, const OUString& rAction, const Point& rPos) +void SfxLokHelper::notifyDialogChild(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const Point& rPos) { - if (SfxLokHelper::getViewsCount() <= 0 || nDialogID == 0) + if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) return; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - const OString aPayload = OString("{ \"dialogId\": \"") + OString::number(nDialogID) + + 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()) + + "\" }"; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 504439a11568..46412c9db379 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2036,27 +2036,27 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable() return xRender; } -void SfxViewShell::notifyDialog(const vcl::DialogID& rDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) +void SfxViewShell::notifyDialog(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const { SfxLokHelper::notifyDialog(rDialogId, rAction, rPayload); } -void SfxViewShell::notifyDialogChild(const vcl::DialogID& rDialogId, const OUString& rAction, const Point& rPos) +void SfxViewShell::notifyDialogChild(const vcl::LOKWindowId& rDialogId, const OUString& rAction, const Point& rPos) const { SfxLokHelper::notifyDialogChild(rDialogId, rAction, rPos); } -void SfxViewShell::RegisterDlg(vcl::DialogID nDialogId, VclPtr<Dialog> pDlg) +void SfxViewShell::RegisterDlg(vcl::LOKWindowId nDialogId, VclPtr<Dialog> pDlg) { if (pDlg) maOpenedDialogs.push_back(std::make_pair(nDialogId, pDlg)); } -VclPtr<Dialog> SfxViewShell::GetOpenedDlg(vcl::DialogID nDialogId) +VclPtr<Dialog> SfxViewShell::GetOpenedDlg(vcl::LOKWindowId nDialogId) { const auto it = std::find_if(maOpenedDialogs.begin(), maOpenedDialogs.end(), - [&nDialogId](const std::pair<vcl::DialogID, VclPtr<Dialog>> aItem) { + [&nDialogId](const std::pair<vcl::LOKWindowId, VclPtr<Dialog>> aItem) { return nDialogId == aItem.first; }); @@ -2068,11 +2068,11 @@ VclPtr<Dialog> SfxViewShell::GetOpenedDlg(vcl::DialogID nDialogId) return ret; } -void SfxViewShell::UnregisterDlg(vcl::DialogID nDialogId) +void SfxViewShell::UnregisterDlg(vcl::LOKWindowId nDialogId) { maOpenedDialogs.erase(std::remove_if(maOpenedDialogs.begin(), maOpenedDialogs.end(), - [&nDialogId](const std::pair<vcl::DialogID, VclPtr<Dialog>> aItem) { + [&nDialogId](const std::pair<vcl::LOKWindowId, VclPtr<Dialog>> aItem) { return aItem.first == nDialogId; })); } |