Kaydet (Commit) 68577e5a authored tarafından Noel Grandin's avatar Noel Grandin

convert SP_EXTEND_RANGE constants to scoped enum

Change-Id: I4d6ed976f4df63c7c51dd110b45787f2396518e4
Reviewed-on: https://gerrit.libreoffice.org/16069Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 623445aa
...@@ -94,19 +94,20 @@ struct Sw2LinesPos ...@@ -94,19 +94,20 @@ struct Sw2LinesPos
* Call SwTextFrm:::GetCharRect with core string position 33. * Call SwTextFrm:::GetCharRect with core string position 33.
*/ */
#define SP_EXTEND_RANGE_NONE 0 enum class SwSPExtendRange : sal_uInt8
#define SP_EXTEND_RANGE_BEFORE 1 {
#define SP_EXTEND_RANGE_BEHIND 2 NONE, BEFORE, BEHIND
};
struct SwSpecialPos struct SwSpecialPos
{ {
sal_Int32 nCharOfst; sal_Int32 nCharOfst;
sal_uInt16 nLineOfst; sal_uInt16 nLineOfst;
sal_uInt8 nExtendRange; SwSPExtendRange nExtendRange;
// #i27615# // #i27615#
SwSpecialPos() : nCharOfst(0), nLineOfst(0), SwSpecialPos() : nCharOfst(0), nLineOfst(0),
nExtendRange(SP_EXTEND_RANGE_NONE) nExtendRange(SwSPExtendRange::NONE)
{} {}
}; };
......
...@@ -582,13 +582,13 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -582,13 +582,13 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
{ {
size_t nPortionNo = FindLastBreak( aAccessiblePositions, nPos ); size_t nPortionNo = FindLastBreak( aAccessiblePositions, nPos );
sal_uInt8 nExtend(SP_EXTEND_RANGE_NONE); SwSPExtendRange nExtend(SwSPExtendRange::NONE);
sal_Int32 nRefPos(0); sal_Int32 nRefPos(0);
sal_Int32 nModelPos(0); sal_Int32 nModelPos(0);
if( nPortionNo < nBeforePortions ) if( nPortionNo < nBeforePortions )
{ {
nExtend = SP_EXTEND_RANGE_BEFORE; nExtend = SwSPExtendRange::BEFORE;
rpPos = &rPos; rpPos = &rPos;
} }
else else
...@@ -620,7 +620,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -620,7 +620,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
// reference position is the first accessibilty for our // reference position is the first accessibilty for our
// core portion // core portion
nRefPos = aAccessiblePositions[ nCorePortionNo ]; nRefPos = aAccessiblePositions[ nCorePortionNo ];
nExtend = SP_EXTEND_RANGE_NONE; nExtend = SwSPExtendRange::NONE;
rpPos = &rPos; rpPos = &rPos;
} }
else if(nPortionNo != nCorePortionNo) else if(nPortionNo != nCorePortionNo)
...@@ -630,7 +630,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -630,7 +630,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
// reference position is the first character of the next // reference position is the first character of the next
// portion, and we are 'behind' // portion, and we are 'behind'
nRefPos = aAccessiblePositions[ nCorePortionNo+1 ]; nRefPos = aAccessiblePositions[ nCorePortionNo+1 ];
nExtend = SP_EXTEND_RANGE_BEHIND; nExtend = SwSPExtendRange::BEHIND;
rpPos = &rPos; rpPos = &rPos;
} }
else else
...@@ -649,9 +649,6 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -649,9 +649,6 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
{ {
OSL_ENSURE( rpPos == &rPos, "Yes!" ); OSL_ENSURE( rpPos == &rPos, "Yes!" );
OSL_ENSURE( nRefPos <= nPos, "wrong reference" ); 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 // get the line number, and adjust nRefPos for the line
// (if necessary) // (if necessary)
......
...@@ -1734,7 +1734,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd ) ...@@ -1734,7 +1734,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, bool bIdleEnd )
// #i27615#,#i30453# // #i27615#,#i30453#
SwSpecialPos aSpecialPos; SwSpecialPos aSpecialPos;
aSpecialPos.nExtendRange = SP_EXTEND_RANGE_BEFORE; aSpecialPos.nExtendRange = SwSPExtendRange::BEFORE;
if (pShellCrsr->IsInFrontOfLabel()) if (pShellCrsr->IsInFrontOfLabel())
{ {
aTmpState.pSpecialPos = &aSpecialPos; aTmpState.pSpecialPos = &aSpecialPos;
......
...@@ -484,9 +484,9 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, ...@@ -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 // more than one line we may not skip any "empty portions" at the
// beginning of a line // beginning of a line
const bool bInsideFirstField = pCMS && pCMS->pSpecialPos && const bool bInsideFirstField = pCMS && pCMS->pSpecialPos &&
( pCMS->pSpecialPos->nLineOfst || ( pCMS->pSpecialPos->nLineOfst ||
SP_EXTEND_RANGE_BEFORE == SwSPExtendRange::BEFORE ==
pCMS->pSpecialPos->nExtendRange ); pCMS->pSpecialPos->nExtendRange );
bool bWidth = pCMS && pCMS->bRealWidth; bool bWidth = pCMS && pCMS->bRealWidth;
if( !pCurr->GetLen() && !pCurr->Width() ) if( !pCurr->GetLen() && !pCurr->Width() )
...@@ -1176,13 +1176,13 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, ...@@ -1176,13 +1176,13 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst,
if ( bSpecialPos ) 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?" ); "LineOffset AND Number Portion?" );
// portions which are behind the string // portions which are behind the string
if ( SP_EXTEND_RANGE_BEHIND == nExtendRange ) if ( SwSPExtendRange::BEHIND == nExtendRange )
++nFindOfst; ++nFindOfst;
// skip lines for fields which cover more than one line // skip lines for fields which cover more than one line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment