diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-11-24 12:06:42 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-28 17:59:52 +0100 |
commit | 42777e61a4060b7b78795a5bb89e3155327a2555 (patch) | |
tree | 3cc5dea83fcbba2e4aab604371c28c04af603355 | |
parent | 474e534738ae147eec450dfbca5e1ddbc86069cb (diff) |
lokdialogs: Assign the LOK window id only when necessary.
Change-Id: Id48957a8c2bde068f30bb26e66df81972fe38e0f
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 11 |
3 files changed, 13 insertions, 4 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 8bd02f13ced5..8d2c789b9f0f 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -182,8 +182,8 @@ short SfxModalDialog::Execute() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(GetLOKWindowId(), this); SetLOKNotifier(pViewShell); + pViewShell->RegisterDlg(GetLOKWindowId(), this); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back(std::make_pair("size", aSize.toString())); @@ -254,8 +254,8 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(GetLOKWindowId(), this); SetLOKNotifier(pViewShell); + pViewShell->RegisterDlg(GetLOKWindowId(), this); // Below method doesn't really give the exact dimensions, // Check GetSizePixel() ? const Size aOptimalSize = GetOptimalSize(); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 54a4088313c6..0fc93ed11812 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -523,8 +523,8 @@ short SfxTabDialog::Execute() SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && pViewShell) { - pViewShell->RegisterDlg(GetLOKWindowId(), this); SetLOKNotifier(pViewShell); + pViewShell->RegisterDlg(GetLOKWindowId(), this); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; aItems.emplace_back(std::make_pair("size", aSize.toString())); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index d3ad60417d87..7ba762908114 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -749,7 +749,7 @@ WindowImpl::WindowImpl( WindowType nType ) static bool bDoubleBuffer = getenv("VCL_DOUBLEBUFFERING_FORCE_ENABLE"); mbDoubleBufferingRequested = bDoubleBuffer; // when we are not sure, assume it cannot do double-buffering via RenderContext mpLOKNotifier = nullptr; - mnLOKWindowId = mnLastWindowId++; + mnLOKWindowId = 0; } WindowImpl::~WindowImpl() @@ -3192,6 +3192,13 @@ void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > const & x void Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier) { + // don't allow setting this twice + assert(mpWindowImpl->mpLOKNotifier == nullptr); + assert(pNotifier); + + // assign the LOK window id + mpWindowImpl->mnLOKWindowId = WindowImpl::mnLastWindowId++; + mpWindowImpl->mpLOKNotifier = pNotifier; } @@ -3202,6 +3209,8 @@ const vcl::ILibreOfficeKitNotifier* Window::GetLOKNotifier() const vcl::LOKWindowId Window::GetLOKWindowId() const { + assert(mpWindowImpl->mnLOKWindowId > 0); + return mpWindowImpl->mnLOKWindowId; } |