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
* 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)
{}
};
......
......@@ -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)
......
......@@ -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;
......
......@@ -485,7 +485,7 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst,
// beginning of a line
const bool bInsideFirstField = pCMS && pCMS->pSpecialPos &&
( pCMS->pSpecialPos->nLineOfst ||
SP_EXTEND_RANGE_BEFORE ==
SwSPExtendRange::BEFORE ==
pCMS->pSpecialPos->nExtendRange );
bool bWidth = pCMS && pCMS->bRealWidth;
......@@ -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
......
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