diff options
author | Christian Lippka <cl@openoffice.org> | 2001-11-13 14:32:11 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-11-13 14:32:11 +0000 |
commit | b5541ad1d1fa4dc31694c877e0f210acf564592b (patch) | |
tree | 6213bb720091af4f3c93f89105db97cfdc4e90d2 /svx/source/unoedit | |
parent | b999e2aaf9e6f325679fe5488e453d738f846880 (diff) |
#94002# use optimized GetAttribs for one para if possible
Diffstat (limited to 'svx/source/unoedit')
-rw-r--r-- | svx/source/unoedit/unofored.cxx | 29 | ||||
-rw-r--r-- | svx/source/unoedit/unoforou.cxx | 34 |
2 files changed, 57 insertions, 6 deletions
diff --git a/svx/source/unoedit/unofored.cxx b/svx/source/unoedit/unofored.cxx index 5db885b4c81e..1028cd707590 100644 --- a/svx/source/unoedit/unofored.cxx +++ b/svx/source/unoedit/unofored.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unofored.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: cl $ $Date: 2001-08-05 15:51:03 $ + * last change: $Author: cl $ $Date: 2001-11-13 15:32:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,30 @@ String SvxEditEngineForwarder::GetText( const ESelection& rSel ) const SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const { - return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ); + if( rSel.nStartPara == rSel.nEndPara ) + { + sal_uInt8 nFlags; + switch( bOnlyHardAttrib ) + { + case EditEngineAttribs_All: + nFlags = GETATTRIBS_ALL; + break; + case EditEngineAttribs_HardAndPara: + nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS; + break; + case EditEngineAttribs_OnlyHard: + nFlags = GETATTRIBS_CHARATTRIBS; + break; + default: + DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs"); + } + + return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); + } + else + { + return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ); + } } SfxItemSet SvxEditEngineForwarder::GetParaAttribs( USHORT nPara ) const diff --git a/svx/source/unoedit/unoforou.cxx b/svx/source/unoedit/unoforou.cxx index b375df4949d1..36e67bf79df8 100644 --- a/svx/source/unoedit/unoforou.cxx +++ b/svx/source/unoedit/unoforou.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoforou.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: cl $ $Date: 2001-11-05 13:55:33 $ + * last change: $Author: cl $ $Date: 2001-11-13 15:32:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,6 +116,34 @@ String SvxOutlinerForwarder::GetText( const ESelection& rSel ) const return pEditEngine->GetText( rSel, LINEEND_LF ); } +static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib, EditEngine& rEditEngine ) +{ + if( rSel.nStartPara == rSel.nEndPara ) + { + sal_uInt8 nFlags; + + switch( bOnlyHardAttrib ) + { + case EditEngineAttribs_All: + nFlags = GETATTRIBS_ALL; + break; + case EditEngineAttribs_HardAndPara: + nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS; + break; + case EditEngineAttribs_OnlyHard: + nFlags = GETATTRIBS_CHARATTRIBS; + break; + default: + DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs"); + } + return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags ); + } + else + { + return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ); + } +} + SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const { if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) ) @@ -138,7 +166,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyH //! und warum ist GetAttribs an der EditEngine nicht const? EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine(); - SfxItemSet aSet( rEditEngine.GetAttribs( rSel, bOnlyHardAttrib ) ); + SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, bOnlyHardAttrib, rEditEngine ) ); if( 0 == bOnlyHardAttrib ) { |