diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-02 02:47:38 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-12-05 12:11:19 +0100 |
commit | e31af027faf462c94cf7341ccda979a263a9f834 (patch) | |
tree | 9eaec77a7823ed35a8559fb32251c451a76e415a /sfx2 | |
parent | 98973b61b124ae20905985e2c9707c7036bd0e26 (diff) |
lokdialog: multiview: Do not mix one view with other
In GTV, use correct application window object to fetch the dialog
object.
Use correct view shell to notify window (dialogs, etc.) callbacks.
Change-Id: I7d82b39d4522a4b4904e156757a032c342c71efb
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 0fd2abc9ba8e..c7755d3b8ff1 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -276,12 +276,9 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) if (comphelper::LibreOfficeKit::isActive() && pViewShell) { 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("type", "dialog")); - aItems.emplace_back(std::make_pair("size", aOptimalSize.toString())); + aItems.emplace_back(std::make_pair("size", GetOptimalSize().toString())); pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index d28e5a835dd6..73e7a170412c 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -132,10 +132,13 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS } } -void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId, +void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, + vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) { + assert(pThisView); + if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) return; @@ -152,8 +155,7 @@ void SfxLokHelper::notifyWindow(vcl::LOKWindowId nLOKWindowId, } aPayload += "}"; - if (SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_WINDOW, aPayload.getStr()); + pThisView->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 23b3237e4c83..1dcc439f291c 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2038,7 +2038,7 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable() void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const { - SfxLokHelper::notifyWindow(nDialogId, rAction, rPayload); + SfxLokHelper::notifyWindow(this, nDialogId, rAction, rPayload); } uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier() |