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

convert GETATTRIBS_ constants to enum class

Change-Id: I236caa9e2dc80455198b442e72e8d9df58f03adc
üst 9bccd260
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -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() );
......
......@@ -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;
......
......@@ -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");
......
......@@ -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");
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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");
......
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