[Libreoffice-commits] core.git: Branch 'private/jmux/new-vcl-scheduler+win_nolock' - 1608 commits - accessibility/inc accessibility/source android/mobile-config.py android/source animations/source avmedia/source basctl/inc basctl/source basegfx/source basegfx/test basic/CppunitTest_basic_macros.mk basic/Library_sb.mk basic/qa basic/source binaryurp/source bin/distro-install-file-lists bin/gbuild-to-ide bin/gbuild-to-ideNS bin/update_pch bridges/inc bridges/Library_cpp_uno.mk bridges/Library_java_uno.mk bridges/Module_bridges.mk bridges/source canvas/source chart2/CppunitTest_chart2_dump.mk chart2/inc chart2/Library_chartcore.mk chart2/Module_chart2.mk chart2/qa chart2/source cli_ure/Executable_climaker.mk cli_ure/Library_cli_cppuhelper_native.mk cli_ure/Library_cli_uno.mk cli_ure/source codemaker/Executable_cppumaker.mk codemaker/source comphelper/qa comphelper/source compilerplugins/clang config_host/config_features.h.in config_host/config_global.h.in config_host/config_liblangtag.h.in config_ho st.mk.in configmgr/qa configmgr/source configure.ac connectivity/Library_postgresql-sdbc-impl.mk connectivity/source connectivity/workben cppcanvas/source cppuhelper/qa cppuhelper/source cppu/source cpputools/source cui/qa cui/source cui/uiconfig dbaccess/Library_dbu.mk dbaccess/Module_dbaccess.mk dbaccess/source dbaccess/win32 desktop/GeneratedPackage_desktop_unopackages_install.mk desktop/inc desktop/Module_desktop.mk desktop/Package_desktop_install.mk desktop/qa desktop/scripts desktop/source desktop/test desktop/unx desktop/win32 distro-configs/LibreOfficeCoverity.conf distro-configs/LibreOfficeEmscripten.conf distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeMinGW64.conf distro-configs/LibreOfficeMinGW.conf distro-configs/LibreOfficeOssFuzz.conf download.lst drawinglayer/source dtrans/source editeng/inc editeng/Module_editeng.mk editeng/qa editeng/source editeng/uiconfig editeng/UIConfig_editeng.mk embeddedobj/source embedserv/source eventattacher/source extensions/s ource external/breakpad external/cairo external/clucene external/coinmp external/cppunit external/curl external/expat external/firebird external/freetype external/gpgme external/hunspell external/icu external/lcms2 external/libabw external/libassuan external/libcdr external/libcmis external/libebook external/libetonyek external/libexttextcat external/libfreehand external/libgltf external/libgpg-error external/liblangtag external/libmspub external/libpagemaker external/libstaroffice external/libvisio external/libxml2 external/libxmlsec external/libxslt external/libzmf external/lpsolve external/mingw-externals external/Module_external.mk external/mysqlcppconn external/neon external/nss external/openssl external/pdfium external/poppler external/postgresql external/python3 external/python33 external/redland extras/Package_cfgsrvnolang.mk extras/source filter/inc filter/Library_t602filter.mk filter/qa filter/source filter/uiconfig forms/source formula/source fpicker/source framework/inc framework/qa framework/source .gitignore helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/qa hwpfilter/source i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk i18nlangtag/Library_i18nlangtag.mk i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/elementary icon-themes/galaxy icon-themes/hicontrast idlc/inc idlc/source idl/inc include/basegfx include/basic include/canvas include/codemaker include/com include/comphelper include/connectivity include/cppu include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/helpcompiler include/i18nlangtag include/i18nutil include/jvmaccess include/jvmfwk include/LibreOfficeKit include/o3tl include/oox include/osl include/rsc include/rtl include/sal include/salhelper include/sax include/sfx2 include/store include/svl include/svtools include/svx include/systools include/toolkit include/tools include/typelib include/ucbhelper include/uno include/unotest include/unotools include/vbahelper include/vcl include/wntgcci include/wntgccx include/xmloff include/xmlreader include/xmlscript include/xmlsecurity instsetoo_native/util ios/CustomTarget_Lo_Xcconfig.mk ios/CustomTarget_TiledLibreOffice_app.mk ios/experimental ios/.gitignore ios/lo.xcconfig.in io/source jvmfwk/plugins jvmfwk/source l10ntools/source librelogo/source libreofficekit/qa libreofficekit/README libreofficekit/source lingucomponent/source linguistic/source lotuswordpro/qa lotuswordpro/source m4/mingw.m4 Makefile.fetch Makefile.in mysqlc/source odk/config odk/CustomTarget_build-examples.mk odk/CustomTarget_check.mk odk/docs odk/examples odk/util offapi/com offapi/org offapi/type_reference offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/registry onlineupdate/source oox/inc oox/Library_oox.mk oox/README oox/source package/inc p ackage/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk postprocess/signing pyuno/CustomTarget_pyuno_pythonloader_ini.mk pyuno/CustomTarget_zipcore.mk pyuno/GeneratedPackage_python-core.mk pyuno/Module_pyuno.mk pyuno/Package_zipcore.mk pyuno/source pyuno/zipcore qadevOOo/runner qadevOOo/tests readlicense_oo/license readlicense_oo/Package_files.mk registry/source registry/test remotebridges/source reportbuilder/java reportdesign/inc reportdesign/source reportdesign/uiconfig reportdesign/UIConfig_dbreport.mk RepositoryExternal.mk RepositoryFixes.mk Repository.mk rsc/Executable_rsc.mk rsc/inc rsc/source sal/inc sal/Library_sal.mk sal/osl sal/qa sal/rtl sal/systools sal/textenc sal/util sax/qa sax/source scaddins/idl scaddins/source sccomp/qa sccomp/source schema/odf1.0 sc/inc sc/Module_sc.mk scp2/InstallModule_ooo.mk scp2/InstallModule_python.mk scp2/InstallModule_ure.mk scp2/Module_scp2.mk scp2/source sc/qa scripting/java scripting/source sc/sdi sc/source sc/uic onfig sc/UITest_conditional_format.mk sdext/source sd/inc sd/qa sd/sdi sd/source sd/uiconfig setup_native/CustomTarget_wintools.mk setup_native/Module_setup_native.mk setup_native/Package_wintools.mk setup_native/source sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source shell/inc shell/source slideshow/source smoketest/com solenv/bin solenv/clang-cl solenv/CompilerTest_compilerplugins_clang.mk solenv/gbuild solenv/gcc-wrappers solenv/gdb solenv/qa soltools/mkdepend sot/source starmath/inc starmath/qa starmath/source stoc/source store/source svgio/source svl/qa svl/source svtools/inc svtools/Library_svt.mk svtools/qa svtools/source svtools/uiconfig svx/inc svx/qa svx/sdi svx/source svx/uiconfig sw/AllLangResTarget_sw.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ww8import.mk sw/inc sw/Library_sw.mk sw/qa sw/README sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk testtools/source toolkit/qa toolkit/source tools/source translations ucbhelper/source ucb/source udkapi/com uitest/c alc_tests uitest/demo_ui uitest/impress_tests uitest/libreoffice uitest/uitest uitest/writer_tests UnoControls/source unoidl/source unotest/source unotools/source unoxml/qa unoxml/source uui/source vbahelper/source vcl/commonfuzzer.mk vcl/CppunitTest_vcl_pdfexport.mk vcl/CppunitTest_vcl_wmf_test.mk vcl/CustomTarget_nativecode.mk vcl/Executable_602fuzzer.mk vcl/Executable_hwpfuzzer.mk vcl/Executable_lwpfuzzer.mk vcl/Executable_pcxfuzzer.mk vcl/Executable_rasfuzzer.mk vcl/Executable_tgafuzzer.mk vcl/Executable_tiffuzzer.mk vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/quartz vcl/README.GDIMetaFile vcl/source vcl/unx vcl/win vcl/workben winaccessibility/source windows/README windows/soffice.sln windows/soffice.vcxproj wizards/com wizards/Module_wizards.mk wizards/Pyuno_web.mk wizards/source writerfilter/inc writerfilter/source writerperfect/CppunitTest_writerperfect_wpftimport.mk writerperfect/inc writerperfect/Module_writerperfect.mk writerper fect/qa writerperfect/source xmlhelp/source xmloff/inc xmloff/source xmlscript/source xmlsecurity/Executable_pdfverify.mk xmlsecurity/inc xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_fw.mk xmlsecurity/Library_xsec_gpg.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/qa xmlsecurity/README xmlsecurity/source xmlsecurity/util xmlsecurity/workben

Jan-Marek Glogowski glogow at fbihome.de
Wed Mar 8 11:39:52 UTC 2017


Rebased ref, commits from common ancestor:
commit 5d868f886e1f2a2f92c270da63637e6b9cdecd5c
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Feb 24 18:27:49 2017 +0100

    Change OSX backend to run via a single shot timer
    
    As all other backends, this runs the LO main loop just via the
    OSX main loop.
    
    But it seems some on mouse over stuff in the start center depends
    on a multi-shot timer, as the on-mouse-over of buttons sometimes
    doesn't work, when on the left panel, but always work, if you move
    from the large middle panel to the left,
    
    Change-Id: Ie7562444951e16ff58edcaf6409f32809314c2fa

diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 17874bd..5ec2d8e 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -152,6 +152,7 @@ public:
     static const short AppEndLoopEvent    = 1;
     static const short AppStartTimerEvent = 10;
     static const short YieldWakeupEvent   = 20;
+    static const short DispatchTimerEvent = 30;
 
     static NSMenu* GetDynamicDockMenu();
 };
diff --git a/vcl/inc/osx/saltimer.h b/vcl/inc/osx/saltimer.h
index 94b58f8..f9a6acb 100644
--- a/vcl/inc/osx/saltimer.h
+++ b/vcl/inc/osx/saltimer.h
@@ -37,6 +37,7 @@ class AquaSalTimer : public SalTimer
     void Stop() override;
 
     static void handleStartTimerEvent( NSEvent* pEvent );
+    static void handleDispatchTimerEvent();
 
     static NSTimer* pRunningTimer;
     static bool bDispatchTimer;
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 5d97506..3902126 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -475,8 +475,11 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent )
             [pDockMenu release];
             pDockMenu = nil;
         }
+        break;
     }
-    break;
+    case DispatchTimerEvent:
+        AquaSalTimer::handleDispatchTimerEvent();
+        break;
 #if !HAVE_FEATURE_MACOSX_SANDBOX
     case AppleRemoteControlEvent: // Defined in <apple_remote/RemoteMainController.h>
     {
@@ -565,6 +568,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
 {
     (void) nReleased;
     assert(nReleased == 0); // not implemented
+    bool bHadEvent = false;
 
     // ensure that the per thread autorelease pool is top level and
     // will therefore not be destroyed by cocoa implicitly
@@ -589,6 +593,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
             {
                 aEvent = maUserEvents.front();
                 maUserEvents.pop_front();
+                bHadEvent = true;
             }
             else
                 bDispatchUser = false;
@@ -600,15 +605,15 @@ bool AquaSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLon
         {
             aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData );
             osl_setCondition( maWaitingYieldCond );
-            // return if only one event is asked for
-            if( ! bHandleAllCurrentEvents )
-                return true;
         }
+
+        // return if only one event is asked for
+        if( !bHandleAllCurrentEvents && bDispatchUser )
+            return true;
     }
 
     // handle cocoa event queue
     // cocoa events may be only handled in the thread the NSApp was created
-    bool bHadEvent = false;
     if( isNSAppThread() && mnActivePrintJobs == 0 )
     {
         // we need to be woken up by a cocoa-event
@@ -653,18 +658,6 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
             [NSApp updateWindows];
 
             AcquireYieldMutex( nCount );
-
-            // #i86581#
-            // FIXME: sometimes the NSTimer will never fire. Firing it by hand then
-            // fixes the problem even seems to set the correct next firing date
-            // Why oh why?
-            if( ! pEvent && AquaSalTimer::pRunningTimer )
-            {
-                // this cause crashes on MacOSX 10.4
-                // [AquaSalTimer::pRunningTimer fire];
-                if (ImplGetSVData()->maSchedCtx.mpSalTimer != nullptr)
-                    ImplGetSVData()->maSchedCtx.mpSalTimer->CallCallback();
-            }
         }
 
         mbWaitingYield = bOldWaitingYield;
