tdf#49895: show wait cursor while Options dialog loads

initializing of the dialogs happens at two stage:
- at the loading of the Options dialog
- at the time of searching

We have to notify the user that there is a process ongoing.
Therefore, a wait cursor indicator added to the both
stage of the initialization.

Change-Id: Ia1c6318aa961424e957ae27ac2ff5f496180cb81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156312
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index d514b7d..1b5e29e 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -791,6 +791,12 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, SearchUpdateHdl, weld::Entry&, void)

IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
{
    // initializeFirstNDialog() can take a long time, show wait cursor and disable input
    std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);

    // Pause redraw
    xTreeLB->freeze();

    if (bIsFirtsInitialize)
    {
        m_xSearchEdit->freeze();
@@ -803,9 +809,6 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, ImplUpdateDataHdl, Timer*, void)
        bIsFirtsInitialize = false;
    }

    // Pause redraw
    xTreeLB->freeze();

    // Apply the search filter
    OUString aSearchTerm(m_xSearchEdit->get_text());
    int nMatchFound = applySearchFilter(aSearchTerm);
@@ -1186,6 +1189,9 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
    m_xSearchEdit->grab_focus();
    SelectHdl_Impl();

    // initializeFirstNDialog() can take a long time, show wait cursor
    std::unique_ptr<weld::WaitObject> xWait(m_pParent ? new weld::WaitObject(m_pParent) : nullptr);

    /* initialize first 25 dialogs which are almost half of the dialogs
    in a row while Options dialog opens. then clear&reselect to avoid UI test failures. */
    initializeFirstNDialog(25);