diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-21 12:12:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-09-21 14:34:53 +0100 |
commit | 148ad4cd0981e8352023f574884340ce81730d7b (patch) | |
tree | c1421116bf15c2758f5e472af85cb487e8619c94 | |
parent | fa5337ce04a642cb54d802f102735d90728516b9 (diff) |
return early on non-main condition, no logic change
Change-Id: Ia804e4c6bfb57e0984f3d6e76cd8d27a299cafe3
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 4ac0b77b2c5e..d38147bdc0ff 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1328,59 +1328,58 @@ bool SwFEShell::DeleteTableSel() size_t SwFEShell::GetCurTabColNum() const { //!!!GetCurMouseTabColNum() mitpflegen!!!! - size_t nRet = 0; - SwFrame *pFrame = GetCurrFrame(); OSL_ENSURE( pFrame, "Cursor parked?" ); // check if SPoint/Mark of current cursor are in a table - if( pFrame && pFrame->IsInTab() ) - { - do { // JP 26.09.95: why compare with ContentFrame - // and not with CellFrame ???? - pFrame = pFrame->GetUpper(); - } while ( !pFrame->IsCellFrame() ); - SWRECTFN( pFrame ) + if (!pFrame || !pFrame->IsInTab()) + return 0; - const SwPageFrame* pPage = pFrame->FindPageFrame(); + size_t nRet = 0; + do { // JP 26.09.95: why compare with ContentFrame + // and not with CellFrame ???? + pFrame = pFrame->GetUpper(); + } while ( !pFrame->IsCellFrame() ); + SWRECTFN( pFrame ) - // get TabCols, as only via these we get to the position - SwTabCols aTabCols; - GetTabCols( aTabCols ); + const SwPageFrame* pPage = pFrame->FindPageFrame(); - if( pFrame->FindTabFrame()->IsRightToLeft() ) - { - long nX = (pFrame->Frame().*fnRect->fnGetRight)() - (pPage->Frame().*fnRect->fnGetLeft)(); + // get TabCols, as only via these we get to the position + SwTabCols aTabCols; + GetTabCols( aTabCols ); - const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight(); + if( pFrame->FindTabFrame()->IsRightToLeft() ) + { + long nX = (pFrame->Frame().*fnRect->fnGetRight)() - (pPage->Frame().*fnRect->fnGetLeft)(); - if ( !::IsSame( nX, nRight ) ) - { - nX = nRight - nX + aTabCols.GetLeft(); - for ( size_t i = 0; i < aTabCols.Count(); ++i ) - if ( ::IsSame( nX, aTabCols[i] ) ) - { - nRet = i + 1; - break; - } - } - } - else + const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight(); + + if ( !::IsSame( nX, nRight ) ) { - const long nX = (pFrame->Frame().*fnRect->fnGetLeft)() - - (pPage->Frame().*fnRect->fnGetLeft)(); + nX = nRight - nX + aTabCols.GetLeft(); + for ( size_t i = 0; i < aTabCols.Count(); ++i ) + if ( ::IsSame( nX, aTabCols[i] ) ) + { + nRet = i + 1; + break; + } + } + } + else + { + const long nX = (pFrame->Frame().*fnRect->fnGetLeft)() - + (pPage->Frame().*fnRect->fnGetLeft)(); - const long nLeft = aTabCols.GetLeftMin(); + const long nLeft = aTabCols.GetLeftMin(); - if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) ) - { - for ( size_t i = 0; i < aTabCols.Count(); ++i ) - if ( ::IsSame( nX, nLeft + aTabCols[i] ) ) - { - nRet = i + 1; - break; - } - } + if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) ) + { + for ( size_t i = 0; i < aTabCols.Count(); ++i ) + if ( ::IsSame( nX, nLeft + aTabCols[i] ) ) + { + nRet = i + 1; + break; + } } } return nRet; |