diff --git a/vcl/osx/salnstimer.mm b/vcl/osx/salnstimer.mm
index 00f67e5..f3057dd 100644
--- a/vcl/osx/salnstimer.mm
+++ b/vcl/osx/salnstimer.mm
@@ -29,19 +29,17 @@
 -(void)timerElapsed:(NSTimer*)pTimer
 {
     (void)pTimer;
-    if( AquaSalTimer::bDispatchTimer )
-    {
-        SolarMutexGuard aGuard;
-        ImplSVData* pSVData = ImplGetSVData();
-        if( pSVData->maSchedCtx.mpSalTimer )
-        {
-            pSVData->maSchedCtx.mpSalTimer->CallCallback();
-
-            // NSTimer does not end nextEventMatchingMask of NSApplication
-            // so we need to wakeup a waiting Yield to inform it something happened
-            GetSalData()->mpFirstInstance->wakeupYield();
-        }
-    }
+    NSEvent* pEvent = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
+                               location: NSZeroPoint
+                               modifierFlags: 0
+                               timestamp: [NSDate timeIntervalSinceReferenceDate]
+                               windowNumber: 0
+                               context: nil
+                               subtype: AquaSalInstance::DispatchTimerEvent
+                               data1: 0
+                               data2: 0 ];
+    assert( pEvent );
+    [NSApp postEvent: pEvent atStart: YES];
 }
 @end
 
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index 5d36de5..f636088 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -28,15 +28,42 @@
 #include "osx/salinst.h"
 
 NSTimer* AquaSalTimer::pRunningTimer = nil;
-bool AquaSalTimer::bDispatchTimer = false;
 
-void ImplSalStartTimer( sal_uLong nMS )
+static void ImplSalStopTimer();
+
+static inline void ImplPostEvent( short nEventId, bool bAtStart, int nUserData = 0 )
+{
+    SalData::ensureThreadAutoreleasePool();
+SAL_WNODEPRECATED_DECLARATIONS_PUSH
+// 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
+    NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
+                               location: NSZeroPoint
+                               modifierFlags: 0
+                               timestamp: [NSDate timeIntervalSinceReferenceDate]
+                               windowNumber: 0
+                               context: nil
+                               subtype: nEventId
+                               data1: nUserData
+                               data2: 0 ];
+SAL_WNODEPRECATED_DECLARATIONS_POP
+    assert( pEvent );
+    [NSApp postEvent: pEvent atStart: bAtStart];
+}
+
+static void ImplSalStartTimer( sal_uLong nMS )
 {
     SalData* pSalData = GetSalData();
+
+    if ( 0 == nMS )
+    {
+        ImplSalStopTimer();
+        ImplPostEvent( AquaSalInstance::DispatchTimerEvent, false );
+        return;
+    }
+
     if( pSalData->mpFirstInstance->isNSAppThread() )
     {
-        AquaSalTimer::bDispatchTimer = true;
-        NSTimeInterval aTI = double(nMS)/1000.0;
+        NSTimeInterval aTI = double(nMS) / 1000.0;
         if( AquaSalTimer::pRunningTimer != nil )
         {
             if (rtl::math::approxEqual(
@@ -46,18 +73,16 @@ void ImplSalStartTimer( sal_uLong nMS )
                 [AquaSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]];
             }
             else
-            {
-                [AquaSalTimer::pRunningTimer invalidate];
-                AquaSalTimer::pRunningTimer = nil;
-            }
+                ImplSalStopTimer();
         }
         if( AquaSalTimer::pRunningTimer == nil )
         {
-            AquaSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI
-                                                   target: [[[TimerCallbackCaller alloc] init] autorelease]
-                                                   selector: @selector(timerElapsed:)
-                                                   userInfo: nil
-                                                   repeats: YES];
+            AquaSalTimer::pRunningTimer = [[NSTimer scheduledTimerWithTimeInterval: aTI
+                                                    target: [[[TimerCallbackCaller alloc] init] autorelease]
+                                                    selector: @selector(timerElapsed:)
+                                                    userInfo: nil
+                                                    repeats: NO
+                                           ] retain];
             /* #i84055# add timer to tracking run loop mode,
                so they also elapse while e.g. life resize
             */
@@ -65,29 +90,25 @@ void ImplSalStartTimer( sal_uLong nMS )
         }
     }
     else
+        ImplPostEvent( AquaSalInstance::AppStartTimerEvent, true, nMS );
+}
+
+static void ImplSalStopTimer()
+{
+    if( AquaSalTimer::pRunningTimer != nil )
     {
-        SalData::ensureThreadAutoreleasePool();
-        // post an event so we can get into the main thread
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    // 'NSApplicationDefined' is deprecated: first deprecated in macOS 10.12
-        NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                                   location: NSZeroPoint
-                                   modifierFlags: 0
-                                   timestamp: [NSDate timeIntervalSinceReferenceDate]
-                                   windowNumber: 0
-                                   context: nil
-                                   subtype: AquaSalInstance::AppStartTimerEvent
-                                   data1: (int)nMS
-                                   data2: 0 ];
-SAL_WNODEPRECATED_DECLARATIONS_POP
-        if( pEvent )
-            [NSApp postEvent: pEvent atStart: YES];
+        [AquaSalTimer::pRunningTimer invalidate];
+        [AquaSalTimer::pRunningTimer release];
+        AquaSalTimer::pRunningTimer = nil;
     }
 }
 
-void ImplSalStopTimer()
+void AquaSalTimer::handleDispatchTimerEvent()
 {
-    AquaSalTimer::bDispatchTimer = false;
+    ImplSVData* pSVData = ImplGetSVData();
+    SolarMutexGuard aGuard;
+    if( pSVData->maSchedCtx.mpSalTimer )
+        pSVData->maSchedCtx.mpSalTimer->CallCallback();
 }
 
 void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent )
@@ -98,14 +119,10 @@ void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent )
         NSTimeInterval posted = [pEvent timestamp] + NSTimeInterval([pEvent data1])/1000.0;
         NSTimeInterval current = [NSDate timeIntervalSinceReferenceDate];
         if( (posted - current) <= 0.0 )
-        {
-            SolarMutexGuard aGuard;
-            if( pSVData->maSchedCtx.mpSalTimer )
-                pSVData->maSchedCtx.mpSalTimer->CallCallback();
-        }
-        ImplSalStartTimer( sal_uLong( [pEvent data1] ) );
+            handleDispatchTimerEvent();
+        else
+            ImplSalStartTimer( sal_uLong( [pEvent data1] ) );
     }
-
 }
 
 AquaSalTimer::AquaSalTimer( )
diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm
index 4c38466..2add55f 100644
--- a/vcl/osx/vclnsapp.mm
+++ b/vcl/osx/vclnsapp.mm
@@ -73,8 +73,8 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
                                data1: 0
                                data2: 0 ];
 SAL_WNODEPRECATED_DECLARATIONS_POP
-    if( pEvent )
-        [NSApp postEvent: pEvent atStart: NO];
+    assert( pEvent );
+    [NSApp postEvent: pEvent atStart: NO];
 }
 
 -(void)sendEvent:(NSEvent*)pEvent
commit 493f779c098c75b988621097907896a59cfd9798
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Feb 24 20:01:23 2017 +0100

    KDE fix various clang plugin complains
    
    Fixes clang plugin reported problems in the KDE and KDE4 backend.
    
    Change-Id: I0280beae9dd6f33ee59bdbe89cd38222f33fdc68

diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx
index 9de3b87..af99f44 100644
--- a/connectivity/source/drivers/kab/KDriver.cxx
+++ b/connectivity/source/drivers/kab/KDriver.cxx
@@ -274,9 +274,7 @@ bool KabImplModule::impl_doAllowNewKDEVersion()
         Reference< XMultiServiceFactory > xConfigProvider(
             css::configuration::theDefaultProvider::get( m_xContext ) );
         Sequence< Any > aCreationArgs(1);
-        aCreationArgs[0] <<= PropertyValue(
-                                OUString(  "nodepath"  ),
-                                0,
+        aCreationArgs[0] <<= PropertyValue( "nodepath", 0,
                                 makeAny( KabDriver::impl_getConfigurationSettingsPath() ),
                                 PropertyState_DIRECT_VALUE );
         Reference< XPropertySet > xSettings( xConfigProvider->createInstanceWithArguments(
diff --git a/vcl/inc/unx/kde/kdedata.hxx b/vcl/inc/unx/kde/kdedata.hxx
index cc238dc..926909a 100644
--- a/vcl/inc/unx/kde/kdedata.hxx
+++ b/vcl/inc/unx/kde/kdedata.hxx
@@ -23,6 +23,9 @@
 #include <unx/saldisp.hxx>
 #include <unx/saldata.hxx>
 #include <unx/salframe.h>
+#include <unx/salgdi.h>
+
+#include <memory>
 
 class KDEData : public X11SalData
 {
@@ -48,13 +51,9 @@ class KDESalFrame : public X11SalFrame
 
     struct GraphicsHolder
     {
-        X11SalGraphics*     pGraphics;
+        std::unique_ptr<X11SalGraphics> pGraphics;
         bool                bInUse;
-        GraphicsHolder()
-                : pGraphics( nullptr ),
-                  bInUse( false )
-        {}
-        ~GraphicsHolder();
+        GraphicsHolder() : bInUse( false ) {}
     };
     GraphicsHolder m_aGraphics[ nMaxGraphics ];
 
@@ -77,7 +76,6 @@ protected:
 public:
     KDESalInstance( SalYieldMutex* pMutex )
             : X11SalInstance( pMutex ) {}
-    virtual ~KDESalInstance() override {}
     virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
 
     virtual bool hasNativeFileSelection() const override { return true; }
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index b4d15c8..c4e9d10 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -129,7 +129,6 @@ class KDEX11Pixmap : public X11Pixmap
 {
 public:
     KDEX11Pixmap( int nWidth, int nHeight );
-    virtual ~KDEX11Pixmap() override {};
 
     virtual int          GetDepth() const override;
     virtual SalX11Screen GetScreen() const override;
@@ -1238,7 +1237,6 @@ class KDESalGraphics : public X11SalGraphics
 {
   public:
     KDESalGraphics() {}
-    virtual ~KDESalGraphics() override {}
     virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override;
     virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart,
                                        const Rectangle& rControlRegion, const Point& aPos,
@@ -2017,10 +2015,10 @@ SalGraphics* KDESalFrame::AcquireGraphics()
                 m_aGraphics[i].bInUse = true;
                 if( ! m_aGraphics[i].pGraphics )
                 {
-                    m_aGraphics[i].pGraphics = new KDESalGraphics();
+                    m_aGraphics[i].pGraphics.reset (new KDESalGraphics() );
                     m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
                 }
-                return m_aGraphics[i].pGraphics;
+                return m_aGraphics[i].pGraphics.get();
             }
         }
     }
@@ -2032,7 +2030,7 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
 {
     for( int i = 0; i < nMaxGraphics; i++ )
     {
-        if( m_aGraphics[i].pGraphics == pGraphics )
+        if( m_aGraphics[i].pGraphics.get() == pGraphics )
         {
             m_aGraphics[i].bInUse = false;
             break;
@@ -2054,11 +2052,6 @@ KDESalFrame::~KDESalFrame()
 {
 }
 
-KDESalFrame::GraphicsHolder::~GraphicsHolder()
-{
-    delete pGraphics;
-}
-
 // KDESalInstance implementation
 
 SalFrame * KDESalInstance::CreateFrame( SalFrame *pParent, SalFrameStyleFlags nStyle )
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 2d4b1eb..9ff22c9 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -345,7 +345,7 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
 {
     for( int i = 0; i < nMaxGraphics; i++ )
     {
-        if( m_aGraphics[i].pGraphics == pGraphics )
+        if( m_aGraphics[i].pGraphics.get() == pGraphics )
         {
             m_aGraphics[i].bInUse = false;
             break;
@@ -363,14 +363,6 @@ void KDESalFrame::updateGraphics( bool bClear )
     }
 }
 
-KDESalFrame::~KDESalFrame()
-{
-}
-
-KDESalFrame::GraphicsHolder::~GraphicsHolder()
-{
-}
-
 SalGraphics* KDESalFrame::AcquireGraphics()
 {
     if( GetWindow() )
@@ -382,10 +374,10 @@ SalGraphics* KDESalFrame::AcquireGraphics()
                 m_aGraphics[i].bInUse = true;
                 if( ! m_aGraphics[i].pGraphics )
                 {
-                    m_aGraphics[i].pGraphics = new KDESalGraphics;
+                    m_aGraphics[i].pGraphics.reset( new KDESalGraphics );
                     m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
                 }
-                return m_aGraphics[i].pGraphics;
+                return m_aGraphics[i].pGraphics.get();
             }
         }
     }
diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx
index d6a92ce..114cd49 100644
--- a/vcl/unx/kde4/KDESalFrame.hxx
+++ b/vcl/unx/kde4/KDESalFrame.hxx
@@ -23,6 +23,7 @@
 
 #include <unx/saldisp.hxx>
 #include <unx/salframe.h>
+#include <unx/salgdi.h>
 
 class KDESalFrame : public X11SalFrame
 {
@@ -31,18 +32,16 @@ class KDESalFrame : public X11SalFrame
 
         struct GraphicsHolder
         {
-            X11SalGraphics* pGraphics;
+            std::unique_ptr<X11SalGraphics> pGraphics;
             bool bInUse;
 
-            GraphicsHolder() : pGraphics(nullptr),bInUse( false ) {}
-            ~GraphicsHolder();
+            GraphicsHolder() : bInUse( false ) {}
         };
 
         GraphicsHolder m_aGraphics[ nMaxGraphics ];
 
     public:
         KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
-        virtual ~KDESalFrame() override;
 
         virtual SalGraphics* AcquireGraphics() override;
         virtual void ReleaseGraphics( SalGraphics *pGraphics ) override;
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
index d6bd676..6d5f3b8 100644
--- a/vcl/unx/kde4/KDEXLib.hxx
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -64,7 +64,7 @@ class KDEXLib : public QObject, public SalXLib
         void socketNotifierActivated( int fd );
         void timeoutActivated();
         void startTimeoutTimer();
-        bool processYield( bool bWait, bool bHandleAllCurrentEvents );
+        static bool processYield( bool bWait, bool bHandleAllCurrentEvents );
 
     Q_SIGNALS:
         void startTimeoutTimerSignal();
commit fdde5f09ea578aba909753f51f6795083f3100c5
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Feb 16 10:35:32 2017 +0100

    MM add notification for send mails
    
    Now that the mail merge job waits for all emails to send, we should
    inform about send mail progress. Therefore this patch adds a new
    notification event.
    
    Change-Id: I0b17ef471f73b75059b31c5da411167571ebea40

diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx
index f0fc855..f939551 100644
--- a/include/sfx2/event.hxx
+++ b/include/sfx2/event.hxx
@@ -67,6 +67,7 @@ enum class SfxEventHintId {
     SwEventFieldMerge,
     SwEventFieldMergeFinished,
     SwEventLayoutFinished,
+    SwEventMergeMailSend,
 };
 
 class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index ed63b5f..a348fc1 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -44,6 +44,7 @@
 #define     STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
 #define     STR_SW_EVENT_FRM_RESIZE           11
 #define     STR_SW_EVENT_FRM_MOVE             12
+#define     STR_SW_EVENT_MERGE_MAIL_SEND      13
 
 class SwFrameFormat;
 class SwFormatINetFormat;
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index fa4d931..bd4e903 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -302,6 +302,7 @@ struct SwDBManager::SwDBManager_Impl
     rtl::Reference<SwDBManager::ConnectionDisposedListener_Impl> m_xDisposeListener;
     rtl::Reference<SwDataSourceRemovedListener> m_xDataSourceRemovedListener;
     osl::Mutex                    m_aAllEmailSendMutex;
+    sal_uInt32                      m_nMessageSend;
     uno::Reference< mail::XMailMessage> m_xLastMessage;
 
     explicit SwDBManager_Impl(SwDBManager& rDBManager)
@@ -1094,6 +1095,7 @@ public:
         osl::MutexGuard aGuard( m_rDBManager.pImpl->m_aAllEmailSendMutex );
         if ( m_rDBManager.pImpl->m_xLastMessage == xMessage )
             m_rDBManager.pImpl->m_xLastMessage.clear();
+        ++m_rDBManager.pImpl->m_nMessageSend;
     }
 
     virtual void mailDeliveryError( ::rtl::Reference<MailDispatcher> xMailDispatcher,
@@ -1106,6 +1108,17 @@ public:
     }
 };
 
+static void lcl_NotifySendMails( sal_uInt32 &rMessageSend, sal_uInt32 &rMessageNotified,
+                                 SfxObjectShell* pDocShell )
+{
+    while ( rMessageSend > rMessageNotified )
+    {
+        lcl_emitEvent( SfxEventHintId::SwEventMergeMailSend,
+            STR_SW_EVENT_MERGE_MAIL_SEND, pDocShell );
+        ++rMessageNotified;
+    }
+}
+
 /**
  * Please have a look at the README in the same directory, before you make
  * larger changes in this function!
@@ -1156,6 +1169,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     ::rtl::Reference< IMailDispatcherListener > xMailListener;
     OUString                            sMailBodyMimeType;
     rtl_TextEncoding                    sMailEncoding = ::osl_getThreadTextEncoding();
+    sal_uInt32                            nMessageNotified = 0;
 
     uno::Reference< beans::XPropertySet > xColumnProp;
 
@@ -1183,6 +1197,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
         {
             // Reset internal mail accounting data
             pImpl->m_xLastMessage.clear();
+            pImpl->m_nMessageSend = 0;
 
             xMailDispatcher.set( new MailDispatcher(rMergeDescriptor.xSmtpServer) );
             xMailListener = new MailDispatcherListener_Impl( *this );
@@ -1541,6 +1556,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             }
         }
 
+        if ( bMT_EMAIL )
+            lcl_NotifySendMails( pImpl->m_nMessageSend, nMessageNotified, xWorkDocSh );
+
         bWorkDocInitialized = true;
         nDocNo++;
         nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
@@ -1647,6 +1665,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
 
     if( xMailDispatcher.is() )
     {
+        lcl_NotifySendMails( pImpl->m_nMessageSend, nMessageNotified, xWorkDocSh );
         if( IsMergeOk() )
         {
             // TODO: Instead of polling via an AutoTimer, post an Idle event,
@@ -1657,7 +1676,10 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             aEmailDispatcherPollTimer.SetTimeout( 500 );
             aEmailDispatcherPollTimer.Start();
             while( IsMergeOk() && pImpl->m_xLastMessage.is() )
+            {
                 Application::Yield();
+                lcl_NotifySendMails( pImpl->m_nMessageSend, nMessageNotified, xWorkDocSh );
+            }
             aEmailDispatcherPollTimer.Stop();
         }
         xMailDispatcher->stop();
commit a7eaee55fdef20242f629383a6dbb6120615c4ce
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Feb 9 19:35:20 2017 +0100

    fixup
    
    Change-Id: If5fdef6d74a6e9b69479fd367860425e5b19f5df

diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx
index ae0775a..df7ac0d 100644
--- a/uui/source/loginerr.hxx
+++ b/uui/source/loginerr.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_UUI_SOURCE_LOGINERR_HXX
 
 #include <rtl/ustring.hxx>
+#include <tools/errinf.hxx>
 
 
 #define LOGINERROR_FLAG_MODIFY_ACCOUNT         1
commit 26d94b7a20637bb4e3452ffd301aed088c7812e4
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Feb 7 16:58:31 2017 +0100

    Restart the system timer if it returns to early
    
    At least on Windows our GetSystemTicks() implementation - using
    QueryPerformanceCounter - occasionally states, the timer returned
    too early, which stops processing further LO events.
    
    As a workaround we restart the timer, as it's now the only source
    of running the LO main loop.
    
    Probably we should use osl_getSystemTime, for measuring, which uses
    GetSystemTimePreciseAsFileTime, if available. Nothing states
    anything is monotonic, so in this regard it may be flawed too.
    
    Change-Id: I94eacd8f5bacf277a68575cc8db84653cbc49d12

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 484738a..388c10f 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -234,10 +234,19 @@ bool Scheduler::ProcessTaskScheduling()
 {
     ImplSVData *pSVData = ImplGetSVData();
     ImplSchedulerContext &rSchedCtx = pSVData->maSchedCtx;
-    sal_uInt64  nTime = tools::Time::GetSystemTicks();
-    if ( pSVData->mbDeInit || !HasPendingTasks( rSchedCtx, nTime ) )
+    sal_uInt64 nTime = tools::Time::GetSystemTicks();
+    if ( pSVData->mbDeInit || InfiniteTimeoutMs == rSchedCtx.mnTimerPeriod )
         return false;
 
+    if ( nTime < rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod )
+    {
+        SAL_WARN( "vcl.schedule", "we're to early - restart the timer!" );
+        UpdateSystemTimer( rSchedCtx,
+                           rSchedCtx.mnTimerStart + rSchedCtx.mnTimerPeriod - nTime,
+                           true, nTime );
+        return false;
+    }
+
     ImplSchedulerData* pSchedulerData = nullptr;
     ImplSchedulerData* pPrevSchedulerData = nullptr;
     ImplSchedulerData *pMostUrgent = nullptr;
commit 5f93b7331a6a718e0266cdeeb2876180c3edcb47
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Sep 14 18:17:18 2016 +0200

    Don't poll busy documents via idle task
    
    Creates a very busy idle-loop, for non-task work like mail merge.
    
    Change-Id: If7be82e4675008f23e6f4f6be5c40df40a231a8b

diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index 83ce6fe..4a98555 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -40,44 +40,44 @@ namespace sw
 DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ),
                                                                 mbStartIdleTimer( false ),
                                                                 mIdleBlockCount( 0 ),
-                                                                maIdle("DocumentTimerManagerIdleTimer")
+                                                                maDocIdle( i_rSwdoc )
 {
-    maIdle.SetPriority( TaskPriority::LOWEST );
-    maIdle.SetInvokeHandler( LINK( this, DocumentTimerManager, DoIdleJobs) );
-    maIdle.SetDebugName( "sw::DocumentTimerManager maIdle" );
+    maDocIdle.SetPriority( TaskPriority::LOWEST );
+    maDocIdle.SetInvokeHandler( LINK( this, DocumentTimerManager, DoIdleJobs) );
+    maDocIdle.SetDebugName( "sw::DocumentTimerManager maDocIdle" );
 }
 
 void DocumentTimerManager::StartIdling()
 {
     mbStartIdleTimer = true;
     if( !mIdleBlockCount )
-        maIdle.Start();
+        maDocIdle.Start();
 }
 
 void DocumentTimerManager::StopIdling()
 {
     mbStartIdleTimer = false;
-    maIdle.Stop();
+    maDocIdle.Stop();
 }
 
 void DocumentTimerManager::BlockIdling()
 {
-    maIdle.Stop();
+    maDocIdle.Stop();
     ++mIdleBlockCount;
 }
 
 void DocumentTimerManager::UnblockIdling()
 {
     --mIdleBlockCount;
-    if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() )
-        maIdle.Start();
+    if( !mIdleBlockCount && mbStartIdleTimer && !maDocIdle.IsActive() )
+        maDocIdle.Start();
 }
 
 void DocumentTimerManager::StartBackgroundJobs()
 {
     // Trigger DoIdleJobs(), asynchronously.
-    if (!maIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0
-        maIdle.Start();
+    if (!maDocIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0
+        maDocIdle.Start();
 }
 
 IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
@@ -96,10 +96,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
         for(SwViewShell& rSh : pShell->GetRingContainer())
         {
             if( rSh.ActionPend() )
-            {
-                pIdle->Start();
                 return;
-            }
         }
 
         if( pTmpRoot->IsNeedGrammarCheck() )
@@ -119,9 +116,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
             if ((*pLayIter)->IsIdleFormat())
             {
                 (*pLayIter)->GetCurrShell()->LayoutIdle();
-
                 // Defer the remaining work.
-                pIdle->Start();
                 return;
             }
         }
@@ -135,11 +130,8 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
                 /* && !pStartSh->GetViewOptions()->IsFieldName()*/ )
         {
             if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() ||
-                 m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
-            {
-                pIdle->Start();
+                      m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
                 return;
-            }
 
             //  Action brackets!
             m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true );
@@ -167,6 +159,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
     if( pModLogFile && 1 != (long)pModLogFile )
         delete pModLogFile, static_cast<long&>(pModLogFile) = 1;
 #endif
+    pIdle->Stop();
 }
 
 DocumentTimerManager::~DocumentTimerManager() {}
diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx
index da4b9e4..698762a 100644
--- a/sw/source/core/inc/DocumentTimerManager.hxx
+++ b/sw/source/core/inc/DocumentTimerManager.hxx
@@ -21,8 +21,8 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX
 
 #include <IDocumentTimerAccess.hxx>
+#include <SwDocIdle.hxx>
 
-#include <vcl/idle.hxx>
 #include <sal/types.h>
 #include <tools/link.hxx>
 
@@ -47,7 +47,6 @@ public:
 
     void StartBackgroundJobs() override;
 
-    // Our own 'IdleTimer' calls the following method
     DECL_LINK( DoIdleJobs, Timer *, void );
 
     virtual ~DocumentTimerManager() override;
@@ -61,7 +60,7 @@ private:
 
     bool mbStartIdleTimer; //< idle timer mode start/stop
     sal_Int32 mIdleBlockCount;
-    Idle  maIdle;
+    SwDocIdle maDocIdle;
 };
 
 }
