diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-05-17 21:06:36 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-04 06:32:41 +0000 |
commit | 68577e5a902db11b5ec000e878cf212007452c72 (patch) | |
tree | 6e9bc6dac8421045d8f75898a601cabfab42aae4 /sw | |
parent | 623445aa0edb6647bab37fc7f8adcec11d43e317 (diff) |
convert SP_EXTEND_RANGE constants to scoped enum
Change-Id: I4d6ed976f4df63c7c51dd110b45787f2396518e4
Reviewed-on: https://gerrit.libreoffice.org/16069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crstate.hxx | 11 | ||||
-rw-r--r-- | sw/source/core/access/accportions.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/itrcrsr.cxx | 12 |
4 files changed, 17 insertions, 19 deletions
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx index fdba24133fd3..678ccd45549b 100644 --- a/sw/inc/crstate.hxx +++ b/sw/inc/crstate.hxx @@ -94,19 +94,20 @@ struct Sw2LinesPos * Call SwTextFrm:::GetCharRect with core string position 33. */ -#define SP_EXTEND_RANGE_NONE 0 -#define SP_EXTEND_RANGE_BEFORE 1 -#define SP_EXTEND_RANGE_BEHIND 2 +enum class SwSPExtendRange : sal_uInt8 +{ + NONE, BEFORE, BEHIND +}; struct SwSpecialPos { sal_Int32 nCharOfst; sal_uInt16 nLineOfst; - sal_uInt8 nExtendRange; + SwSPExtendRange nExtendRange; // #i27615# SwSpecialPos() : nCharOfst(0), nLineOfst(0), - nExtendRange(SP_EXTEND_RANGE_NONE) + nExtendRange(SwSPExtendRange::NONE) {} }; diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 486c40c432fd..9713574844c1 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -582,13 +582,13 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( { size_t nPortionNo = FindLastBreak( aAccessiblePositions, nPos ); - sal_uInt8 nExtend(SP_EXTEND_RANGE_NONE); + SwSPExtendRange nExtend(SwSPExtendRange::NONE); sal_Int32 nRefPos(0); sal_Int32 nModelPos(0); if( nPortionNo < nBeforePortions ) { - nExtend = SP_EXTEND_RANGE_BEFORE; + nExtend = SwSPExtendRange::BEFORE; rpPos = &rPos; } else @@ -620,7 +620,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( // reference position is the first accessibilty for our // core portion nRefPos = aAccessiblePositions[ nCorePortionNo ]; - nExtend = SP_EXTEND_RANGE_NONE; + nExtend = SwSPExtendRange::NONE; rpPos = &rPos; } else if(nPortionNo != nCorePortionNo) @@ -630,7 +630,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( // reference position is the first character of the next // portion, and we are 'behind' nRefPos = aAccessiblePositions[ nCorePortionNo+1 ]; - nExtend = SP_EXTEND_RANGE_BEHIND; + nExtend = SwSPExtendRange::BEHIND; rpPos = &rPos; } else @@ -649,9 +649,6 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( { OSL_ENSURE( rpPos == &rPos, "Yes!" ); OSL_ENSURE( nRefPos <= nPos, "wrong reference" ); - OSL_ENSURE( (nExtend == SP_EXTEND_RANGE_NONE) || - (nExtend == SP_EXTEND_RANGE_BEFORE) || - (nExtend == SP_EXTEND_RANGE_BEHIND), "need extend" ); // get the line number, and adjust nRefPos for the line // (if necessary) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 30781fb0ddc9..501a0e8383b3 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1734,7 +1734,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) // #i27615#,#i30453# SwSpecialPos aSpecialPos; - aSpecialPos.nExtendRange = SP_EXTEND_RANGE_BEFORE; + aSpecialPos.nExtendRange = SwSPExtendRange::BEFORE; if (pShellCrsr->IsInFrontOfLabel()) { aTmpState.pSpecialPos = &aSpecialPos; diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index d8ea12b83da7..2969e1099c5c 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -484,9 +484,9 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, // more than one line we may not skip any "empty portions" at the // beginning of a line const bool bInsideFirstField = pCMS && pCMS->pSpecialPos && - ( pCMS->pSpecialPos->nLineOfst || - SP_EXTEND_RANGE_BEFORE == - pCMS->pSpecialPos->nExtendRange ); + ( pCMS->pSpecialPos->nLineOfst || + SwSPExtendRange::BEFORE == + pCMS->pSpecialPos->nExtendRange ); bool bWidth = pCMS && pCMS->bRealWidth; if( !pCurr->GetLen() && !pCurr->Width() ) @@ -1176,13 +1176,13 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, if ( bSpecialPos ) { - const sal_uInt8 nExtendRange = pCMS->pSpecialPos->nExtendRange; + const SwSPExtendRange nExtendRange = pCMS->pSpecialPos->nExtendRange; - OSL_ENSURE( ! pCMS->pSpecialPos->nLineOfst || SP_EXTEND_RANGE_BEFORE != nExtendRange, + OSL_ENSURE( ! pCMS->pSpecialPos->nLineOfst || SwSPExtendRange::BEFORE != nExtendRange, "LineOffset AND Number Portion?" ); // portions which are behind the string - if ( SP_EXTEND_RANGE_BEHIND == nExtendRange ) + if ( SwSPExtendRange::BEHIND == nExtendRange ) ++nFindOfst; // skip lines for fields which cover more than one line |