diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-06-17 14:07:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-06-17 19:00:25 +0200 |
commit | 43ec63461428f05ee2decf68e791bde94d839ff9 (patch) | |
tree | dd55c36f941701f4bca60c62c30d954341a52023 /editeng/source | |
parent | 4e5dd2c0774242e44ac6edf2bd5ada220541b06b (diff) |
move RemoveAttribs code from EditEngine to ImpEditEngine
so we have the implementation in one class, instead of bouncing
back and forth between two.
Change-Id: I55f419e08323d0fe7cc16bc525fc93920980f4c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168999
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 11 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 1 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 14 |
3 files changed, 16 insertions, 10 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index c1f5824f7af7..bfba5faa811f 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1092,16 +1092,7 @@ SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 void EditEngine::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) { - const EERemoveParaAttribsMode eMode = bRemoveParaAttribs? - EERemoveParaAttribsMode::RemoveAll : - EERemoveParaAttribsMode::RemoveCharItems; - - getImpl().UndoActionStart(EDITUNDO_RESETATTRIBS); - EditSelection aSel(getImpl().ConvertSelection(rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos)); - getImpl().RemoveCharAttribs(aSel, eMode, nWhich); - getImpl().UndoActionEnd(); - if (getImpl().IsUpdateLayout()) - getImpl().FormatAndLayout(); + getImpl().RemoveAttribs(rSelection, bRemoveParaAttribs, nWhich); } vcl::Font EditEngine::GetStandardFont( sal_Int32 nPara ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index d0224d11b6a2..482ea3ecd357 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1063,6 +1063,7 @@ public: 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, SetAttribsMode nSpecial = SetAttribsMode::NONE, bool bSetSelection = true ); + void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ); void RemoveCharAttribs( EditSelection aSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ); void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false ); void SetFlatMode( bool bFlat ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 68134542b157..22536c3cd44a 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -591,6 +591,20 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, SetA } } +void ImpEditEngine::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) +{ + const EERemoveParaAttribsMode eMode = bRemoveParaAttribs? + EERemoveParaAttribsMode::RemoveAll : + EERemoveParaAttribsMode::RemoveCharItems; + + UndoActionStart(EDITUNDO_RESETATTRIBS); + EditSelection aSel(ConvertSelection(rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos)); + RemoveCharAttribs(aSel, eMode, nWhich); + UndoActionEnd(); + if (IsUpdateLayout()) + FormatAndLayout(); +} + void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ) { aSel.Adjust( maEditDoc ); |