From 2136dc24a16c14138a0cf00b701cc468f4c76d2d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 3 May 2018 15:06:58 +0200 Subject: sw_redlinehide: convert headers to TextFrameIndex Only convert the interfaces now, convert the implementations later. Change-Id: I8a84f239d59a5fe21c62615d9ff8e2defa07badc --- sw/source/core/inc/frminf.hxx | 7 +-- sw/source/core/inc/txtfrm.hxx | 52 +++++++++---------- sw/source/core/text/frmcrsr.cxx | 6 +-- sw/source/core/text/frmform.cxx | 10 ++-- sw/source/core/text/frminf.cxx | 8 +-- sw/source/core/text/guess.cxx | 2 +- sw/source/core/text/guess.hxx | 18 +++---- sw/source/core/text/inftxt.cxx | 35 ++++++------- sw/source/core/text/inftxt.hxx | 105 +++++++++++++++++++-------------------- sw/source/core/text/itrcrsr.cxx | 8 +-- sw/source/core/text/itrform2.cxx | 4 +- sw/source/core/text/itrform2.hxx | 12 ++--- sw/source/core/text/itrtxt.cxx | 4 +- sw/source/core/text/itrtxt.hxx | 26 +++++----- sw/source/core/text/pordrop.hxx | 8 +-- sw/source/core/text/porexp.cxx | 4 +- sw/source/core/text/porexp.hxx | 6 +-- sw/source/core/text/porfld.cxx | 2 +- sw/source/core/text/porfld.hxx | 12 ++--- sw/source/core/text/porfly.cxx | 5 +- sw/source/core/text/porftn.hxx | 2 +- sw/source/core/text/porglue.cxx | 2 +- sw/source/core/text/porglue.hxx | 2 +- sw/source/core/text/porlay.cxx | 4 +- sw/source/core/text/porlay.hxx | 24 +++++---- sw/source/core/text/porlin.cxx | 2 +- sw/source/core/text/porlin.hxx | 10 ++-- sw/source/core/text/pormulti.cxx | 29 ++++++----- sw/source/core/text/pormulti.hxx | 38 +++++++------- sw/source/core/text/porrst.cxx | 2 +- sw/source/core/text/porrst.hxx | 16 ++++-- sw/source/core/text/portab.hxx | 4 +- sw/source/core/text/portxt.cxx | 6 +-- sw/source/core/text/portxt.hxx | 4 +- sw/source/core/text/txtdrop.cxx | 2 +- sw/source/core/text/txtfrm.cxx | 12 ++--- sw/source/core/text/txtftn.cxx | 8 +-- 37 files changed, 260 insertions(+), 241 deletions(-) (limited to 'sw/source/core') diff --git a/sw/source/core/inc/frminf.hxx b/sw/source/core/inc/frminf.hxx index 360cba17a4cd..844e5bb4be87 100644 --- a/sw/source/core/inc/frminf.hxx +++ b/sw/source/core/inc/frminf.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_FRMINF_HXX #include +#include "TextFrameIndex.hxx" class SwTextFrame; class SwPaM; @@ -46,13 +47,13 @@ public: SwTwips GetLineStart() const; // return center position of the next character - SwTwips GetCharPos( sal_Int32 nChar, bool bCenter = true ) const; + SwTwips GetCharPos(TextFrameIndex nChar, bool bCenter = true) const; // collect all whitespaces at the beginning and end of a line in Pam void GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const; // Is a bullet point/symbol/etc. at the first text position? - bool IsBullet( sal_Int32 nTextPos ) const; + bool IsBullet(TextFrameIndex nTextPos) const; // determine indentation for first line SwTwips GetFirstIndent() const; @@ -62,7 +63,7 @@ public: { pFrame = pNew; return *this; } // Is it a comparison? Returns position in frame. - sal_Int32 GetBigIndent( sal_Int32& rFndPos, + sal_Int32 GetBigIndent( TextFrameIndex & rFndPos, const SwTextFrame *pNextFrame ) const; }; diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index de4261c7d35c..78588cf149cf 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -54,7 +54,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame friend class SwTestFormat; friend class WidowsAndOrphans; friend class TextFrameLockGuard; // May Lock()/Unlock() - friend bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew ); + friend bool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew); /// SwLineLayout cache: the lines are not actually owned by the SwTextFrame /// but by this SwCache, so they will be deleted in large documents @@ -85,13 +85,13 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame // It is NOT used for the determination of printing area. SwTwips mnAdditionalFirstLineOffset; - sal_Int32 mnOffset; // Is the offset in the Content (character count) + TextFrameIndex mnOffset; // Is the offset in the Content (character count) sal_uInt16 mnCacheIndex; // Index into the cache, USHRT_MAX if there's definitely no fitting object in the cache // Separates the Master and creates a Follow or adjusts the data in the Follow - void AdjustFollow_( SwTextFormatter &rLine, const sal_Int32 nOffset, - const sal_Int32 nStrEnd, const sal_uInt8 nMode ); + void AdjustFollow_( SwTextFormatter &rLine, TextFrameIndex nOffset, + TextFrameIndex nStrEnd, const sal_uInt8 nMode ); // Iterates all Lines and sets the line spacing using the attribute void CalcLineSpace(); @@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame // WidowsAndOrphans, AdjustFrame, AdjustFollow void FormatAdjust( SwTextFormatter &rLine, WidowsAndOrphans &rFrameBreak, - const sal_Int32 nStrLen, const bool bDummy ); + TextFrameIndex nStrLen, const bool bDummy ); bool mbLocked : 1; // In the Format? bool mbWidow : 1; // Are we a Widow? @@ -135,7 +135,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame void SetEmpty( const bool bNew ) { mbEmpty = bNew; } void SetFieldFollow( const bool bNew ) { mbFieldFollow = bNew; } - bool IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const; + bool IsIdxInside(TextFrameIndex nPos, TextFrameIndex nLen) const; // Changes the Frame or not (cf. FlyCnt) bool GetCursorOfst_(SwPosition *pPos, const Point &rPoint, @@ -153,13 +153,13 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame void FormatOnceMore( SwTextFormatter &rLine, SwTextFormatInfo &rInf ); // Formats the Follow and ensures disposing on orphans - bool CalcFollow( const sal_Int32 nTextOfst ); + bool CalcFollow(TextFrameIndex nTextOfst); virtual void MakePos() override; // Corrects the position from which we need to format - static sal_Int32 FindBrk(const OUString &rText, const sal_Int32 nStart, - const sal_Int32 nEnd); + static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart, + TextFrameIndex nEnd); // inline branch SwTwips GetFootnoteFrameHeight_() const; @@ -312,19 +312,19 @@ public: * Prepares the cursor position for a visual cursor move (BiDi). * The behaviour is different for insert and overwrite cursors */ - void PrepareVisualMove( sal_Int32& nPos, sal_uInt8& nCursorLevel, + void PrepareVisualMove( TextFrameIndex& nPos, sal_uInt8& nCursorLevel, bool& bRight, bool bInsertCursor ); /// Methods to manage the FollowFrame - void SplitFrame( const sal_Int32 nTextPos ); + void SplitFrame(TextFrameIndex nTextPos); SwContentFrame *JoinFrame(); - sal_Int32 GetOfst() const { return mnOffset; } - void SetOfst_( const sal_Int32 nNewOfst ); - inline void SetOfst ( const sal_Int32 nNewOfst ); - void ManipOfst ( const sal_Int32 nNewOfst ){ mnOffset = nNewOfst; } + TextFrameIndex GetOfst() const { return mnOffset; } + void SetOfst_(TextFrameIndex nNewOfst); + inline void SetOfst (TextFrameIndex nNewOfst); + void ManipOfst(TextFrameIndex const nNewOfst) { mnOffset = nNewOfst; } SwTextFrame *GetFrameAtPos ( const SwPosition &rPos); inline const SwTextFrame *GetFrameAtPos ( const SwPosition &rPos) const; - SwTextFrame& GetFrameAtOfst( const sal_Int32 nOfst ); + SwTextFrame& GetFrameAtOfst(TextFrameIndex nOfst); /// If there's a Follow and we don't contain text ourselves bool IsEmptyMaster() const { return GetFollow() && !GetFollow()->GetOfst(); } @@ -422,7 +422,7 @@ public: /// Does the Frame have a local footnote (in this Frame or Follow)? #ifdef DBG_UTIL - void CalcFootnoteFlag( sal_Int32 nStop = COMPLETE_STRING ); //For testing SplitFrame + void CalcFootnoteFlag(TextFrameIndex nStop = TextFrameIndex(COMPLETE_STRING)); //For testing SplitFrame #else void CalcFootnoteFlag(); #endif @@ -430,7 +430,7 @@ public: /// Hidden bool IsHiddenNow() const; // bHidden && pOut == pPrt void HideHidden(); // Remove appendage if Hidden - void HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd ); + void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd); /** * Hides respectively shows objects, which are anchored at paragraph, @@ -440,8 +440,8 @@ public: void HideAndShowObjects(); /// Footnote - void RemoveFootnote( const sal_Int32 nStart, - const sal_Int32 nLen = COMPLETE_STRING ); + void RemoveFootnote(TextFrameIndex nStart, + TextFrameIndex nLen = TextFrameIndex(COMPLETE_STRING)); inline SwTwips GetFootnoteFrameHeight() const; SwTextFrame *FindFootnoteRef( const SwTextFootnote *pFootnote ); const SwTextFrame *FindFootnoteRef( const SwTextFootnote *pFootnote ) const @@ -480,7 +480,7 @@ public: void SetFootnote( const bool bNew ) { mbFootnote = bNew; } /// Respect the Follows - inline bool IsInside( const sal_Int32 nPos ) const; + inline bool IsInside(TextFrameIndex nPos) const; const SwBodyFrame *FindBodyFrame() const; @@ -533,16 +533,16 @@ public: sal_uInt16 FirstLineHeight() const; /// Rewires FlyInContentFrame, if nEnd > Index >= nStart - void MoveFlyInCnt( SwTextFrame *pNew, sal_Int32 nStart, sal_Int32 nEnd ); + void MoveFlyInCnt(SwTextFrame *pNew, TextFrameIndex nStart, TextFrameIndex nEnd); /// Calculates the position of FlyInContentFrames - sal_Int32 CalcFlyPos( SwFrameFormat const * pSearch ); + TextFrameIndex CalcFlyPos( SwFrameFormat const * pSearch ); /// Determines the start position and step size of the register bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ); /// Determines the line count - sal_uInt16 GetLineCount( sal_Int32 nPos ); + sal_uInt16 GetLineCount(TextFrameIndex nPos); /// For displaying the line numbers sal_uLong GetAllLines() const { return mnAllLines; } @@ -701,7 +701,7 @@ inline SwTwips SwTextFrame::GrowTst( const SwTwips nGrow ) return Grow( nGrow, true ); } -inline bool SwTextFrame::IsInside( const sal_Int32 nPos ) const +inline bool SwTextFrame::IsInside(TextFrameIndex const nPos) const { bool bRet = true; if( nPos < GetOfst() ) @@ -737,7 +737,7 @@ inline const SwTextFrame *SwTextFrame::GetFrameAtPos( const SwPosition &rPos) co return const_cast(this)->GetFrameAtPos( rPos ); } -inline void SwTextFrame::SetOfst( const sal_Int32 nNewOfst ) +inline void SwTextFrame::SetOfst(TextFrameIndex const nNewOfst) { if ( mnOffset != nNewOfst ) SetOfst_( nNewOfst ); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 2d2dd975ed65..b8b1f3487317 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -103,7 +103,7 @@ SwTextFrame *GetAdjFrameAtPos( SwTextFrame *pFrame, const SwPosition &rPos, } -bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew ) +bool sw_ChangeOffset(SwTextFrame* pFrame, TextFrameIndex nNew) { // Do not scroll in areas and outside of flies OSL_ENSURE( !pFrame->IsFollow(), "Illegal Scrolling by Follow!" ); @@ -138,7 +138,7 @@ bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew ) return false; } -SwTextFrame& SwTextFrame::GetFrameAtOfst( const sal_Int32 nWhere ) +SwTextFrame& SwTextFrame::GetFrameAtOfst(TextFrameIndex const nWhere) { SwTextFrame* pRet = this; while( pRet->HasFollow() && nWhere >= pRet->GetFollow()->GetOfst() ) @@ -1038,7 +1038,7 @@ static void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, sal_Int32 nI } } -void SwTextFrame::PrepareVisualMove( sal_Int32& nPos, sal_uInt8& nCursorLevel, +void SwTextFrame::PrepareVisualMove(TextFrameIndex & nPos, sal_uInt8& nCursorLevel, bool& bForward, bool bInsertCursor ) { if( IsEmpty() || IsHiddenNow() ) diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index b6203899aee0..8f75cdb41a61 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -183,7 +183,7 @@ const SwBodyFrame *SwTextFrame::FindBodyFrame() const return nullptr; } -bool SwTextFrame::CalcFollow( const sal_Int32 nTextOfst ) +bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst) { vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut(); SwSwapIfSwapped swap( this ); @@ -565,7 +565,7 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C // and the Follow starts. // If it's 0, the FollowFrame is deleted. void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine, - const sal_Int32 nOffset, const sal_Int32 nEnd, + const TextFrameIndex nOffset, const TextFrameIndex nEnd, const sal_uInt8 nMode ) { SwFrameSwapper aSwapper( this, false ); @@ -689,7 +689,7 @@ SwContentFrame *SwTextFrame::JoinFrame() return pNxt; } -void SwTextFrame::SplitFrame( const sal_Int32 nTextPos ) +void SwTextFrame::SplitFrame(TextFrameIndex const nTextPos) { SwSwapIfSwapped swap( this ); @@ -765,7 +765,7 @@ void SwTextFrame::SplitFrame( const sal_Int32 nTextPos ) pNew->ManipOfst( nTextPos ); } -void SwTextFrame::SetOfst_( const sal_Int32 nNewOfst ) +void SwTextFrame::SetOfst_(TextFrameIndex const nNewOfst) { // We do not need to invalidate out Follow. // We are a Follow, get formatted right away and call @@ -1000,7 +1000,7 @@ bool SwTextFrame::CalcPreps() void SwTextFrame::FormatAdjust( SwTextFormatter &rLine, WidowsAndOrphans &rFrameBreak, - const sal_Int32 nStrLen, + TextFrameIndex const nStrLen, const bool bDummy ) { SwSwapIfNotSwapped swap( this ); diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx index 6625a0dd594d..d72e137e5120 100644 --- a/sw/source/core/text/frminf.cxx +++ b/sw/source/core/text/frminf.cxx @@ -21,7 +21,7 @@ #include #include "itrtxt.hxx" -sal_Int32 SwTextMargin::GetTextStart() const +TextFrameIndex SwTextMargin::GetTextStart() const { const OUString &rText = GetInfo().GetText(); const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen(); @@ -35,7 +35,7 @@ sal_Int32 SwTextMargin::GetTextStart() const return nEnd; } -sal_Int32 SwTextMargin::GetTextEnd() const +TextFrameIndex SwTextMargin::GetTextEnd() const { const OUString &rText = GetInfo().GetText(); const sal_Int32 nEnd = m_nStart + m_pCurr->GetLen(); @@ -105,7 +105,7 @@ SwTwips SwTextFrameInfo::GetLineStart() const } // Calculates the character's position and returns the middle position -SwTwips SwTextFrameInfo::GetCharPos( sal_Int32 nChar, bool bCenter ) const +SwTwips SwTextFrameInfo::GetCharPos(TextFrameIndex const nChar, bool bCenter) const { SwRectFnSet aRectFnSet(pFrame); SwFrameSwapper aSwapper( pFrame, true ); @@ -251,7 +251,7 @@ SwTwips SwTextFrameInfo::GetFirstIndent() const return 1; } -sal_Int32 SwTextFrameInfo::GetBigIndent( sal_Int32& rFndPos, +sal_Int32 SwTextFrameInfo::GetBigIndent(TextFrameIndex& rFndPos, const SwTextFrame *pNextFrame ) const { SwTextSizeInfo aInf( const_cast(pFrame) ); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index b3cb3b02d472..6dd4765bc311 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -547,7 +547,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, // returns true if word at position nPos has a different spelling // if hyphenated at this position (old german spelling) bool SwTextGuess::AlternativeSpelling( const SwTextFormatInfo &rInf, - const sal_Int32 nPos ) + TextFrameIndex const nPos) { // get word boundaries Boundary aBound = diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx index b5d76688a5ce..ee558d460dcc 100644 --- a/sw/source/core/text/guess.hxx +++ b/sw/source/core/text/guess.hxx @@ -31,10 +31,10 @@ class SwTextGuess { css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord; std::unique_ptr pHanging; // for hanging punctuation - sal_Int32 nCutPos; // this character doesn't fit - sal_Int32 nBreakStart; // start index of word containing line break - sal_Int32 nBreakPos; // start index of break position - sal_Int32 nFieldDiff; // absolute positions can be wrong if we + TextFrameIndex nCutPos; // this character doesn't fit + TextFrameIndex nBreakStart; // start index of word containing line break + TextFrameIndex nBreakPos; // start index of break position + TextFrameIndex nFieldDiff; // absolute positions can be wrong if we // a field in the text has been expanded sal_uInt16 nBreakWidth; // width of the broken portion public: @@ -45,15 +45,15 @@ public: // true, if current portion still fits to current line bool Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight ); - bool AlternativeSpelling( const SwTextFormatInfo &rInf, const sal_Int32 nPos ); + bool AlternativeSpelling( const SwTextFormatInfo &rInf, const TextFrameIndex nPos ); SwHangingPortion* GetHangingPortion() const { return pHanging.get(); } SwHangingPortion* ReleaseHangingPortion() { return pHanging.release(); } sal_uInt16 BreakWidth() const { return nBreakWidth; } - sal_Int32 CutPos() const { return nCutPos; } - sal_Int32 BreakStart() const { return nBreakStart; } - sal_Int32 BreakPos() const {return nBreakPos; } - sal_Int32 FieldDiff() const {return nFieldDiff; } + TextFrameIndex CutPos() const { return nCutPos; } + TextFrameIndex BreakStart() const { return nBreakStart; } + TextFrameIndex BreakPos() const {return nBreakPos; } + TextFrameIndex FieldDiff() const {return nFieldDiff; } const css::uno::Reference< css::linguistic2::XHyphenatedWord >& HyphWord() const { return xHyphWord; } }; diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index d66f946a04ed..4363ac3991ec 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -246,7 +246,7 @@ SwTextSizeInfo::SwTextSizeInfo( const SwTextSizeInfo &rNew ) } void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, - const sal_Int32 nNewIdx ) + TextFrameIndex const nNewIdx) { m_pKanaComp = nullptr; m_nKanaIdx = 0; @@ -322,7 +322,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF } SwTextSizeInfo::SwTextSizeInfo( const SwTextSizeInfo &rNew, const OUString* pText, - const sal_Int32 nIndex ) + TextFrameIndex const nIndex) : SwTextInfo( rNew ), m_pKanaComp(rNew.GetpKanaComp()), m_pVsh(const_cast(rNew).GetVsh()), @@ -357,7 +357,8 @@ SwTextSizeInfo::SwTextSizeInfo( const SwTextSizeInfo &rNew, const OUString* pTex SetLen( GetMinLen( *this ) ); } -SwTextSizeInfo::SwTextSizeInfo( SwTextFrame *pTextFrame, const sal_Int32 nIndex ) +SwTextSizeInfo::SwTextSizeInfo(SwTextFrame *const pTextFrame, + TextFrameIndex const nIndex) : m_bOnWin(false) { CtorInitTextSizeInfo( pTextFrame->getRootFrame()->GetCurrShell()->GetOut(), pTextFrame, nIndex ); @@ -384,8 +385,8 @@ void SwTextSizeInfo::NoteAnimation() const SwPosSize SwTextSizeInfo::GetTextSize( OutputDevice* pOutDev, const SwScriptInfo* pSI, const OUString& rText, - const sal_Int32 nIndex, - const sal_Int32 nLength) const + const TextFrameIndex nIndex, + const TextFrameIndex nLength) const { SwDrawTextInfo aDrawInf( m_pVsh, *pOutDev, pSI, rText, nIndex, nLength ); aDrawInf.SetFrame( m_pFrame ); @@ -416,8 +417,8 @@ SwPosSize SwTextSizeInfo::GetTextSize() const return SwPosSize(m_pFnt->GetTextSize_( aDrawInf )); } -void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const sal_Int32 nIndex, - const sal_Int32 nLength, const sal_uInt16 nComp, +void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const TextFrameIndex nIndex, + const TextFrameIndex nLength, const sal_uInt16 nComp, sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff, vcl::TextLayoutCache const*const pCache) const { @@ -432,8 +433,8 @@ void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const sal_Int32 nInde nMinSize = aSize.Width(); } -sal_Int32 SwTextSizeInfo::GetTextBreak( const long nLineWidth, - const sal_Int32 nMaxLen, +TextFrameIndex SwTextSizeInfo::GetTextBreak( const long nLineWidth, + const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::TextLayoutCache const*const pCache) const { @@ -452,10 +453,10 @@ sal_Int32 SwTextSizeInfo::GetTextBreak( const long nLineWidth, return m_pFnt->GetTextBreak( aDrawInf, nLineWidth ); } -sal_Int32 SwTextSizeInfo::GetTextBreak( const long nLineWidth, - const sal_Int32 nMaxLen, +TextFrameIndex SwTextSizeInfo::GetTextBreak( const long nLineWidth, + const TextFrameIndex nMaxLen, const sal_uInt16 nComp, - sal_Int32& rExtraCharPos, + TextFrameIndex& rExtraCharPos, vcl::TextLayoutCache const*const pCache) const { const SwScriptInfo& rScriptInfo = @@ -473,9 +474,9 @@ sal_Int32 SwTextSizeInfo::GetTextBreak( const long nLineWidth, return m_pFnt->GetTextBreak( aDrawInf, nLineWidth ); } -bool SwTextSizeInfo::HasHint_( const SwTextNode* pTextNode, sal_Int32 nPos ) +bool SwTextSizeInfo::HasHint(TextFrameIndex const nPos) const { - return pTextNode->GetTextAttrForCharAt(nPos); + return m_pFrame->GetTextNode()->GetTextAttrForCharAt(nPos); } void SwTextPaintInfo::CtorInitTextPaintInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint ) @@ -556,7 +557,7 @@ static bool lcl_IsDarkBackground( const SwTextPaintInfo& rInf ) } void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPor, - const sal_Int32 nStart, const sal_Int32 nLength, + TextFrameIndex const nStart, TextFrameIndex const nLength, const bool bKern, const bool bWrong, const bool bSmartTag, const bool bGrammarCheck ) @@ -1568,8 +1569,8 @@ bool SwTextFormatInfo::CheckFootnotePortion_( SwLineLayout const * pCurr ) return false; } -sal_Int32 SwTextFormatInfo::ScanPortionEnd( const sal_Int32 nStart, - const sal_Int32 nEnd ) +TextFrameIndex SwTextFormatInfo::ScanPortionEnd(TextFrameIndex const nStart, + TextFrameIndex const nEnd) { m_cHookChar = 0; sal_Int32 i = nStart; diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index ac85d3da4281..c0bf6f7aa46c 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -120,7 +120,7 @@ class SwTextInfo // Implementation in txthyph.cxx friend void SetParaPortion( SwTextInfo *pInf, SwParaPortion *pRoot ); SwParaPortion *m_pPara; - sal_Int32 m_nTextStart; // TextOfst for Follows + TextFrameIndex m_nTextStart; // TextOfst for Follows protected: SwTextInfo() @@ -134,7 +134,7 @@ public: explicit SwTextInfo( SwTextFrame *pFrame ) { CtorInitTextInfo( pFrame ); } SwParaPortion *GetParaPortion() { return m_pPara; } const SwParaPortion *GetParaPortion() const { return m_pPara; } - sal_Int32 GetTextStart() const { return m_nTextStart; } + TextFrameIndex GetTextStart() const { return m_nTextStart; } }; class SwTextSizeInfo : public SwTextInfo @@ -166,7 +166,8 @@ protected: SwTextFrame *m_pFrame; const SwViewOption *m_pOpt; const OUString *m_pText; - sal_Int32 m_nIdx, m_nLen; + TextFrameIndex m_nIdx; + TextFrameIndex m_nLen; sal_uInt16 m_nKanaIdx; bool m_bOnWin : 1; bool m_bNotEOL : 1; @@ -189,18 +190,18 @@ protected: protected: void CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, - const sal_Int32 nIdx ); + TextFrameIndex nIdx); SwTextSizeInfo(); public: SwTextSizeInfo( const SwTextSizeInfo &rInf ); SwTextSizeInfo( const SwTextSizeInfo &rInf, const OUString* pText, - const sal_Int32 nIdx = 0 ); - SwTextSizeInfo( SwTextFrame *pTextFrame, const sal_Int32 nIndex = 0 ); + TextFrameIndex nIdx = TextFrameIndex(0) ); + SwTextSizeInfo(SwTextFrame *pTextFrame, TextFrameIndex nIndex = TextFrameIndex(0)); // GetMultiAttr returns the text attribute of the multiportion, // if rPos is inside any multi-line part. // rPos will set to the end of the multi-line part. - SwMultiCreator* GetMultiCreator( sal_Int32 &rPos, SwMultiPortion const * pM ) const; + SwMultiCreator* GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const; bool OnWin() const { return m_bOnWin; } void SetOnWin( const bool bNew ) { m_bOnWin = bNew; } @@ -250,41 +251,41 @@ public: const SwViewOption &GetOpt() const { return *m_pOpt; } const OUString &GetText() const { return *m_pText; } - sal_Unicode GetChar( const sal_Int32 nPos ) const { - if (m_pText && nPos < m_pText->getLength()) return (*m_pText)[ nPos ]; + sal_Unicode GetChar(TextFrameIndex const nPos) const { + if (m_pText && nPos < TextFrameIndex(m_pText->getLength())) return (*m_pText)[sal_Int32(nPos)]; return 0; } sal_uInt16 GetTextHeight() const; SwPosSize GetTextSize( OutputDevice* pOut, const SwScriptInfo* pSI, - const OUString& rText, const sal_Int32 nIdx, - const sal_Int32 nLen ) const; + const OUString& rText, TextFrameIndex nIdx, + TextFrameIndex nLen ) const; SwPosSize GetTextSize() const; - void GetTextSize( const SwScriptInfo* pSI, const sal_Int32 nIdx, - const sal_Int32 nLen, const sal_uInt16 nComp, + void GetTextSize( const SwScriptInfo* pSI, TextFrameIndex nIdx, + TextFrameIndex nLen, const sal_uInt16 nComp, sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff, vcl::TextLayoutCache const* = nullptr) const; - inline SwPosSize GetTextSize( const SwScriptInfo* pSI, const sal_Int32 nIdx, - const sal_Int32 nLen ) const; + inline SwPosSize GetTextSize(const SwScriptInfo* pSI, TextFrameIndex nIdx, + TextFrameIndex nLen) const; inline SwPosSize GetTextSize( const OUString &rText ) const; - sal_Int32 GetTextBreak( const long nLineWidth, - const sal_Int32 nMaxLen, + TextFrameIndex GetTextBreak( const long nLineWidth, + const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::TextLayoutCache const*) const; - sal_Int32 GetTextBreak( const long nLineWidth, - const sal_Int32 nMaxLen, + TextFrameIndex GetTextBreak( const long nLineWidth, + const TextFrameIndex nMaxLen, const sal_uInt16 nComp, - sal_Int32& rExtraCharPos, + TextFrameIndex& rExtraCharPos, vcl::TextLayoutCache const*) const; sal_uInt16 GetAscent() const; - sal_Int32 GetIdx() const { return m_nIdx; } - void SetIdx( const sal_Int32 nNew ) { m_nIdx = nNew; } - sal_Int32 GetLen() const { return m_nLen; } - void SetLen( const sal_Int32 nNew ) { m_nLen = nNew; } + TextFrameIndex GetIdx() const { return m_nIdx; } + void SetIdx(const TextFrameIndex nNew) { m_nIdx = nNew; } + TextFrameIndex GetLen() const { return m_nLen; } + void SetLen(const TextFrameIndex nNew) { m_nLen = nNew; } void SetText( const OUString &rNew ){ m_pText = &rNew; } // No Bullets for the symbol font! @@ -297,9 +298,7 @@ public: SwTextFrame *GetTextFrame() { return m_pFrame; } const SwTextFrame *GetTextFrame() const { return m_pFrame; } - bool HasHint( sal_Int32 nPos ) const - { return HasHint_( m_pFrame->GetTextNode(), nPos ); } - static bool HasHint_( const SwTextNode* pTextNode, sal_Int32 nPos ); + bool HasHint(TextFrameIndex nPos) const; // If Kana Compression is enabled, a minimum and maximum portion width // is calculated. We format lines with minimal size and share remaining @@ -362,8 +361,8 @@ class SwTextPaintInfo : public SwTextSizeInfo SwRect aPaintRect; // Original paint rect (from Layout paint) sal_uInt16 nSpaceIdx; - void DrawText_( const OUString &rText, const SwLinePortion &rPor, - const sal_Int32 nIdx, const sal_Int32 nLen, + void DrawText_(const OUString &rText, const SwLinePortion &rPor, + const TextFrameIndex nIdx, const TextFrameIndex nLen, const bool bKern, const bool bWrong = false, const bool bSmartTag = false, const bool bGrammarCheck = false ); @@ -398,12 +397,12 @@ public: SwTextFly& GetTextFly() { return aTextFly; } const SwTextFly& GetTextFly() const { return aTextFly; } inline void DrawText( const OUString &rText, const SwLinePortion &rPor, - const sal_Int32 nIdx = 0, - const sal_Int32 nLen = COMPLETE_STRING, + TextFrameIndex nIdx = TextFrameIndex(0), + TextFrameIndex nLen = TextFrameIndex(COMPLETE_STRING), const bool bKern = false) const; - inline void DrawText( const SwLinePortion &rPor, const sal_Int32 nLen, + inline void DrawText( const SwLinePortion &rPor, TextFrameIndex nLen, const bool bKern = false ) const; - inline void DrawMarkedText( const SwLinePortion &rPor, const sal_Int32 nLen, + inline void DrawMarkedText( const SwLinePortion &rPor, TextFrameIndex nLen, const bool bWrong, const bool bSmartTags, const bool bGrammarCheck ) const; @@ -482,9 +481,9 @@ class SwTextFormatInfo : public SwTextPaintInfo SwTabPortion *m_pLastTab; // The _last_ TabPortion - sal_Int32 m_nSoftHyphPos; // SoftHyphPos for Hyphenation - sal_Int32 m_nLineStart; // Current line start in rText - sal_Int32 m_nUnderScorePos; // enlarge repaint if underscore has been found + TextFrameIndex m_nSoftHyphPos; ///< SoftHyphPos for Hyphenation + TextFrameIndex m_nLineStart; ///< Current line start in rText + TextFrameIndex m_nUnderScorePos; ///< enlarge repaint if underscore has been found // #i34348# Changed type from sal_uInt16 to SwTwips SwTwips m_nLeft; // Left margin SwTwips m_nRight; // Right margin @@ -547,7 +546,7 @@ public: SwTwips GetLineWidth(); // Returns the first changed position of the paragraph - inline sal_Int32 GetReformatStart() const; + inline TextFrameIndex GetReformatStart() const; // Margins SwTwips Left() const { return m_nLeft; } @@ -597,8 +596,8 @@ public: bool IsQuick() const { return m_bQuick; } bool IsTest() const { return m_bTestFormat; } - sal_Int32 GetLineStart() const { return m_nLineStart; } - void SetLineStart( const sal_Int32 nNew ) { m_nLineStart = nNew; } + TextFrameIndex GetLineStart() const { return m_nLineStart; } + void SetLineStart(TextFrameIndex const nNew) { m_nLineStart = nNew; } // these are used during fly calculation sal_uInt16 GetLineHeight() const { return m_nLineHeight; } @@ -610,8 +609,8 @@ public: SwLinePortion *GetUnderflow() { return m_pUnderflow; } void SetUnderflow( SwLinePortion *pNew ) { m_pUnderflow = pNew; m_bUnderflow = true; } - sal_Int32 GetSoftHyphPos() const { return m_nSoftHyphPos; } - void SetSoftHyphPos( const sal_Int32 nNew ) { m_nSoftHyphPos = nNew; } + TextFrameIndex GetSoftHyphPos() const { return m_nSoftHyphPos; } + void SetSoftHyphPos(TextFrameIndex const nNew) { m_nSoftHyphPos = nNew; } inline void SetParaFootnote(); @@ -646,8 +645,8 @@ public: // Should the hyphenate helper be discarded? bool IsHyphenate() const; - sal_Int32 GetUnderScorePos() const { return m_nUnderScorePos; } - void SetUnderScorePos( sal_Int32 nNew ) { m_nUnderScorePos = nNew; } + TextFrameIndex GetUnderScorePos() const { return m_nUnderScorePos; } + void SetUnderScorePos(TextFrameIndex const nNew) { m_nUnderScorePos = nNew; } // Calls HyphenateWord() of Hyphenator css::uno::Reference< css::linguistic2::XHyphenatedWord > @@ -665,7 +664,7 @@ public: // Looks for tabs, TabDec, TXTATR and BRK from nIdx until nEnd. // Return: Position; sets cHookChar if necessary - sal_Int32 ScanPortionEnd( const sal_Int32 nStart, const sal_Int32 nEnd ); + TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd); void SetTabOverflow( bool bOverflow ) { m_bTabOverflow = bOverflow; } bool IsTabOverflow() { return m_bTabOverflow; } @@ -687,8 +686,8 @@ class SwTextSlot final const SwWrongList* pOldSmartTagList; const SwWrongList* pOldGrammarCheckList; SwWrongList* pTempList; - sal_Int32 nIdx; - sal_Int32 nLen; + TextFrameIndex nIdx; + TextFrameIndex nLen; bool bOn; SwTextSizeInfo *pInf; @@ -727,12 +726,12 @@ inline sal_uInt16 SwTextSizeInfo::GetTextHeight() const inline SwPosSize SwTextSizeInfo::GetTextSize( const OUString &rText ) const { - return GetTextSize( m_pOut, nullptr, rText, 0, rText.getLength() ); + return GetTextSize(m_pOut, nullptr, rText, TextFrameIndex(0), TextFrameIndex(rText.getLength())); } inline SwPosSize SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, - const sal_Int32 nNewIdx, - const sal_Int32 nNewLen ) const + TextFrameIndex const nNewIdx, + TextFrameIndex const nNewLen) const { return GetTextSize( m_pOut, pSI, *m_pText, nNewIdx, nNewLen ); } @@ -749,20 +748,20 @@ inline void SwTextPaintInfo::SetPaintOfst( const SwTwips nNew ) inline void SwTextPaintInfo::DrawText( const OUString &rText, const SwLinePortion &rPor, - const sal_Int32 nStart, const sal_Int32 nLength, + const TextFrameIndex nStart, const TextFrameIndex nLength, const bool bKern ) const { const_cast(this)->DrawText_( rText, rPor, nStart, nLength, bKern ); } inline void SwTextPaintInfo::DrawText( const SwLinePortion &rPor, - const sal_Int32 nLength, const bool bKern ) const + const TextFrameIndex nLength, const bool bKern ) const { const_cast(this)->DrawText_( *m_pText, rPor, m_nIdx, nLength, bKern ); } inline void SwTextPaintInfo::DrawMarkedText( const SwLinePortion &rPor, - const sal_Int32 nLength, + const TextFrameIndex nLength, const bool bWrong, const bool bSmartTags, const bool bGrammarCheck ) const @@ -770,7 +769,7 @@ inline void SwTextPaintInfo::DrawMarkedText( const SwLinePortion &rPor, const_cast(this)->DrawText_( *m_pText, rPor, m_nIdx, nLength, false/*bKern*/, bWrong, bSmartTags, bGrammarCheck ); } -inline sal_Int32 SwTextFormatInfo::GetReformatStart() const +inline TextFrameIndex SwTextFormatInfo::GetReformatStart() const { return GetParaPortion()->GetReformat().Start(); } diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index cf0783ed1606..143f959fb85c 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -389,7 +389,7 @@ void SwTextCursor::CtorInitTextCursor( SwTextFrame *pNewFrame, SwTextSizeInfo *p } // 1170: Ancient bug: Shift-End forgets the last character ... -bool SwTextCursor::GetEndCharRect( SwRect* pOrig, const sal_Int32 nOfst, +bool SwTextCursor::GetEndCharRect(SwRect* pOrig, const TextFrameIndex nOfst, SwCursorMoveState* pCMS, const long nMax ) { // 1170: Ambiguity of document positions @@ -463,7 +463,7 @@ bool SwTextCursor::GetEndCharRect( SwRect* pOrig, const sal_Int32 nOfst, // pCMS is used for restricting the cursor, if there are different font // heights in one line ( first value = offset to y of pOrig, second // value = real height of (shortened) cursor -void SwTextCursor::GetCharRect_( SwRect* pOrig, const sal_Int32 nOfst, +void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst, SwCursorMoveState* pCMS ) { const OUString aText = GetInfo().GetText(); @@ -1165,7 +1165,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, const sal_Int32 nOfst, } } -bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, +bool SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst, SwCursorMoveState* pCMS, const long nMax ) { CharCursorToLine(nOfst); @@ -1253,7 +1253,7 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, } // Return: Offset in String -sal_Int32 SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoint, +TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoint, bool bChgNode, SwCursorMoveState* pCMS ) const { // If necessary, as catch up, do the adjustment diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index f8b8b16c679b..c776d63ef553 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1463,7 +1463,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) return pPor; } -sal_Int32 SwTextFormatter::FormatLine(const sal_Int32 nStartPos) +TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) { OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "SwTextFormatter::FormatLine( nStartPos ) with unswapped frame" ); @@ -1977,7 +1977,7 @@ void SwTextFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) } void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, - sal_Int32 nStartIdx, bool bAlways ) const + TextFrameIndex const nStartIdx, bool bAlways) const { OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "SwTextFormatter::UpdatePos with unswapped frame" ); diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index 3cd75e1aefa8..8071c42455c9 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -37,8 +37,8 @@ class SwTextFormatter : public SwTextPainter 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 - sal_Int32 nLeftScanIdx; // for increasing performance during - sal_Int32 nRightScanIdx; // scanning for portion ends + 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 @@ -111,7 +111,7 @@ class SwTextFormatter : public SwTextPainter for example after adjustment change (right alignment, justified, etc.) Mainly to correct the X position. */ - void UpdatePos( SwLineLayout *pCurr, Point aStart, sal_Int32 nStartIdx, + void UpdatePos(SwLineLayout *pCurr, Point aStart, TextFrameIndex nStartIdx, bool bAlways = false ) const; /** @@ -159,7 +159,7 @@ public: } virtual ~SwTextFormatter() override; - sal_Int32 FormatLine( const sal_Int32 nStart ); + TextFrameIndex FormatLine(TextFrameIndex nStart); void RecalcRealHeight(); @@ -169,7 +169,7 @@ public: // A special method for QuoVadis texts: // nErgo is the page number of the ErgoSum Footnote // At 0 it's still unclear - sal_Int32 FormatQuoVadis( const sal_Int32 nStart ); + TextFrameIndex FormatQuoVadis(TextFrameIndex nStart); // The emergency break: Cancel formatting, discard line bool IsStop() const { return GetInfo().IsStop(); } @@ -192,7 +192,7 @@ public: // How wide would you be without any bounds (Flys etc.)? SwTwips CalcFitToContent_( ); - SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, sal_Int32 nPos); + SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, TextFrameIndex nPos); const SwFormatDrop *GetDropFormat() const { return pDropFormat; } void ClearDropFormat() { pDropFormat = nullptr; } diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 15e2762b7323..c842251e73ee 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -190,7 +190,7 @@ void SwTextIter::Bottom() } } -void SwTextIter::CharToLine(const sal_Int32 nChar) +void SwTextIter::CharToLine(TextFrameIndex const nChar) { while( m_nStart + m_pCurr->GetLen() <= nChar && Next() ) ; @@ -199,7 +199,7 @@ void SwTextIter::CharToLine(const sal_Int32 nChar) } // 1170: takes into account ambiguities: -const SwLineLayout *SwTextCursor::CharCursorToLine( const sal_Int32 nPosition ) +const SwLineLayout *SwTextCursor::CharCursorToLine(TextFrameIndex const nPosition) { CharToLine( nPosition ); if( nPosition != m_nStart ) diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx index f105cf44b5bb..bf750c169da1 100644 --- a/sw/source/core/text/itrtxt.hxx +++ b/sw/source/core/text/itrtxt.hxx @@ -39,7 +39,7 @@ protected: SwTwips m_nFrameStart; SwTwips m_nY; SwTwips m_nRegStart; // The register's start position (Y) - sal_Int32 m_nStart; // Start in the text string, end = pCurr->GetLen() + TextFrameIndex m_nStart; // Start in the text string, end = pCurr->GetLen() sal_uInt16 m_nRegDiff; // Register's line distance sal_uInt16 m_nLineNr; // Line number bool m_bPrev : 1; @@ -84,10 +84,10 @@ public: const SwLineLayout *GetCurr() const { return m_pCurr; } // NEVER 0! const SwLineLayout *GetNext() const { return m_pCurr->GetNext(); } const SwLineLayout *GetPrev(); - sal_Int32 GetLength() const { return m_pCurr->GetLen(); } + TextFrameIndex GetLength() const { return m_pCurr->GetLen(); } sal_uInt16 GetLineNr() const { return m_nLineNr; } - sal_Int32 GetStart() const { return m_nStart; } - sal_Int32 GetEnd() const { return GetStart() + GetLength(); } + TextFrameIndex GetStart() const { return m_nStart; } + TextFrameIndex GetEnd() const { return GetStart() + GetLength(); } SwTwips Y() const { return m_nY; } SwTwips RegStart() const { return m_nRegStart; } @@ -108,7 +108,7 @@ public: const SwLineLayout *GetNextLine() const; const SwLineLayout *GetPrevLine(); - void CharToLine( const sal_Int32 ); + void CharToLine(TextFrameIndex); void TwipsToLine(const SwTwips); // Truncates all after pCurr @@ -211,8 +211,8 @@ public: // Returns the TextPos for start and end of the current line without whitespace // Implemented in frminf.cxx - sal_Int32 GetTextStart() const; - sal_Int32 GetTextEnd() const; + TextFrameIndex GetTextStart() const; + TextFrameIndex GetTextEnd() const; SwTextSizeInfo &GetInfo() { return static_cast(SwTextIter::GetInfo()); } @@ -267,7 +267,7 @@ class SwTextCursor : public SwTextAdjuster // Ambiguities static bool bRightMargin; - void GetCharRect_(SwRect *, const sal_Int32, SwCursorMoveState* ); + void GetCharRect_(SwRect *, TextFrameIndex, SwCursorMoveState *); protected: void CtorInitTextCursor( SwTextFrame *pFrame, SwTextSizeInfo *pInf ); explicit SwTextCursor(SwTextNode const * pTextNode) : SwTextAdjuster(pTextNode) { } @@ -277,14 +277,14 @@ public: { CtorInitTextCursor(pTextFrame, pTextSizeInf); } - bool GetCharRect(SwRect *, const sal_Int32, SwCursorMoveState* = nullptr, + bool GetCharRect(SwRect *, TextFrameIndex, SwCursorMoveState* = nullptr, const long nMax = 0 ); - bool GetEndCharRect(SwRect *, const sal_Int32, SwCursorMoveState* = nullptr, + bool GetEndCharRect(SwRect *, TextFrameIndex, SwCursorMoveState* = nullptr, const long nMax = 0 ); - sal_Int32 GetCursorOfst( SwPosition *pPos, const Point &rPoint, + TextFrameIndex GetCursorOfst( SwPosition *pPos, const Point &rPoint, bool bChgNode, SwCursorMoveState* = nullptr ) const; // Respects ambiguities: For the implementation see below - const SwLineLayout *CharCursorToLine( const sal_Int32 nPos ); + const SwLineLayout *CharCursorToLine(TextFrameIndex const nPos); // calculates baseline for portion rPor // bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE @@ -316,7 +316,7 @@ inline bool SwTextIter::SeekAndChg( SwTextSizeInfo &rInf ) inline bool SwTextIter::SeekAndChgBefore( SwTextSizeInfo &rInf ) { if ( rInf.GetIdx() ) - return SeekAndChgAttrIter( rInf.GetIdx()-1, rInf.GetOut() ); + return SeekAndChgAttrIter(rInf.GetIdx() - TextFrameIndex(1), rInf.GetOut()); else return SeekAndChgAttrIter( rInf.GetIdx(), rInf.GetOut() ); } diff --git a/sw/source/core/text/pordrop.hxx b/sw/source/core/text/pordrop.hxx index e72e22302cd4..e0f7a4ea21f4 100644 --- a/sw/source/core/text/pordrop.hxx +++ b/sw/source/core/text/pordrop.hxx @@ -35,20 +35,20 @@ class SwDropPortionPart { SwDropPortionPart* pFollow; SwFont* pFnt; - sal_Int32 nLen; + TextFrameIndex nLen; sal_uInt16 nWidth; bool m_bJoinBorderWithNext; bool m_bJoinBorderWithPrev; public: - SwDropPortionPart( SwFont& rFont, const sal_Int32 nL ) + SwDropPortionPart( SwFont& rFont, const TextFrameIndex nL ) : pFollow( nullptr ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ), m_bJoinBorderWithNext(false), m_bJoinBorderWithPrev(false) {}; ~SwDropPortionPart(); SwDropPortionPart* GetFollow() const { return pFollow; }; void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; }; SwFont& GetFont() const { return *pFnt; } - sal_Int32 GetLen() const { return nLen; } + TextFrameIndex GetLen() const { return nLen; } sal_uInt16 GetWidth() const { return nWidth; } void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } @@ -83,7 +83,7 @@ public: void PaintDrop( const SwTextPaintInfo &rInf ) const; virtual bool Format( SwTextFormatInfo &rInf ) override; virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; sal_uInt16 GetLines() const { return nLines; } sal_uInt16 GetDistance() const { return nDistance; } diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx index f92dd232035f..874ab368804a 100644 --- a/sw/source/core/text/porexp.cxx +++ b/sw/source/core/text/porexp.cxx @@ -22,7 +22,7 @@ #include "inftxt.hxx" #include "porexp.hxx" -sal_Int32 SwExpandPortion::GetCursorOfst( const sal_uInt16 nOfst ) const +TextFrameIndex SwExpandPortion::GetCursorOfst(const sal_uInt16 nOfst) const { return SwLinePortion::GetCursorOfst( nOfst ); } bool SwExpandPortion::GetExpText( const SwTextSizeInfo&, OUString &rText ) const @@ -102,7 +102,7 @@ SwLinePortion *SwBlankPortion::Compress() { return this; } * Causes problems with Fly */ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTextFormatInfo &rInf, - sal_Int32 nIdx, bool bUnderflow ) + TextFrameIndex const nIdx, bool bUnderflow) { if( rInf.StopUnderflow() ) return 0; diff --git a/sw/source/core/text/porexp.hxx b/sw/source/core/text/porexp.hxx index 5a18544c2fd8..ad0448356495 100644 --- a/sw/source/core/text/porexp.hxx +++ b/sw/source/core/text/porexp.hxx @@ -27,7 +27,7 @@ class SwExpandPortion : public SwTextPortion public: SwExpandPortion() { SetWhichPor( POR_EXP ); } virtual bool Format( SwTextFormatInfo &rInf ) override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override; virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override; virtual void Paint( const SwTextPaintInfo &rInf ) const override; @@ -43,14 +43,14 @@ class SwBlankPortion : public SwExpandPortion public: SwBlankPortion( sal_Unicode cCh, bool bMult = false ) : cChar( cCh ), bMulti( bMult ) - { cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); } + { cChar = cCh; SetLen(TextFrameIndex(1)); SetWhichPor( POR_BLANK ); } virtual SwLinePortion *Compress() override; virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override; virtual void FormatEOL( SwTextFormatInfo &rInf ) override; virtual bool Format( SwTextFormatInfo &rInf ) override; virtual void Paint( const SwTextPaintInfo &rInf ) const override; - static sal_uInt16 MayUnderflow( const SwTextFormatInfo &rInf, sal_Int32 nIdx, + static sal_uInt16 MayUnderflow(const SwTextFormatInfo &rInf, TextFrameIndex nIdx, bool bUnderflow ); // Accessibility: pass information about this portion to the PortionHandler diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 906ea389e7b9..59591f67b343 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -513,7 +513,7 @@ SwNumberPortion::SwNumberPortion( const OUString &rExpand, SetCenter( bCntr ); } -sal_Int32 SwNumberPortion::GetCursorOfst( const sal_uInt16 ) const +TextFrameIndex SwNumberPortion::GetCursorOfst(const sal_uInt16) const { return 0; } diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 16847773a40e..d7c06e2ae4b2 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -33,8 +33,8 @@ class SwFieldPortion : public SwExpandPortion protected: OUString m_aExpand; // The expanded field SwFont *m_pFont; // For multi-line fields - sal_Int32 m_nNextOffset; // Offset of the follow in the original string - sal_Int32 m_nNextScriptChg; + TextFrameIndex m_nNextOffset; // Offset of the follow in the original string + TextFrameIndex m_nNextScriptChg; sal_uInt16 m_nViewWidth; // Screen width for empty fields bool m_bFollow : 1; // 2nd or later part of a field bool m_bLeft : 1; // Used by SwNumberPortion @@ -88,8 +88,8 @@ public: bool HasFollow() const { return m_bHasFollow; } void SetHasFollow( bool bNew ) { m_bHasFollow = bNew; } - sal_Int32 GetNextOffset() const { return m_nNextOffset; } - void SetNextOffset( sal_Int32 nNew ) { m_nNextOffset = nNew; } + TextFrameIndex GetNextOffset() const { return m_nNextOffset; } + void SetNextOffset(TextFrameIndex nNew) { m_nNextOffset = nNew; } // Field cloner for SplitGlue virtual SwFieldPortion *Clone( const OUString &rExpand ) const; @@ -109,7 +109,7 @@ class SwHiddenPortion : public SwFieldPortion public: SwHiddenPortion( const OUString &rExpand, SwFont *pFntL = nullptr ) : SwFieldPortion( rExpand, pFntL ) - { SetLen(1); SetWhichPor( POR_HIDDEN ); } + { SetLen(TextFrameIndex(1)); SetWhichPor( POR_HIDDEN ); } virtual void Paint( const SwTextPaintInfo &rInf ) const override; virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override; @@ -132,7 +132,7 @@ public: const sal_uInt16 nMinDst, const bool bLabelAlignmentPosAndSpaceModeActive ); virtual void Paint( const SwTextPaintInfo &rInf ) const override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; virtual bool Format( SwTextFormatInfo &rInf ) override; // Field cloner for SplitGlue diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index b3903a53cf48..e383181d7fd3 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -147,7 +147,8 @@ bool SwFlyCntPortion::Format( SwTextFormatInfo &rInf ) * @param nStart * @param nEnd */ -void SwTextFrame::MoveFlyInCnt( SwTextFrame *pNew, sal_Int32 nStart, sal_Int32 nEnd ) +void SwTextFrame::MoveFlyInCnt(SwTextFrame *pNew, + TextFrameIndex const nStart, TextFrameIndex const nEnd) { SwSortedObjs *pObjs = nullptr; if ( nullptr != (pObjs = GetDrawObjs()) ) @@ -180,7 +181,7 @@ void SwTextFrame::MoveFlyInCnt( SwTextFrame *pNew, sal_Int32 nStart, sal_Int32 n } } -sal_Int32 SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch ) +TextFrameIndex SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch ) { SwpHints* pHints = GetTextNode()->GetpSwpHints(); OSL_ENSURE( pHints, "CalcFlyPos: Why me?" ); diff --git a/sw/source/core/text/porftn.hxx b/sw/source/core/text/porftn.hxx index fe6be2e291d8..bb0b625ce28e 100644 --- a/sw/source/core/text/porftn.hxx +++ b/sw/source/core/text/porftn.hxx @@ -79,7 +79,7 @@ class SwErgoSumPortion : public SwFieldPortion { public: SwErgoSumPortion( const OUString &rExp, const OUString& rStr ); - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; virtual bool Format( SwTextFormatInfo &rInf ) override; // Field cloner for SplitGlue diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index 28193b80d161..38092d79a3fc 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -34,7 +34,7 @@ SwGluePortion::SwGluePortion( const sal_uInt16 nInitFixWidth ) SetWhichPor( POR_GLUE ); } -sal_Int32 SwGluePortion::GetCursorOfst( const sal_uInt16 nOfst ) const +TextFrameIndex SwGluePortion::GetCursorOfst(const sal_uInt16 nOfst) const { if( !GetLen() || nOfst > GetLen() || !Width() ) return SwLinePortion::GetCursorOfst( nOfst ); diff --git a/sw/source/core/text/porglue.hxx b/sw/source/core/text/porglue.hxx index 9ba945c6facc..e02df21c784f 100644 --- a/sw/source/core/text/porglue.hxx +++ b/sw/source/core/text/porglue.hxx @@ -41,7 +41,7 @@ public: inline void MoveHalfGlue( SwGluePortion *pTarget ); inline void AdjFixWidth(); virtual void Paint( const SwTextPaintInfo &rInf ) const override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override; virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override; }; diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 1812198bd8c8..df1755348447 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2026,9 +2026,9 @@ SwParaPortion::~SwParaPortion() { } -sal_Int32 SwParaPortion::GetParLen() const +TextFrameIndex SwParaPortion::GetParLen() const { - sal_Int32 nLen = 0; + TextFrameIndex nLen(0); const SwLineLayout *pLay = this; while( pLay ) { diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx index b7f59f65ec23..5f280c5eedbd 100644 --- a/sw/source/core/text/porlay.hxx +++ b/sw/source/core/text/porlay.hxx @@ -36,16 +36,20 @@ class SwTextFormatter; class SwCharRange { - sal_Int32 nStart, nLen; +private: + TextFrameIndex nStart; + TextFrameIndex nLen; + public: - SwCharRange( const sal_Int32 nInitStart = 0, - const sal_Int32 nInitLen = 0): nStart( nInitStart ), nLen(nInitLen) {} - sal_Int32 &Start() { return nStart; } - const sal_Int32 &Start() const { return nStart; } - void LeftMove( sal_Int32 nNew ) + SwCharRange(TextFrameIndex const nInitStart = TextFrameIndex(0), + TextFrameIndex const nInitLen = TextFrameIndex(0)) + : nStart( nInitStart ), nLen(nInitLen) {} + TextFrameIndex & Start() { return nStart; } + TextFrameIndex const& Start() const { return nStart; } + void LeftMove(TextFrameIndex const nNew) { if ( nNew < nStart ) { nLen += nStart-nNew; nStart = nNew; } } - sal_Int32 &Len() { return nLen; } - const sal_Int32 &Len() const { return nLen; } + TextFrameIndex & Len() { return nLen; } + TextFrameIndex const& Len() const { return nLen; } bool operator<(const SwCharRange &rRange) const { return nStart < rRange.nStart; } bool operator>(const SwCharRange &rRange) const @@ -313,7 +317,7 @@ public: sw::MergedPara const* GetMergedPara() const { return m_pMergedPara.get(); } // For SwTextFrame::Format: returns the paragraph's current length - sal_Int32 GetParLen() const; + TextFrameIndex GetParLen() const; // For Prepare() bool UpdateQuoVadis( const OUString &rQuo ); @@ -357,7 +361,7 @@ inline void SwParaPortion::ResetPreps() inline void SwParaPortion::FormatReset() { m_nDelta = 0; - m_aReformat = SwCharRange(0, COMPLETE_STRING); + m_aReformat = SwCharRange(TextFrameIndex(0), TextFrameIndex(COMPLETE_STRING)); // bFlys needs to be retained in SwTextFrame::Format_() so that empty // paragraphs that needed to avoid Frames with no flow, reformat // when the Frame disappears from the Area diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 092efa9aae02..670209ee4d5e 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -222,7 +222,7 @@ SwLinePortion *SwLinePortion::FindPrevPortion( const SwLinePortion *pRoot ) return pPos; } -sal_Int32 SwLinePortion::GetCursorOfst( const sal_uInt16 nOfst ) const +TextFrameIndex SwLinePortion::GetCursorOfst(const sal_uInt16 nOfst) const { if( nOfst > ( PrtWidth() / 2 ) ) return GetLen(); diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 02c590dd8eba..729740024890 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -21,6 +21,7 @@ #include "possiz.hxx" #include +#include #ifdef DBG_UTIL #include @@ -54,7 +55,7 @@ protected: // Here we have areas with different attributes SwLinePortion *pPortion; // Count of chars and spaces on the line - sal_Int32 nLineLength; + TextFrameIndex nLineLength; sal_uInt16 nAscent; // Maximum ascender SwLinePortion(); @@ -72,8 +73,8 @@ public: // Access methods SwLinePortion *GetPortion() const { return pPortion; } inline SwLinePortion &operator=(const SwLinePortion &rPortion); - sal_Int32 GetLen() const { return nLineLength; } - void SetLen( const sal_Int32 nLen ) { nLineLength = nLen; } + TextFrameIndex GetLen() const { return nLineLength; } + void SetLen(TextFrameIndex const nLen) { nLineLength = nLen; } void SetPortion( SwLinePortion *pNew ){ pPortion = pNew; } sal_uInt16 &GetAscent() { return nAscent; } sal_uInt16 GetAscent() const { return nAscent; } @@ -140,7 +141,8 @@ public: SwLinePortion *FindPrevPortion( const SwLinePortion *pRoot ); SwLinePortion *FindLastPortion(); - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const; + /// the parameter is actually SwTwips apparently? + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const; virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const; void CalcTextSize( const SwTextSizeInfo &rInfo ); diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 99f32ec611d0..a8a64f49de01 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -160,7 +160,8 @@ void SwMultiPortion::ActualizeTabulator() } SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate, - sal_Int32 nEnd, bool bRTL ) : SwMultiPortion( nEnd ) + TextFrameIndex const nEnd, bool bRTL ) + : SwMultiPortion( nEnd ) { const SvxCharRotateItem* pRot = static_cast(rCreate.pItem); if( !pRot ) @@ -185,7 +186,7 @@ SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate, } } -SwBidiPortion::SwBidiPortion( sal_Int32 nEnd, sal_uInt8 nLv ) +SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, sal_uInt8 nLv) : SwMultiPortion( nEnd ), nLevel( nLv ) { SetBidi(); @@ -213,7 +214,7 @@ bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const return false; } -sal_Int32 SwBidiPortion::GetSpaceCnt( const SwTextSizeInfo &rInf ) const +TextFrameIndex SwBidiPortion::GetSpaceCnt(const SwTextSizeInfo &rInf) const { // Calculate number of blanks for justified alignment SwLinePortion* pPor = GetRoot().GetFirstPortion(); @@ -239,7 +240,8 @@ sal_Int32 SwBidiPortion::GetSpaceCnt( const SwTextSizeInfo &rInf ) const // in the next line. // It takes the same brackets and if the original has no content except // brackets, these will be deleted. -SwDoubleLinePortion::SwDoubleLinePortion(SwDoubleLinePortion& rDouble, sal_Int32 nEnd) +SwDoubleLinePortion::SwDoubleLinePortion( + SwDoubleLinePortion& rDouble, TextFrameIndex const nEnd) : SwMultiPortion(nEnd) , pBracket(nullptr) , nLineDiff(0) @@ -265,7 +267,8 @@ SwDoubleLinePortion::SwDoubleLinePortion(SwDoubleLinePortion& rDouble, sal_Int32 // This constructor uses the textattribute to get the right brackets. // The textattribute could be a 2-line-attribute or a character- or // internet style, which contains the 2-line-attribute. -SwDoubleLinePortion::SwDoubleLinePortion(const SwMultiCreator& rCreate, sal_Int32 nEnd) +SwDoubleLinePortion::SwDoubleLinePortion( + const SwMultiCreator& rCreate, TextFrameIndex const nEnd) : SwMultiPortion(nEnd) , pBracket(new SwBracket) , nLineDiff(0) @@ -539,10 +542,10 @@ SwDoubleLinePortion::~SwDoubleLinePortion() // constructs a ruby portion, i.e. an additional text is displayed // beside the main text, e.g. phonetic characters. -SwRubyPortion::SwRubyPortion( const SwRubyPortion& rRuby, sal_Int32 nEnd ) : - SwMultiPortion( nEnd ), - nRubyOffset( rRuby.GetRubyOffset() ), - nAdjustment( rRuby.GetAdjustment() ) +SwRubyPortion::SwRubyPortion(const SwRubyPortion& rRuby, TextFrameIndex const nEnd) + : SwMultiPortion( nEnd ) + , nRubyOffset( rRuby.GetRubyOffset() ) + , nAdjustment( rRuby.GetAdjustment() ) { SetDirection( rRuby.GetDirection() ); SetRubyPosition( rRuby.GetRubyPosition() ); @@ -553,7 +556,7 @@ SwRubyPortion::SwRubyPortion( const SwRubyPortion& rRuby, sal_Int32 nEnd ) : // beside the main text, e.g. phonetic characters. SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt, const IDocumentSettingAccess& rIDocumentSettingAccess, - sal_Int32 nEnd, sal_Int32 nOffs, + TextFrameIndex const nEnd, TextFrameIndex const nOffs, const SwTextSizeInfo &rInf ) : SwMultiPortion( nEnd ) { @@ -807,7 +810,7 @@ static bool lcl_HasRotation( const SwTextAttr& rAttr, // interrupts the first attribute. // E.g. a ruby portion interrupts a 2-line-attribute, a 2-line-attribute // with different brackets interrupts another 2-line-attribute. -SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos, +SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const * pMulti ) const { SwScriptInfo& rSI = const_cast(GetParaPortion())->GetScriptInfo(); @@ -2125,7 +2128,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, // a doubleline- or ruby-portion. // The second parameter is the start index of the line. SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine, - sal_Int32 nPosition ) + TextFrameIndex nPosition) { if( !nPosition ) return nullptr; @@ -2270,7 +2273,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor, SwMultiPortion* pMulti, SwTwips nY, sal_uInt16& nX, - sal_Int32 nCurrStart, + TextFrameIndex const nCurrStart, long nSpaceAdd ) { pTextCursor = pCursor; diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx index 5fdbb7f9ea66..f0ad72a7577c 100644 --- a/sw/source/core/text/pormulti.hxx +++ b/sw/source/core/text/pormulti.hxx @@ -62,7 +62,7 @@ struct SwMultiCreator // in this case the structure SwBracket will be used. struct SwBracket { - sal_Int32 nStart; // Start of text attribute determines the font + TextFrameIndex nStart; // Start of text attribute determines the font sal_uInt16 nAscent; // Ascent of the brackets sal_uInt16 nHeight; // Height of them sal_uInt16 nPreWidth; // Width of the opening bracket @@ -93,7 +93,7 @@ class SwMultiPortion : public SwLinePortion RubyPosition eRubyPosition; // Phonetic position sal_uInt8 nDirection:2; // Direction (0/90/180/270 degrees) protected: - explicit SwMultiPortion(sal_Int32 nEnd) + explicit SwMultiPortion(TextFrameIndex const nEnd) : bTab1(false) , bTab2(false) , bDouble(false) @@ -106,7 +106,7 @@ protected: , nDirection(0) { SetWhichPor(POR_MULTI); - SetLen(nEnd); + SetLen(TextFrameIndex(nEnd)); } void SetDouble() { bDouble = true; } void SetRuby() { bRuby = true; } @@ -157,11 +157,11 @@ class SwDoubleLinePortion : public SwMultiPortion { std::unique_ptr pBracket; // Surrounding brackets SwTwips nLineDiff; // Difference of the width of the both lines - sal_Int32 nBlank1; // Number of blanks in the first line - sal_Int32 nBlank2; // Number of blanks in the second line + TextFrameIndex nBlank1; ///< Number of blanks in the first line + TextFrameIndex nBlank2; ///< Number of blanks in the second line public: - SwDoubleLinePortion( SwDoubleLinePortion& rDouble, sal_Int32 nEnd ); - SwDoubleLinePortion( const SwMultiCreator& rCreate, sal_Int32 nEnd ); + SwDoubleLinePortion(SwDoubleLinePortion& rDouble, TextFrameIndex nEnd); + SwDoubleLinePortion(const SwMultiCreator& rCreate, TextFrameIndex nEnd); virtual ~SwDoubleLinePortion() override; SwBracket* GetBrackets() const { return pBracket.get(); } @@ -177,9 +177,9 @@ public: void CalcBlanks( SwTextFormatInfo &rInf ); static void ResetSpaceAdd( SwLineLayout* pCurr ); SwTwips GetLineDiff() const { return nLineDiff; } - sal_Int32 GetSpaceCnt() const + TextFrameIndex GetSpaceCnt() const { return ( nLineDiff < 0 ) ? nBlank2 : nBlank1; } - sal_Int32 GetSmallerSpaceCnt() const + TextFrameIndex GetSmallerSpaceCnt() const { return ( nLineDiff < 0 ) ? nBlank1 : nBlank2; } virtual long CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) const override; @@ -188,30 +188,30 @@ public: class SwRubyPortion : public SwMultiPortion { - sal_Int32 nRubyOffset; + TextFrameIndex nRubyOffset; css::text::RubyAdjust nAdjustment; void Adjust_( SwTextFormatInfo &rInf); public: - SwRubyPortion( const SwRubyPortion& rRuby, sal_Int32 nEnd ); + SwRubyPortion(const SwRubyPortion& rRuby, TextFrameIndex nEnd); SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt, const IDocumentSettingAccess& rIDocumentSettingAccess, - sal_Int32 nEnd, sal_Int32 nOffs, + TextFrameIndex nEnd, TextFrameIndex nOffs, const SwTextSizeInfo &rInf ); void CalcRubyOffset(); void Adjust( SwTextFormatInfo &rInf ) { if(nAdjustment != css::text::RubyAdjust_LEFT && GetRoot().GetNext()) Adjust_(rInf); } css::text::RubyAdjust GetAdjustment() const { return nAdjustment; } - sal_Int32 GetRubyOffset() const { return nRubyOffset; } + TextFrameIndex GetRubyOffset() const { return nRubyOffset; } }; class SwRotatedPortion : public SwMultiPortion { public: - SwRotatedPortion( sal_Int32 nEnd, sal_uInt8 nDir ) + SwRotatedPortion(TextFrameIndex const nEnd, sal_uInt8 nDir) : SwMultiPortion( nEnd ) { SetDirection( nDir ); } - SwRotatedPortion( const SwMultiCreator& rCreate, sal_Int32 nEnd, + SwRotatedPortion( const SwMultiCreator& rCreate, TextFrameIndex nEnd, bool bRTL ); }; @@ -220,11 +220,11 @@ class SwBidiPortion : public SwMultiPortion sal_uInt8 nLevel; public: - SwBidiPortion( sal_Int32 nEnd, sal_uInt8 nLv ); + SwBidiPortion(TextFrameIndex nEnd, sal_uInt8 nLv); sal_uInt8 GetLevel() const { return nLevel; } // Get number of blanks for justified alignment - sal_Int32 GetSpaceCnt( const SwTextSizeInfo &rInf ) const; + TextFrameIndex GetSpaceCnt(const SwTextSizeInfo &rInf) const; // Calculates extra spacing based on number of blanks virtual long CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) const override; // Manipulate the spacing array at pCurr @@ -237,13 +237,13 @@ class SwTextCursorSave { SwTextCursor* pTextCursor; SwLineLayout* pCurr; - sal_Int32 nStart; + TextFrameIndex nStart; sal_uInt16 nWidth; sal_uInt8 nOldProp; bool bSpaceChg; public: SwTextCursorSave( SwTextCursor* pTextCursor, SwMultiPortion* pMulti, - SwTwips nY, sal_uInt16& nX, sal_Int32 nCurrStart, long nSpaceAdd ); + SwTwips nY, sal_uInt16& nX, TextFrameIndex nCurrStart, long nSpaceAdd); ~SwTextCursorSave(); }; diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index f6c969c32443..c05385317f26 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -81,7 +81,7 @@ SwBreakPortion::SwBreakPortion( const SwLinePortion &rPortion ) SetWhichPor( POR_BRK ); } -sal_Int32 SwBreakPortion::GetCursorOfst( const sal_uInt16 ) const +TextFrameIndex SwBreakPortion::GetCursorOfst(const sal_uInt16) const { return 0; } sal_uInt16 SwBreakPortion::GetViewWidth( const SwTextSizeInfo & ) const diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx index ec42b3dab541..cadd8f871b43 100644 --- a/sw/source/core/text/porrst.hxx +++ b/sw/source/core/text/porrst.hxx @@ -42,7 +42,7 @@ public: virtual void Paint( const SwTextPaintInfo &rInf ) const override; virtual bool Format( SwTextFormatInfo &rInf ) override; virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; // Accessibility: pass information about this portion to the PortionHandler virtual void HandlePortion( SwPortionHandler& rPH ) const override; @@ -94,7 +94,11 @@ class SwHangingPortion : public SwTextPortion sal_uInt16 nInnerWidth; public: explicit SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() ) - { SetWhichPor( POR_HNG ); SetLen( 1 ); Height( aSize.Height() ); } + { + SetWhichPor( POR_HNG ); + SetLen(TextFrameIndex(1)); + Height( aSize.Height() ); + } sal_uInt16 GetInnerWidth() const { return nInnerWidth; } }; @@ -103,8 +107,10 @@ public: class SwHiddenTextPortion : public SwLinePortion { public: - explicit SwHiddenTextPortion( sal_Int32 nLen ) - { SetWhichPor( POR_HIDDEN_TXT ); SetLen( nLen ); } + explicit SwHiddenTextPortion(TextFrameIndex const nLen) + { + SetWhichPor( POR_HIDDEN_TXT ); SetLen( nLen ); + } virtual void Paint( const SwTextPaintInfo &rInf ) const override; virtual bool Format( SwTextFormatInfo &rInf ) override; @@ -123,7 +129,7 @@ public: explicit SwControlCharPortion( sal_Unicode cChar ) : mnViewWidth( 0 ), mnHalfCharWidth( 0 ), mcChar( cChar ) { - SetWhichPor( POR_CONTROLCHAR ); SetLen( 1 ); + SetWhichPor( POR_CONTROLCHAR ); SetLen( TextFrameIndex(1) ); } virtual void Paint( const SwTextPaintInfo &rInf ) const override; diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx index 996743baff14..e03858f14915 100644 --- a/sw/source/core/text/portab.hxx +++ b/sw/source/core/text/portab.hxx @@ -103,7 +103,9 @@ public: SwAutoTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab, const sal_Unicode cFillChar ) : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar ) - { SetLen( 0 ); } + { + SetLen(TextFrameIndex(0)); + } virtual void Paint( const SwTextPaintInfo &rInf ) const override; }; diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index a1d6cd0fefab..971d5816bce7 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -497,7 +497,7 @@ void SwTextPortion::FormatEOL( SwTextFormatInfo &rInf ) } -sal_Int32 SwTextPortion::GetCursorOfst( const sal_uInt16 nOfst ) const +TextFrameIndex SwTextPortion::GetCursorOfst(const sal_uInt16 nOfst) const { OSL_ENSURE( false, "SwTextPortion::GetCursorOfst: don't use this method!" ); return SwLinePortion::GetCursorOfst( nOfst ); @@ -566,8 +566,8 @@ bool SwTextPortion::GetExpText( const SwTextSizeInfo &, OUString & ) const // Responsible for the justified paragraph. They calculate the blank // count and the resulting added space. -sal_Int32 SwTextPortion::GetSpaceCnt( const SwTextSizeInfo &rInf, - sal_Int32& rCharCnt ) const +TextFrameIndex SwTextPortion::GetSpaceCnt(const SwTextSizeInfo &rInf, + TextFrameIndex& rCharCnt) const { sal_Int32 nCnt = 0; sal_Int32 nPos = 0; diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx index bee6e4c19412..aacdf39a3272 100644 --- a/sw/source/core/text/portxt.hxx +++ b/sw/source/core/text/portxt.hxx @@ -38,13 +38,13 @@ public: virtual void Paint( const SwTextPaintInfo &rInf ) const override; virtual bool Format( SwTextFormatInfo &rInf ) override; virtual void FormatEOL( SwTextFormatInfo &rInf ) override; - virtual sal_Int32 GetCursorOfst( const sal_uInt16 nOfst ) const override; + virtual TextFrameIndex GetCursorOfst(sal_uInt16 nOfst) const override; virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const override; virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const override; virtual long CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) const override; // Counts the spaces for justified paragraph - sal_Int32 GetSpaceCnt( const SwTextSizeInfo &rInf, sal_Int32& rCnt ) const; + TextFrameIndex GetSpaceCnt(const SwTextSizeInfo &rInf, TextFrameIndex& rCnt) const; bool CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGuess ); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 31b3eac7654c..5633f8a0ffa1 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -421,7 +421,7 @@ SwPosSize SwDropPortion::GetTextSize( const SwTextSizeInfo &rInf ) const return aPosSize; } -sal_Int32 SwDropPortion::GetCursorOfst( const sal_uInt16 ) const +TextFrameIndex SwDropPortion::GetCursorOfst(const sal_uInt16) const { return 0; } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 1a3e793fc891..6f90a3a20839 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -597,7 +597,7 @@ void SwTextFrame::HideHidden() ClearPara(); } -void SwTextFrame::HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd ) +void SwTextFrame::HideFootnotes(TextFrameIndex const nStart, TextFrameIndex const nEnd) { const SwpHints *pHints = GetTextNode()->GetpSwpHints(); if( pHints ) @@ -774,9 +774,9 @@ void SwTextFrame::HideAndShowObjects() * line has to be formatted as well. * nFound is <= nEndLine. */ -sal_Int32 SwTextFrame::FindBrk( const OUString &rText, - const sal_Int32 nStart, - const sal_Int32 nEnd ) +TextFrameIndex SwTextFrame::FindBrk(const OUString &rText, + const TextFrameIndex nStart, + const TextFrameIndex nEnd) { sal_Int32 nFound = nStart; const sal_Int32 nEndLine = std::min( nEnd, rText.getLength() - 1 ); @@ -799,7 +799,7 @@ sal_Int32 SwTextFrame::FindBrk( const OUString &rText, return nFound; } -bool SwTextFrame::IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const +bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nLen) const { // Silence over-eager warning emitted at least by GCC trunk towards 6: #if defined __GNUC__ && !defined __clang__ @@ -2580,7 +2580,7 @@ sal_uInt16 SwTextFrame::FirstLineHeight() const return pPara->Height(); } -sal_uInt16 SwTextFrame::GetLineCount( sal_Int32 nPos ) +sal_uInt16 SwTextFrame::GetLineCount(TextFrameIndex const nPos) { sal_uInt16 nRet = 0; SwTextFrame *pFrame = this; diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index e44642494175..e5815623dab0 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -83,7 +83,7 @@ SwTextFrame *SwTextFrame::FindFootnoteRef( const SwTextFootnote *pFootnote ) } #ifdef DBG_UTIL -void SwTextFrame::CalcFootnoteFlag( sal_Int32 nStop )// For testing the SplitFrame +void SwTextFrame::CalcFootnoteFlag(TextFrameIndex nStop) // For testing the SplitFrame #else void SwTextFrame::CalcFootnoteFlag() #endif @@ -387,7 +387,7 @@ SwTextFrame *SwTextFrame::FindQuoVadisFrame() return static_cast(pLast); } -void SwTextFrame::RemoveFootnote( const sal_Int32 nStart, const sal_Int32 nLen ) +void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex const nLen) { if ( !IsFootnoteAllowed() ) return; @@ -998,7 +998,7 @@ SwErgoSumPortion *SwTextFormatter::NewErgoSumPortion( SwTextFormatInfo const &rI return pErgo; } -sal_Int32 SwTextFormatter::FormatQuoVadis( const sal_Int32 nOffset ) +TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset) { OSL_ENSURE( ! m_pFrame->IsVertical() || ! m_pFrame->IsSwapped(), "SwTextFormatter::FormatQuoVadis with swapped frame" ); @@ -1449,7 +1449,7 @@ SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr) SetWhichPor( POR_ERGOSUM ); } -sal_Int32 SwErgoSumPortion::GetCursorOfst( const sal_uInt16 ) const +TextFrameIndex SwErgoSumPortion::GetCursorOfst(const sal_uInt16) const { return 0; } -- cgit v1.2.3