summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-06-17 18:24:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-17 21:02:36 +0200
commit3b551da96e1ddb0824002c06ee668055ab077a0e (patch)
treecf9279b4f3b1536d2c4609c09396a1328c82d86c /editeng/source
parentadf72803071cf96e7aafb1b9fcd0480d0a14de3a (diff)
move GetLineLen code from EditEngine to ImpEditEngine
so we have the implementation in one class, instead of bouncing back and forth between two. Change-Id: Ied2b0ed968987f44446abf1066b7e9af106e909d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169039 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/editeng.cxx1
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx4
-rw-r--r--editeng/source/editeng/impedit3.cxx10
4 files changed, 11 insertions, 6 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 2f09ba0a1f61..c06823d9ddbc 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -433,7 +433,6 @@ sal_Int32 EditEngine::GetLineCount( sal_Int32 nParagraph ) const
sal_Int32 EditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const
{
- ensureDocumentFormatted();
return getImpl().GetLineLen(nParagraph, nLine);
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 7dc8ec798efd..a72acecf8f74 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1054,7 +1054,7 @@ public:
sal_uInt32 CalcParaWidth( sal_Int32 nParagraph, bool bIgnoreExtraSpace );
sal_uInt32 CalcLineWidth(ParaPortion const& rPortion, EditLine const& rLine, bool bIgnoreExtraSpace);
sal_Int32 GetLineCount( sal_Int32 nParagraph );
- sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
+ sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine );
void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const;
sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const;
sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 96546d6ae89e..377c66888a6a 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3666,8 +3666,10 @@ sal_Int32 ImpEditEngine::GetLineCount( sal_Int32 nParagraph )
return -1;
}
-sal_Int32 ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const
+sal_Int32 ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine )
{
+ if (!IsFormatted())
+ FormatDoc();
OSL_ENSURE(GetParaPortions().exists(nParagraph), "GetLineLen: Out of range");
const ParaPortion* pPPortion = GetParaPortions().SafeGetObject(nParagraph);
OSL_ENSURE(pPPortion, "Paragraph not found: GetLineLen");
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index dcc93f5312c6..6ae2804b4690 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -638,9 +638,13 @@ void ImpEditEngine::CheckPageOverflow()
SAL_INFO("editeng.chaining", "[OVERFLOW-CHECK] Current Text Height is " << nTxtHeight);
sal_uInt32 nParaCount = maParaPortionList.Count();
- bool bOnlyOneEmptyPara = (nParaCount == 1) &&
- (maParaPortionList.SafeGetObject(0)->GetLines().Count() == 1) &&
- (GetLineLen(0,0) == 0);
+ bool bOnlyOneEmptyPara = false;
+ if (nParaCount == 1)
+ {
+ const ParaPortion* pPPortion = GetParaPortions().SafeGetObject(0);
+ bOnlyOneEmptyPara = pPPortion->GetLines().Count() == 1
+ && pPPortion->GetLines()[0].GetLen() == 0;
+ }
if (nTxtHeight > nBoxHeight && !bOnlyOneEmptyPara)
{