diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-11-22 12:48:17 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-12-10 13:02:00 +0100 |
commit | dce903b181e1618dd931c048ef3b73a2ecab1e76 (patch) | |
tree | 00a76abcbb90835a246f5eb3a143916cad69d5a9 | |
parent | ecab1077e0c33e681aa6c2c84918ae702ad6f0ac (diff) |
Avoid busy-loop related to layout when dragging objects.
Change-Id: I4fb437356bc154cfefc5958592ae5888e24d59c3
-rw-r--r-- | sw/inc/viewsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/view/vnew.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 2 |
6 files changed, 19 insertions, 8 deletions
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index e492465691f3..df0f28c702ac 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -478,6 +478,9 @@ public: bool HasDrawView() const; void MakeDrawView(); + // Are we dragging draw shapes around. + bool HasDrawViewDrag() const; + // DrawView may be used at UI. SdrView *GetDrawView(); const SdrView *GetDrawView() const { return const_cast<SwViewShell*>(this)->GetDrawView(); } diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 4afab01a64d3..c021276ed680 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -122,10 +122,14 @@ DocumentTimerManager::IdleJob DocumentTimerManager::GetNextIdleJob() const return IdleJob::Grammar; } - for ( auto pLayout : m_rDoc.GetAllLayouts() ) + // If we're dragging re-layout doesn't occur so avoid a busy loop. + if (!pShell->HasDrawViewDrag()) { - if( pLayout->IsIdleFormat() ) - return IdleJob::Layout; + for ( auto pLayout : m_rDoc.GetAllLayouts() ) + { + if( pLayout->IsIdleFormat() ) + return IdleJob::Layout; + } } SwFieldUpdateFlags nFieldUpdFlag = m_rDoc.GetDocumentSettingManager().getFieldUpdateFlags(true); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 295671c0a50a..e77e9c5709f4 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -718,7 +718,7 @@ long SwFEShell::BeginDrag( const Point* pPt, bool bIsShift) long SwFEShell::Drag( const Point *pPt, bool ) { OSL_ENSURE( Imp()->HasDrawView(), "Drag without DrawView?" ); - if ( Imp()->GetDrawView()->IsDragObj() ) + if ( HasDrawViewDrag() ) { ScrollTo( *pPt ); Imp()->GetDrawView()->MovDragObj( *pPt ); @@ -772,7 +772,7 @@ void SwFEShell::EndDrag() void SwFEShell::BreakDrag() { OSL_ENSURE( Imp()->HasDrawView(), "BreakDrag without DrawView?" ); - if ( Imp()->GetDrawView()->IsDragObj() ) + if( HasDrawViewDrag() ) Imp()->GetDrawView()->BrkDragObj(); SetChainMarker(); } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index fa81d1736f2c..c4f7d2df30a3 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -679,8 +679,7 @@ bool SwViewShell::HasCharts() const void SwViewShell::LayoutIdle() { - if( !mpOpt->IsIdle() || !GetWin() || - ( Imp()->HasDrawView() && Imp()->GetDrawView()->IsDragObj() ) ) + if( !mpOpt->IsIdle() || !GetWin() || HasDrawViewDrag() ) return; //No idle when printing is going on. diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 4c74acecdd09..f12841050667 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -371,6 +371,11 @@ void SwViewShell::MakeDrawView() Imp()->MakeDrawView( ); } +bool SwViewShell::HasDrawViewDrag() const +{ + return Imp()->HasDrawView() && Imp()->GetDrawView()->IsDragObj(); +} + SdrView* SwViewShell::GetDrawView() { return Imp()->GetDrawView(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 838eedb603ea..0ebe24988797 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -809,7 +809,7 @@ void SwView::Execute(SfxRequest &rReq) break; case FN_ESCAPE: { - if ( m_pWrtShell->HasDrawView() && m_pWrtShell->GetDrawView()->IsDragObj() ) + if ( m_pWrtShell->HasDrawViewDrag() ) { m_pWrtShell->BreakDrag(); m_pWrtShell->EnterSelFrameMode(); |