[Libreoffice-commits] core.git: Branch 'private/jmux/fast-mm-5-0' - 44 commits - avmedia/source basctl/source chart2/source cui/source dbaccess/source desktop/source drawinglayer/source editeng/source external/boost formula/source framework/source include/sal include/svl include/tools include/vcl reportdesign/source sc/inc sc/source sd/source sfx2/source solenv/bin solenv/gbuild solenv/gdb svl/qa svl/source svtools/source svx/source sw/inc sw/qa sw/source vcl/inc vcl/qa vcl/source vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Fri Aug 12 23:38:23 UTC 2016


Rebased ref, commits from common ancestor:
commit 1ec6885c5473fdc6b244c51ec50d2d7bfab9f3a4
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Aug 12 20:23:20 2016 +0200

    MM unit test for leading and tailing sections
    
    Change-Id: Ie0c51a9d7314895b5543d927fce3e1150f1e967e

diff --git a/sw/qa/extras/mailmerge/data/sections_first_last.odt b/sw/qa/extras/mailmerge/data/sections_first_last.odt
new file mode 100644
index 0000000..5a92adb
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/sections_first_last.odt differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 92fc7c3..73f3217 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -29,6 +29,7 @@
 #include <edtwin.hxx>
 #include <olmenu.hxx>
 #include <cmdid.h>
