diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-26 16:03:06 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-27 08:33:45 +0200 |
commit | aff09b486f26fa58a4f26a52e2b26286811d2441 (patch) | |
tree | 79aa3f0463e7024b8189455a9906422008f57113 | |
parent | 9bccd26037188f20fec244bede3022900d1b96fa (diff) |
convert GETATTRIBS_ constants to enum class
Change-Id: I236caa9e2dc80455198b442e72e8d9df58f03adc
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 10 | ||||
-rw-r--r-- | editeng/source/uno/unoedhlp.cxx | 8 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 8 | ||||
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 8 | ||||
-rw-r--r-- | include/editeng/editeng.hxx | 19 | ||||
-rw-r--r-- | sd/source/ui/dlg/headerfooterdlg.cxx | 2 | ||||
-rw-r--r-- | starmath/source/accessibility.cxx | 8 |
9 files changed, 38 insertions, 29 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index afed13934c3b..acc0b851b807 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1728,7 +1728,7 @@ SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, EditEngineAttribs nOn return pImpEditEngine->GetAttribs( aSel, nOnlyHardAttrib ); } -SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const +SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags ) const { return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags ); } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index dd2f6443883d..321bfbf63092 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -807,7 +807,7 @@ public: sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ); sal_uInt32 GetParaHeight( sal_Int32 nParagraph ); - SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const; SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All ); void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 ); void RemoveCharAttribs( EditSelection aSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index fa733cdecd62..698346dc338e 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -391,7 +391,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, EditEngineAttribs nOnl } -SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const +SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags ) const { // Optimized function with less Puts(), which cause unnecessary cloning from default items. // If this works, change GetAttribs( EditSelection ) to use this for each paragraph and merge the results! @@ -413,15 +413,15 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int // StyleSheet / Parattribs... - if ( pNode->GetStyleSheet() && ( nFlags & GETATTRIBS_STYLESHEET ) ) + if ( pNode->GetStyleSheet() && ( nFlags & GetAttribsFlags::STYLESHEET ) ) aAttribs.Set(pNode->GetStyleSheet()->GetItemSet(), true); - if ( nFlags & GETATTRIBS_PARAATTRIBS ) + if ( nFlags & GetAttribsFlags::PARAATTRIBS ) aAttribs.Put( pNode->GetContentAttribs().GetItems() ); // CharAttribs... - if ( nFlags & GETATTRIBS_CHARATTRIBS ) + if ( nFlags & GetAttribsFlags::CHARATTRIBS ) { // Make testing easier... const SfxItemPool& rPool = GetEditDoc().GetItemPool(); @@ -461,7 +461,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int { // OptimizeRagnge() assures that not the same attr can follow for full coverage // only partial, check with current, when using para/styhe, otherwise invalid. - if ( !( nFlags & (GETATTRIBS_PARAATTRIBS|GETATTRIBS_STYLESHEET) ) || + if ( !( nFlags & (GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::STYLESHEET) ) || ( *rAttr.GetItem() != aAttribs.Get( rAttr.Which() ) ) ) { aAttribs.InvalidateItem( rAttr.Which() ); diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index 642489275c07..c966a1ab588f 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -181,7 +181,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE //need to find closest index in front of nIndex in the previous paragraphs if ( aStartPos.nIndex == 0 ) { - SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS ); + SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GetAttribsFlags::CHARATTRIBS ); for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- ) { sal_uInt32 nLen = rEE.GetTextLen(nParaIdx); @@ -189,7 +189,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE { sal_Int32 nStartIdx, nEndIdx; GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, nLen, false ); - SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GETATTRIBS_CHARATTRIBS ); + SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GetAttribsFlags::CHARATTRIBS ); if ( aSet == aCrrntSet ) { aStartPos.nPara = nParaIdx; @@ -205,7 +205,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE //need find closest index behind nIndex in the following paragrphs if ( aEndPos.nIndex == nCrrntParaLen ) { - SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GETATTRIBS_CHARATTRIBS ); + SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GetAttribsFlags::CHARATTRIBS ); for ( sal_Int32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ ) { sal_Int32 nLen = rEE.GetTextLen( nParaIdx ); @@ -213,7 +213,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE { sal_Int32 nStartIdx, nEndIdx; GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0, false ); - SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GETATTRIBS_CHARATTRIBS ); + SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GetAttribsFlags::CHARATTRIBS ); if ( aSet == aCrrntSet ) { aEndPos.nPara = nParaIdx; diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 6b39f0a3095c..163dc74c4802 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -66,17 +66,17 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, EditEngin { if( rSel.nStartPara == rSel.nEndPara ) { - sal_uInt8 nFlags = 0; + GetAttribsFlags nFlags = GetAttribsFlags::NONE; switch( nOnlyHardAttrib ) { case EditEngineAttribs_All: - nFlags = GETATTRIBS_ALL; + nFlags = GetAttribsFlags::ALL; break; case EditEngineAttribs_HardAndPara: - nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS; break; case EditEngineAttribs_OnlyHard: - nFlags = GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::CHARATTRIBS; break; default: OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 5057f0389812..e0c863f65d40 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -76,18 +76,18 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditE { if( rSel.nStartPara == rSel.nEndPara ) { - sal_uInt8 nFlags = 0; + GetAttribsFlags nFlags = GetAttribsFlags::NONE; switch( nOnlyHardAttrib ) { case EditEngineAttribs_All: - nFlags = GETATTRIBS_ALL; + nFlags = GetAttribsFlags::ALL; break; case EditEngineAttribs_HardAndPara: - nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS; break; case EditEngineAttribs_OnlyHard: - nFlags = GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::CHARATTRIBS; break; default: OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs"); diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index ba253f46afdb..06d73f493c06 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -36,6 +36,7 @@ #include <tools/rtti.hxx> #include <editeng/eedata.hxx> +#include <o3tl/typed_flags_set.hxx> namespace com { namespace sun { namespace star { namespace linguistic2 { @@ -122,10 +123,18 @@ enum EditEngineAttribs { /** values for: SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; */ -#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01 -#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02 -#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04 -#define GETATTRIBS_ALL (sal_uInt8)0xFF +enum class GetAttribsFlags +{ + NONE = 0x00, + STYLESHEET = 0x01, + PARAATTRIBS = 0x02, + CHARATTRIBS = 0x04, + ALL = 0x07, +}; +namespace o3tl +{ + template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {}; +} class SdrObject; class EDITENG_DLLPUBLIC EditEngine @@ -303,7 +312,7 @@ public: void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const; - SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const; SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All ); bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8b59c3559f8d..e7590357f67e 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -642,7 +642,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, boo { if( bSet ) { - SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, GETATTRIBS_CHARATTRIBS ) ); + SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, GetAttribsFlags::CHARATTRIBS ) ); SvxLanguageItem aItem( rLanguage, EE_CHAR_LANGUAGE ); aSet.Put( aItem ); diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index cd6c58704140..f3a9b276acdd 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -983,17 +983,17 @@ SfxItemSet SmTextForwarder::GetAttribs( const ESelection& rSel, EditEngineAttrib OSL_ENSURE( pEditEngine, "EditEngine missing" ); if( rSel.nStartPara == rSel.nEndPara ) { - sal_uInt8 nFlags = 0; + GetAttribsFlags nFlags = GetAttribsFlags::NONE; switch( nOnlyHardAttrib ) { case EditEngineAttribs_All: - nFlags = GETATTRIBS_ALL; + nFlags = GetAttribsFlags::ALL; break; case EditEngineAttribs_HardAndPara: - nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS; break; case EditEngineAttribs_OnlyHard: - nFlags = GETATTRIBS_CHARATTRIBS; + nFlags = GetAttribsFlags::CHARATTRIBS; break; default: SAL_WARN("starmath", "unknown flags for SmTextForwarder::GetAttribs"); |