commit ef04117b66d6410d0907d774c8b349c16363d2ba
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sun Jul 31 16:35:49 2016 +0200

    Don't update document stats for non-idle views
    
    This functionality should be merged into the DocumentTimerManager,
    which itself should run the different document idle tasks via
    seperate jobs instead of a single idle, if they don't depend on
    each other.
    
    To implement a non-busy, suspendable Idle, this adds an AutoIdle
    class, which is automatically re-scheduled after being processed.
    
    It also adds a SwDocIdle, which isn't ready to schedule for busy
    documents.
    
    Change-Id: I185137ed3423ecaae0f7edb39018d26c4244d359

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 811c8c6..9c13630 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -159,6 +159,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/crsr/trvltbl \
     sw/source/core/crsr/viscrs \
     sw/source/core/crsr/overlayrangesoutline \
+    sw/source/core/doc/SwDocIdle \
     sw/source/core/doc/SwStyleNameMapper \
     sw/source/core/doc/acmplwrd \
     sw/source/core/doc/CntntIdxStore \
diff --git a/sw/inc/SwDocIdle.hxx b/sw/inc/SwDocIdle.hxx
new file mode 100644
index 0000000..6bc65e2
--- /dev/null
+++ b/sw/inc/SwDocIdle.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SW_INC_SWDOCIDLE_HXX
+#define INCLUDED_SW_INC_SWDOCIDLE_HXX
+
+#include <doc.hxx>
+#include <vcl/idle.hxx>
+
+namespace sw {
+
+/**
+ * An Idle, which is just ready to be scheduled for idle documents.
+ *
+ * Currently it's missing the notification, when busy documents become idle
+ * again, so it relies on any task being triggered to recheck, which is
+ * quite probably not a problem, as busy documents have a high chance to have
+ * generated idle tasks.
+ */
+class SwDocIdle : public AutoIdle
+{
+private:
+    SwDoc &m_rDoc;
+
+protected:
+    virtual sal_uInt64 UpdateMinPeriod(
+        sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override;
+
+public:
+    SwDocIdle( SwDoc &doc );
+    virtual ~SwDocIdle() override;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index f529d54..9d050e0 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -34,6 +34,8 @@
 #include <vector>
 #include <viewsh.hxx>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
 
 using namespace ::com::sun::star;
 
@@ -71,12 +73,13 @@ namespace sw
 
 DocumentStatisticsManager::DocumentStatisticsManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ),
                                                                           mpDocStat( new SwDocStat ),
-                                                                          mbInitialized( false )
+                                                                          mbInitialized( false ),
+                                                                          maStatsUpdateIdle( i_rSwdoc )
+
 {
-    maStatsUpdateTimer.SetTimeout( 1 );
-    maStatsUpdateTimer.SetPriority( TaskPriority::LOWEST );
-    maStatsUpdateTimer.SetInvokeHandler( LINK( this, DocumentStatisticsManager, DoIdleStatsUpdate ) );
-    maStatsUpdateTimer.SetDebugName( "sw::DocumentStatisticsManager maStatsUpdateTimer" );
+    maStatsUpdateIdle.SetPriority( TaskPriority::LOWEST );
+    maStatsUpdateIdle.SetInvokeHandler( LINK( this, DocumentStatisticsManager, DoIdleStatsUpdate ) );
+    maStatsUpdateIdle.SetDebugName( "sw::DocumentStatisticsManager maStatsUpdateIdle" );
 }
 
 void DocumentStatisticsManager::DocInfoChgd(bool const isEnableSetModified)
@@ -120,14 +123,15 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields
     {
         if (!bCompleteAsync)
         {
+            maStatsUpdateIdle.Stop();
             while (IncrementalDocStatCalculate(
                         std::numeric_limits<long>::max(), bFields)) {}
-            maStatsUpdateTimer.Stop();
         }
-        else if (IncrementalDocStatCalculate(5000, bFields))
-            maStatsUpdateTimer.Start();
         else
-            maStatsUpdateTimer.Stop();
+        {
+            if (!maStatsUpdateIdle.IsActive() && IncrementalDocStatCalculate(5000, bFields))
+                maStatsUpdateIdle.Start();
+        }
     }
 }
 
@@ -178,7 +182,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
     }
 
     mpDocStat->nPage     = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ? m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum() : 0;
-    mpDocStat->bModified = false;
+    SetDocStatModified( false );
 
     css::uno::Sequence < css::beans::NamedValue > aStat( mpDocStat->nPage ? 8 : 7);
     sal_Int32 n=0;
@@ -233,11 +237,10 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
     return nChars < 0;
 }
 
-IMPL_LINK_NOARG( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, void )
+IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pIdle, void )
 {
-    if (IncrementalDocStatCalculate(32000))
-        maStatsUpdateTimer.Start();
-
+    if (!IncrementalDocStatCalculate(32000))
+        pIdle->Stop();
     SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
     if( pView )
         pView->UpdateDocStats();
@@ -245,7 +248,7 @@ IMPL_LINK_NOARG( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, void )
 
 DocumentStatisticsManager::~DocumentStatisticsManager()
 {
-    maStatsUpdateTimer.Stop();
+    maStatsUpdateIdle.Stop();
     delete mpDocStat;
 }
 
diff --git a/sw/source/core/doc/SwDocIdle.cxx b/sw/source/core/doc/SwDocIdle.cxx
new file mode 100644
index 0000000..9dd0e32
--- /dev/null
+++ b/sw/source/core/doc/SwDocIdle.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+
+#include "SwDocIdle.hxx"
+
+namespace sw
+{
+
+sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTimeNow */ ) const
+{
+    bool bReadyForSchedule = true;
+    SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
+    if( pView )
+    {
+        SwWrtShell& rWrtShell = pView->GetWrtShell();
+        bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
+    }
+    return bReadyForSchedule
+        ? Scheduler::ImmediateTimeoutMs : Scheduler::InfiniteTimeoutMs;
+}
+
+SwDocIdle::SwDocIdle( SwDoc &doc )
+    : m_rDoc( doc )
+{
+}
+
+SwDocIdle::~SwDocIdle()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/DocumentStatisticsManager.hxx b/sw/source/core/inc/DocumentStatisticsManager.hxx
index b21e8ec..41b961f 100644
--- a/sw/source/core/inc/DocumentStatisticsManager.hxx
+++ b/sw/source/core/inc/DocumentStatisticsManager.hxx
@@ -20,11 +20,10 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATISTICSMANAGER_HXX
 
 #include <IDocumentStatistics.hxx>
-#include <vcl/timer.hxx>
+#include <SwDocIdle.hxx>
 
 class SwDoc;
 struct SwDocStat;
-class Timer;
 
 namespace sw {
 
@@ -61,10 +60,9 @@ private:
     // Our own 'StatsUpdateTimer' calls the following method
     DECL_LINK( DoIdleStatsUpdate, Timer *, void );
 
-
-    SwDocStat       *mpDocStat;          //< Statistics information.
-    bool            mbInitialized;       // allow first time update
-    Timer       maStatsUpdateTimer;      //< Timer for asynchronous stats calculation
+    SwDocStat       *mpDocStat;          //< Statistics information
+    bool             mbInitialized;      //< allow first time update
+    SwDocIdle        maStatsUpdateIdle;  //< Idle for asynchronous stats calculation
 };
 
 }
commit f5ae275eac01aaa60355fa2ed9e9e265f9a53f2b
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 12:00:53 2016 +0200

    Reorganize Scheduler priority classes
    
    This is based on glibs classification of tasks, but while glib uses
    an int for more fine grained priority, we stay with our enum.
    
    1. Timers start with DEFAULT priority, which directly corresponds
       with the previous HIGH priority
    2. Idles start with DEFAULT_IDLE priority instead of the previous
       HIGH priority, so idle default becomes "really run when idle".
    
    As RESIZE and REPAINT are special, and the DEFAULTS are set, there
    is just one primary decision for the programmer: should my idle
    run before paint (AKA HIGH_IDLE)?
    
    If we really need a more fine-grained classification, we can add it
    later, or also switch to a real int. As a result, this drops many
    classifications from the code and drastically changes behaviour,
    AKA a mail merge from KDE is now as fast as Gtk+ again.
    
    Change-Id: I498a73fd02d5fb6f5d7e9f742f3bce972de9b1f9

diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index 18d4f55..c44a12f 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -114,7 +114,7 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
         mpZoomToolBox->SetPaintTransparent( true );
     }
 
-    maIdle.SetPriority( TaskPriority::LOW );
+    maIdle.SetPriority( TaskPriority::HIGH_IDLE );
     maIdle.SetInvokeHandler( LINK( this, MediaControl, implTimeoutHdl ) );
     maIdle.Start();
 }
diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx
index 45f1b61..a2ea3ed 100644
--- a/avmedia/source/framework/soundhandler.cxx
+++ b/avmedia/source/framework/soundhandler.cxx
@@ -221,7 +221,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL&
         // Count this request and initialize self-holder against dying by uno ref count ...
         m_xSelfHold.set(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
         m_xPlayer->start();
-        m_aUpdateIdle.SetPriority( TaskPriority::LOWER );
+        m_aUpdateIdle.SetPriority( TaskPriority::HIGH_IDLE );
         m_aUpdateIdle.Start();
     }
     catch( css::uno::Exception& e )
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 18b4e94..b44f77d 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -123,7 +123,7 @@ bool OGLPlayer::create( const OUString& rURL )
 
     // Set timer
     m_aTimer.SetTimeout(8); // is 125fps enough for anyone ?
-    m_aTimer.SetPriority(TaskPriority::LOW);
+    m_aTimer.SetPriority(TaskPriority::HIGH_IDLE);
     m_aTimer.SetInvokeHandler(LINK(this,OGLPlayer,TimerHandler));
 
     return true;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a82d57c..35d0e41 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -960,7 +960,6 @@ void EditorWindow::CreateEditEngine()
 
     ImplSetFont();
 