+#include <pagefrm.hxx>
 
 /**
  * Maps database URIs to the registered database names for quick lookups
@@ -463,5 +464,40 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf92623, "tdf92623.odt", "10-testing-addresses
     CPPUNIT_ASSERT_EQUAL(sal_Int32(10), countFieldMarks);
 }
 
+DECLARE_SHELL_MAILMERGE_TEST(test_sections_first_last, "sections_first_last.odt", "10-testing-addresses.ods", "testing-addresses")
+{
+    executeMailMerge();
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    // Get the size of the document in nodes
+    SwDoc *pDoc = pTextDoc->GetDocShell()->GetDoc();
+    sal_uLong nSize = pDoc->GetNodes().GetEndOfContent().GetIndex() - pDoc->GetNodes().GetEndOfExtras().GetIndex();
+    nSize -= 2; // The common start and end node
+    CPPUNIT_ASSERT_EQUAL( sal_uLong(13), nSize );
+
+    SwXTextDocument* pTextDocMM = dynamic_cast<SwXTextDocument *>(mxMMComponent.get());
+    CPPUNIT_ASSERT(pTextDocMM);
+
+    SwDoc *pDocMM = pTextDocMM->GetDocShell()->GetDoc();
+    sal_uLong nSizeMM = pDocMM->GetNodes().GetEndOfContent().GetIndex() - pDocMM->GetNodes().GetEndOfExtras().GetIndex();
+    nSizeMM -= 2;
+    CPPUNIT_ASSERT_EQUAL( sal_uLong(10 * nSize), nSizeMM );
+
+    CPPUNIT_ASSERT_EQUAL( sal_uInt16(19), pDocMM->GetDocShell()->GetWrtShell()->GetPhyPageNum() );
+
+    // All even pages should be empty, all sub-documents have two pages
+    const SwRootFrm* pLayout = pDocMM->getIDocumentLayoutAccess().GetCurrentLayout();
+    const SwPageFrm* pPageFrm = static_cast<const SwPageFrm*>( pLayout->Lower() );
+    while ( pPageFrm )
+    {
+        sal_uInt16 nEven = pPageFrm->GetPhyPageNum() % 2;
+        CPPUNIT_ASSERT_EQUAL( bool( !nEven ), pPageFrm->IsEmptyPage() );
+//        CPPUNIT_ASSERT_EQUAL( sal_uInt16( nEven + 1 ), pPageFrm->GetVirtPageNum() );
+        pPageFrm = static_cast<const SwPageFrm*>( pPageFrm->GetNext() );
+    }
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 54d19ccdd2542589205a4b5b49a0265ecc122efe
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Aug 12 19:33:28 2016 +0200

    Switch back to InsertPageBreak in SwDoc::AppendDoc
    
    I'm currently unable to invalidate / update the correct cache to
    make the changed SwPageDesc visible to SwRootFrm::AssertFlyPages.
    
    Instead this continues to use the SwWrtShell::InsertPageBreak,
    which moves the cursor to the new page, which somehow triggers the
    SwCrsrShell to update the (probably?) cached layout information.
    
    The working backtrace looks like this. while the "broken" one
    stops at #16, because the cursor has a valid paragraph.
    
     #0  SwFrm::WrongPageDesc(SwPageFrm*)
     #1  SwFrm::GetNextLeaf(MakePageType)
     #2  SwFrm::GetLeaf(MakePageType, bool)
     #3  SwFlowFrm::MoveFwd(bool, bool, bool)
     #4  SwContentFrm::MakeAll(OutputDevice*)
     #5  SwFrm::PrepareMake(OutputDevice*)
     #6  SwFrm::Calc(OutputDevice*) const
     #7  SwTextFrm::CalcFollow(int)
     #8  SwTextFrm::_AdjustFollow(SwTextFormatter&, int, int, unsigned char)
     #9  SwTextFrm::FormatAdjust(SwTextFormatter&, WidowsAndOrphans&, int, bool)
     #10 SwTextFrm::_Format(SwTextFormatter&, SwTextFormatInfo&, bool)
     #11 SwTextFrm::_Format(OutputDevice*, SwParaPortion*)
     #12 SwTextFrm::Format(OutputDevice*, SwBorderAttrs const*)
     #13 SwContentFrm::MakeAll(OutputDevice*)
     #14 SwFrm::PrepareMake(OutputDevice*)
     #15 SwFrm::Calc(OutputDevice*) const
     #16 SwTextFrm::GetFormatted(bool)
     #17 SwTextFrm::GetCharRect(SwRect&, SwPosition const&, SwCrsrMoveState*) const
     #18 SwCrsrShell::UpdateCrsr(unsigned short, bool)
     #19 SwCrsrShell::EndAction(bool, bool)
     #20 SwEditShell::EndAllAction()
     #21 SwDoc::AppendDoc(SwDoc const&, unsigned short, SwPageDesc*, bool, int)
     #22 SwDBManager::MergeMailFiles(SwWrtShell*, SwMergeDescriptor const&, vcl::Window*)
     #23 SwDBManager::MergeNew(SwMergeDescriptor const&, vcl::Window*)
    
    Have a look at the SwPageDesc with by toggling the #if 0 block
    with log:
    
    SAL_LOG="-INFO-WARN+INFO.sw.docappend+INFO.sw.createcopy+INFO.sw.pagefrm"
    
    Change-Id: I02f955a6be00a3b57d50d18d4da3651cb9473614

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 95e9de6..2bf6986 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -949,6 +949,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
               // can't move after a trailing section.
                 SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
                 SwPosition aBreakPos( aBreakIdx );
+#if 0
                 getIDocumentContentOperations().AppendTextNode( aBreakPos );
                 aBreakIdx++;
                 SwTextNode *aTextNd = aBreakIdx.GetNode().GetTextNode();
@@ -960,6 +961,22 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
                     aDesc->RegisterToPageDesc( *pTargetPageDesc );
                 aTextNd->SetAttr( *aDesc );
                 delete pNewItem;
+                // a magic call to sync with whatever, so AssertFlyPages
+                // sees the correct format AKA same as InsertPageBreak does
+#else
+                // InsertPageBreak just works on SwTextNode nodes, so make
+                // sure the last node is one!
+                bool bIsTextNode = aBreakIdx.GetNode().IsTextNode();
+                if ( !bIsTextNode )
+                    getIDocumentContentOperations().AppendTextNode( aBreakPos );
+                OUString name = pTargetPageDesc->GetName();
+                pTargetShell->InsertPageBreak( &name, nStartPageNumber );
+                if ( !bIsTextNode )
+                {
+                    --aBreakIdx;
+                    GetNodes().Delete( aBreakIdx, 1 );
+                }
+#endif
             }
 
             // There is now a new empty text node on the new page. If it has
commit ad263a1fd41e97ecc7acd7daab4ff6edb1df6050
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Aug 11 18:45:21 2016 +0200

    MM don't keep undo information
    
    Doen't make much sense to store undo information for all merge
    based progress. Actually it even prevents crahes when undoing a
    merged ODT document.
    
    Change-Id: Ic3a3982f3e5eb4f6de9f027a6a5e376c2833e8a5

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index f00b86e..efb8fb6 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -80,6 +80,7 @@
 #include <IDocumentLinksAdministration.hxx>
 #include <IDocumentContentOperations.hxx>
 #include <IDocumentFieldsAccess.hxx>
+#include <IDocumentUndoRedo.hxx>
 #include <swwait.hxx>
 #include <swunohelper.hxx>
 #include <dbui.hrc>
@@ -988,6 +989,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 pTargetShell->GetViewOptions()->SetIdle( false );
                 pTargetDoc = pTargetShell->GetDoc();
                 pTargetDoc->SetInMailMerge(true);
+                pTargetDoc->GetIDocumentUndoRedo().DoUndo( false );
 
                 //copy the styles from the source to the target document
                 pTargetView->GetDocShell()->_LoadStyles( *pSourceDocSh, true );
@@ -1130,6 +1132,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                         pWorkView->AttrChangedNotify( &rWorkShell );// in order for SelectShell to be called
 
                         pWorkDoc = rWorkShell.GetDoc();
+                        pWorkDoc->GetIDocumentUndoRedo().DoUndo( false );
                         pWorkDoc->ReplaceDocumentProperties( *pSourceDocSh->GetDoc());
                         if ( (nMaxDumpDocs < 0) || (nDocNo <= nMaxDumpDocs) )
                             lcl_SaveDoc( xWorkDocSh, "WorkDoc", nDocNo );
@@ -1426,6 +1429,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 SAL_INFO( "sw.pagefrm", "(MergeMailFiles pTargetShell->CalcLayout in" );
                 pTargetShell->CalcLayout();
                 SAL_INFO( "sw.pagefrm", "MergeMailFiles pTargetShell->CalcLayout out)" );
+                pTargetDoc->GetIDocumentUndoRedo().DoUndo( true );
                 pTargetShell->GetViewOptions()->SetIdle( true );
                 std::set<SwRootFrm*> aAllLayouts = pTargetShell->GetDoc()->GetAllLayouts();
                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),
commit 7c954dee29ad18eccd2d80275527c2868233470d
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Aug 11 18:39:20 2016 +0200

    Fix SwDoc::AppendDoc for trailing sections
    
    We already treat the StartOfContent node special in the CopyRange
    function to prevent merging of SwTextNodes.
    
    For trailing sections, we have to expand the code to treat
    EndOfContent special too, because the supplied SwPaM range is
    handled as [mark, point[, so it previously missed the section end
    node, which resulted in "unhiding" the last section, if it was the
    last node in the document.
    
    Change-Id: Ie094e2a0182647a49c9ba45d08a7dd2cabe667c6

diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 75b4f84..1572e21 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -80,7 +80,7 @@ public:
         be within the range!
 
         \warning The range has to include at least two nodes or has to be a
-        SwDoc::IsColumnSelection!
+        SwDoc::IsColumnSelection, because the rPam is treated [mark, point[.
 
         Normally this function should work only with content nodes. But there
         is a special case used by SwDoc::Paste, which starts the SwPaM at the
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 0c5be49..95e9de6 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -905,20 +905,13 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
     SAL_INFO( "sw.pagefrm", "(SwDoc::AppendDoc in " << bDeletePrevious );
 
     // GetEndOfExtras + 1 = StartOfContent == no content node!
-    // this ensures, that we have at least two nodes in the SwPaM.
-    // @see IDocumentContentOperations::CopyRange
+    // This ensures it won't be merged in the SwTextNode at the position.
     SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 );
-    SwNodeIndex aSourceEndIdx( rSource.GetNodes().GetEndOfContent(), -1 );
-    SwPaM aCpyPam( aSourceIdx );
-
-    if ( aSourceEndIdx.GetNode().IsTextNode() ) {
-        aCpyPam.SetMark();
-        // moves to the last content node before EOC; for single paragraph
-        // documents this would result in [n, n], which is considered empty
-        aCpyPam.Move( fnMoveForward, fnGoDoc );
-    }
-    else
-        aCpyPam = SwPaM( aSourceIdx, aSourceEndIdx );
+    // CopyRange works on the range a [mark, point[ and considers an
+    // index < point outside the selection.
+    // @see IDocumentContentOperations::CopyRange
+    SwNodeIndex aSourceEndIdx( rSource.GetNodes().GetEndOfContent(), 0 );
+    SwPaM aCpyPam( aSourceIdx, aSourceEndIdx );
 
 #ifdef DBG_UTIL
     SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType()
@@ -935,10 +928,8 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
     SAL_INFO( "sw.docappend", ".." );
     SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType()
                               << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
-    aSourceEndIdx++;
     SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType()
                               << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() );
-    aSourceEndIdx--;
     SAL_INFO( "sw.docappend", "Src-Nd: " << CNTNT_DOC( &rSource ) );
     SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) );
 #endif
@@ -951,9 +942,25 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
         pTargetShell->StartAllAction();
 
         // Otherwise we have to handle SwPlaceholderNodes as first node
-        if ( pTargetPageDesc ) {
-            OUString name = pTargetPageDesc->GetName();
-            pTargetShell->InsertPageBreak( &name, nStartPageNumber );
+        if ( pTargetPageDesc )
+        {
+            { // Append page break via AppendTextNode
+              // Can't use SwWrtShell::InsertPageBreak, because the cursor
+              // can't move after a trailing section.
+                SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
+                SwPosition aBreakPos( aBreakIdx );
+                getIDocumentContentOperations().AppendTextNode( aBreakPos );
+                aBreakIdx++;
+                SwTextNode *aTextNd = aBreakIdx.GetNode().GetTextNode();
+                SfxPoolItem *pNewItem = aTextNd->GetAttr( RES_PAGEDESC ).Clone();
+                SwFormatPageDesc *aDesc = static_cast< SwFormatPageDesc* >( pNewItem );
+                if ( nStartPageNumber )
+                    aDesc->SetNumOffset( nStartPageNumber );
+                if ( pTargetPageDesc )
+                    aDesc->RegisterToPageDesc( *pTargetPageDesc );
+                aTextNd->SetAttr( *aDesc );
+                delete pNewItem;
+            }
 
             // There is now a new empty text node on the new page. If it has
             // any marks, those are from the previous page: move them back
@@ -1013,7 +1020,8 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
     this->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
     this->getIDocumentFieldsAccess().LockExpFields();
 
-    // Position where the appended doc starts. Will be filled in later (uses GetEndOfContent() because SwNodeIndex has no default ctor).
+    // Position where the appended doc starts. Will be filled in later.
+    // Initially uses GetEndOfContent() because SwNodeIndex has no default ctor.
     SwNodeIndex aStartAppendIndex( GetNodes().GetEndOfContent() );
 
     {
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 30e33ae..cc4485a 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1697,24 +1697,30 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 !pAktNode->pStartOfSection->IsSectionNode() ) )
         ++aRg.aStart;
 
-    // if aEnd-1 points to no ContentNode, search previous one
-    --aRg.aEnd;
-    // #i107142#: if aEnd is start node of a special section, do nothing.
-    // Otherwise this could lead to crash: going through all previous
-    // special section nodes and then one before the first.
-    if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0)
+    const SwNode *aEndNode = &aRg.aEnd.GetNode();
+    int nIsEndOfContent = (aEndNode == &aEndNode->GetNodes().GetEndOfContent()) ? 1 : 0;
+
+    if (0 == nIsEndOfContent)
     {
-        while( ((pAktNode = & aRg.aEnd.GetNode())->GetStartNode() &&
-                !pAktNode->IsSectionNode() ) ||
-                ( pAktNode->IsEndNode() &&
-                ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) )
+        // if aEnd-1 points to no ContentNode, search previous one
+        --aRg.aEnd;
+        // #i107142#: if aEnd is start node of a special section, do nothing.
+        // Otherwise this could lead to crash: going through all previous
+        // special section nodes and then one before the first.
+        if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0)
         {
-            --aRg.aEnd;
+            while( ((pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
+                    !pAktNode->IsSectionNode() ) ||
+                    ( pAktNode->IsEndNode() &&
+                    ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) )
+            {
+                --aRg.aEnd;
+            }
         }
+        ++aRg.aEnd;
     }
-    ++aRg.aEnd;
 
-    // if in same array, check insertion position
+    // is there anything left to copy?
     if( aRg.aStart >= aRg.aEnd )
         return;
 
@@ -1789,7 +1795,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 if (nDistance < nNodeCnt)
                     nNodeCnt -= nDistance;
                 else
-                    nNodeCnt = 1;
+                    nNodeCnt = 1 - nIsEndOfContent;
 
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
@@ -1817,7 +1823,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 if (nDistance < nNodeCnt)
                     nNodeCnt -= nDistance;
                 else
-                    nNodeCnt = 1;
+                    nNodeCnt = 1 - nIsEndOfContent;
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
                 if( bNewFrms && pSectNd &&
@@ -1842,6 +1848,9 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 --nLevel;
                 ++aInsPos; // EndNode already exists
             }
+            else if( 1 == nNodeCnt && 1 == nIsEndOfContent )
+                // we have reached the EndOfContent node - nothing to do!
+                continue;
             else if( !pAktNode->pStartOfSection->IsSectionNode() )
             {
                 // create a section at the original InsertPosition
commit 6d182289791a3d3174b89a74f22ce6d33b460825
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 12:42:29 2016 +0200

    MM block idle-handling of generated documents
    
    We don't need any background idle jobs for the generated documents,
    like spell checking, statistics etc.
    
    This can be done when (or even if) the document is presented to the
    user as a background task.
    
    Change-Id: I4c72ed6e0d2f90d43e7f04cd0ea4418cbffe1206

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 66b7e27..f00b86e 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -985,6 +985,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 //initiate SelectShell() to create sub shells
                 pTargetView->AttrChangedNotify( &pTargetView->GetWrtShell() );
                 pTargetShell = pTargetView->GetWrtShellPtr();
+                pTargetShell->GetViewOptions()->SetIdle( false );
                 pTargetDoc = pTargetShell->GetDoc();
                 pTargetDoc->SetInMailMerge(true);
 
@@ -1125,6 +1126,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                         pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() );
                         //request the layout calculation
                         SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
+                        rWorkShell.GetViewOptions()->SetIdle( false );
                         pWorkView->AttrChangedNotify( &rWorkShell );// in order for SelectShell to be called
 
                         pWorkDoc = rWorkShell.GetDoc();
@@ -1424,6 +1426,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 SAL_INFO( "sw.pagefrm", "(MergeMailFiles pTargetShell->CalcLayout in" );
                 pTargetShell->CalcLayout();
                 SAL_INFO( "sw.pagefrm", "MergeMailFiles pTargetShell->CalcLayout out)" );
+                pTargetShell->GetViewOptions()->SetIdle( true );
                 std::set<SwRootFrm*> aAllLayouts = pTargetShell->GetDoc()->GetAllLayouts();
                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),
                     ::std::bind2nd(::std::mem_fun(&SwRootFrm::FreezeLayout), false));
commit a1a32c7561dd077207a56b7219966f3c3e86473d
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 11:37:15 2016 +0200

    Add SAL_INFOs to dump the SwPageFrm lifecycle
    
    Debug area name is "sw.pagefrm".
    
    Change-Id: I136cc8192137a8c682900a6ce2c557f6b6b3a6cd

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 2e89799..c7983d5 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -429,6 +429,7 @@ certain functionality.
 @li @c sw.idle
 @li @c sw.level2
 @li @c sw.mailmerge - Writer mail merge
+ at li @c sw.pagefrm - debug lifecycle of SwPageFrm
 @li @c sw.rtf - .rtf export filter
 @li @c sw.tiled
 @li @c sw.ui
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index caf4d66..0c5be49 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -858,6 +858,7 @@ void SwDoc::ReplaceCompatibilityOptions(const SwDoc& rSource)
 
 SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
 {
+    SAL_INFO( "sw.pagefrm", "(SwDoc::CreateCopy in" );
     SwDoc* pRet = new SwDoc;
 
     // we have to use pointer here, since the callee has to decide whether
@@ -893,6 +894,7 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
 
     (void)pRet->release();
 
+    SAL_INFO( "sw.pagefrm", "SwDoc::CreateCopy out)" );
     return pRetShell;
 }
 
@@ -900,6 +902,8 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
 SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNumber,
             SwPageDesc *const pTargetPageDesc, bool const bDeletePrevious, int pageOffset)
 {
+    SAL_INFO( "sw.pagefrm", "(SwDoc::AppendDoc in " << bDeletePrevious );
+
     // GetEndOfExtras + 1 = StartOfContent == no content node!
     // this ensures, that we have at least two nodes in the SwPaM.
     // @see IDocumentContentOperations::CopyRange
@@ -980,7 +984,9 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
             // Flush the page break, if we want to keep it
             if ( !bDeletePrevious )
             {
+                SAL_INFO( "sw.pagefrm", "(Flush pagebreak AKA EndAllAction" );
                 pTargetShell->EndAllAction();
+                SAL_INFO( "sw.pagefrm",  "Flush changes AKA EndAllAction)" );
                 pTargetShell->StartAllAction();
             }
         }
@@ -1156,6 +1162,7 @@ else
     if ( pTargetShell )
         pTargetShell->EndAllAction();
 
+    SAL_INFO( "sw.pagefrm", "SwDoc::AppendDoc out)" );
     return aStartAppendIndex;
 }
 
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index a4f1856..59acc35 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -848,6 +848,13 @@ bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
     const SwPageDesc *pNewDesc= ( pNewFlow && !pNewFlow->IsFollow() )
             ? pNewFlow->GetFrm().GetAttrSet()->GetPageDesc().GetPageDesc() : 0;
 
+    SAL_INFO( "sw.pagefrm", "WrongPageDesc p: " << pNew << " phys: " << pNew->GetPhyPageNum() );
+    SAL_INFO( "sw.pagefrm", "WrongPageDesc " << pNew->GetPageDesc() << " " << pDesc );
+    SAL_INFO( "sw.pagefrm", "WrongPageDesc odd: " << bOdd
+              << " first: " << bFirst << " " << pNew->GetFormat() << " == "
+              << (bOdd ? pDesc->GetRightFormat(bFirst) : pDesc->GetLeftFormat(bFirst)) << " "
+              << (bOdd ? pDesc->GetLeftFormat(bFirst) : pDesc->GetRightFormat(bFirst)) );
+
     return (pNew->GetPageDesc() != pDesc)   //  own desc ?
         || (pNew->GetFormat() !=
               (bOdd ? pDesc->GetRightFormat(bFirst) : pDesc->GetLeftFormat(bFirst)))
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 72bfaef..a38815f 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2698,10 +2698,12 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
         SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ?
                 static_cast<SwPageFrm*>(pSibling->GetPrev())->GetPageDesc() : &rDesc;
         pRet = new SwPageFrm( pDoc->GetEmptyPageFormat(), pUpper, pTmpDesc );
+        SAL_INFO( "sw.pagefrm", "InsertNewPage - insert empty p: " << pRet << " d: " << pTmpDesc );
         pRet->Paste( pUpper, pSibling );
         pRet->PreparePage( bFootnote );
     }
     pRet = new SwPageFrm( pFormat, pUpper, &rDesc );
+    SAL_INFO( "sw.pagefrm", "InsertNewPage p: " << pRet << " d: " << &rDesc << " f: " << pFormat );
     pRet->Paste( pUpper, pSibling );
     pRet->PreparePage( bFootnote );
     if ( pRet->GetNext() )
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 78df866..8ef3633 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -964,6 +964,7 @@ void SwPageFrm::PrepareRegisterChg()
  */
 void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** ppPrev )
 {
+    SAL_INFO( "sw.pagefrm", "(CheckPageDescs in phy: " << pStart->GetPhyPageNum() );
     assert(pStart && "no starting page.");
 
     SwViewShell *pSh   = pStart->getRootFrm()->GetCurrShell();
@@ -972,6 +973,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
     if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() )
     {
         pImp->GetLayAction().SetCheckPageNum( pStart->GetPhyPageNum() );
+        SAL_INFO( "sw.pagefrm", "CheckPageDescs out fast - via SetCheckPageNum: "
+                  << pStart->GetPhyPageNum() << ")" );
         return;
     }
 
