tdf#141318 Dialog::GetOptimalSize not including border if called before Show

Change-Id: I96ed67d84660106af2ef5de488da8abc7d556d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113519
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 64dd582..ecba89c 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1018,7 +1018,10 @@ Size SystemWindow::GetOptimalSize() const
    if (!isLayoutEnabled())
        return Window::GetOptimalSize();

    Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
    Window *pBox = GetWindow(GetWindowType::FirstChild);
    // tdf#141318 Do the same as SystemWindow::setOptimalLayoutSize in case we're called before initial layout
    const_cast<SystemWindow*>(this)->settingOptimalLayoutSize(pBox);
    Size aSize = VclContainer::getLayoutRequisition(*pBox);

    sal_Int32 nBorderWidth = get_border_width();