diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-11-24 10:20:47 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-29 10:16:56 +0100 |
commit | ba8154d857aa815ba3c5b52987dc17be6eba7f48 (patch) | |
tree | b1fe470f5123b1a15a4fb128cc706ff197ee3e2a /sfx2/source | |
parent | f2b6bffdedb12983d4ca2bab21fb68eeb3c3d08d (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/source')
-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 73a110038d95..9d30c8596e33 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -164,8 +164,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(); @@ -176,12 +176,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(); @@ -248,14 +248,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; @@ -393,8 +393,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 17f64d51a063..a12d76a14ae1 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -406,8 +406,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(); @@ -521,12 +521,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 9af028916b69..cfd9041ab421 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -144,15 +144,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) @@ -172,13 +172,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 986a640d1625..778a9d9f68b7 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1948,27 +1948,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; }); @@ -1980,11 +1980,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; })); } |