diff options
author | Noel Grandin <noel@peralex.com> | 2014-04-04 08:45:26 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-04-04 13:44:16 +0200 |
commit | 214751e3cc5b154d90963f4abf0a9317733b001b (patch) | |
tree | 9d7c0127be2b0e9ada88bcf73e632233bd841f61 /editeng | |
parent | 6f349af57ebd6d160b6354c2033c46467da4598a (diff) |
cleanup up the EditEngine::GetAttribs call
It was using a bool parameter, but passing various constants
through it.
Make the constants into an enum, and use the enum in the GetAttribs
call.
Change-Id: I3010397dfe83b24db3946b9dea2fb37f4393abdd
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 12 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 5 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 6 | ||||
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 14 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 2 |
7 files changed, 22 insertions, 23 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 30413780943b..f1961ec908b5 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1725,11 +1725,11 @@ void EditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLs pImpEditEngine->GetCharAttribs( nPara, rLst ); } -SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) +SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) { EditSelection aSel( pImpEditEngine-> ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) ); - return pImpEditEngine->GetAttribs( aSel, bOnlyHardAttrib ); + return pImpEditEngine->GetAttribs( aSel, nOnlyHardAttrib ); } SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 93be9b569074..5be394786ac0 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -798,7 +798,7 @@ public: sal_uInt32 GetParaHeight( sal_Int32 nParagraph ); SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; - SfxItemSet GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib = sal_False ); + SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All ); void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 ); void RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 ); void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0, sal_Bool bRemoveFeatures = sal_False ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 447ea2300b16..37996a43a0a3 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -303,7 +303,7 @@ sal_Bool ImpEditEngine::Redo( EditView* pView ) return sal_False; } -SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib ) +SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib ) { aSel.Adjust( aEditDoc ); @@ -330,14 +330,14 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr // First the very hard formatting ... aEditDoc.FindAttribs( pNode, nStartPos, nEndPos, aCurSet ); - if( bOnlyHardAttrib != EditEngineAttribs_OnlyHard ) + if( nOnlyHardAttrib != EditEngineAttribs_OnlyHard ) { // and then paragraph formatting and template... for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++) { if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) { - if ( bOnlyHardAttrib == EditEngineAttribs_All ) + if ( nOnlyHardAttrib == EditEngineAttribs_All ) { const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich ); aCurSet.Put( rItem ); @@ -351,7 +351,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON ) { const SfxPoolItem* pItem = NULL; - if ( bOnlyHardAttrib == EditEngineAttribs_All ) + if ( nOnlyHardAttrib == EditEngineAttribs_All ) { pItem = &pNode->GetContentAttribs().GetItem( nWhich ); } @@ -359,7 +359,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr { pItem = &pNode->GetContentAttribs().GetItems().Get( nWhich ); } - // pItem can only be NULL when bOnlyHardAttrib... + // pItem can only be NULL when nOnlyHardAttrib... if ( !pItem || ( *pItem != aCurSet.Get( nWhich ) ) ) { // Problem: When Paragraph style with for example font, @@ -377,7 +377,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr } // fill empty slots with defaults ... - if ( bOnlyHardAttrib == EditEngineAttribs_All ) + if ( nOnlyHardAttrib == EditEngineAttribs_All ) { for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++ ) { diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index aa49d90e8a66..1a2a13dea7d8 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -524,7 +524,7 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const return sStr; } -SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const +SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const { DBG_ASSERT(mpTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -534,8 +534,7 @@ SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, sal_Boo aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this ); aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this ); - return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), - bOnlyHardAttrib ); + return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), nOnlyHardAttrib ); } SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_Int32 nPara ) const diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index d395baa10a9c..f667432e05d5 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -61,12 +61,12 @@ OUString SvxEditEngineForwarder::GetText( const ESelection& rSel ) const return convertLineEnd(rEditEngine.GetText(rSel, LINEEND_LF), GetSystemLineEnd()); } -SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const +SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const { if( rSel.nStartPara == rSel.nEndPara ) { sal_uInt8 nFlags = 0; - switch( bOnlyHardAttrib ) + switch( nOnlyHardAttrib ) { case EditEngineAttribs_All: nFlags = GETATTRIBS_ALL; @@ -85,7 +85,7 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool } else { - return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ); + return rEditEngine.GetAttribs( rSel, nOnlyHardAttrib ); } } diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index e6204f482b27..5d7d8f343019 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -71,13 +71,13 @@ OUString SvxOutlinerForwarder::GetText( const ESelection& rSel ) const return pEditEngine->GetText( rSel, LINEEND_LF ); } -static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib, EditEngine& rEditEngine ) +static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib, EditEngine& rEditEngine ) { if( rSel.nStartPara == rSel.nEndPara ) { sal_uInt8 nFlags = 0; - switch( bOnlyHardAttrib ) + switch( nOnlyHardAttrib ) { case EditEngineAttribs_All: nFlags = GETATTRIBS_ALL; @@ -95,13 +95,13 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_B } else { - return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ); + return rEditEngine.GetAttribs( rSel, nOnlyHardAttrib ); } } -SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const +SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const { - if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) ) + if( mpAttribsCache && ( EditEngineAttribs_All == nOnlyHardAttrib ) ) { // have we the correct set in cache? if( ((SvxOutlinerForwarder*)this)->maAttribCacheSelection.IsEqual(rSel) ) @@ -121,9 +121,9 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bO //! and why is the GetAttribs on the EditEngine not a const? EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine(); - SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, bOnlyHardAttrib, rEditEngine ) ); + SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, nOnlyHardAttrib, rEditEngine ) ); - if( 0 == bOnlyHardAttrib ) + if( EditEngineAttribs_All == nOnlyHardAttrib ) { mpAttribsCache = new SfxItemSet( aSet ); maAttribCacheSelection = rSel; diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index e2107565ed23..9c46bfbe8df7 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2433,7 +2433,7 @@ OUString SvxDummyTextSource::GetText( const ESelection& ) const return OUString(); } -SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, sal_Bool ) const +SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, EditEngineAttribs ) const { // Very dangerous: The former implementation used a SfxItemPool created on the // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using |