summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-06-16 16:40:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-17 09:45:07 +0200
commit4f74afd4cdfce405933e155e8fb9937e42fe30c0 (patch)
tree315f0865de43db815e60450b24ea63fbd0f84264
parent4ac56fa47e5f525a403d7ef7fa1d0a0243fb6604 (diff)
move RemoveParagragh code from EditEngine to ImpEditEngine
so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: Ifc82d3dd2624868f812533b9df9a34af51a06888 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168953 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--editeng/source/editeng/editeng.cxx17
-rw-r--r--editeng/source/editeng/impedit.hxx1
-rw-r--r--editeng/source/editeng/impedit2.cxx20
3 files changed, 22 insertions, 16 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index c9c9941f89a0..bfd1803cc59a 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -982,22 +982,7 @@ std::unique_ptr<EditTextObject> EditEngine::CreateTextObject( sal_Int32 nPara, s
void EditEngine::RemoveParagraph( sal_Int32 nPara )
{
- DBG_ASSERT(getImpl().GetEditDoc().Count() > 1, "The first paragraph should not be deleted!");
- if (getImpl().GetEditDoc().Count() <= 1)
- return;
-
- ContentNode* pNode = getImpl().GetEditDoc().GetObject(nPara);
- const ParaPortion* pPortion = getImpl().GetParaPortions().SafeGetObject(nPara);
- DBG_ASSERT( pPortion && pNode, "Paragraph not found: RemoveParagraph" );
- if ( pNode && pPortion )
- {
- // No Undo encapsulation needed.
- getImpl().ImpRemoveParagraph(nPara);
- getImpl().InvalidateFromParagraph(nPara);
- getImpl().UpdateSelections();
- if (getImpl().IsUpdateLayout())
- getImpl().FormatAndLayout();
- }
+ getImpl().RemoveParagraph(nPara);
}
sal_Int32 EditEngine::GetTextLen( sal_Int32 nPara ) const
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 61c8f94ac0a2..324ced7e7138 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1374,6 +1374,7 @@ public:
bool PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, vcl::Window const * pFrameWin );
static bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
+ void RemoveParagraph( sal_Int32 nPara );
#ifdef DBG_UTIL
void DumpData(bool bInfoBox);
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index ad974d5aff9c..ca919c10676c 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2522,6 +2522,26 @@ EditPaM ImpEditEngine::ImpDeleteSelection(const EditSelection& rCurSel)
return aStartPaM;
}
+void ImpEditEngine::RemoveParagraph( sal_Int32 nPara )
+{
+ DBG_ASSERT(maEditDoc.Count() > 1, "The first paragraph should not be deleted!");
+ if (maEditDoc.Count() <= 1)
+ return;
+
+ ContentNode* pNode = maEditDoc.GetObject(nPara);
+ const ParaPortion* pPortion = maParaPortionList.SafeGetObject(nPara);
+ DBG_ASSERT( pPortion && pNode, "Paragraph not found: RemoveParagraph" );
+ if ( pNode && pPortion )
+ {
+ // No Undo encapsulation needed.
+ ImpRemoveParagraph(nPara);
+ InvalidateFromParagraph(nPara);
+ UpdateSelections();
+ if (IsUpdateLayout())
+ FormatAndLayout();
+ }
+}
+
void ImpEditEngine::ImpRemoveParagraph( sal_Int32 nPara )
{
assert(maEditDoc.GetObject(nPara));