-    aSyntaxIdle.SetPriority( TaskPriority::LOWER );
     aSyntaxIdle.SetInvokeHandler( LINK( this, EditorWindow, SyntaxTimerHdl ) );
 
     bool bWasDoSyntaxHighlight = bDoSyntaxHighlight;
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index ecdbdf5..6568ac9 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -217,7 +217,6 @@ DlgEditor::DlgEditor (
     m_ClipboardDataFlavorsResource[1].HumanPresentableName = "Dialog 8.0" ;
     m_ClipboardDataFlavorsResource[1].DataType =             cppu::UnoType<Sequence< sal_Int8 >>::get();
 
-    aMarkIdle.SetPriority(TaskPriority::LOW);
     aMarkIdle.SetInvokeHandler( LINK( this, DlgEditor, MarkTimeout ) );
 
     rWindow.SetMapMode( MapMode( MapUnit::Map100thMM ) );
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 871c43a..42a5a77 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -186,7 +186,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
     m_pParameterBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) );
     m_pClassPathBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) );
     m_aResetIdle.SetInvokeHandler( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) );
-    m_aResetIdle.SetPriority(TaskPriority::LOWER);
 
     m_pExpertConfigBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ExpertConfigHdl_Impl) );
     if (!officecfg::Office::Common::Security::EnableExpertConfiguration::get())
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 6f383c3..0067682 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1063,7 +1063,7 @@ void OJoinTableView::ScrollWhileDragging()
     // resetting timer, if still necessary
     if (bNeedScrollTimer)
     {
-        m_aDragScrollIdle.SetPriority(TaskPriority::LOW);
+        m_aDragScrollIdle.SetPriority( TaskPriority::HIGH_IDLE );
         m_aDragScrollIdle.Start();
     }
 
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index d795395..a9e4ef3 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1801,7 +1801,6 @@ OUString FormulaDlg::GetMeText() const
 void FormulaDlg::Update()
 {
     m_pImpl->Update();
-    m_pImpl->aIdle.SetPriority(TaskPriority::LOWER);
     m_pImpl->aIdle.SetInvokeHandler(LINK( this, FormulaDlg, UpdateFocusHdl));
     m_pImpl->aIdle.Start();
 }
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 685381f..35c8312 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -409,7 +409,6 @@ RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits
     , pLabelWidget(pShrinkModeLabel)
 {
     aIdle.SetInvokeHandler( LINK( this, RefEdit, UpdateHdl ) );
-    aIdle.SetPriority( TaskPriority::LOW );
 }
 
 VCL_BUILDER_DECL_FACTORY(RefEdit)
@@ -478,7 +477,6 @@ void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel
     if( pDlg )
     {
         aIdle.SetInvokeHandler( LINK( this, RefEdit, UpdateHdl ) );
-        aIdle.SetPriority( TaskPriority::LOW );
     }
     else
     {
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 1243f2d..3b64726 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -138,6 +138,7 @@ LayoutManager::LayoutManager( const Reference< XComponentContext >& xContext ) :
         m_xToolbarManager = new ToolbarLayoutManager( xContext, Reference<XUIElementFactory>(m_xUIElementFactoryManager, UNO_QUERY_THROW), this );
     }
 
+    m_aAsyncLayoutTimer.SetPriority( TaskPriority::HIGH_IDLE );
     m_aAsyncLayoutTimer.SetTimeout( 50 );
     m_aAsyncLayoutTimer.SetInvokeHandler( LINK( this, LayoutManager, AsyncLayoutHdl ) );
     m_aAsyncLayoutTimer.SetDebugName( "framework::LayoutManager m_aAsyncLayoutTimer" );
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index b20c267..feb248c 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -75,16 +75,14 @@ struct ImplSchedulerData;
 
 enum class TaskPriority
 {
-    HIGHEST      = 0,
-    HIGH         = 1,
-    RESIZE       = 2,
-    REPAINT      = 3,
-    MEDIUM       = 3,
-    POST_PAINT   = 4,
-    DEFAULT_IDLE = 5,
-    LOW          = 6,
-    LOWER        = 7,
-    LOWEST       = 8
+    HIGHEST,       ///< These events should run very fast!
+    DEFAULT,       ///< Default priority used, e.g. the default timer priority
+    HIGH_IDLE,     ///< Important idle events to be run before processing drawing events
+    RESIZE,        ///< Resize runs before repaint, so we won't paint twice
+    REPAINT,       ///< All repaint events should go in here
+    POST_PAINT,    ///< Everything running directly after painting
+    DEFAULT_IDLE,  ///< Default idle priority
+    LOWEST         ///< Low, very idle cleanup tasks
 };
 
 class VCL_DLLPUBLIC Task
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 177d87d..b441ab4 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -116,7 +116,6 @@ ODesignView::ODesignView(   vcl::Window* pParent,
     m_aSplitWin->SetAlign(WindowAlign::Left);
     m_aSplitWin->Show();
 
-    m_aMarkIdle.SetPriority( TaskPriority::LOW );
     m_aMarkIdle.SetInvokeHandler( LINK( this, ODesignView, MarkTimeout ) );
 }
 
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a2365bb..8f1f4f5 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -250,7 +250,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
     SetLanguage( ScGlobal::eLnge, ScGlobal::eLnge, ScGlobal::eLnge );
 
     aTrackIdle.SetInvokeHandler( LINK( this, ScDocument, TrackTimeHdl ) );
-    aTrackIdle.SetPriority( TaskPriority::LOW );
 }
 
 sfx2::LinkManager* ScDocument::GetLinkManager()
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 580c34ac..c67b70e 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -179,7 +179,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
                                         ERRCODE_AREA_APP2-1,
                                         GetResMgr() );
 
-    aSpellIdle.SetPriority(TaskPriority::LOWER);
     aSpellIdle.SetInvokeHandler( LINK( this, ScModule, SpellTimerHdl ) );
     aSpellIdle.SetDebugName( "sc::ScModule aSpellIdle" );
 
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index ac5d9b5..81d841e 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -109,13 +109,11 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window
     m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this);
     nAcceptCount=0;
     nRejectCount=0;
-    aReOpenIdle.SetPriority(TaskPriority::MEDIUM);
     aReOpenIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl ));
 
     pTPFilter=m_pAcceptChgCtr->GetFilterPage();
     pTPView=m_pAcceptChgCtr->GetViewPage();
     pTheView=pTPView->GetTableControl();
-    aSelectionIdle.SetPriority(TaskPriority::LOW);
     aSelectionIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl ));
     aSelectionIdle.SetDebugName( "ScAcceptChgDlg  aSelectionIdle" );
 
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 54425e0..611aea2 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -764,7 +764,6 @@ ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef
         pActiveWin(nullptr)
 {
     m_aHelper.SetWindow(m_rWindow.get());
-    aIdle.SetPriority(TaskPriority::LOWER);
     aIdle.SetInvokeHandler(LINK( this, ScRefHandler, UpdateFocusHdl));
 
     if( bBindRef ) EnterRefMode();
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index a6c7104..772f3a8 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -421,7 +421,6 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD
     m_pLbConflicts->SetSelectionMode( SelectionMode::Multiple );
     m_pLbConflicts->SetHighlightRange();
 
-    maSelectionIdle.SetPriority( TaskPriority::LOW );
     maSelectionIdle.SetInvokeHandler( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) );
     maSelectionIdle.SetDebugName( "ScConflictsDlg maSelectionIdle" );
 
diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx
index 7799458..d97cf79 100644
--- a/sd/source/ui/dlg/filedlg.cxx
+++ b/sd/source/ui/dlg/filedlg.cxx
@@ -130,7 +130,6 @@ IMPL_LINK_NOARG(SdFileDialog_Imp, PlayMusicHdl, void*, void)
             {
                 mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl, "" ), css::uno::UNO_QUERY_THROW );
                 mxPlayer->start();
-                maUpdateIdle.SetPriority( TaskPriority::LOW );
                 maUpdateIdle.Start();
             }
             catch (const css::uno::Exception&)
diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx
index 2372158..79171d0 100644
--- a/sd/source/ui/framework/module/ShellStackGuard.cxx
+++ b/sd/source/ui/framework/module/ShellStackGuard.cxx
@@ -72,7 +72,6 @@ ShellStackGuard::ShellStackGuard (Reference<frame::XController>& rxController)
 
         // Prepare the printer polling.
         maPrinterPollingIdle.SetInvokeHandler(LINK(this,ShellStackGuard,TimeoutHandler));
-        maPrinterPollingIdle.SetPriority(TaskPriority::LOWER);
     }
 }
 
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 34d3ae3..f9069f4 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -143,9 +143,7 @@ View::View(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev,
 
     // Timer for delayed drop (has to be for MAC)
     maDropErrorIdle.SetInvokeHandler( LINK(this, View, DropErrorHdl) );
-    maDropErrorIdle.SetPriority(TaskPriority::MEDIUM);
     maDropInsertFileIdle.SetInvokeHandler( LINK(this, View, DropInsertFileHdl) );
-    maDropInsertFileIdle.SetPriority(TaskPriority::MEDIUM);
 }
 
 void View::ImplClearDrawDropMarker()
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 03ae9db..9fba4de 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -109,7 +109,7 @@ SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
         StartListening( *rHint.GetObjShell() );
     pIdle.reset( new Idle("SfxEventASyncer") );
     pIdle->SetInvokeHandler( LINK(this, SfxEventAsyncer_Impl, IdleHdl) );
-    pIdle->SetPriority( TaskPriority::HIGHEST );
+    pIdle->SetPriority( TaskPriority::HIGH_IDLE );
     pIdle->SetDebugName( "sfx::SfxEventAsyncer_Impl pIdle" );
     pIdle->Start();
 }
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1ac1ce2..92f2c40 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -551,7 +551,6 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im
 
     m_pOpenBtn->SetClickHdl( LINK( this, IndexTabPage_Impl, OpenHdl ) );
     aFactoryIdle.SetInvokeHandler( LINK(this, IndexTabPage_Impl, IdleHdl ));
-    aFactoryIdle.SetPriority(TaskPriority::LOWER);
     aKeywordTimer.SetInvokeHandler( LINK( this, IndexTabPage_Impl, TimeoutHdl ) );
 }
 
@@ -1431,7 +1430,6 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)
     nMinWidth = ( m_pActiveLB->GetSizePixel().Width() / 2 );
 
     aIdle.SetInvokeHandler( LINK( this, SfxHelpIndexWindow_Impl, InitHdl ) );
-    aIdle.SetPriority( TaskPriority::LOWER );
     aIdle.Start();
 
     Show();
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 37a1726..d9b71e3 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -450,7 +450,7 @@ void SfxDispatcher::Construct_Impl()
 
     xImp->xPoster = new SfxHintPoster(aGenLink);
 
-    xImp->aIdle.SetPriority(TaskPriority::MEDIUM);
+    xImp->aIdle.SetPriority(TaskPriority::HIGH_IDLE );
     xImp->aIdle.SetInvokeHandler( LINK(this, SfxDispatcher, EventHdl_Impl ) );
     xImp->aIdle.SetDebugName( "sfx::SfxDispatcher_Impl aIdle" );
 }
@@ -574,8 +574,6 @@ void SfxDispatcher::Pop(SfxShell& rShell, SfxDispatcherPopFlags nMode)
     if(!pSfxApp->IsDowning() && !xImp->aToDoStack.empty())
     {
         // No immediate update is requested
-        xImp->aIdle.SetPriority(TaskPriority::MEDIUM);
-        xImp->aIdle.SetInvokeHandler( LINK(this, SfxDispatcher, EventHdl_Impl ) );
         xImp->aIdle.Start();
     }
     else
@@ -770,8 +768,6 @@ void SfxDispatcher::DoActivate_Impl(bool bMDI)
     if(!xImp->aToDoStack.empty())
     {
         // No immediate update is requested
-        xImp->aIdle.SetPriority(TaskPriority::MEDIUM);
-        xImp->aIdle.SetInvokeHandler( LINK(this, SfxDispatcher, EventHdl_Impl ) );
         xImp->aIdle.Start();
     }
 }
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 40933e2..e0d599c 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -143,7 +143,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aEditIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl));
     aEditIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aEditIdle" );
 
-    aAutoArrangeIdle.SetPriority( TaskPriority::LOW );
+    aAutoArrangeIdle.SetPriority( TaskPriority::HIGH_IDLE );
     aAutoArrangeIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl));
     aAutoArrangeIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" );
 
@@ -151,11 +151,11 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aCallSelectHdlIdle.SetInvokeHandler( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl));
     aCallSelectHdlIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" );
 
