diff options
author | Andreas Martens <ama@openoffice.org> | 2000-11-09 10:35:30 +0000 |
---|---|---|
committer | Andreas Martens <ama@openoffice.org> | 2000-11-09 10:35:30 +0000 |
commit | a2170438168b6f4304343462dee36b7d7304c334 (patch) | |
tree | 11afdd465e587c51d2da5850c6f1fb40ca0cedfa /sw/source | |
parent | 31934ee782ece088413893f403575883b973d7b9 (diff) |
Opt/Fix: The new MakeRestPortion replaces old MakeRestPortion/GetRestPortion/GetFieldRest when a field or multiportion is broken by the line or page end
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 43 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/text/txtfld.cxx | 107 |
4 files changed, 24 insertions, 143 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index fd4382b692..f2733673a0 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfrm.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:08:21 $ + * last change: $Author: ama $ $Date: 2000-11-09 11:35:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -313,9 +313,6 @@ public: // Return: found sal_Bool Hyphenate( SwInterHyphInfo &rInf ); - // Liefert den Rest eines Feldes fuer den Follow zurueck - const SwFldPortion* GetRestPortion(); - // Probegrow inline SwTwips GrowTst( const SwTwips nGrow ); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 44f3a573f3..ae84874280 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frmform.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: ama $ $Date: 2000-11-06 09:13:07 $ + * last change: $Author: ama $ $Date: 2000-11-09 11:34:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1315,36 +1315,21 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() ) { - SwFldPortion* pRest = rLine.GetFieldRest( rInf ); - if( pRest ) + const SwLineLayout* pLine; { SwTxtFrm *pMaster = FindMaster(); ASSERT( pMaster, "SwTxtFrm::Format: homeless follow" ); - const SwFldPortion *pFld = pMaster->GetRestPortion(); - if( pFld ) - { - pRest->TakeNextOffset( pFld ); - const SwTxtAttr* pTwoLines; - // If we get a field portion rest in a multi-line part of the - // text, we have to create the surrounding multi-portion, too. - if( GetOfst() && - 0 != (pTwoLines = rInf.GetTwoLines( GetOfst()-1) ) ) - { - SwDoubleLinePortion* pTmp = - new SwDoubleLinePortion( *pTwoLines->GetEnd() ); -#ifdef DEBUG - //pTmp->SetRuby( pRest ); - pTmp->SetBrackets( 0, ']' ); -#endif - pTmp->SetFldRest( pRest ); - rInf.SetRest( pTmp ); - } - else - rInf.SetRest( pRest ); - } - else - delete pRest; + if( !pMaster->HasPara() ) + pMaster->GetFormatted(); + SwTxtSizeInfo aInf( pMaster ); + SwTxtIter aMasterLine( pMaster, &aInf ); + aMasterLine.Bottom(); + pLine = aMasterLine.GetCurr(); } + SwLinePortion* pRest = + rLine.MakeRestPortion( pLine, GetOfst() ); + if( pRest ) + rInf.SetRest( pRest ); else SetFieldFollow( sal_False ); } @@ -1378,7 +1363,7 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, if( !rLine.Next() ) { if( !bFormat ) - rLine.MakeRestPortion(); + rLine.MakeRestPortion( rLine.GetCurr(), rLine.GetEnd() ); rLine.Insert( new SwLineLayout() ); rLine.Next(); bFormat = sal_True; diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index cd818ee4dd..e90b22fde1 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -2,9 +2,9 @@ * * $RCSfile: itrform2.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ama $ $Date: 2000-10-16 13:09:38 $ + * last change: $Author: ama $ $Date: 2000-11-09 11:34:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,7 +98,8 @@ class SwTxtFormatter : public SwTxtPainter SwDropPortion *NewDropPortion( SwTxtFormatInfo &rInf ) const; SwNumberPortion *NewFtnNumPortion( SwTxtFormatInfo &rInf ) const; SwErgoSumPortion *NewErgoSumPortion( SwTxtFormatInfo &rInf ) const; - SwExpandPortion *NewFldPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHt ) const; + SwExpandPortion *NewFldPortion( SwTxtFormatInfo &rInf, + const SwTxtAttr *pHt ) const; SwFtnPortion *NewFtnPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHt ); SwFlyCntPortion *NewFlyCntPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHt ) const; @@ -201,8 +202,7 @@ public: // Wie breit waerest Du ohne rechte Begrenzungen (Flys etc.)? KSHORT _CalcFitToContent( ); - SwFldPortion *GetFieldRest( SwTxtFormatInfo &rInf ) const; - void MakeRestPortion(); + SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, xub_StrLen nPos); inline const SwFmtDrop *GetDropFmt() const { return pDropFmt; } inline void ClearDropFmt() { pDropFmt = 0; } diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 37845096ba..430fdd4961 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfld.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: ama $ $Date: 2000-10-17 10:22:50 $ + * last change: $Author: ama $ $Date: 2000-11-09 11:33:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,7 +132,7 @@ sal_Bool lcl_IsInBody( SwFrm *pFrm ) SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, - SwTxtAttr *pHint ) const + const SwTxtAttr *pHint ) const { SwExpandPortion *pRet; SwFrm *pFrame = (SwFrm*)pFrm; @@ -293,63 +293,6 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, } -SwFldPortion *SwTxtFormatter::GetFieldRest( SwTxtFormatInfo &rInf ) const -{ - if( !nStart ) - return NULL; - SwTxtAttr *pHint = GetAttr( nStart - 1 ); - SwFldPortion *pRet = NULL; - if( !pHint ) - return pRet; - - if( pHint->Which() == RES_TXTATR_FIELD ) - { - SwExpandPortion* pNew = NewFldPortion( rInf, pHint ); - if( pNew->InFldGrp() ) - pRet = (SwFldPortion*)pNew; - else - delete pNew; - } - return pRet; -} - - -void SwTxtFormatter::MakeRestPortion() -{ - const SwFldPortion* pFld = NULL; - const SwLinePortion* pLine = GetCurr(); - while( pLine ) - { - if( pLine->InFldGrp() ) - pFld = (SwFldPortion*)pLine; - pLine = pLine->GetPortion(); - } - if( pFld && pFld->HasFollow() ) - { - xub_StrLen nNext = nStart + GetCurr()->GetLen(); - if( !nNext ) - return; - SwTxtAttr *pHint = GetAttr( nNext - 1 ); - if( !pHint ) - return; - SwFldPortion *pRest = NULL; - - if( pHint->Which() == RES_TXTATR_FIELD ) - { - SwExpandPortion* pNew = NewFldPortion( GetInfo(), pHint ); - if( pNew->InFldGrp() ) - pRest = (SwFldPortion*)pNew; - else - delete pNew; - } - if( pRest ) - { - pRest->TakeNextOffset( pFld ); - GetInfo().SetRest( pRest ); - } - } -} - /************************************************************************* * SwTxtFormatter::NewExtraPortion() *************************************************************************/ @@ -512,47 +455,3 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const return pRet; } -/*-----------------16.10.00 09:55------------------- - * SwTxtFrm::GetRestPortion() returns a field portion, - * if the last portion in the last line is a field portion, - * which is not complete. So the following part of the text frame - * has to start with the rest of the field. - * If the field portion is inside a multi-portion, the next text frame - * starts with a multi-portion, too. - * --------------------------------------------------*/ - -const SwFldPortion* SwTxtFrm::GetRestPortion() -{ - if( !HasPara() ) - GetFormatted(); - SwTxtSizeInfo aInf( this ); - SwTxtIter aLine( this, &aInf ); - aLine.Bottom(); - SwFldPortion* pRet = NULL; - const SwLinePortion* pLine = aLine.GetCurr(); - const SwMultiPortion *pMulti = NULL; - while( pLine ) - { - if( pLine->InFldGrp() ) - { - pMulti = NULL; - pRet = (SwFldPortion*)pLine; - } - else if( pLine->IsMultiPortion() ) - { - pRet = NULL; - pMulti = (SwMultiPortion*)pLine; - } - pLine = pLine->GetPortion(); - // If the last portion is a multi-portion, we enter it - // and look for a field portion inside. - if( !pLine && pMulti ) - pLine = pMulti->GetRoot().GetNext(); - } - if( pRet && !pRet->HasFollow() ) - pRet = NULL; - return pRet; -} - - - |