summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-22 22:25:20 +0530
committerJan Holesovsky <kendy@collabora.com>2017-11-28 17:50:49 +0100
commit667d7003c2525f79b21cbf2a870f03168634e232 (patch)
tree287e85e1b2e6b52775fa135a5aea37390cefd049 /sfx2
parentd7a6ca1778784379e3fa5474a40734fd6c6026c6 (diff)
lokdialog: Changed dialog painting to allow for modal dialogs
Split IDialogNotifier from IDialogRenderable and make SfxViewShell implement it. We now just send the dialog UNO command to the backend and wait for core to emit a 'created' dialog callback which signals dialog creation in the backend. The client is then supposed to send the paint commands for rendering the dialog. Change-Id: I1bfbce83c17955fa0212408376d6bcd1b2d2d1dd
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/tabdlg.cxx14
-rw-r--r--sfx2/source/view/viewsh.cxx44
2 files changed, 58 insertions, 0 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index ffc821d53baf..7d37ad998b42 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -23,6 +23,7 @@
#include <algorithm>
#include <vcl/builder.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/IDialogRenderable.hxx>
#include <unotools/viewoptions.hxx>
#include "appdata.hxx"
@@ -36,6 +37,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/sfxdlg.hxx>
#include <sfx2/itemconnect.hxx>
+#include <sfx2/viewsh.hxx>
#include "uitest/sfx_uiobject.hxx"
@@ -509,6 +511,18 @@ short SfxTabDialog::Execute()
if ( !m_pTabCtrl->GetPageCount() )
return RET_CANCEL;
Start_Impl();
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (pViewShell)
+ {
+ pViewShell->RegisterDlg(maID, this);
+ registerDialogNotifier(static_cast<vcl::IDialogNotifier*>(pViewShell));
+ const Size aSize = GetOptimalSize();
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back(std::make_pair("size", aSize.toString()));
+ pViewShell->notifyDialog(maID, "created", aItems);
+ }
+
return TabDialog::Execute();
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 25278f8bd2bf..c8a0a9000762 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2036,6 +2036,50 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable()
return xRender;
}
+void SfxViewShell::notifyDialog(const vcl::DialogID& rDialogID, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload)
+{
+ SfxLokHelper::notifyDialog(rDialogID, rAction, rPayload);
+}
+
+void SfxViewShell::notifyDialogChild(const vcl::DialogID& rDialogID, const OUString& rAction, const Point& rPos)
+{
+ SfxLokHelper::notifyDialog(rDialogID, rAction);
+}
+
+void SfxViewShell::RegisterDlg(const vcl::DialogID& rDialogId, VclPtr<Dialog> pDlg)
+{
+ if (pDlg)
+ maOpenedDialogs.push_back(std::make_pair(rName, pDlg));
+}
+
+VclPtr<Dialog> SfxViewShell::GetOpenedDlg(const vcl::DialogID& rDialogId)
+{
+ if (rName.startsWith(".uno:"))
+ rName = rName.replaceFirst(".uno:", "");
+
+ const auto it = std::find_if(maOpenedDialogs.begin(),
+ maOpenedDialogs.end(),
+ [&rDialogId](const std::pair<vcl::DialogID, VclPtr<Dialog>> aItem) {
+ return rDialogId == aItem.first;
+ });
+
+ Dialog* ret = nullptr;
+ if (it != maOpenedDialogs.end())
+ {
+ ret = it->second;
+ }
+ return ret;
+}
+
+void SfxViewShell::UnregisterDlg(const OUString& rName)
+{
+ maOpenedDialogs.erase(std::remove_if(maOpenedDialogs.begin(),
+ maOpenedDialogs.end(),
+ [&rDialogId](const std::pair<vcl::DialogID, VclPtr<Dialog>> aItem) {
+ return aItem.first == rDialogId;
+ }));
+}
+
uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier()
{
uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;