@@ -1043,7 +1046,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                         pNextFormatWish = bNextWantOdd ? pNextDesc->GetLeftFormat() : pNextDesc->GetRightFormat();
                     if ( pNextFormatWish && pNextPage->GetFormat() == pNextFormatWish )
                     {
-                        SAL_INFO( "sw.swpagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                        SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
                                   << " c: 1+3 - skip next page of p: " << pPage );
                         if (pPage->GetPageDesc() != pPrevPage->GetPageDesc())
                             pPage->SetPageDesc( pPrevPage->GetPageDesc(), 0 );
@@ -1057,6 +1060,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                 bool bUpdatePrev = false;
                 if (ppPrev && *ppPrev == pPage)
                     bUpdatePrev = true;
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                          << " c: 1 - destroy p: " << pPage );
                 SwFrm::DestroyFrm(pPage);
                 if ( pStart == pPage )
                     pStart = pNextPage;
@@ -1069,6 +1074,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                       pDesc != pPage->GetPageDesc() )
             {
                 pPage->SetPageDesc( pDesc, 0 );
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                          << " c: 2 - set desc p: " << pPage << " d: " << pDesc );
             }
             else if ( !bIsEmpty &&      //3.
                       bIsOdd != bWantOdd &&
@@ -1080,6 +1087,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                 if ( pPrevPage )
                     pDesc = pPrevPage->GetPageDesc();
                 SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFormat(), pRoot, pDesc );
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                          << " c: 3 - insert empty p: " << pTmp << " d: " << pDesc );
                 pTmp->Paste( pRoot, pPage );
                 pTmp->PreparePage( false );
                 pPage = pTmp;
@@ -1088,6 +1097,9 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             {
                 SwPageDesc *pOld = pPage->GetPageDesc();
                 pPage->SetPageDesc( pDesc, pFormatWish );
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                          << " c: 4 - set desc + format p: " << pPage
+                          << " d: " << pDesc << " f: " << pFormatWish );
                 if ( bFootnotes )
                 {
                     // If specific values of the FootnoteInfo are changed, something has to happen.
@@ -1102,6 +1114,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             else if ( pFormatWish && pPage->GetFormat() != pFormatWish )         //5.
             {
                 pPage->SetFrameFormat( pFormatWish );
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                          << " c: 5 - set format p: " << pPage << " f: " << pFormatWish );
             }
             else if ( !pFormatWish )                                       //6.
             {
@@ -1110,6 +1124,9 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                 if ( pFormatWish && pPage->GetFormat() != pFormatWish )
                 {
                     pPage->SetFrameFormat( pFormatWish );
+                    SAL_INFO( "sw.pagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                              << " c: 6 - set format p: " << pPage << " f: " << pFormatWish );
+                }
             }
 #if OSL_DEBUG_LEVEL > 0
             else
@@ -1133,6 +1150,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
                 if (ppPrev && *ppPrev == pPage)
                     bUpdatePrev = true;
                 SwFrm::DestroyFrm(pPage);
+                SAL_INFO( "sw.pagefrm", "CheckPageDescs - handle bIsEmpty - destroy p: " << pPage );
                 if ( pStart == pPage )
                     pStart = pTmp;
                 pPage = pTmp;
@@ -1174,6 +1192,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
         pPg = static_cast<SwPageFrm*>(pPg->GetNext());
     }
 #endif
+    SAL_INFO( "sw.pagefrm", "CheckPageDescs out)" );
 }
 
 static bool lcl_InsertPage( SwRootFrm *pRoot, SwPageFrm **pRefSibling,
@@ -1183,7 +1202,12 @@ static bool lcl_InsertPage( SwRootFrm *pRoot, SwPageFrm **pRefSibling,
     SwPageFrm *pPage = new SwPageFrm(pFormat, pRoot, pDesc);
     SwPageFrm *pSibling = *pRefSibling;
     if ( pRefPage )
+    {
         *pRefPage = pPage;
+        SAL_INFO( "sw.pagefrm", "lcl_InsertPage p: " << pPage << " d: " << pDesc << " f: " << pFormat );
+    }
+    else
+        SAL_INFO( "sw.pagefrm", "lcl_InsertPage - insert empty p: " << pPage << " d: " << pDesc );
     pPage->Paste( pRoot, pSibling );
     pPage->PreparePage( bFootnote );
     // If the sibling has no body text, destroy it as long as it is no footnote page.
@@ -1254,8 +1278,12 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFootnote )
             {
                 const sal_uInt16 nNum = pImp->GetLayAction().GetCheckPageNum();
                 if ( nNum == pPrevPage->GetPhyPageNum() + 1 )
+                {
                     pImp->GetLayAction().SetCheckPageNumDirect(
                                                     pSibling->GetPhyPageNum() );
+                    SAL_INFO( "sw.pagefrm", "InsertPage - SetCheckPageNumDirect: "
+                              << pSibling->GetPhyPageNum() );
+                }
                 return pPage;
             }
         }
@@ -1392,6 +1420,7 @@ void SwRootFrm::RemoveSuperfluous()
 
         if ( pPage )
         {
+            SAL_INFO( "sw.pagefrm", "RemoveSuperfluous - DestroyFrm p: " << pPage );
             RemovePage( &pPage, SwRemoveResult::Prev );
             nDocPos = pPage ? pPage->Frm().Top() : 0;
         }
@@ -1455,11 +1484,27 @@ void SwRootFrm::AssertFlyPages()
             }
         }
     }
