diff options
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 8 |
3 files changed, 30 insertions, 21 deletions
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index d78f1b7d28f5..cc5a81e2a8ba 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1092,9 +1092,9 @@ bool SwFEShell::CheckHeadline( bool bRepeat ) const if ( !IsTableMode() ) { SwFrm *pFrm = GetCurrFrm(); // DONE MULTIIHEADER - if ( pFrm && pFrm->IsInTab() ) + SwTabFrm* pTab = (pFrm && pFrm->IsInTab()) ? pFrm->FindTabFrm() : NULL; + if (pTab) { - SwTabFrm* pTab = pFrm->FindTabFrm(); if ( bRepeat ) { bRet = pTab->IsFollow() && pTab->IsInHeadline( *pFrm ); @@ -1140,8 +1140,14 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const if ( aBoxes.empty() ) { do - { pFrm = pFrm->GetUpper(); - } while ( !pFrm->IsCellFrm() ); + { + pFrm = pFrm->GetUpper(); + } + while (pFrm && !pFrm->IsCellFrm()); + + if (!pFrm) + return false; + SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox())); aBoxes.insert( pBox ); } @@ -1385,6 +1391,9 @@ static const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt, if ( pFrm->IsInTab() ) pFrm = const_cast<SwFrm*>(pFrm)->ImplFindTabFrm(); + if (!pFrm) + break; + if ( pFrm->IsTabFrm() ) { Point aPt( rPt ); @@ -2341,10 +2350,10 @@ bool SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const bool SwFEShell::IsTableVertical() const { SwFrm *pFrm = GetCurrFrm(); - if( !pFrm || !pFrm->IsInTab() ) + SwTabFrm *pTab = (pFrm && pFrm->IsInTab()) ? pFrm->ImplFindTabFrm() : NULL; + if (!pTab) return false; - - return pFrm->ImplFindTabFrm()->IsVertical(); + return pTab->IsVertical(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index f1aa8322f3b6..b69a258ba663 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -710,16 +710,16 @@ SwFrm *SwFrm::_FindNext() if ( !bIgnoreTab && pThis->IsInTab() ) { SwLayoutFrm *pUp = pThis->GetUpper(); - while ( !pUp->IsCellFrm() ) + while (pUp && !pUp->IsCellFrm()) pUp = pUp->GetUpper(); - OSL_ENSURE( pUp, "Cntnt in Tabelle aber nicht in Zelle." ); - SwFrm* pNxt = static_cast<SwCellFrm*>(pUp)->GetFollowCell(); + SAL_WARN_IF(!pUp, "sw.core", "Cntnt in table but not in cell."); + SwFrm* pNxt = pUp ? static_cast<SwCellFrm*>(pUp)->GetFollowCell() : NULL; if ( pNxt ) pNxt = static_cast<SwCellFrm*>(pNxt)->ContainsCntnt(); if ( !pNxt ) { pNxt = lcl_NextFrm( pThis ); - if ( pUp->IsAnLower( pNxt ) ) + if (pUp && pUp->IsAnLower(pNxt)) pRet = pNxt; } else @@ -1069,10 +1069,10 @@ SwFrm *SwFrm::_FindPrev() if ( !bIgnoreTab && pThis->IsInTab() ) { SwLayoutFrm *pUp = pThis->GetUpper(); - while ( !pUp->IsCellFrm() ) + while (pUp && !pUp->IsCellFrm()) pUp = pUp->GetUpper(); - OSL_ENSURE( pUp, "Cntnt in table but not in cell." ); - if ( pUp->IsAnLower( pPrvCnt ) ) + SAL_WARN_IF(!pUp, "sw.core", "Cntnt in table but not in cell."); + if (pUp && pUp->IsAnLower(pPrvCnt)) return pPrvCnt; } else @@ -1391,11 +1391,11 @@ void SwFrm::SetDirFlags( bool bVert ) SwLayoutFrm* SwFrm::GetNextCellLeaf( MakePageType ) { SwFrm* pTmpFrm = this; - while ( !pTmpFrm->IsCellFrm() ) + while (pTmpFrm && !pTmpFrm->IsCellFrm()) pTmpFrm = pTmpFrm->GetUpper(); - OSL_ENSURE( pTmpFrm, "SwFrm::GetNextCellLeaf() without cell" ); - return static_cast<SwCellFrm*>(pTmpFrm)->GetFollowCell(); + SAL_WARN_IF(!pTmpFrm, "sw.core", "SwFrm::GetNextCellLeaf() without cell"); + return pTmpFrm ? static_cast<SwCellFrm*>(pTmpFrm)->GetFollowCell() : NULL; } SwLayoutFrm* SwFrm::GetPrevCellLeaf( MakePageType ) diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index caf63ca5d59f..505e225bf48b 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1753,9 +1753,9 @@ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo ) (Frm().*fnRect->fnSetHeight)( nOld + nDist ); if( IsVertical()&& !IsVertLR() && !IsReverse() ) Frm().Pos().X() -= nDist; - if ( nOld && IsInTab() ) + SwTabFrm *pTab = (nOld && IsInTab()) ? FindTabFrm() : NULL; + if (pTab) { - SwTabFrm *pTab = FindTabFrm(); if ( pTab->GetTable()->GetHTMLTableLayout() && !pTab->IsJoinLocked() && !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() ) @@ -1841,9 +1841,9 @@ SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo ) if( IsVertical() && !IsVertLR() ) Frm().Pos().X() += nDist; nDist = nRstHeight; - if ( IsInTab() ) + SwTabFrm *pTab = IsInTab() ? FindTabFrm() : NULL; + if (pTab) { - SwTabFrm *pTab = FindTabFrm(); if ( pTab->GetTable()->GetHTMLTableLayout() && !pTab->IsJoinLocked() && !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() ) |