[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noelgrandin at gmail.com
Wed Jun 3 23:33:05 PDT 2015
sw/inc/crstate.hxx | 11 ++++++-----
sw/source/core/access/accportions.cxx | 11 ++++-------
sw/source/core/crsr/crsrsh.cxx | 2 +-
sw/source/core/text/itrcrsr.cxx | 12 ++++++------
4 files changed, 17 insertions(+), 19 deletions(-)
New commits:
commit 68577e5a902db11b5ec000e878cf212007452c72
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun May 17 21:06:36 2015 +0200
convert SP_EXTEND_RANGE constants to scoped enum
Change-Id: I4d6ed976f4df63c7c51dd110b45787f2396518e4
Reviewed-on: https://gerrit.libreoffice.org/16069
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
index fdba241..678ccd4 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 486c40c..9713574 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 30781fb..501a0e8 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 d8ea12b..2969e10 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
More information about the Libreoffice-commits
mailing list