From a679189743f3a2d1a15a4dad3557d6fa8975ef0e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 16 Jun 2017 08:35:05 +0200 Subject: tdf#108524 sw: allow move of frame inside section without columns The intention here is to deny the move of a frame that's inside a table inside a section. But the code also checked if there a column frame in-between, so it allowed the move for a frame in a section with 2 cols, but not without columns (which does not sound intentional, since that's a simpler case). So drop the requirement to have a column frame between the argument and the section frame, just check that there is no table frame in between. This is needed, but not enough to split the section in the bugdoc (but at least now the content of the section is marked as movable). Change-Id: I9155b291a19c692efc30f01f8e206fac5f1ccf81 Reviewed-on: https://gerrit.libreoffice.org/38858 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 6ade80cf142664e78954c7544534e9436ceb90c7) --- sw/source/core/layout/findfrm.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 89cf31663e2c..fb5854a80c9c 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -1253,17 +1253,14 @@ void SwFrame::InvalidateNextPrtArea() } } -/// @returns true if the frame _directly_ sits in a section with columns -/// but not if it sits in a table which itself sits in a section with columns. -static bool lcl_IsInColSct( const SwFrame *pUp ) +/// @returns true if the frame _directly_ sits in a section +/// but not if it sits in a table which itself sits in a section. +static bool lcl_IsInSectionDirectly( const SwFrame *pUp ) { - bool bRet = false; while( pUp ) { - if( pUp->IsColumnFrame() ) - bRet = true; - else if( pUp->IsSctFrame() ) - return bRet; + if( pUp->IsSctFrame() ) + return true; else if( pUp->IsTabFrame() ) return false; pUp = pUp->GetUpper(); @@ -1290,7 +1287,7 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const if ( _pLayoutFrame && IsFlowFrame() ) { - if ( _pLayoutFrame->IsInSct() && lcl_IsInColSct( _pLayoutFrame ) ) + if ( _pLayoutFrame->IsInSct() && lcl_IsInSectionDirectly( _pLayoutFrame ) ) { bRetVal = true; } -- cgit v1.2.3