sw/source/core/text/itrform2.cxx | 68 +++++++++++++++++++-------------------- sw/source/core/text/itrform2.hxx | 54 +++++++++++++++--------------- sw/source/core/text/pormulti.cxx | 8 ++-- sw/source/core/text/txtdrop.cxx | 14 ++++---- 4 files changed, 72 insertions(+), 72 deletions(-)
New commits: commit a00f7fe7c2f5fbbf9bc007fc0d59eed83e317a83 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Oct 21 09:02:47 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Oct 21 10:48:15 2019 +0200 sw: prefix members of SwTextFormatter See tdf#94879 for motivation. Change-Id: I65dd12dc738a1b3e8727832ba4c7dd47e3cbabfc Reviewed-on: https://gerrit.libreoffice.org/81205 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 395fcc23ce2c..2a1b8432ac0e 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -88,16 +88,16 @@ void SwTextFormatter::CtorInitTextFormatter( SwTextFrame *pNewFrame, SwTextForma { CtorInitTextPainter( pNewFrame, pNewInf ); m_pInf = pNewInf; - pDropFormat = GetInfo().GetDropFormat(); - pMulti = nullptr; - - bOnceMore = false; - bFlyInCntBase = false; - bTruncLines = false; - nCntEndHyph = 0; - nCntMidHyph = 0; - nLeftScanIdx = TextFrameIndex(COMPLETE_STRING); - nRightScanIdx = TextFrameIndex(0); + m_pDropFormat = GetInfo().GetDropFormat(); + m_pMulti = nullptr; + + m_bOnceMore = false; + m_bFlyInContentBase = false; + m_bTruncLines = false; + m_nContentEndHyph = 0; + m_nContentMidHyph = 0; + m_nLeftScanIdx = TextFrameIndex(COMPLETE_STRING); + m_nRightScanIdx = TextFrameIndex(0); m_pByEndIter.reset(); m_pFirstOfBorderMerge = nullptr; @@ -370,7 +370,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) SeekAndChg( rInf ); // Width() is shortened in CalcFlyWidth if we have a FlyPortion - OSL_ENSURE( !rInf.X() || pMulti, "SwTextFormatter::BuildPortion X=0?" ); + OSL_ENSURE( !rInf.X() || m_pMulti, "SwTextFormatter::BuildPortion X=0?" ); CalcFlyWidth( rInf ); SwFlyPortion *pFly = rInf.GetFly(); if( pFly ) @@ -489,7 +489,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) } } } - else if ( bHasGrid && pGrid->IsSnapToChars() && ! pGridKernPortion && ! pMulti && ! pPor->InTabGrp() ) + else if ( bHasGrid && pGrid->IsSnapToChars() && ! pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() ) { // insert a grid kerning portion pGridKernPortion = pPor->IsKernPortion() ? @@ -535,7 +535,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) MergeCharacterBorder(*static_cast<SwDropPortion*>(pPor)); // the multi-portion has its own format function - if( pPor->IsMultiPortion() && ( !pMulti || pMulti->IsBidi() ) ) + if( pPor->IsMultiPortion() && ( !m_pMulti || m_pMulti->IsBidi() ) ) bFull = BuildMultiPortion( rInf, *static_cast<SwMultiPortion*>(pPor) ); else bFull = pPor->Format( rInf ); @@ -632,7 +632,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) } } - if ( bHasGrid && pGrid->IsSnapToChars() && pPor != pGridKernPortion && ! pMulti && ! pPor->InTabGrp() ) + if ( bHasGrid && pGrid->IsSnapToChars() && pPor != pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() ) { TextFrameIndex const nTmp = rInf.GetIdx() + pPor->GetLen(); const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width(); @@ -721,7 +721,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) void SwTextFormatter::CalcAdjustLine( SwLineLayout *pCurrent ) { - if( SvxAdjust::Left != GetAdjust() && !pMulti) + if( SvxAdjust::Left != GetAdjust() && !m_pMulti) { pCurrent->SetFormatAdj(true); if( IsFlyInCntBase() ) @@ -780,7 +780,7 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor ) else bChg = SeekAndChgBefore( rInf ); } - else if ( pMulti ) + else if ( m_pMulti ) // do not open attributes starting at 0 in empty multi // portions (rotated numbering followed by a footnote // can cause trouble, because the footnote attribute @@ -991,16 +991,16 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) // we keep an invariant during method calls: // there are no portion ending characters like hard spaces // or tabs in [ nLeftScanIdx, nRightScanIdx ] - if ( nLeftScanIdx <= rInf.GetIdx() && rInf.GetIdx() <= nRightScanIdx ) + if ( m_nLeftScanIdx <= rInf.GetIdx() && rInf.GetIdx() <= m_nRightScanIdx ) { - if ( nNextChg > nRightScanIdx ) - nNextChg = nRightScanIdx = - rInf.ScanPortionEnd( nRightScanIdx, nNextChg ); + if ( nNextChg > m_nRightScanIdx ) + nNextChg = m_nRightScanIdx = + rInf.ScanPortionEnd( m_nRightScanIdx, nNextChg ); } else { - nLeftScanIdx = rInf.GetIdx(); - nNextChg = nRightScanIdx = + m_nLeftScanIdx = rInf.GetIdx(); + nNextChg = m_nRightScanIdx = rInf.ScanPortionEnd( rInf.GetIdx(), nNextChg ); } @@ -1083,7 +1083,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) // 5. The foot note count if( !rInf.IsFootnoteDone() ) { - OSL_ENSURE( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), + OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(), "Rotated number portion trouble" ); const bool bFootnoteNum = m_pFrame->IsFootnoteNumFrame(); @@ -1105,7 +1105,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf) // 7. The numbering if( !rInf.IsNumDone() && !pPor ) { - OSL_ENSURE( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(), + OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(), "Rotated number portion trouble" ); // If we're in the follow, then of course not @@ -1243,7 +1243,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) if( !pPor ) { - if( ( !pMulti || pMulti->IsBidi() ) && + if( ( !m_pMulti || m_pMulti->IsBidi() ) && // i#42734 // No multi portion if there is a hook character waiting: ( !rInf.GetRest() || '\0' == rInf.GetHookChar() ) ) @@ -1251,7 +1251,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) // We open a multiportion part, if we enter a multi-line part // of the paragraph. TextFrameIndex nEnd = rInf.GetIdx(); - std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, pMulti ); + std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti ); if( pCreate ) { SwMultiPortion* pTmp = nullptr; @@ -1390,7 +1390,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) // Special portions containing numbers (footnote anchor, footnote number, // numbering) can be contained in a rotated portion, if the user // choose a rotated character attribute. - if (!pMulti) + if (!m_pMulti) { if ( pPor->IsFootnotePortion() ) { @@ -1877,15 +1877,15 @@ void SwTextFormatter::FormatReset( SwTextFormatInfo &rInf ) bool SwTextFormatter::CalcOnceMore() { - if( pDropFormat ) + if( m_pDropFormat ) { const sal_uInt16 nOldDrop = GetDropHeight(); - CalcDropHeight( pDropFormat->GetLines() ); - bOnceMore = nOldDrop != GetDropHeight(); + CalcDropHeight( m_pDropFormat->GetLines() ); + m_bOnceMore = nOldDrop != GetDropHeight(); } else - bOnceMore = false; - return bOnceMore; + m_bOnceMore = false; + return m_bOnceMore; } SwTwips SwTextFormatter::CalcBottomLine() const @@ -2074,7 +2074,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, if( pPos->IsMultiPortion() && static_cast<SwMultiPortion*>(pPos)->HasFlyInContent() ) { OSL_ENSURE( !GetMulti(), "Too much multi" ); - const_cast<SwTextFormatter*>(this)->pMulti = static_cast<SwMultiPortion*>(pPos); + const_cast<SwTextFormatter*>(this)->m_pMulti = static_cast<SwMultiPortion*>(pPos); SwLineLayout *pLay = &GetMulti()->GetRoot(); Point aSt( aTmpInf.X(), aStart.Y() ); @@ -2103,7 +2103,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, aSt.AdjustY(pLay->Height() ); pLay = pLay->GetNext(); } while ( pLay ); - const_cast<SwTextFormatter*>(this)->pMulti = nullptr; + const_cast<SwTextFormatter*>(this)->m_pMulti = nullptr; } pPos->Move( aTmpInf ); pPos = pPos->GetNextPortion(); diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index ff9af549ccd7..c9a14f566741 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -32,16 +32,16 @@ class SwFootnotePortion; class SwTextFormatter : public SwTextPainter { - const SwFormatDrop *pDropFormat; - SwMultiPortion* pMulti; // during formatting a multi-portion - sal_uInt8 nCntEndHyph; // Counts consecutive hyphens at the line end - sal_uInt8 nCntMidHyph; // Counts consecutive hyphens before flies - TextFrameIndex nLeftScanIdx; // for increasing performance during - TextFrameIndex nRightScanIdx; // scanning for portion ends - bool bOnceMore : 1; // Another round? - bool bFlyInCntBase : 1; // Base reference that sets a character-bound frame - bool bTruncLines : 1; // Flag for extending the repaint rect, if needed - bool bUnclipped : 1; // Flag whether repaint is larger than the fixed line height + const SwFormatDrop *m_pDropFormat; + SwMultiPortion* m_pMulti; // during formatting a multi-portion + sal_uInt8 m_nContentEndHyph; // Counts consecutive hyphens at the line end + sal_uInt8 m_nContentMidHyph; // Counts consecutive hyphens before flies + TextFrameIndex m_nLeftScanIdx; // for increasing performance during + TextFrameIndex m_nRightScanIdx; // scanning for portion ends + bool m_bOnceMore : 1; // Another round? + bool m_bFlyInContentBase : 1; // Base reference that sets a character-bound frame + bool m_bTruncLines : 1; // Flag for extending the repaint rect, if needed + bool m_bUnclipped : 1; // Flag whether repaint is larger than the fixed line height std::unique_ptr<sw::MergedAttrIterByEnd> m_pByEndIter; // HACK for TryNewNoLengthPortion SwLinePortion* m_pFirstOfBorderMerge; // The first text portion of a joined border (during portion building) @@ -152,7 +152,7 @@ public: void CtorInitTextFormatter( SwTextFrame *pFrame, SwTextFormatInfo *pInf ); SwTextFormatter(SwTextFrame *pTextFrame, SwTextFormatInfo *pTextFormatInf) : SwTextPainter(pTextFrame->GetTextNodeFirst()) - , bUnclipped(false) + , m_bUnclipped(false) { CtorInitTextFormatter( pTextFrame, pTextFormatInf ); } @@ -193,33 +193,33 @@ public: SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, TextFrameIndex nPos); - const SwFormatDrop *GetDropFormat() const { return pDropFormat; } - void ClearDropFormat() { pDropFormat = nullptr; } + const SwFormatDrop *GetDropFormat() const { return m_pDropFormat; } + void ClearDropFormat() { m_pDropFormat = nullptr; } - SwMultiPortion *GetMulti() const { return pMulti; } + SwMultiPortion *GetMulti() const { return m_pMulti; } - bool IsOnceMore() const { return bOnceMore; } - void SetOnceMore( bool bNew ) { bOnceMore = bNew; } + bool IsOnceMore() const { return m_bOnceMore; } + void SetOnceMore( bool bNew ) { m_bOnceMore = bNew; } - bool HasTruncLines() const { return bTruncLines; } - void SetTruncLines( bool bNew ) { bTruncLines = bNew; } + bool HasTruncLines() const { return m_bTruncLines; } + void SetTruncLines( bool bNew ) { m_bTruncLines = bNew; } - bool IsUnclipped() const { return bUnclipped; } - void SetUnclipped( bool bNew ) { bUnclipped = bNew; } + bool IsUnclipped() const { return m_bUnclipped; } + void SetUnclipped( bool bNew ) { m_bUnclipped = bNew; } - bool IsFlyInCntBase() const { return bFlyInCntBase; } - void SetFlyInCntBase( bool bNew = true ) { bFlyInCntBase = bNew; } + bool IsFlyInCntBase() const { return m_bFlyInContentBase; } + void SetFlyInCntBase( bool bNew = true ) { m_bFlyInContentBase = bNew; } SwTextFormatInfo &GetInfo() { return static_cast<SwTextFormatInfo&>(SwTextIter::GetInfo()); } const SwTextFormatInfo &GetInfo() const { return static_cast<const SwTextFormatInfo&>(SwTextIter::GetInfo()); } - void InitCntHyph() { CntHyphens( nCntEndHyph, nCntMidHyph ); } - const sal_uInt8 &CntEndHyph() const { return nCntEndHyph; } - const sal_uInt8 &CntMidHyph() const { return nCntMidHyph; } - sal_uInt8 &CntEndHyph() { return nCntEndHyph; } - sal_uInt8 &CntMidHyph() { return nCntMidHyph; } + void InitCntHyph() { CntHyphens( m_nContentEndHyph, m_nContentMidHyph ); } + const sal_uInt8 &CntEndHyph() const { return m_nContentEndHyph; } + const sal_uInt8 &CntMidHyph() const { return m_nContentMidHyph; } + sal_uInt8 &CntEndHyph() { return m_nContentEndHyph; } + sal_uInt8 &CntMidHyph() { return m_nContentMidHyph; } /** * Merge border of the drop portion with modifying the font of diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index a21514d86213..260e1921ae1a 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -1955,9 +1955,9 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, else nTmpX = rInf.X(); - SwMultiPortion* pOldMulti = pMulti; + SwMultiPortion* pOldMulti = m_pMulti; - pMulti = &rMulti; + m_pMulti = &rMulti; SwLineLayout *pOldCurr = m_pCurr; TextFrameIndex const nOldStart = GetStart(); SwTwips nMinWidth = nTmpX + 1; @@ -2160,7 +2160,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, pNextFirst = nullptr; } while ( true ); - pMulti = pOldMulti; + m_pMulti = pOldMulti; m_pCurr = pOldCurr; m_nStart = nOldStart; @@ -2275,7 +2275,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, } // during a recursion of BuildMultiPortions we may not build // a new SwBidiPortion, this would cause a memory leak - else if( rMulti.IsBidi() && ! pMulti ) + else if( rMulti.IsBidi() && ! m_pMulti ) { if ( ! rMulti.GetLen() ) lcl_TruncateMultiPortion( rMulti, rInf, nStartIdx ); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 4a3c425560fc..7588b20d4ad9 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -559,10 +559,10 @@ void SwTextFormatter::GuessDropHeight( const sal_uInt16 nLines ) SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf ) { - if( !pDropFormat ) + if( !m_pDropFormat ) return nullptr; - TextFrameIndex nPorLen(pDropFormat->GetWholeWord() ? 0 : pDropFormat->GetChars()); + TextFrameIndex nPorLen(m_pDropFormat->GetWholeWord() ? 0 : m_pDropFormat->GetChars()); nPorLen = m_pFrame->GetDropLen( nPorLen ); if( !nPorLen ) { @@ -576,17 +576,17 @@ SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf ) if ( !( GetDropHeight() || IsOnceMore() ) ) { if ( GetNext() ) - CalcDropHeight( pDropFormat->GetLines() ); + CalcDropHeight( m_pDropFormat->GetLines() ); else - GuessDropHeight( pDropFormat->GetLines() ); + GuessDropHeight( m_pDropFormat->GetLines() ); } // the DropPortion if( GetDropHeight() ) pDropPor = new SwDropPortion( GetDropLines(), GetDropHeight(), - GetDropDescent(), pDropFormat->GetDistance() ); + GetDropDescent(), m_pDropFormat->GetDistance() ); else - pDropPor = new SwDropPortion( 0,0,0,pDropFormat->GetDistance() ); + pDropPor = new SwDropPortion( 0,0,0,m_pDropFormat->GetDistance() ); pDropPor->SetLen( nPorLen ); @@ -603,7 +603,7 @@ SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf ) // build DropPortionParts: OSL_ENSURE( ! rInf.GetIdx(), "Drop Portion not at 0 position!" ); TextFrameIndex nNextChg(0); - const SwCharFormat* pFormat = pDropFormat->GetCharFormat(); + const SwCharFormat* pFormat = m_pDropFormat->GetCharFormat(); SwDropPortionPart* pCurrPart = nullptr; while ( nNextChg < nPorLen ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits