diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-05-17 20:46:09 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-04 06:52:47 +0000 |
commit | 79800559268c636740fec69018b1f99f047c3f93 (patch) | |
tree | 4de6b7388032cfe632e69710ecc8ffe44b241d6f /sw | |
parent | 81610561edfb8c899a062cc09fc1a80e8098577f (diff) |
convert MT_ constants to scoped enum
Change-Id: I21e253ed9dccdab84be4838b5beee9385467ed37
Reviewed-on: https://gerrit.libreoffice.org/16068
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crstate.hxx | 15 | ||||
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/text/itrcrsr.cxx | 10 |
3 files changed, 25 insertions, 22 deletions
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx index 678ccd45549b..119817b0f67e 100644 --- a/sw/inc/crstate.hxx +++ b/sw/inc/crstate.hxx @@ -49,18 +49,21 @@ struct SwFillCrsrPos // Multiportion types: two lines, bidirectional, 270 degrees rotation, // ruby portion and 90 degrees rotation -#define MT_TWOLINE 0 -#define MT_BIDI 1 -#define MT_ROT_270 3 -#define MT_RUBY 4 -#define MT_ROT_90 7 +enum class MultiPortionType : sal_uInt8 +{ + TWOLINE = 0, + BIDI = 1, + ROT_270 = 3, + RUBY = 4, + ROT_90 = 7, +}; struct Sw2LinesPos { SwRect aLine; ///< Position and size of the line SwRect aPortion; ///< Position and size of the multi portion SwRect aPortion2; ///< needed for nested multi portions - sal_uInt8 nMultiType; ///< Multiportion type + MultiPortionType nMultiType; ///< Multiportion type }; /** diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 999afd119abb..c60cb742e3b6 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2145,11 +2145,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) SwRect aTmp( aStRect ); // BiDi-Portions are swimming against the current. - const bool bPorR2L = ( MT_BIDI == pSt2Pos->nMultiType ) ? + const bool bPorR2L = ( MultiPortionType::BIDI == pSt2Pos->nMultiType ) ? ! bR2L : bR2L; - if( MT_BIDI == pSt2Pos->nMultiType && + if( MultiPortionType::BIDI == pSt2Pos->nMultiType && (pSt2Pos->aPortion2.*fnRect->fnGetWidth)() ) { // nested bidi portion @@ -2177,7 +2177,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) (pSt2Pos->aPortion.*fnRect->fnGetRight)() ); } - if( MT_ROT_90 == pSt2Pos->nMultiType || + if( MultiPortionType::ROT_90 == pSt2Pos->nMultiType || (pSt2Pos->aPortion.*fnRect->fnGetTop)() == (aTmp.*fnRect->fnGetTop)() ) { @@ -2189,7 +2189,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) Sub( aRegion, aTmp ); SwTwips nTmp = (pSt2Pos->aLine.*fnRect->fnGetBottom)(); - if( MT_ROT_90 != pSt2Pos->nMultiType && + if( MultiPortionType::ROT_90 != pSt2Pos->nMultiType && (aStRect.*fnRect->fnBottomDist)( nTmp ) > 0 ) { (aTmp.*fnRect->fnSetTop)( (aTmp.*fnRect->fnGetBottom)() ); @@ -2221,11 +2221,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) SwRect aTmp( aEndRect ); // BiDi-Portions are swimming against the current. - const bool bPorR2L = ( MT_BIDI == pEnd2Pos->nMultiType ) ? + const bool bPorR2L = ( MultiPortionType::BIDI == pEnd2Pos->nMultiType ) ? ! bEndR2L : bEndR2L; - if( MT_BIDI == pEnd2Pos->nMultiType && + if( MultiPortionType::BIDI == pEnd2Pos->nMultiType && (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)() ) { // nested bidi portion @@ -2253,7 +2253,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); } - if( MT_ROT_90 == pEnd2Pos->nMultiType || + if( MultiPortionType::ROT_90 == pEnd2Pos->nMultiType || (pEnd2Pos->aPortion.*fnRectX->fnGetBottom)() == (aEndRect.*fnRectX->fnGetBottom)() ) { @@ -2265,7 +2265,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) Sub( aRegion, aTmp ); // 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)(); if( (aEndRect.*fnRectX->fnGetTop)() != nTmp ) @@ -2296,8 +2296,8 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) } } else if( pSt2Pos && pEnd2Pos && - MT_BIDI == pSt2Pos->nMultiType && - MT_BIDI == pEnd2Pos->nMultiType && + MultiPortionType::BIDI == pSt2Pos->nMultiType && + MultiPortionType::BIDI == pEnd2Pos->nMultiType && pSt2Pos->aPortion == pEnd2Pos->aPortion && pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 ) { @@ -2363,7 +2363,7 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr) if( pStartFrm == pEndFrm ) { bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos && - ( MT_BIDI & pSt2Pos->nMultiType ) && + ( MultiPortionType::BIDI == pSt2Pos->nMultiType ) && pSt2Pos->aPortion == pEnd2Pos->aPortion; //case 1: (Same frame and same row) if( bSameRotatedOrBidi || diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 2969e1099c5c..94e8ef05b186 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -677,16 +677,16 @@ void SwTextCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, if( static_cast<SwMultiPortion*>(pPor)->HasRotation() ) { if( static_cast<SwMultiPortion*>(pPor)->IsRevers() ) - pCMS->p2Lines->nMultiType = MT_ROT_270; + pCMS->p2Lines->nMultiType = MultiPortionType::ROT_270; else - pCMS->p2Lines->nMultiType = MT_ROT_90; + pCMS->p2Lines->nMultiType = MultiPortionType::ROT_90; } else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() ) - pCMS->p2Lines->nMultiType = MT_TWOLINE; + pCMS->p2Lines->nMultiType = MultiPortionType::TWOLINE; else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() ) - pCMS->p2Lines->nMultiType = MT_BIDI; + pCMS->p2Lines->nMultiType = MultiPortionType::BIDI; else - pCMS->p2Lines->nMultiType = MT_RUBY; + pCMS->p2Lines->nMultiType = MultiPortionType::RUBY; SwTwips nTmpWidth = pPor->Width(); if( nSpaceAdd ) |