From 214751e3cc5b154d90963f4abf0a9317733b001b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 4 Apr 2014 08:45:26 +0200 Subject: 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 --- editeng/source/uno/unoedprx.cxx | 5 ++--- editeng/source/uno/unofored.cxx | 6 +++--- editeng/source/uno/unoforou.cxx | 14 +++++++------- editeng/source/uno/unotext.cxx | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) (limited to 'editeng/source/uno') 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 -- cgit