editeng/source/editeng/editeng.cxx  |   15 +--------------
 editeng/source/editeng/impedit.hxx  |    3 ++-
 editeng/source/editeng/impedit5.cxx |   19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 965052fac15f00ce80f2747323c0dca9d1641e79
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jun 16 12:31:16 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jun 16 14:34:33 2024 +0200

    move SetPolygon code from EditEngine to ImpEditEngine
    
    so we have the implementation in one class, instead of bouncing
    back and forth between two.
    
    Change-Id: Ia91df69b95159f5487d914a67848fb3f18a69dc5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168923
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index ce9b182c0f54..77deee5c6ef0 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -522,20 +522,7 @@ void EditEngine::SetPolygon( const 
basegfx::B2DPolyPolygon& rPolyPolygon )
 
 void EditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const 
basegfx::B2DPolyPolygon* pLinePolyPolygon)
 {
-    bool bSimple(false);
-
-    if(pLinePolyPolygon && 1 == rPolyPolygon.count())
-    {
-        if(rPolyPolygon.getB2DPolygon(0).isClosed())
-        {
-            // open polygon
-            bSimple = true;
-        }
-    }
-
-    TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 
2, 2, bSimple, true );
-    getImpl().SetTextRanger( std::unique_ptr<TextRanger>(pRanger) );
-    getImpl().SetPaperSize( pRanger->GetBoundRect().GetSize() );
+    getImpl().SetPolygon(rPolyPolygon, pLinePolyPolygon);
 }
 
 void EditEngine::ClearPolygon()
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 07f6af002358..2da7087e4308 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -943,7 +943,8 @@ public:
     const ViewsType& GetEditViews() const { return maEditViews; }
 
     const Size& GetPaperSize() const { return maPaperSize; }
-    void SetPaperSize(const Size& rSize) { maPaperSize = rSize; }
+
+    void                    SetPolygon(const basegfx::B2DPolyPolygon& 
rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
 
     void                    SetVertical( bool bVertical);
     bool                    IsEffectivelyVertical() const                      
{ return GetEditDoc().IsEffectivelyVertical(); }
diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 396e529c514d..512d16ffcaee 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -20,6 +20,7 @@
 #include <memory>
 #include "impedit.hxx"
 #include <editeng/editeng.hxx>
+#include <editeng/txtrange.hxx>
 #include <svl/hint.hxx>
 #include <sfx2/app.hxx>
 #include <utility>
@@ -788,6 +789,24 @@ void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* 
pNode )
     // Portion does not need to be invalidated here, happens elsewhere.
 }
 
+void ImpEditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, 
const basegfx::B2DPolyPolygon* pLinePolyPolygon)
+{
+    bool bSimple(false);
+
+    if(pLinePolyPolygon && 1 == rPolyPolygon.count())
+    {
+        if(rPolyPolygon.getB2DPolygon(0).isClosed())
+        {
+            // open polygon
+            bSimple = true;
+        }
+    }
+
+    TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 
2, 2, bSimple, true );
+    SetTextRanger( std::unique_ptr<TextRanger>(pRanger) );
+    maPaperSize = pRanger->GetBoundRect().GetSize();
+}
+
 IdleFormattter::IdleFormattter()
     : Idle("editeng::ImpEditEngine aIdleFormatter")
 {

Reply via email to