-    aDocRectChangedIdle.SetPriority( TaskPriority::MEDIUM );
+    aDocRectChangedIdle.SetPriority( TaskPriority::HIGH_IDLE );
     aDocRectChangedIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl));
     aDocRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" );
 
-    aVisRectChangedIdle.SetPriority( TaskPriority::MEDIUM );
+    aVisRectChangedIdle.SetPriority( TaskPriority::HIGH_IDLE );
     aVisRectChangedIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl));
     aVisRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" );
 
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 1928d96..f0f65f3 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -287,7 +287,6 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow *
 
     Resize();
 
-    aUpdateIdle.SetPriority( TaskPriority::LOW );
     aUpdateIdle.SetInvokeHandler( LINK( this, SvxSuperContourDlg, UpdateHdl ) );
 
     aCreateIdle.SetPriority( TaskPriority::RESIZE );
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index dcd1e52..2b8def3 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -204,7 +204,6 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
     m_pCbbTarget->Disable();
     pOwnData->bExecState = false;
 
-    pOwnData->aIdle.SetPriority( TaskPriority::LOW );
     pOwnData->aIdle.SetInvokeHandler( LINK( this, SvxIMapDlg, UpdateHdl ) );
 
     m_pTbxIMapDlg1->EnableItem( mnActiveId, false );
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 0e81e85..a284764 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -61,7 +61,7 @@ namespace sdr
             setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
 
             // init timer
-            SetPriority(TaskPriority::HIGH);
+            SetPriority(TaskPriority::HIGH_IDLE);
             Stop();
         }
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index dfe57ea..6a4756c 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -84,7 +84,7 @@ PagePrimitiveExtractor::PagePrimitiveExtractor(
     setPreviewRenderer(true);
 
     // init timer
-    SetPriority(TaskPriority::HIGH);
+    SetPriority(TaskPriority::HIGH_IDLE);
     Stop();
 }
 
diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx
index 9511c62..8d0e295 100644
--- a/svx/source/sdr/event/eventhandler.cxx
+++ b/svx/source/sdr/event/eventhandler.cxx
@@ -81,7 +81,7 @@ namespace sdr
 
         TimerEventHandler::TimerEventHandler()
         {
-            SetPriority(TaskPriority::HIGH);
+            SetPriority(TaskPriority::HIGH_IDLE);
             Stop();
         }
 
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 41407b6..e848fb6 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -1100,7 +1100,7 @@ void SdrItemBrowser::SetDirty()
 {
     if (!bDirty) {
         bDirty = true;
-        aIdle.SetPriority(TaskPriority::HIGH);
+        aIdle.SetPriority(TaskPriority::HIGH_IDLE);
         aIdle.Start();
     }
 }
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 9a8e4e4..34642fb 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -121,7 +121,6 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString&
         SetSpinSize( 1 );
     }
 
-    maIdle.SetPriority( TaskPriority::LOW );
     maIdle.SetInvokeHandler( LINK( this, ImplGrafMetricField, ImplModifyHdl ) );
 }
 
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 44dce31..debd8c4 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -534,7 +534,6 @@ void SwSrcEditWindow::CreateTextEngine()
     m_pOutWin->SetFont( aFont );
     m_pTextEngine->SetFont( aFont );
 
-    m_aSyntaxIdle.SetPriority( TaskPriority::LOWER );
     m_aSyntaxIdle.SetInvokeHandler( LINK( this, SwSrcEditWindow, SyntaxTimerHdl ) );
 
     m_pTextEngine->EnableUndo( true );
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 260a021..89c7f3a 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -83,7 +83,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin,
 
     // the controller is asynchronously set
     aLoadedIdle.SetInvokeHandler(LINK(this, SwOneExampleFrame, TimeoutHdl));
-    aLoadedIdle.SetPriority(TaskPriority::HIGH);
+    aLoadedIdle.SetPriority(TaskPriority::HIGH_IDLE);
 
     CreateControl();
 
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 75dcf6c..5d97506 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -109,7 +109,6 @@ void AquaSalInstance::delayedSettingsChanged( bool bInvalidate )
 {
     osl::Guard< comphelper::SolarMutex > aGuard( *mpSalYieldMutex );
     AquaDelayedSettingsChanged* pIdle = new AquaDelayedSettingsChanged( bInvalidate );
-    pIdle->SetPriority( TaskPriority::MEDIUM );
     pIdle->Start();
 }
 
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 0abea5f..c8fdb2f 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -41,8 +41,7 @@ void Idle::Start()
     {
         switch ( GetPriority() )
         {
-            case TaskPriority::LOW:
-            case TaskPriority::LOWER:
+            case TaskPriority::DEFAULT_IDLE:
             case TaskPriority::LOWEST:
                 nPeriod = Scheduler::InfiniteTimeoutMs;
                 break;
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 7d14d0e..484738a 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -477,7 +477,7 @@ Task::~Task()
 TaskImpl::TaskImpl( const sal_Char *pDebugName )
     : mpSchedulerData( nullptr )
     , mpDebugName( pDebugName )
-    , mePriority( TaskPriority::HIGH )
+    , mePriority( TaskPriority::DEFAULT )
     , mbActive( false )
 {
 }
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index b31c0b9..296dad5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -461,7 +461,7 @@ void Application::Execute()
         pSVData->maAppData.mnEventTestLimit = 50;
         pSVData->maAppData.mpEventTestingIdle = new Idle("eventtesting");
         pSVData->maAppData.mpEventTestingIdle->SetInvokeHandler(LINK(&(pSVData->maAppData), ImplSVAppData, VclEventTestingHdl));
-        pSVData->maAppData.mpEventTestingIdle->SetPriority(TaskPriority::MEDIUM);
+        pSVData->maAppData.mpEventTestingIdle->SetPriority(TaskPriority::HIGH_IDLE);
         pSVData->maAppData.mpEventTestInput = new SvFileStream("eventtesting", StreamMode::READ);
         pSVData->maAppData.mpEventTestingIdle->Start();
     }
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index 774eba1..454084e 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -41,7 +41,7 @@ Timer::Timer( bool bAuto, const sal_Char *pDebugName )
     , mnTimeout( Scheduler::ImmediateTimeoutMs )
     , mbAuto( bAuto )
 {
-    SetPriority( TaskPriority::HIGHEST );
+    SetPriority( TaskPriority::DEFAULT );
 }
 
 Timer::Timer( const sal_Char *pDebugName )
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 6b8abdf..831cb93 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -275,7 +275,7 @@ IdleFormatter::IdleFormatter()
 {
     mpView = nullptr;
     mnRestarts = 0;
-    SetPriority(TaskPriority::HIGH);
+    SetPriority(TaskPriority::HIGH_IDLE);
 }
 
 IdleFormatter::~IdleFormatter()
diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index 14268ce..d995c75 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -113,7 +113,7 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::
     mReady = false;
     Idle aIdle;
     aIdle.SetDebugName("UI Test Idle Handler");
-    aIdle.SetPriority(TaskPriority::HIGH);
+    aIdle.SetPriority(TaskPriority::DEFAULT);
 
     std::function<void()> func = [this](){
 
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 7871b53..56b42a8 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -88,11 +88,11 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
     SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
 
     maDockIdle.SetInvokeHandler( LINK( this, ImplDockFloatWin2, DockTimerHdl ) );
-    maDockIdle.SetPriority( TaskPriority::MEDIUM );
+    maDockIdle.SetPriority( TaskPriority::HIGH_IDLE );
     maDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maDockIdle" );
 
     maEndDockIdle.SetInvokeHandler( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) );
-    maEndDockIdle.SetPriority( TaskPriority::MEDIUM );
+    maDockIdle.SetPriority( TaskPriority::HIGH_IDLE );
     maEndDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maEndDockIdle" );
 }
 
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index ced4ec9..88e1d1d 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -98,7 +98,7 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits,
     SetBackground();
 
     maDockIdle.SetInvokeHandler( LINK( this, ImplDockFloatWin, DockTimerHdl ) );
-    maDockIdle.SetPriority( TaskPriority::MEDIUM );
+    maDockIdle.SetPriority( TaskPriority::HIGH_IDLE );
     maDockIdle.SetDebugName( "vcl::ImplDockFloatWin maDockIdle" );
 }
 
commit a0cd4950f669afca6fe54124246cdc6ea44eb71f
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Jan 8 11:18:00 2016 +0100

    MM don't generate documents for invalid emails
    
    If we don't have a valid mail address, there is no point merging a
    document.
    
    We also have to account differently for documents with fields of
    type RES_DBNEXTSETFLD or RES_DBNUMSETFLD, as these would advance
    the document cursor for multiple rows.
    
    Sadly there is currently no way to inform the user of bad email
    entries. As before these entries are just skipped.
    
    Change-Id: I2b02174e173b8b721c7394d47febfefd3b3066e9

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index e97d400..8277c98 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -275,7 +275,7 @@ class SW_DLLPUBLIC SwDBManager
     SAL_DLLPRIVATE bool MergeMailFiles( SwWrtShell* pSh,
                                         const SwMergeDescriptor& rMergeDescriptor );
 
-    SAL_DLLPRIVATE bool ToNextMergeRecord();
+    SAL_DLLPRIVATE bool ToNextMergeRecord(const sal_uInt16 nSkip = 0);
     SAL_DLLPRIVATE bool IsValidMergeRecord() const;
 
     SwDBManager(SwDBManager const&) = delete;
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 39add21..fa4d931 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -162,7 +162,8 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pD
 }
 
 enum class SwDBNextRecord { NEXT, FIRST };
-static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action = SwDBNextRecord::NEXT );
+static bool lcl_ToNextRecord( SwDSParam* pParam, const sal_uInt16 nSkip = 0,
+                              const SwDBNextRecord action = SwDBNextRecord::NEXT );
 
 enum class WorkingDocType { SOURCE, TARGET, COPY };
 static SfxObjectShell* lcl_CreateWorkingDocument(
@@ -509,7 +510,7 @@ bool SwDBManager::Merge( const SwMergeDescriptor& rMergeDesc )
         pImpl->pMergeData->xConnection = xConnection;
     // add an XEventListener
 
-    lcl_ToNextRecord(pImpl->pMergeData, SwDBNextRecord::FIRST);
+    lcl_ToNextRecord(pImpl->pMergeData, 0, SwDBNextRecord::FIRST);
 
     uno::Reference<sdbc::XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection,aData.sDataSource);
 
@@ -1304,6 +1305,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     // it can be manually computed from the source documents (for which we do layouts, so the page
     // count is known, and there is a blank page between each of them in the target document).
     int targetDocPageCount = 0;
