tdf#109123 Change SwDocIdle base class to Idle

This hides SwDocIdle from SalInstance::AnyInput( VCL_INPUT_ANY )
on Windows. Otherwise Writer assumes there is more stuff to do, as
it can't know the scheduled Windows event is just for itself,
resulting in a busy loop, which freezes Writer.

Change-Id: I919c40e8e1673eb09a69a3084203d1c4a6ecac8a
Reviewed-on: https://gerrit.libreoffice.org/40189
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
diff --git a/sw/inc/SwDocIdle.hxx b/sw/inc/SwDocIdle.hxx
index 6bc65e2..f20fabd 100644
--- a/sw/inc/SwDocIdle.hxx
+++ b/sw/inc/SwDocIdle.hxx
@@ -32,7 +32,7 @@ namespace sw {
 * quite probably not a problem, as busy documents have a high chance to have
 * generated idle tasks.
 */
class SwDocIdle : public AutoIdle
class SwDocIdle : public Idle
{
private:
    SwDoc &m_rDoc;
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index 9d050e0..c3bd626 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -127,11 +127,10 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields
            while (IncrementalDocStatCalculate(
                        std::numeric_limits<long>::max(), bFields)) {}
        }
        else if (IncrementalDocStatCalculate(5000, bFields))
            maStatsUpdateIdle.Start();
        else
        {
            if (!maStatsUpdateIdle.IsActive() && IncrementalDocStatCalculate(5000, bFields))
                maStatsUpdateIdle.Start();
        }
            maStatsUpdateIdle.Stop();
    }
}

@@ -239,8 +238,8 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF

IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pIdle, void )
{
    if (!IncrementalDocStatCalculate(32000))
        pIdle->Stop();
    if (IncrementalDocStatCalculate(32000))
        pIdle->Start();
    SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
    if( pView )
        pView->UpdateDocStats();
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index 4a985557..ec4874e 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -96,7 +96,10 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
        for(SwViewShell& rSh : pShell->GetRingContainer())
        {
            if( rSh.ActionPend() )
            {
                pIdle->Start();
                return;
            }
        }

        if( pTmpRoot->IsNeedGrammarCheck() )
@@ -117,6 +120,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
            {
                (*pLayIter)->GetCurrShell()->LayoutIdle();
                // Defer the remaining work.
                pIdle->Start();
                return;
            }
        }
@@ -131,7 +135,10 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
        {
            if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() ||
                      m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
            {
                pIdle->Start();
                return;
            }

            //  Action brackets!
            m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true );
@@ -159,7 +166,6 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
    if( pModLogFile && 1 != (long)pModLogFile )
        delete pModLogFile, static_cast<long&>(pModLogFile) = 1;
#endif
    pIdle->Stop();
}

DocumentTimerManager::~DocumentTimerManager() {}