+
+#if OSL_DEBUG_LEVEL > 0
+    pPage = static_cast<SwPageFrm*>(Lower());
+    while ( pPage && pPage->GetNext() &&
+            !static_cast<SwPageFrm*>(pPage->GetNext())->IsFootnotePage() )
+    {
+        SAL_INFO( "sw.pagefrm",  "AssertFlyPages p: " << pPage << " d: " << pPage->GetPageDesc()
+                   << " f: " << pPage->GetFormat() << " virt: " << pPage->GetVirtPageNum()
+                   << " phys: " << pPage->GetPhyPageNum() << " empty: " << pPage->IsEmptyPage() );
+        pPage = static_cast<SwPageFrm*>(pPage->GetNext());
+    }
+    SAL_INFO( "sw.pagefrm", "AssertFlyPages p: " << pPage << " d: " << pPage->GetPageDesc()
+              << " f: " << pPage->GetFormat() << " virt: " << pPage->GetVirtPageNum()
+              << " phys: " << pPage->GetPhyPageNum() << " empty: " << pPage->IsEmptyPage() );
+#endif
 }
 
 /// Ensure that after the given page all page-bound objects are located on the correct page
 void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
 {
+    SAL_INFO( "sw.pagefrm", "(AssertPageFlys in" );
     while ( pPage )
     {
         if (pPage->GetSortedObjs())
@@ -1474,6 +1519,7 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
                 if ((rAnch.GetAnchorId() == FLY_AT_PAGE) &&
                      nPg != pPage->GetPhyPageNum() )
                 {
+                    SAL_INFO( "sw.pagefrm", nPg << " " << pPage->GetPhyPageNum() );
                     // If on the wrong page, check if previous page is empty
                     if( nPg && !(pPage->GetPhyPageNum()-1 == nPg &&
                         static_cast<SwPageFrm*>(pPage->GetPrev())->IsEmptyPage()) )
@@ -1497,6 +1543,7 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
         }
         pPage = static_cast<SwPageFrm*>(pPage->GetNext());
     }
+    SAL_INFO( "sw.pagefrm", "AssertPageFlys out)" );
 }
 
 Size SwRootFrm::ChgSize( const Size& aNewSize )
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 98080da..66b7e27 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1421,7 +1421,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
             // Unfreeze target document layouts and correct all PageDescs.
             if(bCreateSingleFile)
             {
+                SAL_INFO( "sw.pagefrm", "(MergeMailFiles pTargetShell->CalcLayout in" );
                 pTargetShell->CalcLayout();
+                SAL_INFO( "sw.pagefrm", "MergeMailFiles pTargetShell->CalcLayout out)" );
                 std::set<SwRootFrm*> aAllLayouts = pTargetShell->GetDoc()->GetAllLayouts();
                 std::for_each( aAllLayouts.begin(), aAllLayouts.end(),
                     ::std::bind2nd(::std::mem_fun(&SwRootFrm::FreezeLayout), false));
commit e26d7a805d033df448628c40935c4b1981bf43ab
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 11:29:16 2016 +0200

    Don't oscillate empty pages in CheckPageDescs
    
    For the first case of dropping "wrong" empty pages,look ahead and
    pre-validate the next page, if it needs this empty page, to
    prevent case three for the next page.
    
    This prevents destruction and re-insert of the empty page.
    
    Change-Id: I475aa98a2693f814afcc41bd4bc73f04e742c105

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 0d34c01..78df866 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1026,6 +1026,33 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             if ( bIsEmpty && ( pFormatWish ||          //1.
                  ( !bWantOdd && !pPrevPage ) ) )
             {
+                // Check all cases for the next page, so we don't oscillate empty pages
+                // Skip case 1 and 2, as we require a non-empty next page to save the empty page
+                // Case 3 is the one we actually want to predict and skip
+                // We can skip the empty check of case 3, as we just work on an existing next page
+                bool bNextWantOdd;
+                SwPageDesc *pNextDesc;
+                if ( pNextPage && !pNextPage->IsEmptyPage() &&    //3.
+                     pNextPage->OnRightPage() == (bNextWantOdd = pNextPage->WannaRightPage()) &&
+                     pNextPage->GetPageDesc() == (pNextDesc = pNextPage->FindPageDesc()) )   //4.
+                {
+                    bool bNextFirst = pNextPage->OnFirstPage();
+                    SwFrameFormat *pNextFormatWish = (bNextWantOdd) ?   //5.
+                        pNextDesc->GetRightFormat(bNextFirst) : pNextDesc->GetLeftFormat(bNextFirst);
+                    if ( !pNextFormatWish )    // 6.
+                        pNextFormatWish = bNextWantOdd ? pNextDesc->GetLeftFormat() : pNextDesc->GetRightFormat();
+                    if ( pNextFormatWish && pNextPage->GetFormat() == pNextFormatWish )
+                    {
+                        SAL_INFO( "sw.swpagefrm", "CheckPageDescs phys: " << pPage->GetPhyPageNum()
+                                  << " c: 1+3 - skip next page of p: " << pPage );
+                        if (pPage->GetPageDesc() != pPrevPage->GetPageDesc())
+                            pPage->SetPageDesc( pPrevPage->GetPageDesc(), 0 );
+                        // We can skip the next page, as all checks were already done!
+                        pPage = static_cast<SwPageFrm*>(pNextPage->GetNext());
+                        continue;
+                    }
+                }
+
                 pPage->Cut();
                 bool bUpdatePrev = false;
                 if (ppPrev && *ppPrev == pPage)
commit e48505005029bb19cd85774691b29bf0e9c09682
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 11:23:23 2016 +0200

    Flush the page break for correct layouting
    
    This is a workaround to create correct SwPageFrm objects for
    layouting, so the page break is actually visible when
    copying nodes, so we create the correct SwPageFrm.
    
    This is especially problematic for mail merge after the fix in
    commit 60d34e1c840d2c317bb7d0a5b14f4602c22b3fcc, which -
    correctly - checks all later SwPageDesc for every fix done by
    CheckPageDescs().
    
    Change-Id: Ie6ea2e9a0587199be4dbaf3ed63a94c29b318ce2

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 8dbe159..caf4d66 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -976,6 +976,13 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
                 for (sw::mark::IMark* pMark : aSeenMarks)
                     pMarkAccess->repositionMark(pMark, aPaM);
             }
+
+            // Flush the page break, if we want to keep it
+            if ( !bDeletePrevious )
+            {
+                pTargetShell->EndAllAction();
+                pTargetShell->StartAllAction();
+            }
         }
     }
 #ifdef DBG_UTIL
commit 7ee2eb4fe75030c2eeb8ebf6ebbddc4217348964
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 11:06:33 2016 +0200

    Use InsertPage in AssertFlyPages
    
    AssertFlyPages used it's own code to insert pages. It had two
    flaws:
    
      1. It used the SwPageDesc of the previous page, unaware of
         changed page description of a new page, which would later
         be fixed by CheckPageDescs, eventually requiring re-layout.
    
      2. The Code has an of-by-one error when setting the initial
         bOdd, which would also insert wrong / inverse left and
         right pages.
    
    So this changes AssertFlyPages to use InsertPage, which has a
    little more overhead for inserts, but prevents later expensive
    corrections, especially when CheckPageDescs() inserts or removes
    "early" pages, which need to evaluate and move all page bound
    flys.
    
    Change-Id: I8806cebb26db60602d8438f117e0416e07228b3b

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index c9a2e01..0d34c01 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1408,29 +1408,9 @@ void SwRootFrm::AssertFlyPages()
 
     if ( nMaxPg > pPage->GetPhyPageNum() )
     {
-        // Continue pages based on the rules of the PageDesc after the last page.
-        bool bOdd = (pPage->GetPhyPageNum() % 2) != 0;
-        SwPageDesc *pDesc = pPage->GetPageDesc();
-        SwFrm *pSibling = pPage->GetNext();
         for ( sal_uInt16 i = pPage->GetPhyPageNum(); i < nMaxPg; ++i  )
-        {
-            if ( !(bOdd ? pDesc->GetRightFormat() : pDesc->GetLeftFormat()) )
-            {
-                // Insert empty page (but Flys will be stored in the next page)
-                pPage = new SwPageFrm( pDoc->GetEmptyPageFormat(), this, pDesc );
-                pPage->Paste( this, pSibling );
-                pPage->PreparePage( false );
-                bOdd = !bOdd;
-                ++i;
-            }
-            pPage = new
-                    SwPageFrm( (bOdd ? pDesc->GetRightFormat() :
-                                       pDesc->GetLeftFormat()), this, pDesc );
-            pPage->Paste( this, pSibling );
-            pPage->PreparePage( false );
-            bOdd = !bOdd;
-            pDesc = pDesc->GetFollow();
-        }
+            pPage = InsertPage( pPage, false );
+
         // If the endnote pages are now corrupt, destroy them.
         if ( !pDoc->GetFootnoteIdxs().empty() )
         {
@@ -1441,7 +1421,7 @@ void SwRootFrm::AssertFlyPages()
             if ( pPage )
             {
                 SwPageDesc *pTmpDesc = pPage->FindPageDesc();
-                bOdd = pPage->OnRightPage();
+                bool bOdd = pPage->OnRightPage();
                 if ( pPage->GetFormat() !=
                      (bOdd ? pTmpDesc->GetRightFormat() : pTmpDesc->GetLeftFormat()) )
                     RemoveFootnotes( pPage, false, true );
commit 2bc9951e0352856f48ef923a9ce763ff298b5a3b
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 10:15:33 2016 +0200

    Refactor duplicated code in SwFrm::InsertPage
    
    Change-Id: Iff9a78cf2f5e6ded4d1b03a8303529aa324ddad9

diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index e5ca715..aa77518 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -48,6 +48,12 @@ struct SwCrsrMoveState;
 #define INV_LINENUM 32
 #define INV_DIRECTION 64
 
+enum SwRemoveResult
+{
+    Next,
+    Prev
+};
+
 #include <vector>
 
 /// The root element of a Writer document layout.
@@ -369,6 +375,8 @@ public:
 
     bool IsLayoutFreezed() const { return mbLayoutFreezed; }
     void FreezeLayout( bool freeze ) { mbLayoutFreezed = freeze; }
+
+    void RemovePage( SwPageFrm **pDel, SwRemoveResult eResult );
 };
 
 inline long SwRootFrm::GetBrowseWidth() const
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 1e747e5..c9a2e01 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1149,6 +1149,26 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
 #endif
 }
 
+static bool lcl_InsertPage( SwRootFrm *pRoot, SwPageFrm **pRefSibling,
+                            SwFrameFormat *pFormat, SwPageDesc *pDesc,
+                            bool bFootnote, SwPageFrm **pRefPage )
+{
+    SwPageFrm *pPage = new SwPageFrm(pFormat, pRoot, pDesc);
+    SwPageFrm *pSibling = *pRefSibling;
+    if ( pRefPage )
+        *pRefPage = pPage;
+    pPage->Paste( pRoot, pSibling );
+    pPage->PreparePage( bFootnote );
+    // If the sibling has no body text, destroy it as long as it is no footnote page.
+    if ( pSibling && !pSibling->IsFootnotePage() &&
+         !pSibling->FindFirstBodyContent() )
+    {
+        pRoot->RemovePage( pRefSibling, SwRemoveResult::Next ) ;
+        return false;
+    }
+    return true;
+}
+
 SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFootnote )
 {
     SwRootFrm *pRoot = static_cast<SwRootFrm*>(pPrevPage->GetUpper());
@@ -1186,45 +1206,15 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, bool bFootnote )
     // If there is no FrameFormat for this page, create an empty page.
     if( bWishedOdd != bNextOdd )
     {
-        SwFrameFormat *const pEmptyFormat = pDoc->GetEmptyPageFormat();
-        SwPageDesc *pTmpDesc = pPrevPage->GetPageDesc();
-        SwPageFrm *pPage = new SwPageFrm(pEmptyFormat, pRoot, pTmpDesc);
-        pPage->Paste( pRoot, pSibling );
-        pPage->PreparePage( bFootnote );
-        // If the sibling has no body text, destroy it as long as it is no footnote page.
-        if ( pSibling && !pSibling->IsFootnotePage() &&
-             !pSibling->FindFirstBodyContent() )
-        {
-            SwPageFrm *pDel = pSibling;
-            pSibling = static_cast<SwPageFrm*>(pSibling->GetNext());
-            if ( !pDoc->GetFootnoteIdxs().empty() )
-                pRoot->RemoveFootnotes( pDel, true );
-            pDel->Cut();
-            SwFrm::DestroyFrm(pDel);
-        }
-        else
-            bCheckPages = true;
+        bCheckPages = lcl_InsertPage( pRoot, &pSibling, pDoc->GetEmptyPageFormat(),
+                                      pPrevPage->GetPageDesc(), bFootnote, NULL ) || bCheckPages;
     }
     SwFrameFormat *const pFormat( (bWishedOdd)
             ? pDesc->GetRightFormat(bWishedFirst)
             : pDesc->GetLeftFormat(bWishedFirst) );
     assert(pFormat);
