Resolves: tdf#121181 expand message boxes to show full title

as MsgBox used to do

Change-Id: I03d459b8c18f60a19ea5b0034a8d98f6aa4f5ce4
Reviewed-on: https://gerrit.libreoffice.org/63117
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 7975bd2..6557c45 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -443,6 +443,7 @@ class SystemWindow;
class WorkWindow;
class Dialog;
class MessBox;
class MessageDialog;
class DockingWindow;
class FloatingWindow;
class GroupBox;
@@ -505,6 +506,7 @@ class VCL_DLLPUBLIC Window : public ::OutputDevice
    friend class ::WorkWindow;
    friend class ::Dialog;
    friend class ::MessBox;
    friend class ::MessageDialog;
    friend class ::DockingWindow;
    friend class ::FloatingWindow;
    friend class ::GroupBox;
diff --git a/vcl/inc/messagedialog.hxx b/vcl/inc/messagedialog.hxx
index 5b4fda5..756409e 100644
--- a/vcl/inc/messagedialog.hxx
+++ b/vcl/inc/messagedialog.hxx
@@ -35,6 +35,8 @@ private:
    friend class VclPtr<MessageDialog>;
    MessageDialog(vcl::Window* pParent, WinBits nStyle);

    virtual void StateChanged(StateChangedType nType) override;

public:
    MessageDialog(vcl::Window* pParent, const OUString& rMessage, VclMessageType eMessageType,
                  VclButtonsType eButtonsType);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 10f28da..9c5a8c8 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2479,6 +2479,20 @@ void MessageDialog::set_secondary_text(const OUString &rSecondaryString)
    }
}

void MessageDialog::StateChanged(StateChangedType nType)
{
    if (nType == StateChangedType::InitShow)
    {
        // MessageBox should be at least as wide as to see the title
        auto nTitleWidth = CalcTitleWidth();
        // Extra-Width for Close button
        nTitleWidth += mpWindowImpl->mnTopBorder;
        if (get_preferred_size().Width() < nTitleWidth)
            set_width_request(nTitleWidth);
    }
    Dialog::StateChanged(nType);
}

VclVPaned::VclVPaned(vcl::Window *pParent)
    : VclContainer(pParent, WB_HIDE | WB_CLIPCHILDREN)
    , m_pSplitter(VclPtr<Splitter>::Create(this, WB_VSCROLL))