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

convert MT_ constants to scoped enum

Change-Id: I21e253ed9dccdab84be4838b5beee9385467ed37
Reviewed-on: https://gerrit.libreoffice.org/16068Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 81610561
...@@ -49,18 +49,21 @@ struct SwFillCrsrPos ...@@ -49,18 +49,21 @@ struct SwFillCrsrPos
// Multiportion types: two lines, bidirectional, 270 degrees rotation, // Multiportion types: two lines, bidirectional, 270 degrees rotation,
// ruby portion and 90 degrees rotation // ruby portion and 90 degrees rotation
#define MT_TWOLINE 0 enum class MultiPortionType : sal_uInt8
#define MT_BIDI 1 {
#define MT_ROT_270 3 TWOLINE = 0,
#define MT_RUBY 4 BIDI = 1,
#define MT_ROT_90 7 ROT_270 = 3,
RUBY = 4,
ROT_90 = 7,
};
struct Sw2LinesPos struct Sw2LinesPos
{ {
SwRect aLine; ///< Position and size of the line SwRect aLine; ///< Position and size of the line
SwRect aPortion; ///< Position and size of the multi portion SwRect aPortion; ///< Position and size of the multi portion
SwRect aPortion2; ///< needed for nested multi portions SwRect aPortion2; ///< needed for nested multi portions
sal_uInt8 nMultiType; ///< Multiportion type MultiPortionType nMultiType; ///< Multiportion type
}; };
/** /**
......
...@@ -2145,11 +2145,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2145,11 +2145,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
SwRect aTmp( aStRect ); SwRect aTmp( aStRect );
// BiDi-Portions are swimming against the current. // BiDi-Portions are swimming against the current.
const bool bPorR2L = ( MT_BIDI == pSt2Pos->nMultiType ) ? const bool bPorR2L = ( MultiPortionType::BIDI == pSt2Pos->nMultiType ) ?
! bR2L : ! bR2L :
bR2L; bR2L;
if( MT_BIDI == pSt2Pos->nMultiType && if( MultiPortionType::BIDI == pSt2Pos->nMultiType &&
(pSt2Pos->aPortion2.*fnRect->fnGetWidth)() ) (pSt2Pos->aPortion2.*fnRect->fnGetWidth)() )
{ {
// nested bidi portion // nested bidi portion
...@@ -2177,7 +2177,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2177,7 +2177,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
(pSt2Pos->aPortion.*fnRect->fnGetRight)() ); (pSt2Pos->aPortion.*fnRect->fnGetRight)() );
} }
if( MT_ROT_90 == pSt2Pos->nMultiType || if( MultiPortionType::ROT_90 == pSt2Pos->nMultiType ||
(pSt2Pos->aPortion.*fnRect->fnGetTop)() == (pSt2Pos->aPortion.*fnRect->fnGetTop)() ==
(aTmp.*fnRect->fnGetTop)() ) (aTmp.*fnRect->fnGetTop)() )
{ {
...@@ -2189,7 +2189,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2189,7 +2189,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
Sub( aRegion, aTmp ); Sub( aRegion, aTmp );
SwTwips nTmp = (pSt2Pos->aLine.*fnRect->fnGetBottom)(); SwTwips nTmp = (pSt2Pos->aLine.*fnRect->fnGetBottom)();
if( MT_ROT_90 != pSt2Pos->nMultiType && if( MultiPortionType::ROT_90 != pSt2Pos->nMultiType &&
(aStRect.*fnRect->fnBottomDist)( nTmp ) > 0 ) (aStRect.*fnRect->fnBottomDist)( nTmp ) > 0 )
{ {
(aTmp.*fnRect->fnSetTop)( (aTmp.*fnRect->fnGetBottom)() ); (aTmp.*fnRect->fnSetTop)( (aTmp.*fnRect->fnGetBottom)() );
...@@ -2221,11 +2221,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2221,11 +2221,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
SwRect aTmp( aEndRect ); SwRect aTmp( aEndRect );
// BiDi-Portions are swimming against the current. // BiDi-Portions are swimming against the current.
const bool bPorR2L = ( MT_BIDI == pEnd2Pos->nMultiType ) ? const bool bPorR2L = ( MultiPortionType::BIDI == pEnd2Pos->nMultiType ) ?
! bEndR2L : ! bEndR2L :
bEndR2L; bEndR2L;
if( MT_BIDI == pEnd2Pos->nMultiType && if( MultiPortionType::BIDI == pEnd2Pos->nMultiType &&
(pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)() ) (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)() )
{ {
// nested bidi portion // nested bidi portion
...@@ -2253,7 +2253,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2253,7 +2253,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
(pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() );
} }
if( MT_ROT_90 == pEnd2Pos->nMultiType || if( MultiPortionType::ROT_90 == pEnd2Pos->nMultiType ||
(pEnd2Pos->aPortion.*fnRectX->fnGetBottom)() == (pEnd2Pos->aPortion.*fnRectX->fnGetBottom)() ==
(aEndRect.*fnRectX->fnGetBottom)() ) (aEndRect.*fnRectX->fnGetBottom)() )
{ {
...@@ -2265,7 +2265,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2265,7 +2265,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
Sub( aRegion, aTmp ); Sub( aRegion, aTmp );
// The next statement means neither ruby nor rotate(90): // The next statement means neither ruby nor rotate(90):
if( !( MT_RUBY & pEnd2Pos->nMultiType ) ) if( !( MultiPortionType::RUBY == pEnd2Pos->nMultiType ) )
{ {
SwTwips nTmp = (pEnd2Pos->aLine.*fnRectX->fnGetTop)(); SwTwips nTmp = (pEnd2Pos->aLine.*fnRectX->fnGetTop)();
if( (aEndRect.*fnRectX->fnGetTop)() != nTmp ) if( (aEndRect.*fnRectX->fnGetTop)() != nTmp )
...@@ -2296,8 +2296,8 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2296,8 +2296,8 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
} }
} }
else if( pSt2Pos && pEnd2Pos && else if( pSt2Pos && pEnd2Pos &&
MT_BIDI == pSt2Pos->nMultiType && MultiPortionType::BIDI == pSt2Pos->nMultiType &&
MT_BIDI == pEnd2Pos->nMultiType && MultiPortionType::BIDI == pEnd2Pos->nMultiType &&
pSt2Pos->aPortion == pEnd2Pos->aPortion && pSt2Pos->aPortion == pEnd2Pos->aPortion &&
pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 ) pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 )
{ {
...@@ -2363,7 +2363,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) ...@@ -2363,7 +2363,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
if( pStartFrm == pEndFrm ) if( pStartFrm == pEndFrm )
{ {
bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos && bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos &&
( MT_BIDI & pSt2Pos->nMultiType ) && ( MultiPortionType::BIDI == pSt2Pos->nMultiType ) &&
pSt2Pos->aPortion == pEnd2Pos->aPortion; pSt2Pos->aPortion == pEnd2Pos->aPortion;
//case 1: (Same frame and same row) //case 1: (Same frame and same row)
if( bSameRotatedOrBidi || if( bSameRotatedOrBidi ||
......
...@@ -677,16 +677,16 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, ...@@ -677,16 +677,16 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst,
if( static_cast<SwMultiPortion*>(pPor)->HasRotation() ) if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
{ {
if( static_cast<SwMultiPortion*>(pPor)->IsRevers() ) if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
pCMS->p2Lines->nMultiType = MT_ROT_270; pCMS->p2Lines->nMultiType = MultiPortionType::ROT_270;
else else
pCMS->p2Lines->nMultiType = MT_ROT_90; pCMS->p2Lines->nMultiType = MultiPortionType::ROT_90;
} }
else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() ) else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
pCMS->p2Lines->nMultiType = MT_TWOLINE; pCMS->p2Lines->nMultiType = MultiPortionType::TWOLINE;
else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() ) else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
pCMS->p2Lines->nMultiType = MT_BIDI; pCMS->p2Lines->nMultiType = MultiPortionType::BIDI;
else else
pCMS->p2Lines->nMultiType = MT_RUBY; pCMS->p2Lines->nMultiType = MultiPortionType::RUBY;
SwTwips nTmpWidth = pPor->Width(); SwTwips nTmpWidth = pPor->Width();
if( nSpaceAdd ) if( nSpaceAdd )
......
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