diff options
Diffstat (limited to 'sw/source/core/text/txtftn.cxx')
-rw-r--r-- | sw/source/core/text/txtftn.cxx | 84 |
1 files changed, 37 insertions, 47 deletions
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 9a1fde88724a..c26259c3f465 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,14 +45,11 @@ #include <editeng/brshitem.hxx> #include <editeng/charrotateitem.hxx> #include <breakit.hxx> -#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ #include <com/sun/star/i18n/ScriptType.hdl> -#endif #include <tabfrm.hxx> // OD 2004-05-24 #i28701# #include <sortedobjs.hxx> -#include "txtcfg.hxx" #include "swfont.hxx" // new SwFont #include "porftn.hxx" #include "porfly.hxx" @@ -104,10 +102,10 @@ SwTxtFrm *SwTxtFrm::FindFtnRef( const SwTxtFtn *pFtn ) * CalcFtnFlag() *************************************************************************/ -#ifndef DBG_UTIL -void SwTxtFrm::CalcFtnFlag() +#if OSL_DEBUG_LEVEL > 1 +void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//For testing the SplitFrm #else -void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm +void SwTxtFrm::CalcFtnFlag() #endif { bFtn = sal_False; @@ -118,11 +116,11 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm const sal_uInt16 nSize = pHints->Count(); -#ifndef DBG_UTIL - const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; -#else +#if OSL_DEBUG_LEVEL > 1 const xub_StrLen nEnd = nStop != STRING_LEN ? nStop : GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; +#else + const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; #endif for ( sal_uInt16 i = 0; i < nSize; ++i ) @@ -148,7 +146,7 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm sal_Bool SwTxtFrm::CalcPrepFtnAdjust() { - ASSERT( HasFtn(), "Wer ruft mich da?" ); + OSL_ENSURE( HasFtn(), "Wer ruft mich da?" ); SwFtnBossFrm *pBoss = FindFtnBossFrm( sal_True ); const SwFtnFrm *pFtn = pBoss->FindFirstFtn( this ); if( pFtn && FTNPOS_CHAPTER != GetNode()->GetDoc()->GetFtnInfo().ePos && @@ -197,7 +195,7 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) // containing the footnote. SWRECTFN( pFrm ) - ASSERT( !pFrm->IsVertical() || !pFrm->IsSwapped(), + OSL_ENSURE( !pFrm->IsVertical() || !pFrm->IsSwapped(), "lcl_GetFtnLower with swapped frame" ); SwTwips nAdd; @@ -223,8 +221,8 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) pRow = pRow->GetUpper(); const SwTabFrm* pTabFrm = (SwTabFrm*)pRow->GetUpper(); - ASSERT( pTabFrm && pRow && - pRow->GetUpper()->IsTabFrm(), "Upper of row should be tab" ) + OSL_ENSURE( pTabFrm && pRow && + pRow->GetUpper()->IsTabFrm(), "Upper of row should be tab" ); const sal_Bool bDontSplit = !pTabFrm->IsFollow() && !pTabFrm->IsLayoutSplitAllowed(); @@ -254,11 +252,11 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) // #i10770#: If there are fly frames anchored at previous paragraphs, // the deadline should consider their lower borders. const SwFrm* pStartFrm = pFrm->GetUpper()->GetLower(); - ASSERT( pStartFrm, "Upper has no lower" ) + OSL_ENSURE( pStartFrm, "Upper has no lower" ); SwTwips nFlyLower = bVert ? LONG_MAX : 0; while ( pStartFrm != pFrm ) { - ASSERT( pStartFrm, "Frame chain is broken" ) + OSL_ENSURE( pStartFrm, "Frame chain is broken" ); if ( pStartFrm->GetDrawObjs() ) { const SwSortedObjs &rObjs = *pStartFrm->GetDrawObjs(); @@ -295,8 +293,8 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const { - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::GetFtnLine with swapped frame" ) + OSL_ENSURE( ! IsVertical() || ! IsSwapped(), + "SwTxtFrm::GetFtnLine with swapped frame" ); SwTxtFrm *pThis = (SwTxtFrm*)this; @@ -338,7 +336,7 @@ SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const SwTwips SwTxtFrm::_GetFtnFrmHeight() const { - ASSERT( !IsFollow() && IsInFtn(), "SwTxtFrm::SetFtnLine: moon walk" ); + OSL_ENSURE( !IsFollow() && IsInFtn(), "SwTxtFrm::SetFtnLine: moon walk" ); const SwFtnFrm *pFtnFrm = FindFtnFrm(); const SwTxtFrm *pRef = (const SwTxtFrm *)pFtnFrm->GetRef(); @@ -362,7 +360,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const SwTwips nTmp = (*fnRect->fnYDiff)( (pCont->*fnRect->fnGetPrtBottom)(), (Frm().*fnRect->fnGetTop)() ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if( nTmp < 0 ) { sal_Bool bInvalidPos = sal_False; @@ -375,7 +373,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const break; pTmp = pTmp->GetUpper(); } - ASSERT( bInvalidPos, "Hanging below FtnCont" ); + OSL_ENSURE( bInvalidPos, "Hanging below FtnCont" ); } #endif @@ -512,7 +510,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) // Wir loeschen nicht, sondern wollen die Ftn verschieben. // Drei Faelle koennen auftreten: // 1) Es gibt weder Follow noch PrevFollow - // -> RemoveFtn() (vielleicht sogar ein ASSERT wert) + // -> RemoveFtn() (vielleicht sogar ein OSL_ENSURE(wert) // 2) nStart > GetOfst, ich habe einen Follow // -> Ftn wandert in den Follow // 3) nStart < GetOfst, ich bin ein Follow @@ -540,7 +538,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) while( pDest->GetFollow() && ((SwTxtFrm*)pDest-> GetFollow())->GetOfst() <= nIdx ) pDest = pDest->GetFollow(); - ASSERT( !pDest->FindFtnBossFrm( !bEndn )->FindFtn( + OSL_ENSURE( !pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest,pFtn),"SwTxtFrm::RemoveFtn: footnote exists"); //Nicht ummelden sondern immer Moven. @@ -569,7 +567,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) } ((SwTxtFrm*)pDest)->SetFtn( sal_True ); - ASSERT( pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest, + OSL_ENSURE( pDest->FindFtnBossFrm( !bEndn )->FindFtn( pDest, pFtn),"SwTxtFrm::RemoveFtn: footnote ChgRef failed"); } else @@ -583,7 +581,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) else pFtnBoss->RemoveFtn( this, pFtn ); bRemove = bRemove || !bEndDoc; - ASSERT( bEndn ? !pEndBoss->FindFtn( this, pFtn ) : + OSL_ENSURE( bEndn ? !pEndBoss->FindFtn( this, pFtn ) : !pFtnBoss->FindFtn( this, pFtn ), "SwTxtFrm::RemoveFtn: can't get off that footnote" ); } @@ -633,7 +631,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) void SwTxtFrm::ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine ) { - ASSERT( !IsVertical() || !IsSwapped(), + OSL_ENSURE( !IsVertical() || !IsSwapped(), "SwTxtFrm::ConnectFtn with swapped frame" ); bFtn = sal_True; @@ -851,7 +849,7 @@ void SwTxtFrm::ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine ) SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHint ) { - ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(), + OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(), "NewFtnPortion with unswapped frame" ); if( !pFrm->IsFtnAllowed() ) @@ -998,7 +996,7 @@ SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf, SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const { - ASSERT( pFrm->IsInFtn() && !pFrm->GetIndPrev() && !rInf.IsFtnDone(), + OSL_ENSURE( pFrm->IsInFtn() && !pFrm->GetIndPrev() && !rInf.IsFtnDone(), "This is the wrong place for a ftnnumber" ); if( rInf.GetTxtStart() != nStart || rInf.GetTxtStart() != rInf.GetIdx() ) @@ -1024,7 +1022,7 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const const IDocumentSettingAccess* pIDSA = pFrm->GetTxtNode()->getIDocumentSettingAccess(); SwFont *pNumFnt = new SwFont( pParSet, pIDSA ); - // --> FME 2005-02-17 #i37142# + // #i37142# // Underline style of paragraph font should not be considered // Overline style of paragraph font should not be considered // Weight style of paragraph font should not be considered @@ -1038,7 +1036,6 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN ); pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK ); pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL ); - // <-- pNumFnt->SetDiffFnt(&rSet, pIDSA ); pNumFnt->SetVertical( pNumFnt->GetOrientation(), pFrm->IsVertical() ); @@ -1054,7 +1051,7 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const XubString lcl_GetPageNumber( const SwPageFrm* pPage ) { - ASSERT( pPage, "GetPageNumber: Homeless TxtFrm" ); + OSL_ENSURE( pPage, "GetPageNumber: Homeless TxtFrm" ); MSHORT nVirtNum = pPage->GetVirtPageNum(); const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType(); return rNum.GetNumStr( nVirtNum ); @@ -1095,7 +1092,7 @@ SwErgoSumPortion *SwTxtFormatter::NewErgoSumPortion( SwTxtFormatInfo &rInf ) con xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) { - ASSERT( ! pFrm->IsVertical() || ! pFrm->IsSwapped(), + OSL_ENSURE( ! pFrm->IsVertical() || ! pFrm->IsSwapped(), "SwTxtFormatter::FormatQuoVadis with swapped frame" ); if( !pFrm->IsInFtn() || pFrm->ImplFindFtnFrm()->GetAttr()->GetFtn().IsEndNote() ) @@ -1169,8 +1166,8 @@ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) rInf.SetRest( 0 ); pCurrPor->Move( rInf ); - ASSERT( pFollow->IsQuoVadisPortion(), - "Quo Vadis, rest of QuoVadisPortion" ) + OSL_ENSURE( pFollow->IsQuoVadisPortion(), + "Quo Vadis, rest of QuoVadisPortion" ); // format the rest and append it to the other QuoVadis parts pFollow->Format( rInf ); @@ -1356,7 +1353,7 @@ SwFtnSave::SwFtnSave( const SwTxtSizeInfo &rInf, SwFmtFtn& rFtn = (SwFmtFtn&)pTxtFtn->GetFtn(); const SwDoc *pDoc = rInf.GetTxtFrm()->GetNode()->GetDoc(); - // --> OD 2009-01-29 #i98418# + // #i98418# if ( bApplyGivenScriptType ) { pFnt->SetActual( nGivenScriptType ); @@ -1367,7 +1364,6 @@ SwFtnSave::SwFtnSave( const SwTxtSizeInfo &rInf, String aTmpStr( rFtn.GetViewNumStr( *pDoc ) ); pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmpStr, 0 ) ); } - // <-- const SwEndNoteInfo* pInfo; if( rFtn.IsEndNote() ) @@ -1429,10 +1425,9 @@ SwFtnPortion::SwFtnPortion( const XubString &rExpand, SwTxtFrm *pFrame, , pFrm(pFrame) , pFtn(pFootn) , nOrigHeight( nReal ) - // --> OD 2009-01-29 #i98418# + // #i98418# , mbPreferredScriptTypeSet( false ) , mnPreferredScriptType( SW_LATIN ) - // <-- { SetLen(1); SetWhichPor( POR_FTN ); @@ -1454,10 +1449,9 @@ sal_Bool SwFtnPortion::GetExpTxt( const SwTxtSizeInfo &, XubString &rTxt ) const sal_Bool SwFtnPortion::Format( SwTxtFormatInfo &rInf ) { - // --> OD 2009-01-29 #i98418# + // #i98418# // SwFtnSave aFtnSave( rInf, pFtn ); SwFtnSave aFtnSave( rInf, pFtn, mbPreferredScriptTypeSet, mnPreferredScriptType ); - // <-- // the idx is manipulated in SwExpandPortion::Format // this flag indicates, that a footnote is allowed to trigger // an underflow during SwTxtGuess::Guess @@ -1478,10 +1472,9 @@ sal_Bool SwFtnPortion::Format( SwTxtFormatInfo &rInf ) void SwFtnPortion::Paint( const SwTxtPaintInfo &rInf ) const { - // --> OD 2009-01-29 #i98418# + // #i98418# // SwFtnSave aFtnSave( rInf, pFtn ); SwFtnSave aFtnSave( rInf, pFtn, mbPreferredScriptTypeSet, mnPreferredScriptType ); - // <-- rInf.DrawViewOpt( *this, POR_FTN ); SwExpandPortion::Paint( rInf ); } @@ -1492,20 +1485,18 @@ void SwFtnPortion::Paint( const SwTxtPaintInfo &rInf ) const SwPosSize SwFtnPortion::GetTxtSize( const SwTxtSizeInfo &rInfo ) const { - // --> OD 2009-01-29 #i98418# + // #i98418# // SwFtnSave aFtnSave( rInfo, pFtn ); SwFtnSave aFtnSave( rInfo, pFtn, mbPreferredScriptTypeSet, mnPreferredScriptType ); - // <-- return SwExpandPortion::GetTxtSize( rInfo ); } -// --> OD 2009-01-29 #i98418# +// #i98418# void SwFtnPortion::SetPreferredScriptType( sal_uInt8 nPreferredScriptType ) { mbPreferredScriptTypeSet = true; mnPreferredScriptType = nPreferredScriptType; } -// <-- /************************************************************************* * class SwQuoVadisPortion @@ -1652,7 +1643,6 @@ void SwParaPortion::SetErgoSumNum( const XubString& rErgo ) SwLineLayout *pLay = this; while( pLay->GetNext() ) { - DBG_LOOP; pLay = pLay->GetNext(); } SwLinePortion *pPor = pLay; @@ -1678,7 +1668,6 @@ sal_Bool SwParaPortion::UpdateQuoVadis( const XubString &rQuo ) SwLineLayout *pLay = this; while( pLay->GetNext() ) { - DBG_LOOP; pLay = pLay->GetNext(); } SwLinePortion *pPor = pLay; @@ -1698,3 +1687,4 @@ sal_Bool SwParaPortion::UpdateQuoVadis( const XubString &rQuo ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |