vcl: LOK: emmit size_changed after window creation

This guarantees that the correct size of the window
is set on the client side. Some windows are created
with default (and invalid) size and rely on Resize
to be called right after. This doesn't happen
with message boxes and they need to get size_changed
right after the window is fully created and ready.

Change-Id: I8c281a31770de4b37b9de6d333159e5379344dff
Reviewed-on: https://gerrit.libreoffice.org/76293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Ashod Nakashian 2019-05-08 08:15:52 -04:00 committed by Noel Grandin
parent 1d77ea8f3e
commit 6451da84ec

View file

@ -983,7 +983,8 @@ bool Dialog::ImplStartExecute()
if (bModal) if (bModal)
pSVData->maAppData.mnModalMode++; pSVData->maAppData.mnModalMode++;
css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW); css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(
css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
css::document::DocumentEvent aObject; css::document::DocumentEvent aObject;
aObject.EventName = "DialogExecute"; aObject.EventName = "DialogExecute";
xEventBroadcaster->documentEventOccured(aObject); xEventBroadcaster->documentEventOccured(aObject);
@ -992,6 +993,20 @@ bool Dialog::ImplStartExecute()
else else
UITestLogger::getInstance().log("ModelessDialogExecuted Id:" + get_id()); UITestLogger::getInstance().log("ModelessDialogExecuted Id:" + get_id());
if (comphelper::LibreOfficeKit::isActive())
{
if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
// Dialog boxes don't get the Resize call and they
// can have invalid size at 'created' message above.
// If there is no difference, the client should detect it and ignore us,
// otherwise, this should make sure that the window has the correct size.
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("size", GetSizePixel().toString());
pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
}
}
return true; return true;
} }