editeng/source/editeng/editeng.cxx  |   18 ++++++------------
 editeng/source/editeng/impedit.hxx  |    1 +
 editeng/source/editeng/impedit3.cxx |    6 ++++++
 include/editeng/editeng.hxx         |    1 -
 4 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 6e3cefc89e80ec0f7fab058a583d3ac4c702400e
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Jun 21 17:36:06 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jun 21 20:51:41 2024 +0200

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

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index e86e4b40b5d4..7707ce81ce42 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -420,12 +420,6 @@ sal_Int32 EditEngine::GetParagraphCount() const
     return getImpl().maEditDoc.Count();
 }
 
-void EditEngine::ensureDocumentFormatted() const
-{
-    if (!getImpl().IsFormatted())
-        getImpl().FormatDoc();
-}
-
 sal_Int32 EditEngine::GetLineCount( sal_Int32 nParagraph ) const
 {
     return getImpl().GetLineCount(nParagraph);
@@ -459,7 +453,7 @@ tools::Rectangle EditEngine::GetParaBounds( sal_Int32 nPara 
)
 
 sal_uInt32 EditEngine::GetTextHeight( sal_Int32 nParagraph ) const
 {
-    ensureDocumentFormatted();
+    getImpl().EnsureDocumentFormatted();
     sal_uInt32 nHeight = getImpl().GetParaHeight(nParagraph);
     return nHeight;
 }
@@ -801,14 +795,14 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, 
EditView* pEditView, v
 
 sal_uInt32 EditEngine::GetTextHeight() const
 {
-    ensureDocumentFormatted();
+    getImpl().EnsureDocumentFormatted();
     sal_uInt32 nHeight = !IsEffectivelyVertical() ? getImpl().GetTextHeight() 
: getImpl().CalcTextWidth( true );
     return nHeight;
 }
 
 sal_uInt32 EditEngine::CalcTextWidth()
 {
-    ensureDocumentFormatted();
+    getImpl().EnsureDocumentFormatted();
     sal_uInt32 nWidth = !IsEffectivelyVertical() ? 
getImpl().CalcTextWidth(true) : getImpl().GetTextHeight();
     return nWidth;
 }
@@ -1147,7 +1141,7 @@ tools::Long EditEngine::GetFirstLineStartX( sal_Int32 
nParagraph )
     if ( pPPortion )
     {
         DBG_ASSERT(getImpl().IsFormatted() || !getImpl().IsFormatting(), 
"GetFirstLineStartX: Doc not formatted - unable to format!");
-        ensureDocumentFormatted();
+        getImpl().EnsureDocumentFormatted();
         const EditLine& rFirstLine = pPPortion->GetLines()[0];
         nX = rFirstLine.GetStartPosX();
     }
@@ -1192,7 +1186,7 @@ bool EditEngine::IsRightToLeft( sal_Int32 nPara ) const
 
 bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
 {
-    ensureDocumentFormatted();
+    getImpl().EnsureDocumentFormatted();
 
     // take unrotated positions for calculation here
     Point aDocPos = GetDocPos( rPaperPos );
@@ -1580,7 +1574,7 @@ tools::Rectangle EditEngine::GetCharacterBounds( const 
EPosition& rPos ) const
 ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara )
 {
     // This only works if not already in the format ...
-    ensureDocumentFormatted();
+    getImpl().EnsureDocumentFormatted();
 
     ParagraphInfos aInfos;
     aInfos.bValid = getImpl().IsFormatted();
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 6a686723a184..768bbbadfc29 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -988,6 +988,7 @@ public:
     void ScaleContentToFitWindow(o3tl::sorted_vector<sal_Int32>& 
rRepaintParagraphs);
     void FormatDoc();
     void FormatFullDoc();
+    void EnsureDocumentFormatted();
 
     void                    Draw( OutputDevice& rOutDev, const Point& 
rStartPos, Degree10 nOrientation );
     void                    Draw( OutputDevice& rOutDev, const 
tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip );
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index df5a13a83e71..7c1ccc19cfa8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -500,6 +500,12 @@ void 
ImpEditEngine::ScaleContentToFitWindow(o3tl::sorted_vector<sal_Int32>& aRep
     }
 }
 
+void ImpEditEngine::EnsureDocumentFormatted()
+{
+    if (!IsFormatted())
+        FormatDoc();
+}
+
 void ImpEditEngine::FormatDoc()
 {
     if (!IsUpdateLayout() || IsFormatting())
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 27e5da82febc..e2b40613b0f2 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -196,7 +196,6 @@ private:
     SAL_DLLPRIVATE bool HasText() const;
     SAL_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
     SAL_DLLPRIVATE void SetInSelectionMode(bool b);
-    SAL_DLLPRIVATE void ensureDocumentFormatted() const;
 
 public:
     EditEngine(SfxItemPool* pItemPool);

Reply via email to