+    sal_Int32 nRecordPerDoc = pSourceShell->GetDoc()
+        ->getIDocumentFieldsAccess().GetRecordsPerDocument();
 
     if( !bIsMergeSilent && !bMT_PRINTER )
     {
@@ -1313,8 +1316,6 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
         // Synchronized docs don't auto-advance the record set, but there is a
         // "security" check, which will always advance the record set, if there
         // is no "next record" field in a synchronized doc => nRecordPerDoc > 0
-        sal_Int32 nRecordPerDoc = pSourceShell->GetDoc()
-                ->getIDocumentFieldsAccess().GetRecordsPerDocument();
         if ( bSynchronizedDoc && (nRecordPerDoc > 1) )
             --nRecordPerDoc;
         assert( nRecordPerDoc > 0 );
@@ -1350,6 +1351,14 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
         if( bMT_EMAIL || bColumnName )
         {
             sColumnData = GetDBField( xColumnProp, aColumnDBFormat );
+            if( bMT_EMAIL && !SwMailMergeHelper::CheckMailAddress( sColumnData ) )
+            {
+                OSL_FAIL("invalid e-Mail address in database column");
+                nDocNo++;
+                ToNextMergeRecord( nRecordPerDoc );
+                nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
+                continue;
+            }
         }
 
         // create a new temporary file name - only done once in case of bCreateSingleFile
@@ -1511,23 +1520,16 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                     // schedule file for later removal
                     aFilesToRemove.push_back( sFileURL );
 
-                    if( !SwMailMergeHelper::CheckMailAddress( sColumnData ) )
-                    {
-                        OSL_FAIL("invalid e-Mail address in database column");
-                    }
-                    else
-                    {
-                        uno::Reference< mail::XMailMessage > xMessage = lcl_CreateMailFromDoc(
+                    uno::Reference< mail::XMailMessage > xMessage = lcl_CreateMailFromDoc(
                             rMergeDescriptor, sFileURL, sColumnData, sMailBodyMimeType,
                             sMailEncoding, pStoreToFilter->GetMimeType() );
-                        if( xMessage.is() )
-                        {
-                            osl::MutexGuard aGuard( pImpl->m_aAllEmailSendMutex );
-                            pImpl->m_xLastMessage.set( xMessage );
-                            xMailDispatcher->enqueueMailMessage( xMessage );
-                            if( !xMailDispatcher->isStarted() )
-                                xMailDispatcher->start();
-                        }
+                    if( xMessage.is() )
+                    {
+                        osl::MutexGuard aGuard( pImpl->m_aAllEmailSendMutex );
+                        pImpl->m_xLastMessage.set( xMessage );
+                        xMailDispatcher->enqueueMailMessage( xMessage );
+                        if( !xMailDispatcher->isStarted() )
+                            xMailDispatcher->start();
                     }
                 }
             }
@@ -2136,10 +2138,10 @@ bool    SwDBManager::GetMergeColumnCnt(const OUString& rColumnName, sal_uInt16 n
     return bRet;
 }
 
-bool SwDBManager::ToNextMergeRecord()
+bool SwDBManager::ToNextMergeRecord( const sal_uInt16 nSkip )
 {
     assert( pImpl->pMergeData && pImpl->pMergeData->xResultSet.is() && "no data source in merge" );
-    return lcl_ToNextRecord( pImpl->pMergeData );
+    return lcl_ToNextRecord( pImpl->pMergeData, nSkip );
 }
 
 bool SwDBManager::FillCalcWithMergeData( SvNumberFormatter *pDocFormatter,
@@ -2222,7 +2224,7 @@ bool SwDBManager::ToNextRecord(
     return lcl_ToNextRecord( pFound );
 }
 
-static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action )
+static bool lcl_ToNextRecord( SwDSParam* pParam, const sal_uInt16 nSkip, const SwDBNextRecord action )
 {
     bool bRet = true;
 
@@ -2255,12 +2257,18 @@ static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action )
         }
         else if( action == SwDBNextRecord::FIRST )
         {
-            pParam->bEndOfDB = !pParam->xResultSet->first();
+            if( 0 == nSkip )
+                pParam->bEndOfDB = !pParam->xResultSet->first();
+            else
+                pParam->bEndOfDB = !pParam->xResultSet->absolute( nSkip );
         }
         else
         {
             sal_Int32 nBefore = pParam->xResultSet->getRow();
-            pParam->bEndOfDB = !pParam->xResultSet->next();
+            if( 0 == nSkip )
+                pParam->bEndOfDB = !pParam->xResultSet->next();
+            else
+                pParam->bEndOfDB = !pParam->xResultSet->absolute( nBefore + nSkip );
             if( !pParam->bEndOfDB && nBefore == pParam->xResultSet->getRow() )
             {
                 // next returned true but it didn't move
@@ -2268,7 +2276,7 @@ static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action )
             }
         }
 
-        ++pParam->nSelectionIndex;
+        pParam->nSelectionIndex += 1 + nSkip;
         bRet = !pParam->bEndOfDB;
     }
     catch( const uno::Exception &e )
commit b38d637fe3a263c4e2623379d8b5815563ca76ca
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sun Oct 16 21:04:59 2016 +0000

    Fix MouseOver handling for various controls
    
    This fixes the mouse over handling for Edit, ComboBox,
    ImplSmallBorderWindowView and ListBox.
    
    Change-Id: I6d3e91f786a4e43ca308f55baa9987db6d78949c

diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index c29fe97..e15fee6 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -176,6 +176,7 @@ public:
     virtual void        Command( const CommandEvent& rCEvt ) override;
     virtual void        StateChanged( StateChangedType nType ) override;
     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) override;
+    virtual bool        EventNotify( NotifyEvent& rNEvt ) override;
 
     virtual void        Modify();
     virtual void        UpdateData();
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index bf63f49..2d29c21 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -798,6 +798,7 @@ public:
     virtual void                        DataChanged( const DataChangedEvent& rDCEvt );
     virtual bool                        PreNotify( NotifyEvent& rNEvt );
     virtual bool                        EventNotify( NotifyEvent& rNEvt );
+    void                                InvalidateOutermostBorder( NotifyEvent& rNEvt, ControlType eType );
 
     // These methods call the relevant virtual method when not in/post dispose
     void                                CompatGetFocus();
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 84d1edc..05690cd 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -697,6 +697,13 @@ void ComboBox::DataChanged( const DataChangedEvent& rDCEvt )
 bool ComboBox::EventNotify( NotifyEvent& rNEvt )
 {
     bool bDone = false;
+
+    // trigger redraw if mouse over state has changed
+    if (IsNativeControlSupported(ControlType::Editbox, ControlPart::Entire))
+    {
+        InvalidateOutermostBorder( rNEvt, ControlType::Combobox );
+    }
+
     if ((rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
         && (rNEvt.GetWindow() == m_pImpl->m_pSubEdit)
         && !IsReadOnly())
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 95dc4d9..f60fb5b 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1738,6 +1738,12 @@ void Edit::Resize()
     }
 }
 
+bool Edit::EventNotify( NotifyEvent& rNEvt )
+{
+    InvalidateOutermostBorder( rNEvt, ControlType::Editbox );
+    return Control::EventNotify( rNEvt );
+}
+
 void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags )
 {
     ApplySettings(*pDev);
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index c56845b..562990e 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2646,10 +2646,13 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
             Point aPoint( -nLeft, -nTop );
             Rectangle aCtrlRegion( aPoint - GetPosPixel(), pWin->GetSizePixel() );
 
-            bool bMouseOver = false;
-            vcl::Window *pChild = pWin->GetWindow( GetWindowType::FirstChild );
-            while( pChild && !(bMouseOver = pChild->IsMouseOver()) )
-                pChild = pChild->GetWindow( GetWindowType::Next );
+            bool bMouseOver = pWin->IsMouseOver();
+            if( !bMouseOver )
+            {
+                vcl::Window *pChild = pWin->GetWindow( GetWindowType::FirstChild );
+                while( pChild && !(bMouseOver = pChild->IsMouseOver()) )
+                    pChild = pChild->GetWindow( GetWindowType::Next );
+            }
             if( bMouseOver )
                 nState |= ControlState::ROLLOVER;
 
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 6a174b8..c8ae449 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -679,13 +679,15 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c
                 nState |= ControlState::FOCUSED;
         }
 
-        bool bMouseOver = false;
-        vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
-        while(pCtrlChild && !(bMouseOver = pCtrlChild->IsMouseOver()))
+        bool bMouseOver = pCtrl->IsMouseOver();
+        if (!bMouseOver)
         {
-            pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
+            vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
+            while(pCtrlChild && !(bMouseOver = pCtrlChild->IsMouseOver()))
+            {
+                pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
+            }
         }
-
         if (bMouseOver)
             nState |= ControlState::ROLLOVER;
 
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index da6fc79..7da00b8 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -203,6 +203,27 @@ bool Window::EventNotify( NotifyEvent& rNEvt )
     return bRet;
 }
 
+void Window::InvalidateOutermostBorder( NotifyEvent& rNEvt, ControlType eType )
+{
+    const MouseEvent* pMouseEvt = nullptr;
+    // trigger redraw if mouse over state has changed
+    if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent())
+        && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged()
+        && IsNativeWidgetEnabled() && IsNativeControlSupported(eType, ControlPart::Entire)
+        && (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) && (this == rNEvt.GetWindow())
+        && ImplGetSVData()->maNWFData.mbNoFocusRects && !GetWindow( GetWindowType::CompoundParent ))
+    {
+        // allow control to show focused state
+        vcl::Window *pInvalWin = this, *pBorder = this;
+        while( ( pBorder = pInvalWin->GetWindow( GetWindowType::Border ) ) != pInvalWin && pBorder &&
+                pInvalWin->ImplGetFrame() == pBorder->ImplGetFrame() )
+        {
+            pInvalWin = pBorder;
+        }
+        pInvalWin->Invalidate( InvalidateFlags::Children | InvalidateFlags::Update );
+    }
+}
+
 void Window::CallEventListeners( VclEventId nEvent, void* pData )
 {
     VclWindowEvent aEvent( this, nEvent, pData );
commit 9b2bcfdc5f28263f80b084dfbb7cfa724a2d167a
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sun Oct 16 19:57:29 2016 +0000

    Change compound OnMouseOver handling
    
    This sends Notify events to the compound window, if the mouse
    enters to any of the childrens, or leaves from any of the children
    outside of the compound window / control.
    
    Additionally all leave events from the compound window are
    dropped, if the mouse moves to a child control.
    
    This allows us to skip a lot of redraws AKA flickers for border
    focus indicating themes (mbNoFocusRects).
    
    Change-Id: Ibc03226b1cb86443b62a688d3b98f17811b3db61

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 75f5a24..bf63f49 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -139,6 +139,7 @@ enum class GetWindowType
     Border                   = 12,
     FirstTopWindowChild      = 13,
     NextTopWindowSibling     = 16,
+    CompoundParent           = 17,
 };
 
 // Flags for setPosSizePixel()
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index ce70eba..85d9315 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -1049,6 +1049,18 @@ vcl::Window* Window::GetWindow( GetWindowType nType ) const
         case GetWindowType::Parent:
             return mpWindowImpl->mpRealParent;
 
+        case GetWindowType::CompoundParent:
+        {
+            vcl::Window *pParent = GetParent();
+            while( pParent )
+            {
+                if( pParent->IsCompoundControl() )
+                    break;
+                pParent = pParent->GetParent();
+            }
+            return pParent;
+        }
+
         case GetWindowType::FirstChild:
             return mpWindowImpl->mpFirstChild;
 
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 55efefd..ffd6d9e 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -256,6 +256,16 @@ static void ContextMenuEventLink( void* pCEvent, void* )
     delete pEv;
 }
 
+static inline vcl::Window* GetNonCommonCompoundWin( vcl::Window* pNew, vcl::Window* pOld )
+{
+    assert( pNew );
+    vcl::Window *pCompoundWin = pNew->GetWindow( GetWindowType::CompoundParent );
+    if ( pCompoundWin && ( pCompoundWin->IsDisposed() || (pOld &&
+            pCompoundWin == pOld->GetWindow( GetWindowType::CompoundParent )) ) )
+        pCompoundWin = nullptr;
+    return pCompoundWin;
+}
+
 bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave,
                            long nX, long nY, sal_uInt64 nMsgTime,
                            sal_uInt16 nCode, MouseEventModifiers nMode )
@@ -354,6 +364,8 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
     if ( !pChild && !bMouseLeave )
         return false;
 
+    VclPtr<vcl::Window> pMouseMoveWin = pWinFrameData->mpMouseMoveWin;
+
     // execute a few tests and catch the message or implement the status
     if ( pChild )
     {
@@ -386,6 +398,15 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
             {
                 pWinFrameData->mpMouseMoveWin = pChild;
                 pChild->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
+                if ( nMode & MouseEventModifiers::ENTERWINDOW )
+                {
+                    vcl::Window* pCompoundWin = GetNonCommonCompoundWin( pChild, pMouseMoveWin );
+                    if ( pCompoundWin )
+                    {
+                        aNEvt = NotifyEvent( nSVEvent, pCompoundWin, &aMEvt );
+                        pCompoundWin->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
+                    }
+                }
             }
 
             if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN )
@@ -416,7 +437,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
         {
             Point aChildMousePos = pChild->ImplFrameToOutput( aMousePos );
             if ( !bMouseLeave &&
-                 (pChild == pWinFrameData->mpMouseMoveWin) &&
+                 (pChild == pMouseMoveWin) &&
                  (aChildMousePos.X() == pWinFrameData->mnLastMouseWinX) &&
                  (aChildMousePos.Y() == pWinFrameData->mnLastMouseWinY) &&
                  (nOldCode == pWinFrameData->mnMouseCode) )
@@ -510,7 +531,6 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
         }
 
         // test for mouseleave and mouseenter