-    SwPageFrm *pPage = new SwPageFrm( pFormat, pRoot, pDesc );
-    pPage->Paste( pRoot, pSibling );
-    pPage->PreparePage( bFootnote );
-    // If the sibling has no body text, destroy it as long as it is no footnote page.
-    if ( pSibling && !pSibling->IsFootnotePage() &&
-         !pSibling->FindFirstBodyContent() )
-    {
-        SwPageFrm *pDel = pSibling;
-        pSibling = static_cast<SwPageFrm*>(pSibling->GetNext());
-        if ( !pDoc->GetFootnoteIdxs().empty() )
-            pRoot->RemoveFootnotes( pDel, true );
-        pDel->Cut();
-        SwFrm::DestroyFrm(pDel);
-    }
-    else
-        bCheckPages = true;
+    SwPageFrm *pPage = NULL;
+    bCheckPages = lcl_InsertPage( pRoot, &pSibling, pFormat, pDesc, bFootnote, &pPage ) || bCheckPages;
 
     if ( pSibling )
     {
@@ -1293,6 +1283,17 @@ SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool )
     return nDist;
 }
 
+void SwRootFrm::RemovePage( SwPageFrm **pDelRef, SwRemoveResult eResult )
+{
+    SwPageFrm *pDel = *pDelRef;
+    (*pDelRef) = static_cast<SwPageFrm*>(
+        eResult == SwRemoveResult::Next ? pDel->GetNext() : pDel->GetPrev() );
+    if ( !GetFormat()->GetDoc()->GetFootnoteIdxs().empty() )
+        RemoveFootnotes( pDel, true );
+    pDel->Cut();
+    SwFrm::DestroyFrm( pDel );
+}
+
 /// remove pages that are not needed at all
 void SwRootFrm::RemoveSuperfluous()
 {
@@ -1364,12 +1365,7 @@ void SwRootFrm::RemoveSuperfluous()
 
         if ( pPage )
         {
-            SwPageFrm *pEmpty = pPage;
-            pPage = static_cast<SwPageFrm*>(pPage->GetPrev());
-            if ( !GetFormat()->GetDoc()->GetFootnoteIdxs().empty() )
-                RemoveFootnotes( pEmpty, true );
-            pEmpty->Cut();
-            SwFrm::DestroyFrm(pEmpty);
+            RemovePage( &pPage, SwRemoveResult::Prev );
             nDocPos = pPage ? pPage->Frm().Top() : 0;
         }
     } while ( pPage );
commit 92133efad3ae103a9d0077f664f0355c6b60f2d1
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 10:05:08 2016 +0200

    Fix some variable scopes and clarify names
    
    Helps understanding the code, especially CheckPageDescs().
    
    Change-Id: I53e7d0ea65d6c6ae3da98acba4d366a47d2c4210

diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 2a4c1f4..a4f1856 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -810,15 +810,15 @@ bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
     // Way out of the situation: Try to preliminarily insert a
     // new page once (empty pages are already inserted by InsertPage()
     // if required)
-    const SwFormatPageDesc &rFormatDesc = GetAttrSet()->GetPageDesc();
 
     //My Pagedesc doesn't count if I'm a follow!
