summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-06-16 12:31:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-16 14:34:33 +0200
commit965052fac15f00ce80f2747323c0dca9d1641e79 (patch)
treee4432b0b44c599de3ab3b3d892266160a091d39f /editeng
parent4ff2e148fa25933e64b7bbecbcd3ed551ad686ab (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editeng.cxx15
-rw-r--r--editeng/source/editeng/impedit.hxx3
-rw-r--r--editeng/source/editeng/impedit5.cxx19
3 files changed, 22 insertions, 15 deletions
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")
{