-        VclPtr<vcl::Window> pMouseMoveWin = pWinFrameData->mpMouseMoveWin;
         if ( pChild != pMouseMoveWin )
         {
             if ( pMouseMoveWin )
@@ -521,12 +541,30 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
                 pWinFrameData->mbInMouseMove = true;
                 pMouseMoveWin->ImplGetWinData()->mbMouseOver = false;
 
+                // Don't leave notify a compound window, if leaving to a child control
+                bool bDoNotify = (!pMouseMoveWin->IsCompoundControl() || !pChild || pChild->IsDisposed()
+                    || pMouseMoveWin != pChild->GetWindow( GetWindowType::CompoundParent ));
                 // A MouseLeave can destroy this window
-                if ( !ImplCallPreNotify( aNLeaveEvt ) )
+                if ( bDoNotify && !ImplCallPreNotify( aNLeaveEvt ) )
                 {
                     pMouseMoveWin->MouseMove( aMLeaveEvt );
-                    if( !pMouseMoveWin->IsDisposed() )
-                        aNLeaveEvt.GetWindow()->ImplNotifyKeyMouseCommandEventListeners( aNLeaveEvt );
+                    if ( !pMouseMoveWin->IsDisposed() )
+                        pMouseMoveWin->ImplNotifyKeyMouseCommandEventListeners( aNLeaveEvt );
+                }
+                // If we left the compound control not from the compound window, notify the compound window
+                if ( bDoNotify && !pMouseMoveWin->IsCompoundControl() )
+                {
+                    VclPtr<vcl::Window> pCompoundWin = GetNonCommonCompoundWin( pMouseMoveWin, pChild );
+                    if ( pCompoundWin )
+                    {
+                        aNLeaveEvt = NotifyEvent( MouseNotifyEvent::MOUSEMOVE, pCompoundWin, &aMLeaveEvt );
+                        if ( !ImplCallPreNotify( aNLeaveEvt ) )
+                        {
+                            pCompoundWin->MouseMove( aMLeaveEvt );
+                            if ( !pCompoundWin->IsDisposed() )
+                                pCompoundWin->ImplNotifyKeyMouseCommandEventListeners( aNLeaveEvt );
+                        }
+                    }
                 }
 
                 pWinFrameData->mpMouseMoveWin = nullptr;
@@ -645,6 +683,15 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
             return true;
     }
 
+    if ( nMode & MouseEventModifiers::ENTERWINDOW )
+    {
+        vcl::Window *pCompoundWin = GetNonCommonCompoundWin( pChild, pMouseMoveWin );
+        if ( pCompoundWin )
+        {
+            NotifyEvent aCNEvt( nSVEvent, pCompoundWin, &aMEvt );
+            ImplCallPreNotify( aCNEvt );
+        }
+    }
     if ( ImplCallPreNotify( aNEvt ) || pChild->IsDisposed() )
         bRet = true;
     else
@@ -681,6 +728,12 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
                     // the HelpRequest handler should not be called anymore
                     vcl::Window* pOldHelpTextWin = pSVData->maHelpData.mpHelpWin;
                     pChild->ImplGetWindowImpl()->mbMouseMove = false;
+                    if ( nMode & MouseEventModifiers::ENTERWINDOW )
+                    {
+                        vcl::Window *pCompoundWin = GetNonCommonCompoundWin( pChild, pMouseMoveWin );
+                        if ( pCompoundWin )
+                            pCompoundWin->MouseMove( aMEvt );
+                    }
                     pChild->MouseMove( aMEvt );
                     if ( pOldHelpTextWin != pSVData->maHelpData.mpHelpWin )
                         bCallHelpRequest = false;
@@ -714,6 +767,15 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
 
         assert(aNEvt.GetWindow() == pChild);
 
+        if ( nMode & MouseEventModifiers::ENTERWINDOW )
+        {
+            vcl::Window *pCompoundWin = GetNonCommonCompoundWin( pChild, pMouseMoveWin );
+            if ( pCompoundWin )
+            {
+                NotifyEvent aCNEvt( nSVEvent, pCompoundWin, &aMEvt );
+                pCompoundWin->ImplNotifyKeyMouseCommandEventListeners( aCNEvt );
+            }
+        }
         if (!pChild->IsDisposed())
             pChild->ImplNotifyKeyMouseCommandEventListeners( aNEvt );
     }
commit 9078073a24c783da19df9c4a9d6a11df4fa67dec
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Apr 22 04:48:08 2016 +0200

    Disable font dependent tests when missing fonts
    
    A (very) few tests depend on correct MS metric compatible fonts,
    like Calibri, Arial and Times New Roman, and fail if these are
    substituted with incompatible fonts. Disable failing asserts, so
    we'll at least test loading the documents.
    
    Change-Id: I4d07ffa7cd0da17f1c6631641853779294426210

diff --git a/configure.ac b/configure.ac
index 32c689e..a62ce43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11284,7 +11284,7 @@ test_font_map()
         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
     done
-    if test $TESTEXPR
+    if eval "test $TESTEXPR"
     then
         AC_MSG_RESULT([ok])
     else
@@ -11312,6 +11312,8 @@ else
             TEST_FONTS_MISSING=1
         else
             test_font_map 'Calibri' 'Carlito'
+            test_font_map 'Arial' 'LiberationSans'
+            test_font_map 'Times New Roman' 'LiberationSerif'
             if test ${TEST_FONTS_MISSING} -eq 1
             then
                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 591a7f8..e945a34 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -21,6 +21,8 @@
 
 #include <basic/sbxdef.hxx>
 
+#include <config_test.h>
+
 #include "docsh.hxx"
 #include "patattr.hxx"
 #include "scitems.hxx"
@@ -294,7 +296,9 @@ void ScMacrosTest::testVba()
     osl::FileBase::getSystemPathFromFileURL( sTempDirURL, sTempDir );
     sTempDir += OUStringLiteral1(SAL_PATHDELIMITER);
     OUString sTestFileName("My Test WorkBook.xls");
+#if ! TEST_FONTS_MISSING
     Sequence< uno::Any > aParams;
+#endif
     for ( sal_uInt32  i=0; i<SAL_N_ELEMENTS( testInfo ); ++i )
     {
         OUString aFileName;
@@ -308,10 +312,17 @@ void ScMacrosTest::testVba()
         // time - while processing other StarBasic methods.
         Application::Reschedule(true);
 
+        SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
+
+        CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+        SAL_INFO("sc.qa", "about to invoke vba test in " << aFileName << " with url " << testInfo[i].sMacroUrl);
+
+        bool bWorkbooksHandling = OUString( testInfo[i].sFileBaseName ) == "Workbooks." && !sTempDir.isEmpty() ;
+
+#if ! TEST_FONTS_MISSING
         Any aRet;
         Sequence< sal_Int16 > aOutParamIndex;
         Sequence< Any > aOutParam;
-        bool bWorkbooksHandling = OUString( testInfo[i].sFileBaseName ) == "Workbooks." && !sTempDir.isEmpty() ;
 
         if ( bWorkbooksHandling )
         {
@@ -320,11 +331,6 @@ void ScMacrosTest::testVba()
             aParams[ 1 ] <<= sTestFileName;
         }
 
-        SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
-
-        CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-        SAL_INFO("sc.qa", "about to invoke vba test in " << aFileName << " with url " << testInfo[i].sMacroUrl);
-
         SfxObjectShell::CallXScript(
             xComponent, testInfo[i].sMacroUrl, aParams, aRet, aOutParamIndex,
             aOutParam);
@@ -332,6 +338,8 @@ void ScMacrosTest::testVba()
         aRet >>= aStringRes;
         CPPUNIT_ASSERT_EQUAL_MESSAGE(
             "script reported failure", OUString("OK"), aStringRes);
+#endif
+
         pFoundShell->DoClose();
         if ( bWorkbooksHandling )
         {
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index a7ce8ee..95c670f 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -90,6 +90,8 @@
 #include "helper/shared_test_impl.hxx"
 #include <algorithm>
 
+#include <config_test.h>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
@@ -1657,8 +1659,10 @@ void ScFiltersTest::testChartImportXLS()
     const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 0);
     CPPUNIT_ASSERT_MESSAGE("Failed to retrieve a chart object from the 2nd sheet.", pOleObj);
 
+#if ! TEST_FONTS_MISSING
     CPPUNIT_ASSERT_EQUAL(11137L, pOleObj->GetLogicRect().getWidth());
     CPPUNIT_ASSERT(8640L > pOleObj->GetLogicRect().getHeight());
+#endif
 
     xDocSh->DoClose();
 }
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 10fb24b..6843a94 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -47,6 +47,7 @@
 #include <svx/svxids.hrc>
 
 #include <chrono>
+#include <config_test.h>
 
 using namespace css;
 
@@ -366,6 +367,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
     // Did we manage to go after the first character?
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), rEditView.GetSelection().nStartPos);
 
+#if ! TEST_FONTS_MISSING
     vcl::Cursor* pCursor = rEditView.GetCursor();
     Point aPosition(pCursor->GetPos().getX(), pCursor->GetPos().getY() + pCursor->GetSize().Height() / 2);
     aPosition.setX(aPosition.getX() - 1000);
@@ -378,6 +380,7 @@ void SdTiledRenderingTest::testPostMouseEvent()
     CPPUNIT_ASSERT(pView->GetTextEditObject());
     // The new cursor position must be before the first word.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), rEditView.GetSelection().nStartPos);
+#endif
     comphelper::LibreOfficeKit::setActive(false);
 }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index a48caad..5a9bae3 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -102,6 +102,7 @@
 #include <comphelper/configurationhelper.hxx>
 #include <editeng/unolingu.hxx>
 #include <config_features.h>
+#include <config_test.h>
 
 static const char* const DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
 
@@ -3561,6 +3562,7 @@ void SwUiWriterTest::testTdf77014()
 
     aHandler.clear();
 
+#if ! TEST_FONTS_MISSING
     // skip empty paragraph
     pTextFrame = static_cast<SwTextFrame*>(pTextFrame->GetNext());
 
@@ -3660,6 +3662,7 @@ void SwUiWriterTest::testTdf77014()
         rPortionItem = aHandler.mPortionItems[7];
         CPPUNIT_ASSERT_EQUAL(OUString("finish"), rPortionItem.msItemType);
     }
+#endif
 }
 
 void SwUiWriterTest::testTdf92648()
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index a2c95ca..343a1d7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -50,6 +50,8 @@
 
 #include <bordertest.hxx>
 
+#include <config_test.h>
+
 #define convertTwipToMm100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
 
 class Test : public SwModelTestBase
@@ -605,8 +607,10 @@ DECLARE_WW8EXPORT_TEST(testfdo68963, "fdo68963.doc")
     // The problem was that the text was not displayed.
     CPPUNIT_ASSERT ( !parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText").isEmpty() );
     CPPUNIT_ASSERT_EQUAL( OUString("Topic 1"), parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText") );
+#if ! TEST_FONTS_MISSING
     // all crossreference bookmarks should have a target.  Shouldn't be any "Reference source not found" in the xml
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), parseDump("/root/page/body/txt[24]/Special[2]","rText").indexOf("Reference source not found"));
+#endif
 }
 #endif
 
commit ec4b2974f17400e17388594c1da7b9814e713ece
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sun Oct 30 02:02:10 2016 +0100

    Just wait for the Yield mutex in the timer callback
    
    Probably this instantly deadlocks, but it's worth a shot ;-)
    
    Change-Id: Ib46eb6dbf57f29c85ffdbd6492922020f7785d30

diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 2b7e90c..f994fd8 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -150,16 +150,9 @@ void EmitTimerCallback()
     if ( ! pSVData->maSchedCtx.mpSalTimer )
         return;
 
-    // Try to acquire the mutex. If we don't get the mutex then we
-    // try this a short time later again.
-    if (ImplSalYieldMutexTryToAcquire())
-    {
-        pSVData->maSchedCtx.mpSalTimer->CallCallback();
-
-        ImplSalYieldMutexRelease();
-    }
-    else

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list