-    SwPageDesc *pDesc = 0;
+    const SwPageDesc *pDesc = 0;
     int nTmp = 0;
     SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( this );
     if ( !pFlow || !pFlow->IsFollow() )
     {
-        pDesc = const_cast<SwPageDesc*>(rFormatDesc.GetPageDesc());
+        const SwFormatPageDesc &rFormatDesc = GetAttrSet()->GetPageDesc();
+        pDesc = rFormatDesc.GetPageDesc();
         if( pDesc )
         {
             if( !pDesc->GetRightFormat() )
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 6e426b4..1e747e5 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -988,19 +988,21 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
         pPage = static_cast<SwPageFrm*>(pPage->GetPrev());
     while ( pPage )
     {
-        // obtain PageDesc and FrameFormat
+        SwPageFrm *pPrevPage = static_cast<SwPageFrm*>(pPage->GetPrev());
+        SwPageFrm *pNextPage = static_cast<SwPageFrm*>(pPage->GetNext());
+
         SwPageDesc *pDesc = pPage->FindPageDesc();
-        bool bCheckEmpty = pPage->IsEmptyPage();
-        bool bActOdd = pPage->OnRightPage();
-        bool bOdd = pPage->WannaRightPage();
+        bool bIsEmpty = pPage->IsEmptyPage();
+        bool bIsOdd = pPage->OnRightPage();
+        bool bWantOdd = pPage->WannaRightPage();
         bool bFirst = pPage->OnFirstPage();
-        SwFrameFormat *pFormatWish = (bOdd)
+        SwFrameFormat *pFormatWish = (bWantOdd)
             ? pDesc->GetRightFormat(bFirst) : pDesc->GetLeftFormat(bFirst);
 
-        if ( bActOdd != bOdd ||
+        if ( bIsOdd != bWantOdd ||
              pDesc != pPage->GetPageDesc() ||        // wrong Desc
-             ( pFormatWish != pPage->GetFormat()  &&       // wrong format and
-               ( !pPage->IsEmptyPage() || pFormatWish ) // not blank /empty
+             ( pFormatWish != pPage->GetFormat() &&       // wrong format and
+               ( !bIsEmpty || pFormatWish ) // not blank /empty
              )
            )
         {
@@ -1010,8 +1012,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
 
             // invalidate the field, starting from here
             if ( nDocPos == LONG_MAX )
-                nDocPos = pPage->GetPrev() ?
-                            pPage->GetPrev()->Frm().Top() : pPage->Frm().Top();
+                nDocPos = pPrevPage ?  pPrevPage->Frm().Top() : pPage->Frm().Top();
 
             // Cases:
             //  1. Empty page should be "normal" page -> remove empty page and take next one
@@ -1022,38 +1023,36 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             //  5. Normal page should have different format -> change
             //  6. No "wish" format provided -> take the "other" format (left/right) of the PageDesc
 
-            if ( pPage->IsEmptyPage() && ( pFormatWish ||          //1.
-                 ( !bOdd && !pPage->GetPrev() ) ) )
+            if ( bIsEmpty && ( pFormatWish ||          //1.
+                 ( !bWantOdd && !pPrevPage ) ) )
             {
-                SwPageFrm *pTmp = static_cast<SwPageFrm*>(pPage->GetNext());
                 pPage->Cut();
                 bool bUpdatePrev = false;
                 if (ppPrev && *ppPrev == pPage)
                     bUpdatePrev = true;
                 SwFrm::DestroyFrm(pPage);
                 if ( pStart == pPage )
-                    pStart = pTmp;
-                pPage = pTmp;
+                    pStart = pNextPage;
+                pPage = pNextPage;
                 if (bUpdatePrev)
-                    *ppPrev = pTmp;
+                    *ppPrev = pNextPage;
                 continue;
             }
-            else if ( pPage->IsEmptyPage() && !pFormatWish &&  //2.
+            else if ( bIsEmpty && !pFormatWish &&  //2.
                       pDesc != pPage->GetPageDesc() )
             {
                 pPage->SetPageDesc( pDesc, 0 );
             }
-            else if ( !pPage->IsEmptyPage() &&      //3.
-                      bActOdd != bOdd &&
-                      ( ( !pPage->GetPrev() && !bOdd ) ||
-                        ( pPage->GetPrev() &&
-                          !static_cast<SwPageFrm*>(pPage->GetPrev())->IsEmptyPage() )
+            else if ( !bIsEmpty &&      //3.
+                      bIsOdd != bWantOdd &&
+                      ( ( !pPrevPage && !bWantOdd ) ||
+                        ( pPrevPage && !pPrevPage->IsEmptyPage() )
                       )
                     )
             {
-                if ( pPage->GetPrev() )
-                    pDesc = static_cast<SwPageFrm*>(pPage->GetPrev())->GetPageDesc();
-                SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFormat(),pRoot,pDesc);
+                if ( pPrevPage )
+                    pDesc = pPrevPage->GetPageDesc();
+                SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFormat(), pRoot, pDesc );
                 pTmp->Paste( pRoot, pPage );
                 pTmp->PreparePage( false );
                 pPage = pTmp;
@@ -1080,9 +1079,9 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             else if ( !pFormatWish )                                       //6.
             {
                 // get format with inverted logic
-                if (!pFormatWish)
-                    pFormatWish = bOdd ? pDesc->GetLeftFormat() : pDesc->GetRightFormat();
-                if ( pPage->GetFormat() != pFormatWish )
+                pFormatWish = bWantOdd ? pDesc->GetLeftFormat() : pDesc->GetRightFormat();
+                if ( pFormatWish && pPage->GetFormat() != pFormatWish )
+                {
                     pPage->SetFrameFormat( pFormatWish );
             }
 #if OSL_DEBUG_LEVEL > 0
@@ -1092,7 +1091,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, bool bNotifyFields, SwPageFrm** p
             }
 #endif
         }
-        if ( bCheckEmpty )
+        if ( bIsEmpty )
         {
             // It also might be that an empty page is not needed at all.
             // However, the algorithm above cannot determine that. It is not needed if the following
commit b632da899ec2ba860efe6ac4f5674f898fd764eb
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 09:47:40 2016 +0200

    Don't re-check valid SwPageDescs when layouting
    
    nCheckPageNum is set to USHRT_MAX, if all SwPageDesc were checked.
    Code manipulating SwPageFrm objects checks the pages via
    CheckPageDescs(). If this is currently forbidden, CheckPageDescs()
    sets nCheckPageNum to the first page to check.
    
    I guess the !pPage check is there to check the pages - at the end,
    if someone has missed the CheckPageDescs call. And we have to run
    the check, if the current page is unchecked AKA
      pPage->GetPhyPageNum() >= nCheckPageNum
    to do correct layouting.
    
    Change-Id: Ib67878115cde04b7161c919a67131a1e1dc67d8d

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index ba9edb0..da0e97a 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -472,7 +472,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
     sal_uInt16 nPercentPageNum = 0;
     while ( (pPage && !IsInterrupt()) || nCheckPageNum != USHRT_MAX )
     {
-        if (!pPage || (nCheckPageNum != USHRT_MAX && pPage->GetPhyPageNum() >= nCheckPageNum))
+        if ( (nCheckPageNum != USHRT_MAX) && (!pPage || pPage->GetPhyPageNum() >= nCheckPageNum) )
         {
             if ( !pPage || pPage->GetPhyPageNum() > nCheckPageNum )
             {
commit b485d785ed0004ec10fd44c40aa1efc852a2a836
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 10 12:33:21 2016 +0200

    Add SAL_INFOs to dump the Scheduler handling
    
    Debug area name is "vcl.scheduler".
    
    Change-Id: Ia1eab69e76671bd33ce3324c5eb058e4e00dfdd2

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index d734876..2e89799 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -403,6 +403,7 @@ certain functionality.
 @li @c vcl.osx
 @li @c vcl.osx.print
 @li @c vcl.quartz
+ at li @c vcl.scheduler - VCL task scheduling code
 @li @c vcl.scrollbar - Scroll Bars
 @li @c vcl.sm - Session Manager
 @li @c vcl.unity
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 8921fc6..e64e4e9 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -169,7 +169,12 @@ next_entry:
         pMostUrgent->mnLastTime = nTime;
         UpdateMinPeriod( pMostUrgent, nTime, nMinPeriod );
 
+        Scheduler *pTempScheduler = pMostUrgent->mpScheduler;
+        SAL_INFO( "vcl.schedule", pTempScheduler << "  invoke   "
+                   << pTempScheduler->mpDebugName );
         pMostUrgent->Invoke();
+        if ( !pMostUrgent->mpScheduler )
+            SAL_INFO( "vcl.schedule", pTempScheduler <<  "  tag-rm   " );
 
         // do some simple round-robin scheduling
         // nothing to do, if we're already the last element
@@ -184,7 +189,7 @@ next_entry:
         }
     }
 
-    // delete clock if no more timers available
+    // delete the wakeup timer, if no more tasks need scheduling
     if ( nMinPeriod != MAX_SLEEP_PERIOD )
         Timer::ImplStartTimer( pSVData, nMinPeriod );
     else if ( pSVData->mpSalTimer )
@@ -216,10 +221,12 @@ void Scheduler::Start()
         mpSchedulerData->mbInScheduler = false;
         mpSchedulerData->mpNext        = pSVData->mpFirstSchedulerData;
         pSVData->mpFirstSchedulerData  = mpSchedulerData;
+        SAL_INFO( "vlc.scheduler", this <<  "  added    " << mpDebugName );
     }
 
     assert( mpSchedulerData->mpScheduler == this );
     mpSchedulerData->mnLastTime  = tools::Time::GetSystemTicks();
+    SAL_INFO( "vlc.scheduler", this <<  "  started  " << mpDebugName );
 
     pSVData->mbNeedsReschedule = true;
 }
@@ -229,6 +236,7 @@ void Scheduler::Stop()
     if ( !mpSchedulerData )
         return;
     Scheduler::SetDeletionFlags();
+    SAL_INFO( "vlc.scheduler", this <<  "  stopped  " << mpDebugName );
     assert( !mpSchedulerData );
 }
 
commit 37855890ef247933dcbce5585a298820b2793ccd
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)?
    
    And this includes the defintion to skip idles with
    priority >= DEFAULT_IDLE in busy times. This should proably be
    expanded to also include timers, as priority is already handled
    independent from the task type.
    
    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 cde96f3..43ee70a 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -187,7 +187,7 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
         maMinSize.Height() = ( maMinSize.Height() << 1 ) + AVMEDIA_CONTROLOFFSET;
     }
 
-    maIdle.SetPriority( SchedulerPriority::LOW );
+    maIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     maIdle.SetIdleHdl( LINK( this, MediaControl, implTimeoutHdl ) );
     maIdle.Start();
 }
diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx
index 3ed91fd..15239c6 100644
--- a/avmedia/source/framework/soundhandler.cxx
+++ b/avmedia/source/framework/soundhandler.cxx
@@ -222,7 +222,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 = css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
         m_xPlayer->start();
-        m_aUpdateIdle.SetPriority( SchedulerPriority::LOWER );
+        m_aUpdateIdle.SetPriority( SchedulerPriority::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 7ddaa50..48f292e 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -124,7 +124,7 @@ bool OGLPlayer::create( const OUString& rURL )
 
     // Set timer
     m_aTimer.SetTimeout(8); // is 125fps enough for anyone ?
-    m_aTimer.SetPriority(SchedulerPriority::LOW);
+    m_aTimer.SetPriority(SchedulerPriority::HIGH_IDLE);
     m_aTimer.SetTimeoutHdl(LINK(this,OGLPlayer,TimerHandler));
 
     return true;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 40bea12..e29cc4e 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -976,7 +976,6 @@ void EditorWindow::CreateEditEngine()
 
     ImplSetFont();
 
-    aSyntaxIdle.SetPriority( SchedulerPriority::LOWER );
     aSyntaxIdle.SetIdleHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) );
 
     bool bWasDoSyntaxHighlight = bDoSyntaxHighlight;
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index f9cb691..1d135b7 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -220,7 +220,6 @@ DlgEditor::DlgEditor (
     m_ClipboardDataFlavorsResource[1].HumanPresentableName = "Dialog 8.0" ;
     m_ClipboardDataFlavorsResource[1].DataType =             cppu::UnoType<Sequence< sal_Int8 >>::get();
 
-    aMarkIdle.SetPriority(SchedulerPriority::LOW);
     aMarkIdle.SetIdleHdl( LINK( this, DlgEditor, MarkTimeout ) );
 
     rWindow.SetMapMode( MapMode( MAP_100TH_MM ) );
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index c844c12..8acf831 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -182,7 +182,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.SetIdleHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) );
-    m_aResetIdle.SetPriority(SchedulerPriority::LOWER);
 
     m_pExpertConfigBtn->SetClickHdl( LINK( this, SvxJavaOptionsPage, ExpertConfigHdl_Impl) );
     if (!officecfg::Office::Common::Security::EnableExpertConfiguration::get())
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index c167f2b..82eb729 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -141,7 +141,7 @@ _SfxMacroTabPage::_SfxMacroTabPage(vcl::Window* pParent, const SfxItemSet& rAttr
     mpImpl = new _SfxMacroTabPage_Impl;
 
     mpImpl->maFillGroupIdle.SetIdleHdl( LINK( this, _SfxMacroTabPage, TimeOut_Impl ) );
-    mpImpl->maFillGroupIdle.SetPriority( SchedulerPriority::HIGHEST );
+    mpImpl->maFillGroupIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     mpImpl->maFillGroupIdle.SetDebugName( "_SfxMacroTabPage maFillGroupIdle" );
 }
 
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index a1dbb2d..a11eb60 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1069,7 +1069,7 @@ bool OJoinTableView::ScrollWhileDragging()
     // resetting timer, if still necessary
     if (bNeedScrollTimer)
     {
-        m_aDragScrollIdle.SetPriority(SchedulerPriority::LOW);
+        m_aDragScrollIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
         m_aDragScrollIdle.Start();
     }
 
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index fb98cdd..b0e8853 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -1220,7 +1220,6 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
     m_pUpdateBtn->Enable( false );
     m_pCloseBtn->GrabFocus();
 
-    m_aIdle.SetPriority( SchedulerPriority::MEDIUM );
     m_aIdle.SetIdleHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
 }
 
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 425593d..97753e2 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1786,7 +1786,6 @@ OUString FormulaDlg::GetMeText() const
 void FormulaDlg::Update()
 {
     m_pImpl->Update();
-    m_pImpl->aIdle.SetPriority(SchedulerPriority::LOWER);
     m_pImpl->aIdle.SetIdleHdl(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 6c5aaf7..1ba677d 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -473,7 +473,6 @@ RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits
     , pLabelWidget(pShrinkModeLabel)
 {
     aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
-    aIdle.SetPriority( SchedulerPriority::LOW );
 }
 
 RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent,
@@ -483,7 +482,6 @@ RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent,
     , pLabelWidget(pShrinkModeLabel)
 {
     aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
-    aIdle.SetPriority( SchedulerPriority::LOW );
 }
 
 VCL_BUILDER_DECL_FACTORY(RefEdit)
@@ -549,7 +547,6 @@ void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel
     if( pDlg )
     {
         aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
-        aIdle.SetPriority( SchedulerPriority::LOW );
     }
     else
     {
diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx
index aae475c..25e3c3a 100644
--- a/include/vcl/scheduler.hxx
+++ b/include/vcl/scheduler.hxx
@@ -38,14 +38,13 @@ struct ImplSchedulerData
 
 /// Higher priority = smaller number!
 enum class SchedulerPriority {
-    HIGHEST   = 0,
-    HIGH      = 1,
-    RESIZE    = 2,
-    REPAINT   = 3,
-    MEDIUM    = 3,
-    LOW       = 4,
-    LOWER     = 5,
-    LOWEST    = 6
+    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
+    DEFAULT_IDLE,  ///< Default idle priority
+    LOWEST
 };
 
 class VCL_DLLPUBLIC Scheduler
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 0a6f567..a164e0c 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -120,7 +120,6 @@ ODesignView::ODesignView(   vcl::Window* pParent,
     m_aSplitWin->SetAlign(WINDOWALIGN_LEFT);
     m_aSplitWin->Show();
 
-    m_aMarkIdle.SetPriority( SchedulerPriority::LOW );
     m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) );
 }
 
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 8d3e4e3..4aadeea 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.SetIdleHdl( LINK( this, ScDocument, TrackTimeHdl ) );
-    aTrackIdle.SetPriority( SchedulerPriority::LOW );
 }
 
 sfx2::LinkManager* ScDocument::GetLinkManager()
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 980be1a..88abec7 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -174,7 +174,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
                                         ERRCODE_AREA_APP2-1,
                                         GetResMgr() );
 
-    aSpellIdle.SetPriority(SchedulerPriority::LOWER);
     aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) );
     aSpellIdle.SetDebugName( "sc::ScModule aSpellIdle" );
 
diff --git a/sc/source/ui/docshell/autostyl.cxx b/sc/source/ui/docshell/autostyl.cxx
index ed81680..5b146dd 100644
--- a/sc/source/ui/docshell/autostyl.cxx
+++ b/sc/source/ui/docshell/autostyl.cxx
@@ -84,7 +84,7 @@ ScAutoStyleList::ScAutoStyleList(ScDocShell* pShell)
 {
     aTimer.SetTimeoutHdl( LINK( this, ScAutoStyleList, TimerHdl ) );
     aInitIdle.SetIdleHdl( LINK( this, ScAutoStyleList, InitHdl ) );
-    aInitIdle.SetPriority( SchedulerPriority::HIGHEST );
+    aInitIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
 }
 
 ScAutoStyleList::~ScAutoStyleList()
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index d1a331f..fe6d85b 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -103,7 +103,6 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP,
     InitLRUList();
     SetStyle(GetStyle()|WB_CLIPCHILDREN);
 
-    aIdle.SetPriority(SchedulerPriority::LOWER);
     aIdle.SetIdleHdl(LINK( this, ScFunctionDockWin, TimerHdl));
 
     if (pCW != NULL)
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index eb87be0..b54a8b8 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -114,13 +114,11 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window
     m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this);
     nAcceptCount=0;
     nRejectCount=0;
-    aReOpenIdle.SetPriority(SchedulerPriority::MEDIUM);
     aReOpenIdle.SetIdleHdl(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl ));
 
     pTPFilter=m_pAcceptChgCtr->GetFilterPage();
     pTPView=m_pAcceptChgCtr->GetViewPage();
     pTheView=pTPView->GetTableControl();
-    aSelectionIdle.SetPriority(SchedulerPriority::LOW);
     aSelectionIdle.SetIdleHdl(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 870692c..8fa85ea 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -777,7 +777,6 @@ ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef
 {
     m_aHelper.SetWindow(m_rWindow.get());
     reverseUniqueHelpIdHack(*m_rWindow.get());
-    aIdle.SetPriority(SchedulerPriority::LOWER);
     aIdle.SetIdleHdl(LINK( this, ScRefHandler, UpdateFocusHdl));
 
     if( bBindRef ) EnterRefMode();
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 42008e1..1d1fcee 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -420,7 +420,6 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD
     m_pLbConflicts->SetSelectionMode( MULTIPLE_SELECTION );
     m_pLbConflicts->SetHighlightRange();
 
-    maSelectionIdle.SetPriority( SchedulerPriority::LOW );
     maSelectionIdle.SetIdleHdl( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) );
     maSelectionIdle.SetDebugName( "ScConflictsDlg maSelectionIdle" );
 
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 0450ef2..16d9d08 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -586,13 +586,10 @@ AssistentDlgImpl::AssistentDlgImpl( vcl::Window* pWindow, const Link<>& rFinishL
     maAssistentFunc.GotoPage(1);
     mpLastPageButton->Disable();
 
-    maPrevIdle.SetPriority( SchedulerPriority::LOWER );
     maPrevIdle.SetIdleHdl( LINK( this, AssistentDlgImpl, UpdatePreviewHdl));
 
-    maEffectPrevIdle.SetPriority( SchedulerPriority::MEDIUM );
     maEffectPrevIdle.SetIdleHdl( LINK( this, AssistentDlgImpl, EffectPreviewIdleHdl ));
 
-    maUpdatePageListIdle.SetPriority( SchedulerPriority::MEDIUM );
     maUpdatePageListIdle.SetIdleHdl( LINK( this, AssistentDlgImpl, UpdatePageListHdl));
 
     SetStartType( ST_EMPTY );
diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx
index 16128a6..8ddedd8 100644
--- a/sd/source/ui/dlg/filedlg.cxx
+++ b/sd/source/ui/dlg/filedlg.cxx
@@ -133,7 +133,6 @@ IMPL_LINK_NOARG(SdFileDialog_Imp, PlayMusicHdl)
             {
                 mxPlayer.set( avmedia::MediaWindow::createPlayer( aUrl, "" ), css::uno::UNO_QUERY_THROW );
                 mxPlayer->start();
-                maUpdateIdle.SetPriority( SchedulerPriority::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 bfcbdf5..bf51e2e 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.SetIdleHdl(LINK(this,ShellStackGuard,TimeoutHandler));
-        maPrinterPollingIdle.SetPriority(SchedulerPriority::LOWER);
     }
 }
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 40745d2..16e0d8c 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -538,6 +538,7 @@ SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation,
         mpOldActiveWindow = mpViewShell->GetActiveWindow();
 
     maUpdateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, updateHdl));
+    maUpdateTimer.SetPriority( SchedulerPriority::HIGH_IDLE );
 
     maDeactivateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, deactivateHdl));
     maDeactivateTimer.SetTimeout( 20 );
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index a9aac3f..9ae8e603 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -139,9 +139,7 @@ View::View(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev,
 
     // Timer for delayed drop (has to be for MAC)
     maDropErrorIdle.SetIdleHdl( LINK(this, View, DropErrorHdl) );
-    maDropErrorIdle.SetPriority(SchedulerPriority::MEDIUM);
     maDropInsertFileIdle.SetIdleHdl( LINK(this, View, DropInsertFileHdl) );
-    maDropInsertFileIdle.SetPriority(SchedulerPriority::MEDIUM);
 }
 
 void View::ImplClearDrawDropMarker()
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index f11f1f6..1fffd75 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -115,7 +115,7 @@ SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
         StartListening( *rHint.GetObjShell() );
     pIdle = new Idle;
     pIdle->SetIdleHdl( LINK(this, SfxEventAsyncer_Impl, IdleHdl) );
-    pIdle->SetPriority( SchedulerPriority::HIGHEST );
+    pIdle->SetPriority( SchedulerPriority::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 33b717d..53c8b80 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -565,7 +565,6 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im
     m_pOpenBtn->SetClickHdl( LINK( this, IndexTabPage_Impl, OpenHdl ) );
     Link<Timer *, void> aTimeoutLink = LINK( this, IndexTabPage_Impl, TimeoutHdl );
     aFactoryIdle.SetIdleHdl( LINK(this, IndexTabPage_Impl, IdleHdl ));
-    aFactoryIdle.SetPriority(SchedulerPriority::LOWER);
     aKeywordTimer.SetTimeoutHdl( aTimeoutLink );
 }
 
@@ -1466,7 +1465,6 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)
     nMinWidth = ( m_pActiveLB->GetSizePixel().Width() / 2 );
 
     aIdle.SetIdleHdl( LINK( this, SfxHelpIndexWindow_Impl, InitHdl ) );
-    aIdle.SetPriority( SchedulerPriority::LOWER );
     aIdle.Start();
 
     Show();
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index ca626f1..563bd3f 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -333,7 +333,7 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
 
     xImp->xPoster = new SfxHintPoster(aGenLink);
 
-    xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM);
+    xImp->aIdle.SetPriority(SchedulerPriority::HIGH_IDLE );
     xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) );
     xImp->aIdle.SetDebugName( "sfx::SfxDispatcher_Impl aIdle" );
 }
@@ -470,8 +470,6 @@ void SfxDispatcher::Pop(SfxShell& rShell, SfxDispatcherPopFlags nMode)
     if(!pSfxApp->IsDowning() && !xImp->aToDoStack.empty())
     {
         // No immediate update is requested
-        xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM);
-        xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) );
         xImp->aIdle.Start();
     }
     else
@@ -677,8 +675,6 @@ void SfxDispatcher::DoActivate_Impl(bool bMDI, SfxViewFrame* /* pOld */)
     if(!xImp->aToDoStack.empty())
     {
         // No immediate update is requested
-        xImp->aIdle.SetPriority(SchedulerPriority::MEDIUM);
-        xImp->aIdle.SetIdleHdl( LINK(this, SfxDispatcher, EventHdl_Impl ) );
         xImp->aIdle.Start();
     }
 }
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 94ed791..83d1980 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -141,7 +141,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl));
     aEditIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aEditIdle" );
 
-    aAutoArrangeIdle.SetPriority( SchedulerPriority::LOW );
+    aAutoArrangeIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     aAutoArrangeIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl));
     aAutoArrangeIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" );
 
@@ -149,11 +149,11 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aCallSelectHdlIdle.SetIdleHdl( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl));
     aCallSelectHdlIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" );
 
-    aDocRectChangedIdle.SetPriority( SchedulerPriority::MEDIUM );
+    aDocRectChangedIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     aDocRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl));
     aDocRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" );
 
-    aVisRectChangedIdle.SetPriority( SchedulerPriority::MEDIUM );
+    aVisRectChangedIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     aVisRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl));
     aVisRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" );
 
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index ad1c81f..11ff636 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -89,7 +89,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS
     nNodeBmpWidth       = 0;
 
     bAsyncBeginDrag     = false;
-    aAsyncBeginDragIdle.SetPriority( SchedulerPriority::HIGHEST );
+    aAsyncBeginDragIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     aAsyncBeginDragIdle.SetIdleHdl( LINK(this,SvImpLBox,BeginDragHdl));
     // button animation in listbox
     pActiveButton = 0;
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 47e783a..0be9f95 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -285,7 +285,6 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow *
 
     Resize();
 
-    aUpdateIdle.SetPriority( SchedulerPriority::LOW );
     aUpdateIdle.SetIdleHdl( LINK( this, SvxSuperContourDlg, UpdateHdl ) );
 
     aCreateIdle.SetPriority( SchedulerPriority::RESIZE );
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index f51829b..1938d8f 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -205,7 +205,6 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
     m_pCbbTarget->Disable();
     pOwnData->bExecState = false;
 
-    pOwnData->aIdle.SetPriority( SchedulerPriority::LOW );
     pOwnData->aIdle.SetIdleHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
 
     m_pTbxIMapDlg1->EnableItem( mnActiveId, false );
diff --git a/svx/source/inc/eventhandler.hxx b/svx/source/inc/eventhandler.hxx
index dd5dbb4..c061b93 100644
--- a/svx/source/inc/eventhandler.hxx
+++ b/svx/source/inc/eventhandler.hxx
@@ -96,7 +96,7 @@ namespace sdr
         class TimerEventHandler : public EventHandler, public Idle
         {
         public:
-            TimerEventHandler(SchedulerPriority ePriority = SchedulerPriority::HIGH);
+            TimerEventHandler(SchedulerPriority ePriority = SchedulerPriority::HIGH_IDLE);
 
             virtual ~TimerEventHandler();
 
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index b4d6873..04a80d9 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -59,7 +59,7 @@ namespace sdr
             setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
 
             // init timer
-            SetPriority(SchedulerPriority::HIGH);
+            SetPriority(SchedulerPriority::HIGH_IDLE);
             Stop();
         }
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index dc70525..d8ae7b7 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(SchedulerPriority::HIGH);
+    SetPriority(SchedulerPriority::HIGH_IDLE);
     Stop();
 }
 
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 77ed4b3..0ac50f3 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -384,7 +384,7 @@ namespace sdr
             mbRefreshWithPreRendering(bRefreshWithPreRendering)
         {
             // Init timer
-            maBufferIdle.SetPriority( SchedulerPriority::HIGH );
+            maBufferIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
             maBufferIdle.SetIdleHdl(LINK(this, OverlayManagerBuffered, ImpBufferTimerHandler));
             maBufferIdle.SetDebugName( "sdr::overlay::OverlayManagerBuffered maBufferIdle" );
         }
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 5e0fa26..0ad6123 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -1114,7 +1114,7 @@ void SdrItemBrowser::SetDirty()
 {
     if (!bDirty) {
         bDirty = true;
-        aIdle.SetPriority(SchedulerPriority::HIGH);
+        aIdle.SetPriority(SchedulerPriority::HIGH_IDLE);
         aIdle.Start();
     }
 }
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index cb5add9..5ff6684 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -137,7 +137,6 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString&
         SetSpinSize( 1 );
     }
 
-    maIdle.SetPriority( SchedulerPriority::LOW );
     maIdle.SetIdleHdl( LINK( this, ImplGrafMetricField, ImplModifyHdl ) );
 }
 
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index c15e72d..9c59099 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -531,7 +531,6 @@ void SwSrcEditWindow::CreateTextEngine()
     pOutWin->SetFont( aFont );
     pTextEngine->SetFont( aFont );
 
-    aSyntaxIdle.SetPriority( SchedulerPriority::LOWER );
     aSyntaxIdle.SetIdleHdl( LINK( this, SwSrcEditWindow, SyntaxTimerHdl ) );
 
     pTextEngine->EnableUndo( true );
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 785eba8..52130d8 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -83,7 +83,6 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin,
 
     // the controller is asynchronously set
     aLoadedIdle.SetIdleHdl(LINK(this, SwOneExampleFrame, TimeoutHdl));
-    aLoadedIdle.SetPriority(SchedulerPriority::LOWER);
 
     CreateControl();
 
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 1e543bc..7ef4888 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -24,6 +24,7 @@
 
 Idle::Idle( const sal_Char *pDebugName ) : SchedulerCallback( pDebugName )
 {
+    SetPriority( SchedulerPriority::DEFAULT_IDLE );
 }
 
 void Idle::Start()
@@ -33,28 +34,14 @@ void Idle::Start()
     Timer::ImplStartTimer( pSVData, 0 );
 }
 
-bool Idle::ReadyForSchedule( const sal_uInt64 /* nTime */, const bool /* bIdle */ )
+bool Idle::ReadyForSchedule( const sal_uInt64 /* nTime */, const bool bIdle )
 {
-    // tdf#91727 - We need to re-work this to allow only UI idle handlers
-    //             and not timeouts to be processed in some limited scenarios
-    return true; // !bTimer
+    return (bIdle || mePriority < SchedulerPriority::DEFAULT_IDLE);
 }
 
 void Idle::UpdateMinPeriod( const sal_uInt64 /* nTime */, sal_uInt64 &nMinPeriod )
 {
-    switch (mePriority) {
-    case SchedulerPriority::HIGHEST:
-    case SchedulerPriority::HIGH:
-    case SchedulerPriority::RESIZE:
-    case SchedulerPriority::REPAINT:
-        nMinPeriod = MIN_SLEEP_PERIOD; // don't wait.
-        break;
-    default:
-        // FIXME: tdf#92036 workaround, I should be 1 too - wait 5ms
-        if (nMinPeriod > 5)
-            nMinPeriod = 5;
-        break;
-    }
+    nMinPeriod = MIN_SLEEP_PERIOD;
 }
 
 AutoIdle::AutoIdle( const sal_Char *pDebugName )
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 28cb667..8921fc6 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -248,7 +248,7 @@ Scheduler& Scheduler::operator=( const Scheduler& rScheduler )
 Scheduler::Scheduler(const sal_Char *pDebugName):
     mpSchedulerData(NULL),
     mpDebugName(pDebugName),
-    mePriority(SchedulerPriority::HIGH)
+    mePriority(SchedulerPriority::DEFAULT)
 {
 }
 
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index 6a4c5d4..b0cc98c 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -74,6 +74,7 @@ void Timer::InitSystemTimer()
 Timer::Timer( const sal_Char *pDebugName ) : SchedulerCallback( pDebugName )
 {
     mnTimeout    = MIN_SLEEP_PERIOD;
+    mePriority   = SchedulerPriority::DEFAULT;
 }
 
 void Timer::Start()
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index 014cae9..5f8c3ad 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -223,7 +223,7 @@ IdleFormatter::IdleFormatter()
 {
     mpView = 0;
     mnRestarts = 0;
-    SetPriority(SchedulerPriority::HIGH);
+    SetPriority(SchedulerPriority::HIGH_IDLE);
 }
 
 IdleFormatter::~IdleFormatter()
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index cee8abb..0e7b01e 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -91,11 +91,11 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
     SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
 
     maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, DockTimerHdl ) );
-    maDockIdle.SetPriority( SchedulerPriority::MEDIUM );
+    maDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     maDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maDockIdle" );
 
     maEndDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) );
-    maEndDockIdle.SetPriority( SchedulerPriority::MEDIUM );
+    maEndDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     maEndDockIdle.SetDebugName( "vcl::ImplDockFloatWin2 maEndDockIdle" );
 }
 
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index d2ae04d..2d6161d 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -107,7 +107,7 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits,
     SetBackground();
 
     maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin, DockTimerHdl ) );
-    maDockIdle.SetPriority( SchedulerPriority::MEDIUM );
+    maDockIdle.SetPriority( SchedulerPriority::HIGH_IDLE );
     maDockIdle.SetDebugName( "vcl::ImplDockFloatWin maDockIdle" );
 }
 
commit 88055681a5a33a4548ff3320a3dd77f0a2cf9b17
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Aug 1 10:51:09 2016 +0200

    Get rid of special yield handling for Impress
    
    Change-Id: I3997e2d3f8149272066113d8dddfab3aec3d3995

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 78f758c..f4d8910 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -458,18 +458,14 @@ public:
     /** Run the main event processing loop until it is quit by Quit().
 
      @see Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
     */
     static void                 Execute();
 
     /** Quit the program
 
      @see Execute, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
     */
     static void                 Quit();
 
@@ -480,27 +476,21 @@ public:
         event. Defaults to false.
 
      @see Execute, Quit, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
      */
     static void                 Reschedule( bool bAllEvents = false );
 
     /** Allow processing of the next event.
 
      @see Execute, Quit, Reschedule, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
     */
     static void                 Yield();
 
     /**
 
      @see Execute, Quit, Reschedule, Yield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
     */
     static void                 EndYield();
 
@@ -512,9 +502,7 @@ public:
      @returns SolarMutex reference
 
      @see Execute, Quit, Reschedule, Yield, EndYield,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex
     */
     static comphelper::SolarMutex& GetSolarMutex();
 
@@ -523,9 +511,7 @@ public:
      @returns oslThreadIdentifier that contains the thread ID
 
      @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          ReleaseSolarMutex, AcquireSolarMutex
     */
     static oslThreadIdentifier  GetMainThreadIdentifier();
 
@@ -537,9 +523,7 @@ public:
      @returns The number of mutexes that were acquired by this thread.
 
      @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, AcquireSolarMutex
     */
     static sal_uLong            ReleaseSolarMutex();
 
@@ -549,60 +533,10 @@ public:
      VCL concurrently.
 
      @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, AddPostYieldListener,
-          RemovePostYieldListener
+          GetMainThreadIdentifier, ReleaseSolarMutex
     */
     static void                 AcquireSolarMutex( sal_uLong nCount );
 
-    /** @brief Enables "no yield" mode
-
-     "No yield" mode prevents Yield() from waiting for events.
-
-     @remarks This was originally implemented in OOo bug 98792 to improve
-        Impress slideshows.
-
-     @see DisableNoYieldMode, Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          DisableNoYield, AddPostYieldListener, RemovePostYieldListener
-    */
-    static void                 EnableNoYieldMode();
-
-    /** @brief Disables "no yield" mode
-
-     "No yield" mode prevents Yield() from waiting for events.
-
-     @remarks This was originally implemented in OOo bug 98792 to improve
-        Impress slideshows.
-
-     @see EnableNoYieldMode, Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYield, AddPostYieldListener, RemovePostYieldListener
-    */
-
-    static void                 DisableNoYieldMode();
-
-    /** Add a listener for yield events
-
-     @param  i_rListener     Listener to add
-
-     @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          EnableNoYieldMode, DisableNoYieldMode, RemovePostYieldListener
-    */
-    static void                 AddPostYieldListener( const Link<>& i_rListener );
-
-    /** Remove listener for yield events
-
-     @param  i_rListener     Listener to remove
-
-     @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
-          GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
-          AddPostYieldListener, EnableNoYieldMode, DisableNoYieldMode
-    */
-    static void                 RemovePostYieldListener( const Link<>& i_rListener );
-
-
     /** Queries whether the application is in "main", i.e. not yet in
         the event loop
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index bf61d37..40745d2 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -746,9 +746,6 @@ void SAL_CALL SlideshowImpl::disposing()
 
     setActiveXToolbarsVisible( true );
 
-    Application::DisableNoYieldMode();
-    Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
-
     mbDisposed = true;
 }
 
@@ -1789,22 +1786,6 @@ IMPL_LINK_NOARG_TYPED(SlideshowImpl, updateHdl, Timer *, void)
     updateSlideShow();
 }
 
-IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener)
-{
-    // prevent me from deletion when recursing (App::Reschedule does)
-    const rtl::Reference<SlideshowImpl> this_(this);
-
-    Application::DisableNoYieldMode();
-    Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
-    Application::Reschedule(true); // fix for fdo#32861 - process
-                                   // *all* outstanding events after
-                                   // yield is done.
-    if (mbDisposed)
-        return 0;
-    Application::Reschedule(true);
-    return updateSlideShow();
-}
-
 sal_Int32 SlideshowImpl::updateSlideShow()
 {
     // prevent me from deletion when recursing (App::EnableYieldMode does)
@@ -1829,13 +1810,7 @@ sal_Int32 SlideshowImpl::updateSlideShow()
 
         if (mxShow.is() && (fUpdate >= 0.0))
         {
-            if (::basegfx::fTools::equalZero(fUpdate))
-            {
-                // Use post yield listener for short update intervalls.
-                Application::EnableNoYieldMode();
-                Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
-            }
-            else
+            if (!::basegfx::fTools::equalZero(fUpdate))
             {
                 // Avoid busy loop when the previous call to update()
                 // returns a small positive number but not 0 (which is
@@ -1853,14 +1828,14 @@ sal_Int32 SlideshowImpl::updateSlideShow()
                 // integer may lead to zero value.)
                 OSL_ASSERT(static_cast<sal_uLong>(fUpdate * 1000.0) > 0);
 
-                Application::DisableNoYieldMode();
-                Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
-
                 // Use a timer for the asynchronous callback.
                 maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0));
-                maUpdateTimer.Start();
+                if (!maUpdateTimer.IsActive())
+                    maUpdateTimer.Start();
             }
         }
+        else
+            maUpdateTimer.SetTimeout( 500 );
     }
     catch( Exception& )
     {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list